mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-13 09:26:16 +00:00
Added "top" attribute to mark top module in hierarchy
This commit is contained in:
parent
a4edecb0ca
commit
28093d9dd2
6 changed files with 63 additions and 3 deletions
|
@ -280,6 +280,10 @@ struct HierarchyPass : public Pass {
|
|||
log(" use the specified top module to built a design hierarchy. modules\n");
|
||||
log(" outside this tree (unused modules) are removed.\n");
|
||||
log("\n");
|
||||
log(" when the -top option is used, the 'top' attribute will be set on the\n");
|
||||
log(" specified top module. otherwise a module with the 'top' attribute set\n");
|
||||
log(" will implicitly be used as top module, if such a module exists.\n");
|
||||
log("\n");
|
||||
log("In -generate mode this pass generates blackbox modules for the given cell\n");
|
||||
log("types (wildcards supported). For this the design is searched for cells that\n");
|
||||
log("match the given types and then the given port declarations are used to\n");
|
||||
|
@ -381,6 +385,11 @@ struct HierarchyPass : public Pass {
|
|||
|
||||
log_push();
|
||||
|
||||
if (top_mod == NULL)
|
||||
for (auto &mod_it : design->modules)
|
||||
if (mod_it.second->get_bool_attribute("\\top"))
|
||||
top_mod = mod_it.second;
|
||||
|
||||
if (top_mod != NULL)
|
||||
hierarchy(design, top_mod);
|
||||
|
||||
|
@ -407,6 +416,14 @@ struct HierarchyPass : public Pass {
|
|||
hierarchy(design, top_mod);
|
||||
}
|
||||
|
||||
if (top_mod != NULL) {
|
||||
for (auto &mod_it : design->modules)
|
||||
if (mod_it.second == top_mod)
|
||||
mod_it.second->attributes["\\top"] = RTLIL::Const(1);
|
||||
else
|
||||
mod_it.second->attributes.erase("\\top");
|
||||
}
|
||||
|
||||
if (!keep_positionals)
|
||||
{
|
||||
std::set<RTLIL::Module*> pos_mods;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue