mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Add "wreduce -keepdc", fixes #1016
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
		
							parent
							
								
									c907899422
								
							
						
					
					
						commit
						c4b8575f43
					
				
					 2 changed files with 13 additions and 3 deletions
				
			
		| 
						 | 
					@ -29,6 +29,7 @@ PRIVATE_NAMESPACE_BEGIN
 | 
				
			||||||
struct WreduceConfig
 | 
					struct WreduceConfig
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pool<IdString> supported_cell_types;
 | 
						pool<IdString> supported_cell_types;
 | 
				
			||||||
 | 
						bool keepdc = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WreduceConfig()
 | 
						WreduceConfig()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					@ -82,7 +83,7 @@ struct WreduceWorker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			SigBit ref = sig_a[i];
 | 
								SigBit ref = sig_a[i];
 | 
				
			||||||
			for (int k = 0; k < GetSize(sig_s); k++) {
 | 
								for (int k = 0; k < GetSize(sig_s); k++) {
 | 
				
			||||||
				if (ref != Sx && sig_b[k*GetSize(sig_a) + i] != Sx && ref != sig_b[k*GetSize(sig_a) + i])
 | 
									if ((config->keepdc || (ref != Sx && sig_b[k*GetSize(sig_a) + i] != Sx)) && ref != sig_b[k*GetSize(sig_a) + i])
 | 
				
			||||||
					goto no_match_ab;
 | 
										goto no_match_ab;
 | 
				
			||||||
				if (sig_b[k*GetSize(sig_a) + i] != Sx)
 | 
									if (sig_b[k*GetSize(sig_a) + i] != Sx)
 | 
				
			||||||
					ref = sig_b[k*GetSize(sig_a) + i];
 | 
										ref = sig_b[k*GetSize(sig_a) + i];
 | 
				
			||||||
| 
						 | 
					@ -495,6 +496,9 @@ struct WreducePass : public Pass {
 | 
				
			||||||
		log("        Do not change the width of memory address ports. Use this options in\n");
 | 
							log("        Do not change the width of memory address ports. Use this options in\n");
 | 
				
			||||||
		log("        flows that use the 'memory_memx' pass.\n");
 | 
							log("        flows that use the 'memory_memx' pass.\n");
 | 
				
			||||||
		log("\n");
 | 
							log("\n");
 | 
				
			||||||
 | 
							log("    -keepdc\n");
 | 
				
			||||||
 | 
							log("        Do not optimize explicit don't-care values.\n");
 | 
				
			||||||
 | 
							log("\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	void execute(std::vector<std::string> args, Design *design) YS_OVERRIDE
 | 
						void execute(std::vector<std::string> args, Design *design) YS_OVERRIDE
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					@ -509,6 +513,10 @@ struct WreducePass : public Pass {
 | 
				
			||||||
				opt_memx = true;
 | 
									opt_memx = true;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								if (args[argidx] == "-keepdc") {
 | 
				
			||||||
 | 
									config.keepdc = true;
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		extra_args(args, argidx, design);
 | 
							extra_args(args, argidx, design);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -195,9 +195,11 @@ struct PrepPass : public ScriptPass
 | 
				
			||||||
			run(nokeepdc ? "opt" : "opt -keepdc");
 | 
								run(nokeepdc ? "opt" : "opt -keepdc");
 | 
				
			||||||
			if (!ifxmode) {
 | 
								if (!ifxmode) {
 | 
				
			||||||
				if (help_mode)
 | 
									if (help_mode)
 | 
				
			||||||
					run("wreduce [-memx]");
 | 
										run("wreduce -keepdc [-memx]");
 | 
				
			||||||
				else
 | 
									else if (nokeepdc)
 | 
				
			||||||
					run(memxmode ? "wreduce -memx" : "wreduce");
 | 
										run(memxmode ? "wreduce -memx" : "wreduce");
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										run(memxmode ? "wreduce -keepdc -memx" : "wreduce -keepdc");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (!nomemmode) {
 | 
								if (!nomemmode) {
 | 
				
			||||||
				run(string("memory_dff") + (help_mode ? " [-nordff]" : nordff ? " -nordff" : ""));
 | 
									run(string("memory_dff") + (help_mode ? " [-nordff]" : nordff ? " -nordff" : ""));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue