From a2c036d5ab6708f85fc3b986831edbafa268fb8f Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 28 Apr 2006 04:28:35 +0000 Subject: [PATCH] Allow concatenations as arguments to inout ports. --- PExpr.h | 10 +++++++++- elab_net.cc | 36 +++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/PExpr.h b/PExpr.h index 311532b79..d777dec74 100644 --- a/PExpr.h +++ b/PExpr.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: PExpr.h,v 1.80 2006/04/16 00:54:04 steve Exp $" +#ident "$Id: PExpr.h,v 1.81 2006/04/28 04:28:35 steve Exp $" #endif # include @@ -128,6 +128,7 @@ class PEConcat : public PExpr { virtual NetNet* elaborate_lnet(Design*des, NetScope*scope, bool implicit_net_ok =false) const; + virtual NetNet* elaborate_bi_net(Design*des, NetScope*scope) const; virtual NetNet* elaborate_net(Design*des, NetScope*scope, unsigned width, const NetExpr* rise, @@ -143,6 +144,10 @@ class PEConcat : public PExpr { bool is_force) const; virtual bool is_constant(Module*) const; + private: + NetNet* elaborate_lnet_common_(Design*des, NetScope*scope, + bool implicit_net_ok, + bool bidirectional_flag) const; private: svectorparms_; PExpr*repeat_; @@ -553,6 +558,9 @@ class PECallFunction : public PExpr { /* * $Log: PExpr.h,v $ + * Revision 1.81 2006/04/28 04:28:35 steve + * Allow concatenations as arguments to inout ports. + * * Revision 1.80 2006/04/16 00:54:04 steve * Cleanup lval part select handling. * diff --git a/elab_net.cc b/elab_net.cc index 1a2161deb..6dfa00c7a 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elab_net.cc,v 1.180 2006/04/24 05:15:07 steve Exp $" +#ident "$Id: elab_net.cc,v 1.181 2006/04/28 04:28:35 steve Exp $" #endif # include "config.h" @@ -1733,8 +1733,9 @@ NetNet* PEIdent::elaborate_net_ram_(Design*des, NetScope*scope, * destination. The caller can connect gate outputs to this signal to * make the l-value connections. */ -NetNet* PEConcat::elaborate_lnet(Design*des, NetScope*scope, - bool implicit_net_ok) const +NetNet* PEConcat::elaborate_lnet_common_(Design*des, NetScope*scope, + bool implicit_net_ok, + bool bidirectional_flag) const { assert(scope); @@ -1764,8 +1765,12 @@ NetNet* PEConcat::elaborate_lnet(Design*des, NetScope*scope, continue; } - nets[idx] = parms_[idx]->elaborate_lnet(des, scope, - implicit_net_ok); + if (bidirectional_flag) { + nets[idx] = parms_[idx]->elaborate_bi_net(des, scope); + } else { + nets[idx] = parms_[idx]->elaborate_lnet(des, scope, + implicit_net_ok); + } if (nets[idx] == 0) errors += 1; else @@ -1797,11 +1802,14 @@ NetNet* PEConcat::elaborate_lnet(Design*des, NetScope*scope, << endl; } + NetPartSelect::dir_t part_dir = bidirectional_flag + ? NetPartSelect::BI + : NetPartSelect::VP; + for (unsigned idx = 0 ; idx < nets.count() ; idx += 1) { unsigned wid = nets[idx]->vector_width(); unsigned off = width - wid; - NetPartSelect*ps = new NetPartSelect(osig, off, wid, - NetPartSelect::VP); + NetPartSelect*ps = new NetPartSelect(osig, off, wid, part_dir); des->add_node(ps); connect(ps->pin(1), osig->pin(0)); @@ -1816,6 +1824,17 @@ NetNet* PEConcat::elaborate_lnet(Design*des, NetScope*scope, return osig; } +NetNet* PEConcat::elaborate_lnet(Design*des, NetScope*scope, + bool implicit_net_ok) const +{ + return elaborate_lnet_common_(des, scope, implicit_net_ok, false); +} + +NetNet* PEConcat::elaborate_bi_net(Design*des, NetScope*scope) const +{ + return elaborate_lnet_common_(des, scope, true, true); +} + /* * Elaborate a number as a NetConst object. */ @@ -2731,6 +2750,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope, /* * $Log: elab_net.cc,v $ + * Revision 1.181 2006/04/28 04:28:35 steve + * Allow concatenations as arguments to inout ports. + * * Revision 1.180 2006/04/24 05:15:07 steve * Fix support for indexed part select in continuous assign l-values. *