From 829af9f438ae560af6e2cc8dc28d2634a2128d0c Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 6 May 2023 09:25:26 -0700 Subject: [PATCH] Fix connecting single element array ports The current check to decide whether a port is an array or a scalar signal uses the number of pins on the NetNet. If it is larger than one the code assumes that it is an array. But for arrays with on a single element the number of pins will be 1 and the port is incorrectly treated as a scalar signal which results in an error. Instead of using the number of pins check for the number of unpacked dimensions to decide whether the port is an array. Signed-off-by: Lars-Peter Clausen --- elaborate.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index 27d2ea350..9523f49d9 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -1538,7 +1538,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const // array, then there should be no sub-ports and // the r-value expression is processed // differently. - if (prts.size() >= 1 && prts[0]->pin_count()>1) { + if (prts.size() >= 1 && prts[0]->unpacked_dimensions() > 0) { ivl_assert(*this, prts.size()==1); elaborate_unpacked_port(des, scope, prts[0], pins[idx], ptype, rmod, idx); @@ -1703,7 +1703,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const // differently. Note that we are calling it the // "r-value" expression, but since this is an // output port, we assign to it from the internal object. - if (prts[0]->pin_count() > 1) { + if (prts[0]->unpacked_dimensions() > 0) { elaborate_unpacked_port(des, scope, prts[0], pins[idx], ptype, rmod, idx); continue;