Skip to content

Commit 9e9213c

Browse files
hierarchy: Ignore width mismatch from verific
But only if it's also a blackbox module with parameters (i.e. it *could* be parametrizable width).
1 parent 7ffe610 commit 9e9213c

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

passes/hierarchy/hierarchy.cc

+23-9
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,11 @@ struct HierarchyPass : public Pass {
978978
}
979979
}
980980

981+
bool verific_mod = false;
982+
#ifdef YOSYS_ENABLE_VERIFIC
983+
verific_mod = verific_import_pending;
984+
#endif
985+
981986
if (top_mod == nullptr && !load_top_mod.empty()) {
982987
#ifdef YOSYS_ENABLE_VERIFIC
983988
if (verific_import_pending) {
@@ -1418,13 +1423,18 @@ struct HierarchyPass : public Pass {
14181423
if (m == nullptr)
14191424
continue;
14201425

1421-
if (m->get_blackbox_attribute() && !cell->parameters.empty() && m->get_bool_attribute(ID::dynports)) {
1422-
IdString new_m_name = m->derive(design, cell->parameters, true);
1423-
if (new_m_name.empty())
1424-
continue;
1425-
if (new_m_name != m->name) {
1426-
m = design->module(new_m_name);
1427-
blackbox_derivatives.insert(m);
1426+
bool boxed_params = false;
1427+
if (m->get_blackbox_attribute() && !cell->parameters.empty()) {
1428+
if (m->get_bool_attribute(ID::dynports)) {
1429+
IdString new_m_name = m->derive(design, cell->parameters, true);
1430+
if (new_m_name.empty())
1431+
continue;
1432+
if (new_m_name != m->name) {
1433+
m = design->module(new_m_name);
1434+
blackbox_derivatives.insert(m);
1435+
}
1436+
} else {
1437+
boxed_params = true;
14281438
}
14291439
}
14301440

@@ -1440,8 +1450,12 @@ struct HierarchyPass : public Pass {
14401450

14411451
SigSpec sig = conn.second;
14421452

1443-
if (!keep_portwidths && GetSize(w) != GetSize(conn.second))
1444-
{
1453+
bool resize_widths = !keep_portwidths && GetSize(w) != GetSize(conn.second);
1454+
if (resize_widths && verific_mod && boxed_params)
1455+
log_warning("Ignoring width mismatch on %s.%s.%s from verific, is port width parametrizable?\n",
1456+
log_id(module), log_id(cell), log_id(conn.first)
1457+
);
1458+
else if (resize_widths) {
14451459
if (GetSize(w) < GetSize(conn.second))
14461460
{
14471461
int n = GetSize(conn.second) - GetSize(w);

0 commit comments

Comments
 (0)