From 042f4057078edc8a777861ac3d630349ffaaa8d5 Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 21 Mar 2011 14:29:20 -0700 Subject: [PATCH] Change elaboration to better support top level and unconnected ports. This patch changes the module elaboration slightly to allow passing the appropriate information for unconnected and top level ports. This allows the vlog95 generator to get the basic structure correct. --- elaborate.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index 4629c735b..a1e0e5a49 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -1229,6 +1229,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const // unconnected port. for (unsigned idx = 0 ; idx < pins.size() ; idx += 1) { + bool unconnected_port = false; // Skip unconnected module ports. This happens when a // null parameter is passed in. @@ -1289,11 +1290,9 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const } } } - - continue; + unconnected_port = true; } - // Inside the module, the port is zero or more signals // that were already elaborated. List all those signals // and the NetNet equivalents, for all the instances. @@ -1332,7 +1331,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const // If I find that the port is unconnected inside the // module, then there is nothing to connect. Skip the // argument. - if (prts_vector_width == 0) { + if ((prts_vector_width == 0) || unconnected_port) { continue; } @@ -4650,6 +4649,17 @@ Design* elaborate(listroots) delete des; return 0; } + + // Some of the generators need to have the ports correctly + // defined for the root modules. This code does that. + for (unsigned idx = 0; idx < rmod->port_count(); idx += 1) { + vector mport = rmod->get_port(idx); + for (unsigned pin = 0; pin < mport.size(); pin += 1) { + // This really does more than we need and adds extra + // stuff to the design that should be cleaned later. + (void) mport[pin]->elaborate_port(des, scope); + } + } } // Now that the structure and parameters are taken care of,