mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	Add "whitebox" attribute, add "read_verilog -wb"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
		
							parent
							
								
									ea8ac0aaad
								
							
						
					
					
						commit
						f4abc21d8a
					
				
					 23 changed files with 81 additions and 42 deletions
				
			
		| 
						 | 
				
			
			@ -140,7 +140,7 @@ struct BlifDumper
 | 
			
		|||
			return "subckt";
 | 
			
		||||
		if (!design->modules_.count(RTLIL::escape_id(cell_type)))
 | 
			
		||||
			return "gate";
 | 
			
		||||
		if (design->modules_.at(RTLIL::escape_id(cell_type))->get_bool_attribute("\\blackbox"))
 | 
			
		||||
		if (design->modules_.at(RTLIL::escape_id(cell_type))->get_blackbox_attribute())
 | 
			
		||||
			return "gate";
 | 
			
		||||
		return "subckt";
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -196,7 +196,7 @@ struct BlifDumper
 | 
			
		|||
		}
 | 
			
		||||
		f << stringf("\n");
 | 
			
		||||
 | 
			
		||||
		if (module->get_bool_attribute("\\blackbox")) {
 | 
			
		||||
		if (module->get_blackbox_attribute()) {
 | 
			
		||||
			f << stringf(".blackbox\n");
 | 
			
		||||
			f << stringf(".end\n");
 | 
			
		||||
			return;
 | 
			
		||||
| 
						 | 
				
			
			@ -640,7 +640,7 @@ struct BlifBackend : public Backend {
 | 
			
		|||
		for (auto module_it : design->modules_)
 | 
			
		||||
		{
 | 
			
		||||
			RTLIL::Module *module = module_it.second;
 | 
			
		||||
			if (module->get_bool_attribute("\\blackbox") && !config.blackbox_mode)
 | 
			
		||||
			if (module->get_blackbox_attribute() && !config.blackbox_mode)
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
			if (module->processes.size() != 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -178,7 +178,7 @@ struct EdifBackend : public Backend {
 | 
			
		|||
		for (auto module_it : design->modules_)
 | 
			
		||||
		{
 | 
			
		||||
			RTLIL::Module *module = module_it.second;
 | 
			
		||||
			if (module->get_bool_attribute("\\blackbox"))
 | 
			
		||||
			if (module->get_blackbox_attribute())
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
			if (top_module_name.empty())
 | 
			
		||||
| 
						 | 
				
			
			@ -192,7 +192,7 @@ struct EdifBackend : public Backend {
 | 
			
		|||
			for (auto cell_it : module->cells_)
 | 
			
		||||
			{
 | 
			
		||||
				RTLIL::Cell *cell = cell_it.second;
 | 
			
		||||
				if (!design->modules_.count(cell->type) || design->modules_.at(cell->type)->get_bool_attribute("\\blackbox")) {
 | 
			
		||||
				if (!design->modules_.count(cell->type) || design->modules_.at(cell->type)->get_blackbox_attribute()) {
 | 
			
		||||
					lib_cell_ports[cell->type];
 | 
			
		||||
					for (auto p : cell->connections())
 | 
			
		||||
						lib_cell_ports[cell->type][p.first] = GetSize(p.second);
 | 
			
		||||
| 
						 | 
				
			
			@ -302,7 +302,7 @@ struct EdifBackend : public Backend {
 | 
			
		|||
		*f << stringf("    (technology (numberDefinition))\n");
 | 
			
		||||
		for (auto module : sorted_modules)
 | 
			
		||||
		{
 | 
			
		||||
			if (module->get_bool_attribute("\\blackbox"))
 | 
			
		||||
			if (module->get_blackbox_attribute())
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
			SigMap sigmap(module);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -127,7 +127,7 @@ struct IntersynthBackend : public Backend {
 | 
			
		|||
			RTLIL::Module *module = module_it.second;
 | 
			
		||||
			SigMap sigmap(module);
 | 
			
		||||
 | 
			
		||||
			if (module->get_bool_attribute("\\blackbox"))
 | 
			
		||||
			if (module->get_blackbox_attribute())
 | 
			
		||||
				continue;
 | 
			
		||||
			if (module->memories.size() == 0 && module->processes.size() == 0 && module->cells_.size() == 0)
 | 
			
		||||
				continue;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1543,7 +1543,7 @@ struct Smt2Backend : public Backend {
 | 
			
		|||
 | 
			
		||||
		for (auto module : sorted_modules)
 | 
			
		||||
		{
 | 
			
		||||
			if (module->get_bool_attribute("\\blackbox") || module->has_memories_warn() || module->has_processes_warn())
 | 
			
		||||
			if (module->get_blackbox_attribute() || module->has_memories_warn() || module->has_processes_warn())
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
			log("Creating SMT-LIBv2 representation of module %s.\n", log_id(module));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -739,7 +739,7 @@ struct SmvBackend : public Backend {
 | 
			
		|||
		pool<Module*> modules;
 | 
			
		||||
 | 
			
		||||
		for (auto module : design->modules())
 | 
			
		||||
			if (!module->get_bool_attribute("\\blackbox") && !module->has_memories_warn() && !module->has_processes_warn())
 | 
			
		||||
			if (!module->get_blackbox_attribute() && !module->has_memories_warn() && !module->has_processes_warn())
 | 
			
		||||
				modules.insert(module);
 | 
			
		||||
 | 
			
		||||
		if (template_f.is_open())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -212,7 +212,7 @@ struct SpiceBackend : public Backend {
 | 
			
		|||
		for (auto module_it : design->modules_)
 | 
			
		||||
		{
 | 
			
		||||
			RTLIL::Module *module = module_it.second;
 | 
			
		||||
			if (module->get_bool_attribute("\\blackbox"))
 | 
			
		||||
			if (module->get_blackbox_attribute())
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
			if (module->processes.size() != 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,7 +67,7 @@ struct TableBackend : public Backend {
 | 
			
		|||
 | 
			
		||||
		for (auto module : design->modules())
 | 
			
		||||
		{
 | 
			
		||||
			if (module->get_bool_attribute("\\blackbox"))
 | 
			
		||||
			if (module->get_blackbox_attribute())
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
			SigMap sigmap(module);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1770,7 +1770,7 @@ struct VerilogBackend : public Backend {
 | 
			
		|||
 | 
			
		||||
		*f << stringf("/* Generated by %s */\n", yosys_version_str);
 | 
			
		||||
		for (auto it = design->modules_.begin(); it != design->modules_.end(); ++it) {
 | 
			
		||||
			if (it->second->get_bool_attribute("\\blackbox") != blackboxes)
 | 
			
		||||
			if (it->second->get_blackbox_attribute() != blackboxes)
 | 
			
		||||
				continue;
 | 
			
		||||
			if (selected && !design->selected_whole_module(it->first)) {
 | 
			
		||||
				if (design->selected_module(it->first))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue