mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-22 13:53:40 +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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue