From 041091cfac07a34ba1f29978da4df2fe4b781176 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 26 Nov 2006 06:29:16 +0000 Subject: [PATCH] Fix nexus widths for direct link assign and ternary nets. --- elab_net.cc | 10 +++++++++- elaborate.cc | 16 +++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/elab_net.cc b/elab_net.cc index c8342ac2a..8a2d1b8fe 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.189 2006/08/08 05:11:37 steve Exp $" +#ident "$Id: elab_net.cc,v 1.190 2006/11/26 06:29:16 steve Exp $" #endif # include "config.h" @@ -2588,6 +2588,11 @@ NetNet* PETernary::elaborate_net(Design*des, NetScope*scope, if (tru_sig->vector_width() < dwidth) tru_sig = pad_to_width(des, tru_sig, dwidth); + if (dwidth < fal_sig->vector_width()) + fal_sig = crop_to_width(des, fal_sig, dwidth); + + if (dwidth < tru_sig->vector_width()) + tru_sig = crop_to_width(des, tru_sig, dwidth); /* Make the device and connect its outputs to the osig and inputs to the tru and false case nets. Also connect the @@ -2840,6 +2845,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope, /* * $Log: elab_net.cc,v $ + * Revision 1.190 2006/11/26 06:29:16 steve + * Fix nexus widths for direct link assign and ternary nets. + * * Revision 1.189 2006/08/08 05:11:37 steve * Handle 64bit delay constants. * diff --git a/elaborate.cc b/elaborate.cc index 46e9aee15..1a95eee64 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elaborate.cc,v 1.349 2006/11/04 06:19:25 steve Exp $" +#ident "$Id: elaborate.cc,v 1.350 2006/11/26 06:29:16 steve Exp $" #endif # include "config.h" @@ -181,6 +181,17 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const lval->vector_width()); rid = tmp; } + + } else if (cnt < rid->vector_width()) { + + if (debug_elaborate) + cerr << get_line() << ": debug: PGAssign " + << "Truncate r-value from " + << cnt << " bits to " + << lval->vector_width() << " bits." << endl; + + NetNet*tmp = crop_to_width(des, rid, lval->vector_width()); + rid = tmp; } if (! need_driver_flag) { @@ -3326,6 +3337,9 @@ Design* elaborate(listroots) /* * $Log: elaborate.cc,v $ + * Revision 1.350 2006/11/26 06:29:16 steve + * Fix nexus widths for direct link assign and ternary nets. + * * Revision 1.349 2006/11/04 06:19:25 steve * Remove last bits of relax_width methods, and use test_width * to calculate the width of an r-value expression that may