Add error for cell output ports that are connected to constants

This commit is contained in:
Clifford Wolf 2017-07-22 15:08:30 +02:00
parent 024ba310ec
commit b6bd12fade
1 changed files with 22 additions and 21 deletions

View File

@ -620,8 +620,6 @@ struct HierarchyPass : public Pass {
} }
} }
if (!keep_portwidths)
{
for (auto module : design->modules()) for (auto module : design->modules())
for (auto cell : module->cells()) for (auto cell : module->cells())
{ {
@ -643,11 +641,10 @@ struct HierarchyPass : public Pass {
if (GetSize(conn.second) == 0) if (GetSize(conn.second) == 0)
continue; continue;
if (GetSize(w) == GetSize(conn.second))
continue;
SigSpec sig = conn.second; SigSpec sig = conn.second;
if (!keep_portwidths && GetSize(w) != GetSize(conn.second))
{
if (GetSize(w) < GetSize(conn.second)) if (GetSize(w) < GetSize(conn.second))
{ {
int n = GetSize(conn.second) - GetSize(w); int n = GetSize(conn.second) - GetSize(w);
@ -669,6 +666,10 @@ struct HierarchyPass : public Pass {
log_id(conn.first), GetSize(conn.second), GetSize(sig)); log_id(conn.first), GetSize(conn.second), GetSize(sig));
cell->setPort(conn.first, sig); cell->setPort(conn.first, sig);
} }
if (w->port_output && !w->port_input && sig.has_const())
log_error("Output port %s.%s.%s (%s) is connected to constants: %s\n",
log_id(module), log_id(cell), log_id(conn.first), log_id(cell->type), log_signal(sig));
} }
} }