mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Added "rename -top new_name"
This commit is contained in:
		
							parent
							
								
									9f7a5b4ef9
								
							
						
					
					
						commit
						99100f367d
					
				
					 3 changed files with 43 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -316,6 +316,21 @@ RTLIL::Module *RTLIL::Design::module(RTLIL::IdString name)
 | 
			
		|||
	return modules_.count(name) ? modules_.at(name) : NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RTLIL::Module *RTLIL::Design::top_module()
 | 
			
		||||
{
 | 
			
		||||
	RTLIL::Module *module = nullptr;
 | 
			
		||||
	int module_count = 0;
 | 
			
		||||
 | 
			
		||||
	for (auto mod : selected_modules()) {
 | 
			
		||||
		if (mod->get_bool_attribute("\\top"))
 | 
			
		||||
			return mod;
 | 
			
		||||
		module_count++;
 | 
			
		||||
		module = mod;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return module_count == 1 ? module : nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RTLIL::Design::add(RTLIL::Module *module)
 | 
			
		||||
{
 | 
			
		||||
	log_assert(modules_.count(module->name) == 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -800,6 +800,7 @@ struct RTLIL::Design
 | 
			
		|||
 | 
			
		||||
	RTLIL::ObjRange<RTLIL::Module*> modules();
 | 
			
		||||
	RTLIL::Module *module(RTLIL::IdString name);
 | 
			
		||||
	RTLIL::Module *top_module();
 | 
			
		||||
 | 
			
		||||
	bool has(RTLIL::IdString id) const {
 | 
			
		||||
		return modules_.count(id) != 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue