From 15becdaee44020b2c40033f1143a0f35e0d900c0 Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 18 Jul 2002 02:06:37 +0000 Subject: [PATCH] Need driver for sure in assign feedback and other cases. --- elaborate.cc | 52 +++++++++++++++++++++++++++++++++++++++------ tgt-vvp/vvp_scope.c | 11 +++++++++- 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index 642867fa3..47e0ac99b 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: elaborate.cc,v 1.256 2002/07/18 00:24:22 steve Exp $" +#ident "$Id: elaborate.cc,v 1.257 2002/07/18 02:06:37 steve Exp $" #endif # include "config.h" @@ -122,12 +122,47 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const if (rid->pin_count() < cnt) cnt = rid->pin_count(); - if ((rid->type() == lval->type()) && (rise_time == 0)) { - unsigned idx; - for (idx = 0 ; idx < cnt; idx += 1) { - if (! lval->pin(idx) .is_linked (rid->pin(idx))) - connect(lval->pin(idx), rid->pin(idx)); + bool need_driver_flag = false; + + /* If the device is linked to itself, a driver is + needed. Should I print a warning here? */ + for (unsigned idx = 0 ; idx < cnt ; idx += 1) { + if (lval->pin(idx) .is_linked (rid->pin(idx))) { + need_driver_flag = true; + break; } + } + + /* If the nets are different type (i.e. reg vs tri) then + a driver is needed. */ + if (rid->type() != lval->type()) + need_driver_flag = true; + + /* If there is a delay, then I need a driver to carry + it. */ + if (rise_time || fall_time || decay_time) + need_driver_flag = true; + + /* If there is a strength to be carried, then I need a + driver to carry that strength. */ + for (unsigned idx = 0 ; idx < cnt ; idx += 1) { + if (rid->pin(idx).drive0() != drive0) { + need_driver_flag = true; + break; + } + if (rid->pin(idx).drive1() != drive1) { + need_driver_flag = true; + break; + } + } + + if (! need_driver_flag) { + /* Don't need a driver, presumably because the + r-value already has the needed drivers. Just + hook things up. */ + unsigned idx; + for (idx = 0 ; idx < cnt; idx += 1) + connect(lval->pin(idx), rid->pin(idx)); if (cnt < lval->pin_count()) { verinum tmpv (0UL, lval->pin_count()-cnt); @@ -140,6 +175,8 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const } } else { + /* Do need a driver. Use BUFZ objects to carry the + strength and delays. */ unsigned idx; for (idx = 0 ; idx < cnt ; idx += 1) { NetBUFZ*dev = new NetBUFZ(scope, @@ -2466,6 +2503,9 @@ Design* elaborate(listroots) /* * $Log: elaborate.cc,v $ + * Revision 1.257 2002/07/18 02:06:37 steve + * Need driver for sure in assign feedback and other cases. + * * Revision 1.256 2002/07/18 00:24:22 steve * Careful with assign to self. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 0c6f81bf8..ea4283006 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vvp_scope.c,v 1.73 2002/07/08 04:04:07 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.74 2002/07/18 02:06:37 steve Exp $" #endif # include "vvp_priv.h" @@ -253,6 +253,9 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) if (ivl_logic_delay(lptr, 0) != 0) break; + if (nex == ivl_logic_pin(lptr, 1)) + break; + return draw_net_input(ivl_logic_pin(lptr, 1)); } while(0); @@ -705,6 +708,9 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr) if (ivl_logic_delay(lptr, 0) != 0) break; + if (ivl_logic_pin(lptr, 0) == ivl_logic_pin(lptr, 1)) + break; + return; } @@ -1460,6 +1466,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.74 2002/07/18 02:06:37 steve + * Need driver for sure in assign feedback and other cases. + * * Revision 1.73 2002/07/08 04:04:07 steve * Generate code for wide muxes. *