mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	Merge pull request #1138 from YosysHQ/koriakin/xc7nocarrymux
synth_xilinx: Add -nocarry and -nowidelut options
This commit is contained in:
		
						commit
						bb4ae8bc66
					
				
					 2 changed files with 34 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -76,7 +76,7 @@ struct SynthEcp5Pass : public ScriptPass
 | 
			
		|||
		log("    -nodram\n");
 | 
			
		||||
		log("        do not use distributed RAM cells in output netlist\n");
 | 
			
		||||
		log("\n");
 | 
			
		||||
		log("    -nomux\n");
 | 
			
		||||
		log("    -nowidelut\n");
 | 
			
		||||
		log("        do not use PFU muxes to implement LUTs larger than LUT4s\n");
 | 
			
		||||
		log("\n");
 | 
			
		||||
		log("    -abc2\n");
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +93,7 @@ struct SynthEcp5Pass : public ScriptPass
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	string top_opt, blif_file, edif_file, json_file;
 | 
			
		||||
	bool noccu2, nodffe, nobram, nodram, nomux, flatten, retime, abc2, vpr;
 | 
			
		||||
	bool noccu2, nodffe, nobram, nodram, nowidelut, flatten, retime, abc2, vpr;
 | 
			
		||||
 | 
			
		||||
	void clear_flags() YS_OVERRIDE
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -105,7 +105,7 @@ struct SynthEcp5Pass : public ScriptPass
 | 
			
		|||
		nodffe = false;
 | 
			
		||||
		nobram = false;
 | 
			
		||||
		nodram = false;
 | 
			
		||||
		nomux = false;
 | 
			
		||||
		nowidelut = false;
 | 
			
		||||
		flatten = true;
 | 
			
		||||
		retime = false;
 | 
			
		||||
		abc2 = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -172,8 +172,8 @@ struct SynthEcp5Pass : public ScriptPass
 | 
			
		|||
				nodram = true;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			if (args[argidx] == "-nomux") {
 | 
			
		||||
				nomux = true;
 | 
			
		||||
			if (args[argidx] == "-nowidelut" || args[argidx] == "-nomux") {
 | 
			
		||||
				nowidelut = true;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			if (args[argidx] == "-abc2") {
 | 
			
		||||
| 
						 | 
				
			
			@ -264,7 +264,7 @@ struct SynthEcp5Pass : public ScriptPass
 | 
			
		|||
				run("abc", "      (only if -abc2)");
 | 
			
		||||
			}
 | 
			
		||||
			run("techmap -map +/ecp5/latches_map.v");
 | 
			
		||||
			if (nomux)
 | 
			
		||||
			if (nowidelut)
 | 
			
		||||
				run("abc -lut 4 -dress");
 | 
			
		||||
			else
 | 
			
		||||
				run("abc -lut 4:7 -dress");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,6 +67,12 @@ struct SynthXilinxPass : public ScriptPass
 | 
			
		|||
		log("    -nosrl\n");
 | 
			
		||||
		log("        disable inference of shift registers\n");
 | 
			
		||||
		log("\n");
 | 
			
		||||
		log("    -nocarry\n");
 | 
			
		||||
		log("        do not use XORCY/MUXCY/CARRY4 cells in output netlist\n");
 | 
			
		||||
		log("\n");
 | 
			
		||||
		log("    -nowidelut\n");
 | 
			
		||||
		log("        do not use MUXF[78] resources to implement LUTs larger than LUT6s\n");
 | 
			
		||||
		log("\n");
 | 
			
		||||
		log("    -run <from_label>:<to_label>\n");
 | 
			
		||||
		log("        only run the commands between the labels (see below). an empty\n");
 | 
			
		||||
		log("        from label is synonymous to 'begin', and empty to label is\n");
 | 
			
		||||
| 
						 | 
				
			
			@ -85,7 +91,7 @@ struct SynthXilinxPass : public ScriptPass
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	std::string top_opt, edif_file, blif_file, arch;
 | 
			
		||||
	bool flatten, retime, vpr, nobram, nodram, nosrl;
 | 
			
		||||
	bool flatten, retime, vpr, nobram, nodram, nosrl, nocarry, nowidelut;
 | 
			
		||||
 | 
			
		||||
	void clear_flags() YS_OVERRIDE
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -98,6 +104,8 @@ struct SynthXilinxPass : public ScriptPass
 | 
			
		|||
		nobram = false;
 | 
			
		||||
		nodram = false;
 | 
			
		||||
		nosrl = false;
 | 
			
		||||
		nocarry = false;
 | 
			
		||||
		nowidelut = false;
 | 
			
		||||
		arch = "xc7";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -141,6 +149,14 @@ struct SynthXilinxPass : public ScriptPass
 | 
			
		|||
				retime = true;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			if (args[argidx] == "-nocarry") {
 | 
			
		||||
				nocarry = true;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			if (args[argidx] == "-nowidelut") {
 | 
			
		||||
				nowidelut = true;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			if (args[argidx] == "-vpr") {
 | 
			
		||||
				vpr = true;
 | 
			
		||||
				continue;
 | 
			
		||||
| 
						 | 
				
			
			@ -237,10 +253,14 @@ struct SynthXilinxPass : public ScriptPass
 | 
			
		|||
				run("shregmap -tech xilinx -minlen 3", "(skip if '-nosrl')");
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (!vpr || help_mode)
 | 
			
		||||
				run("techmap -map +/techmap.v -map +/xilinx/arith_map.v");
 | 
			
		||||
			else
 | 
			
		||||
				run("techmap -map +/techmap.v +/xilinx/arith_map.v -D _EXPLICIT_CARRY");
 | 
			
		||||
			if (help_mode)
 | 
			
		||||
				run("techmap -map +/techmap.v [-map +/xilinx/arith_map.v]", "(skip if '-nocarry')");
 | 
			
		||||
			else if (!nocarry) {
 | 
			
		||||
				if (!vpr)
 | 
			
		||||
					run("techmap -map +/techmap.v -map +/xilinx/arith_map.v");
 | 
			
		||||
				else
 | 
			
		||||
					run("techmap -map +/techmap.v -map +/xilinx/arith_map.v -D _EXPLICIT_CARRY");
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			run("opt -fast");
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -252,7 +272,9 @@ struct SynthXilinxPass : public ScriptPass
 | 
			
		|||
 | 
			
		||||
		if (check_label("map_luts")) {
 | 
			
		||||
			if (help_mode)
 | 
			
		||||
				run("abc -luts 2:2,3,6:5,10,20 [-dff]");
 | 
			
		||||
				run("abc -luts 2:2,3,6:5[,10,20] [-dff]", "(skip if 'nowidelut', only for '-retime')");
 | 
			
		||||
			else if (nowidelut)
 | 
			
		||||
				run("abc -luts 2:2,3,6:5" + string(retime ? " -dff" : ""));
 | 
			
		||||
			else
 | 
			
		||||
				run("abc -luts 2:2,3,6:5,10,20" + string(retime ? " -dff" : ""));
 | 
			
		||||
			run("clean");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue