mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	Further clean up passes/sat/eval.cc.
				
					
				
			Co-Authored-By: Eddie Hung <eddie@fpgeh.com>
This commit is contained in:
		
							parent
							
								
									b63b2dbbc3
								
							
						
					
					
						commit
						f4faa1514b
					
				
					 1 changed files with 15 additions and 16 deletions
				
			
		| 
						 | 
					@ -149,7 +149,7 @@ struct VlogHammerReporter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (auto c : module->cells())
 | 
							for (auto c : module->cells())
 | 
				
			||||||
			if (!satgen.importCell(c))
 | 
								if (!satgen.importCell(c))
 | 
				
			||||||
				log_error("Failed to import cell %s (type %s) to SAT database.\n", RTLIL::id2cstr(c->name), RTLIL::id2cstr(c->type));
 | 
									log_error("Failed to import cell %s (type %s) to SAT database.\n", log_id(c->name), log_id(c->type));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ez->assume(satgen.signals_eq(recorded_set_vars, recorded_set_vals));
 | 
							ez->assume(satgen.signals_eq(recorded_set_vars, recorded_set_vals));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -262,21 +262,21 @@ struct VlogHammerReporter
 | 
				
			||||||
					if (module == modules.front()) {
 | 
										if (module == modules.front()) {
 | 
				
			||||||
						RTLIL::SigSpec sig(wire);
 | 
											RTLIL::SigSpec sig(wire);
 | 
				
			||||||
						if (!ce.eval(sig))
 | 
											if (!ce.eval(sig))
 | 
				
			||||||
							log_error("Can't read back value for port %s!\n", RTLIL::id2cstr(inputs[i]));
 | 
												log_error("Can't read back value for port %s!\n", log_id(inputs[i]));
 | 
				
			||||||
						input_pattern_list += stringf(" %s", sig.as_const().as_string().c_str());
 | 
											input_pattern_list += stringf(" %s", sig.as_const().as_string().c_str());
 | 
				
			||||||
						log("++PAT++ %d %s %s #\n", idx, RTLIL::id2cstr(inputs[i]), sig.as_const().as_string().c_str());
 | 
											log("++PAT++ %d %s %s #\n", idx, log_id(inputs[i]), sig.as_const().as_string().c_str());
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (module->wire("\\y") == nullptr)
 | 
									if (module->wire("\\y") == nullptr)
 | 
				
			||||||
					log_error("No output wire (y) found in module %s!\n", RTLIL::id2cstr(module->name));
 | 
										log_error("No output wire (y) found in module %s!\n", log_id(module->name));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				RTLIL::SigSpec sig(module->wire("\\y"));
 | 
									RTLIL::SigSpec sig(module->wire("\\y"));
 | 
				
			||||||
				RTLIL::SigSpec undef;
 | 
									RTLIL::SigSpec undef;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				while (!ce.eval(sig, undef)) {
 | 
									while (!ce.eval(sig, undef)) {
 | 
				
			||||||
					// log_error("Evaluation of y in module %s failed: sig=%s, undef=%s\n", RTLIL::id2cstr(module->name), log_signal(sig), log_signal(undef));
 | 
										// log_error("Evaluation of y in module %s failed: sig=%s, undef=%s\n", log_id(module->name), log_signal(sig), log_signal(undef));
 | 
				
			||||||
					log_warning("Setting signal %s in module %s to undef.\n", log_signal(undef), RTLIL::id2cstr(module->name));
 | 
										log_warning("Setting signal %s in module %s to undef.\n", log_signal(undef), log_id(module->name));
 | 
				
			||||||
					ce.set(undef, RTLIL::Const(RTLIL::State::Sx, undef.size()));
 | 
										ce.set(undef, RTLIL::Const(RTLIL::State::Sx, undef.size()));
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -288,7 +288,7 @@ struct VlogHammerReporter
 | 
				
			||||||
					sat_check(module, recorded_set_vars, recorded_set_vals, sig, true);
 | 
										sat_check(module, recorded_set_vars, recorded_set_vals, sig, true);
 | 
				
			||||||
				} else if (rtl_sig.size() > 0) {
 | 
									} else if (rtl_sig.size() > 0) {
 | 
				
			||||||
					if (rtl_sig.size() != sig.size())
 | 
										if (rtl_sig.size() != sig.size())
 | 
				
			||||||
						log_error("Output (y) has a different width in module %s compared to rtl!\n", RTLIL::id2cstr(module->name));
 | 
											log_error("Output (y) has a different width in module %s compared to rtl!\n", log_id(module->name));
 | 
				
			||||||
					for (int i = 0; i < GetSize(sig); i++)
 | 
										for (int i = 0; i < GetSize(sig); i++)
 | 
				
			||||||
						if (rtl_sig[i] == RTLIL::State::Sx)
 | 
											if (rtl_sig[i] == RTLIL::State::Sx)
 | 
				
			||||||
							sig[i] = RTLIL::State::Sx;
 | 
												sig[i] = RTLIL::State::Sx;
 | 
				
			||||||
| 
						 | 
					@ -319,10 +319,10 @@ struct VlogHammerReporter
 | 
				
			||||||
			RTLIL::IdString esc_name = RTLIL::escape_id(name);
 | 
								RTLIL::IdString esc_name = RTLIL::escape_id(name);
 | 
				
			||||||
			for (auto mod : modules) {
 | 
								for (auto mod : modules) {
 | 
				
			||||||
				if (mod->wire(esc_name) == nullptr)
 | 
									if (mod->wire(esc_name) == nullptr)
 | 
				
			||||||
					log_error("Can't find input %s in module %s!\n", name.c_str(), RTLIL::id2cstr(mod->name));
 | 
										log_error("Can't find input %s in module %s!\n", name.c_str(), log_id(mod->name));
 | 
				
			||||||
				RTLIL::Wire *port = mod->wire(esc_name);
 | 
									RTLIL::Wire *port = mod->wire(esc_name);
 | 
				
			||||||
				if (!port->port_input || port->port_output)
 | 
									if (!port->port_input || port->port_output)
 | 
				
			||||||
					log_error("Wire %s in module %s is not an input!\n", name.c_str(), RTLIL::id2cstr(mod->name));
 | 
										log_error("Wire %s in module %s is not an input!\n", name.c_str(), log_id(mod->name));
 | 
				
			||||||
				if (width >= 0 && width != port->width)
 | 
									if (width >= 0 && width != port->width)
 | 
				
			||||||
					log_error("Port %s has different sizes in the different modules!\n", name.c_str());
 | 
										log_error("Port %s has different sizes in the different modules!\n", name.c_str());
 | 
				
			||||||
				width = port->width;
 | 
									width = port->width;
 | 
				
			||||||
| 
						 | 
					@ -440,13 +440,12 @@ struct EvalPass : public Pass {
 | 
				
			||||||
		extra_args(args, argidx, design);
 | 
							extra_args(args, argidx, design);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		RTLIL::Module *module = NULL;
 | 
							RTLIL::Module *module = NULL;
 | 
				
			||||||
		for (auto mod : design->modules())
 | 
							for (auto mod : design->selected_modules()) {
 | 
				
			||||||
			if (design->selected(mod)) {
 | 
								if (module)
 | 
				
			||||||
				if (module)
 | 
									log_cmd_error("Only one module must be selected for the EVAL pass! (selected: %s and %s)\n",
 | 
				
			||||||
					log_cmd_error("Only one module must be selected for the EVAL pass! (selected: %s and %s)\n",
 | 
											log_id(module->name), log_id(mod->name));
 | 
				
			||||||
							RTLIL::id2cstr(module->name), RTLIL::id2cstr(mod->name));
 | 
								module = mod;
 | 
				
			||||||
				module = mod;
 | 
							}
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if (module == NULL)
 | 
							if (module == NULL)
 | 
				
			||||||
			log_cmd_error("Can't perform EVAL on an empty selection!\n");
 | 
								log_cmd_error("Can't perform EVAL on an empty selection!\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue