mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	ice40: Add option to only use CE if it'd be use by more than X FFs
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
		
							parent
							
								
									8d3ab626ea
								
							
						
					
					
						commit
						3e5ab50a73
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
					@ -69,6 +69,10 @@ struct SynthIce40Pass : public ScriptPass
 | 
				
			||||||
		log("    -nodffe\n");
 | 
							log("    -nodffe\n");
 | 
				
			||||||
		log("        do not use SB_DFFE* cells in output netlist\n");
 | 
							log("        do not use SB_DFFE* cells in output netlist\n");
 | 
				
			||||||
		log("\n");
 | 
							log("\n");
 | 
				
			||||||
 | 
							log("    -dffe_min_ce_use <min_ce_use>\n");
 | 
				
			||||||
 | 
							log("        do not use SB_DFFE* cells if the resulting CE line would go to less\n");
 | 
				
			||||||
 | 
							log("        than min_ce_use SB_DFFE*in output netlist\n");
 | 
				
			||||||
 | 
							log("\n");
 | 
				
			||||||
		log("    -nobram\n");
 | 
							log("    -nobram\n");
 | 
				
			||||||
		log("        do not use SB_RAM40_4K* cells in output netlist\n");
 | 
							log("        do not use SB_RAM40_4K* cells in output netlist\n");
 | 
				
			||||||
		log("\n");
 | 
							log("\n");
 | 
				
			||||||
| 
						 | 
					@ -87,6 +91,7 @@ struct SynthIce40Pass : public ScriptPass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	string top_opt, blif_file, edif_file, json_file;
 | 
						string top_opt, blif_file, edif_file, json_file;
 | 
				
			||||||
	bool nocarry, nodffe, nobram, flatten, retime, abc2, vpr;
 | 
						bool nocarry, nodffe, nobram, flatten, retime, abc2, vpr;
 | 
				
			||||||
 | 
						int min_ce_use;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void clear_flags() YS_OVERRIDE
 | 
						void clear_flags() YS_OVERRIDE
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					@ -96,6 +101,7 @@ struct SynthIce40Pass : public ScriptPass
 | 
				
			||||||
		json_file = "";
 | 
							json_file = "";
 | 
				
			||||||
		nocarry = false;
 | 
							nocarry = false;
 | 
				
			||||||
		nodffe = false;
 | 
							nodffe = false;
 | 
				
			||||||
 | 
							min_ce_use = -1;
 | 
				
			||||||
		nobram = false;
 | 
							nobram = false;
 | 
				
			||||||
		flatten = true;
 | 
							flatten = true;
 | 
				
			||||||
		retime = false;
 | 
							retime = false;
 | 
				
			||||||
| 
						 | 
					@ -155,6 +161,10 @@ struct SynthIce40Pass : public ScriptPass
 | 
				
			||||||
				nodffe = true;
 | 
									nodffe = true;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								if (args[argidx] == "-dffe_min_ce_use" && argidx+1 < args.size()) {
 | 
				
			||||||
 | 
									min_ce_use = std::stoi(args[++argidx]);
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			if (args[argidx] == "-nobram") {
 | 
								if (args[argidx] == "-nobram") {
 | 
				
			||||||
				nobram = true;
 | 
									nobram = true;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
| 
						 | 
					@ -228,6 +238,10 @@ struct SynthIce40Pass : public ScriptPass
 | 
				
			||||||
			run("dffsr2dff");
 | 
								run("dffsr2dff");
 | 
				
			||||||
			if (!nodffe)
 | 
								if (!nodffe)
 | 
				
			||||||
				run("dff2dffe -direct-match $_DFF_*");
 | 
									run("dff2dffe -direct-match $_DFF_*");
 | 
				
			||||||
 | 
								if (min_ce_use >= 0) {
 | 
				
			||||||
 | 
									run("opt_merge");
 | 
				
			||||||
 | 
									run(stringf("dff2dffe -unmap-mince %d", min_ce_use));
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			run("techmap -D NO_LUT -map +/ice40/cells_map.v");
 | 
								run("techmap -D NO_LUT -map +/ice40/cells_map.v");
 | 
				
			||||||
			run("opt_expr -mux_undef");
 | 
								run("opt_expr -mux_undef");
 | 
				
			||||||
			run("simplemap");
 | 
								run("simplemap");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue