mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	This commit is contained in:
		
						commit
						f6a0f2cf73
					
				
					 7 changed files with 32 additions and 16 deletions
				
			
		
							
								
								
									
										4
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -112,8 +112,8 @@ ifeq ($(SANITIZER),address)
 | 
			
		|||
ENABLE_COVER := 0
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(SANITIZER),memory)
 | 
			
		||||
CXXFLAGS += -fPIE
 | 
			
		||||
LDFLAGS += -fPIE
 | 
			
		||||
CXXFLAGS += -fPIE -fsanitize-memory-track-origins
 | 
			
		||||
LDFLAGS += -fPIE -fsanitize-memory-track-origins
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(SANITIZER),cfi)
 | 
			
		||||
CXXFLAGS += -flto
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -540,7 +540,7 @@ struct BlifBackend : public Backend {
 | 
			
		|||
			if (module->processes.size() != 0)
 | 
			
		||||
				log_error("Found unmapped processes in module %s: unmapped processes are not supported in BLIF backend!\n", RTLIL::id2cstr(module->name));
 | 
			
		||||
			if (module->memories.size() != 0)
 | 
			
		||||
				log_error("Found munmapped emories in module %s: unmapped memories are not supported in BLIF backend!\n", RTLIL::id2cstr(module->name));
 | 
			
		||||
				log_error("Found unmapped memories in module %s: unmapped memories are not supported in BLIF backend!\n", RTLIL::id2cstr(module->name));
 | 
			
		||||
 | 
			
		||||
			if (module->name == RTLIL::escape_id(top_module_name)) {
 | 
			
		||||
				BlifDumper::dump(*f, module, design, config);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -153,7 +153,7 @@ struct EdifBackend : public Backend {
 | 
			
		|||
			if (module->processes.size() != 0)
 | 
			
		||||
				log_error("Found unmapped processes in module %s: unmapped processes are not supported in EDIF backend!\n", RTLIL::id2cstr(module->name));
 | 
			
		||||
			if (module->memories.size() != 0)
 | 
			
		||||
				log_error("Found munmapped emories in module %s: unmapped memories are not supported in EDIF backend!\n", RTLIL::id2cstr(module->name));
 | 
			
		||||
				log_error("Found unmapped memories in module %s: unmapped memories are not supported in EDIF backend!\n", RTLIL::id2cstr(module->name));
 | 
			
		||||
 | 
			
		||||
			for (auto cell_it : module->cells_)
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -218,7 +218,7 @@ struct SpiceBackend : public Backend {
 | 
			
		|||
			if (module->processes.size() != 0)
 | 
			
		||||
				log_error("Found unmapped processes in module %s: unmapped processes are not supported in SPICE backend!\n", log_id(module));
 | 
			
		||||
			if (module->memories.size() != 0)
 | 
			
		||||
				log_error("Found munmapped emories in module %s: unmapped memories are not supported in SPICE backend!\n", log_id(module));
 | 
			
		||||
				log_error("Found unmapped memories in module %s: unmapped memories are not supported in SPICE backend!\n", log_id(module));
 | 
			
		||||
 | 
			
		||||
			if (module->name == RTLIL::escape_id(top_module_name)) {
 | 
			
		||||
				top_module = module;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -630,11 +630,11 @@ struct SatHelper
 | 
			
		|||
						    "---------------------------------------------------------------------------------------------------";
 | 
			
		||||
				if (last_timestep == -2) {
 | 
			
		||||
					log(max_timestep > 0 ? "  Time " : "  ");
 | 
			
		||||
					log("%-*s %10s %10s %*s\n", maxModelName+10, "Signal Name", "Dec", "Hex", maxModelWidth+5, "Bin");
 | 
			
		||||
					log("%-*s %11s %9s %*s\n", maxModelName+5, "Signal Name", "Dec", "Hex", maxModelWidth+3, "Bin");
 | 
			
		||||
				}
 | 
			
		||||
				log(max_timestep > 0 ? "  ---- " : "  ");
 | 
			
		||||
				log("%*.*s %10.10s %10.10s %*.*s\n", maxModelName+10, maxModelName+10,
 | 
			
		||||
						hline, hline, hline, maxModelWidth+5, maxModelWidth+5, hline);
 | 
			
		||||
				log("%*.*s %11.11s %9.9s %*.*s\n", maxModelName+5, maxModelName+5,
 | 
			
		||||
						hline, hline, hline, maxModelWidth+3, maxModelWidth+3, hline);
 | 
			
		||||
				last_timestep = info.timestep;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -647,9 +647,9 @@ struct SatHelper
 | 
			
		|||
				log("  ");
 | 
			
		||||
 | 
			
		||||
			if (info.width <= 32 && !found_undef)
 | 
			
		||||
				log("%-*s %10d %10x %*s\n", maxModelName+10, info.description.c_str(), value.as_int(), value.as_int(), maxModelWidth+5, value.as_string().c_str());
 | 
			
		||||
				log("%-*s %11d %9x %*s\n", maxModelName+5, info.description.c_str(), value.as_int(), value.as_int(), maxModelWidth+3, value.as_string().c_str());
 | 
			
		||||
			else
 | 
			
		||||
				log("%-*s %10s %10s %*s\n", maxModelName+10, info.description.c_str(), "--", "--", maxModelWidth+5, value.as_string().c_str());
 | 
			
		||||
				log("%-*s %11s %9s %*s\n", maxModelName+5, info.description.c_str(), "--", "--", maxModelWidth+3, value.as_string().c_str());
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (last_timestep == -2)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,6 +108,7 @@ static void find_cell(LibertyAst *ast, std::string cell_type, bool clkpol, bool
 | 
			
		|||
	LibertyAst *best_cell = NULL;
 | 
			
		||||
	std::map<std::string, char> best_cell_ports;
 | 
			
		||||
	int best_cell_pins = 0;
 | 
			
		||||
	bool best_cell_noninv = false;
 | 
			
		||||
	double best_cell_area = 0;
 | 
			
		||||
 | 
			
		||||
	if (ast->id != "library")
 | 
			
		||||
| 
						 | 
				
			
			@ -155,6 +156,7 @@ static void find_cell(LibertyAst *ast, std::string cell_type, bool clkpol, bool
 | 
			
		|||
 | 
			
		||||
		int num_pins = 0;
 | 
			
		||||
		bool found_output = false;
 | 
			
		||||
		bool found_noninv_output = false;
 | 
			
		||||
		for (auto pin : cell->children)
 | 
			
		||||
		{
 | 
			
		||||
			if (pin->id != "pin" || pin->args.size() != 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -175,10 +177,14 @@ static void find_cell(LibertyAst *ast, std::string cell_type, bool clkpol, bool
 | 
			
		|||
					value.erase(pos, 1);
 | 
			
		||||
				if (value == ff->args[0]) {
 | 
			
		||||
					this_cell_ports[pin->args[0]] = cell_next_pol ? 'Q' : 'q';
 | 
			
		||||
					if (cell_next_pol)
 | 
			
		||||
						found_noninv_output = true;
 | 
			
		||||
					found_output = true;
 | 
			
		||||
				} else
 | 
			
		||||
				if (value == ff->args[1]) {
 | 
			
		||||
					this_cell_ports[pin->args[0]] = cell_next_pol ? 'q' : 'Q';
 | 
			
		||||
					if (!cell_next_pol)
 | 
			
		||||
						found_noninv_output = true;
 | 
			
		||||
					found_output = true;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			@ -187,7 +193,7 @@ static void find_cell(LibertyAst *ast, std::string cell_type, bool clkpol, bool
 | 
			
		|||
				this_cell_ports[pin->args[0]] = 0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!found_output || (best_cell != NULL && num_pins > best_cell_pins))
 | 
			
		||||
		if (!found_output || (best_cell != NULL && (num_pins > best_cell_pins || (best_cell_noninv && !found_noninv_output))))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if (best_cell != NULL && num_pins == best_cell_pins && area > best_cell_area)
 | 
			
		||||
| 
						 | 
				
			
			@ -196,12 +202,14 @@ static void find_cell(LibertyAst *ast, std::string cell_type, bool clkpol, bool
 | 
			
		|||
		best_cell = cell;
 | 
			
		||||
		best_cell_pins = num_pins;
 | 
			
		||||
		best_cell_area = area;
 | 
			
		||||
		best_cell_noninv = found_noninv_output;
 | 
			
		||||
		best_cell_ports.swap(this_cell_ports);
 | 
			
		||||
	continue_cell_loop:;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (best_cell != NULL) {
 | 
			
		||||
		log("  cell %s (pins=%d, area=%.2f) is a direct match for cell type %s.\n", best_cell->args[0].c_str(), best_cell_pins, best_cell_area, cell_type.c_str());
 | 
			
		||||
		log("  cell %s (%sinv, pins=%d, area=%.2f) is a direct match for cell type %s.\n",
 | 
			
		||||
				best_cell->args[0].c_str(), best_cell_noninv ? "non" : "", best_cell_pins, best_cell_area, cell_type.c_str());
 | 
			
		||||
		if (prepare_mode) {
 | 
			
		||||
			cell_mappings[cell_type].cell_name = cell_type;
 | 
			
		||||
			cell_mappings[cell_type].ports["C"] = 'C';
 | 
			
		||||
| 
						 | 
				
			
			@ -221,6 +229,7 @@ static void find_cell_sr(LibertyAst *ast, std::string cell_type, bool clkpol, bo
 | 
			
		|||
	LibertyAst *best_cell = NULL;
 | 
			
		||||
	std::map<std::string, char> best_cell_ports;
 | 
			
		||||
	int best_cell_pins = 0;
 | 
			
		||||
	bool best_cell_noninv = false;
 | 
			
		||||
	double best_cell_area = 0;
 | 
			
		||||
 | 
			
		||||
	if (ast->id != "library")
 | 
			
		||||
| 
						 | 
				
			
			@ -260,6 +269,7 @@ static void find_cell_sr(LibertyAst *ast, std::string cell_type, bool clkpol, bo
 | 
			
		|||
 | 
			
		||||
		int num_pins = 0;
 | 
			
		||||
		bool found_output = false;
 | 
			
		||||
		bool found_noninv_output = false;
 | 
			
		||||
		for (auto pin : cell->children)
 | 
			
		||||
		{
 | 
			
		||||
			if (pin->id != "pin" || pin->args.size() != 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -280,10 +290,14 @@ static void find_cell_sr(LibertyAst *ast, std::string cell_type, bool clkpol, bo
 | 
			
		|||
					value.erase(pos, 1);
 | 
			
		||||
				if (value == ff->args[0]) {
 | 
			
		||||
					this_cell_ports[pin->args[0]] = cell_next_pol ? 'Q' : 'q';
 | 
			
		||||
					if (cell_next_pol)
 | 
			
		||||
						found_noninv_output = true;
 | 
			
		||||
					found_output = true;
 | 
			
		||||
				} else
 | 
			
		||||
				if (value == ff->args[1]) {
 | 
			
		||||
					this_cell_ports[pin->args[0]] = cell_next_pol ? 'q' : 'Q';
 | 
			
		||||
					if (!cell_next_pol)
 | 
			
		||||
						found_noninv_output = true;
 | 
			
		||||
					found_output = true;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			@ -292,7 +306,7 @@ static void find_cell_sr(LibertyAst *ast, std::string cell_type, bool clkpol, bo
 | 
			
		|||
				this_cell_ports[pin->args[0]] = 0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!found_output || (best_cell != NULL && num_pins > best_cell_pins))
 | 
			
		||||
		if (!found_output || (best_cell != NULL && (num_pins > best_cell_pins || (best_cell_noninv && !found_noninv_output))))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if (best_cell != NULL && num_pins == best_cell_pins && area > best_cell_area)
 | 
			
		||||
| 
						 | 
				
			
			@ -301,12 +315,14 @@ static void find_cell_sr(LibertyAst *ast, std::string cell_type, bool clkpol, bo
 | 
			
		|||
		best_cell = cell;
 | 
			
		||||
		best_cell_pins = num_pins;
 | 
			
		||||
		best_cell_area = area;
 | 
			
		||||
		best_cell_noninv = found_noninv_output;
 | 
			
		||||
		best_cell_ports.swap(this_cell_ports);
 | 
			
		||||
	continue_cell_loop:;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (best_cell != NULL) {
 | 
			
		||||
		log("  cell %s (pins=%d, area=%.2f) is a direct match for cell type %s.\n", best_cell->args[0].c_str(), best_cell_pins, best_cell_area, cell_type.c_str());
 | 
			
		||||
		log("  cell %s (%sinv, pins=%d, area=%.2f) is a direct match for cell type %s.\n",
 | 
			
		||||
				best_cell->args[0].c_str(), best_cell_noninv ? "non" : "", best_cell_pins, best_cell_area, cell_type.c_str());
 | 
			
		||||
		if (prepare_mode) {
 | 
			
		||||
			cell_mappings[cell_type].cell_name = cell_type;
 | 
			
		||||
			cell_mappings[cell_type].ports["C"] = 'C';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue