From b6a15b2f4d11cad6ff8d3037803700b05eacbe9b Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 22 Jun 2002 04:22:40 +0000 Subject: [PATCH] Wide unary minus in continuous assignments. --- elab_net.cc | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/elab_net.cc b/elab_net.cc index 2441e5120..a628cd460 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 */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: elab_net.cc,v 1.91 2002/06/19 04:20:03 steve Exp $" +#ident "$Id: elab_net.cc,v 1.92 2002/06/22 04:22:40 steve Exp $" #endif # include "config.h" @@ -2079,10 +2079,33 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope, break; default: - cerr << get_line() << ": internal error: Wide unary " - << "minus not supported here." << endl; - des->errors += 1; - sig = 0; + NetAddSub*sub = new NetAddSub(scope, scope->local_hsymbol(), + sig->pin_count()); + sub->attribute("LPM_Direction", verinum("SUB")); + + des->add_node(sub); + + for (unsigned idx = 0 ; idx < sig->pin_count(); idx += 1) + connect(sig->pin(idx), sub->pin_Result(idx)); + + for (unsigned idx = 0; idx < sub_sig->pin_count(); idx += 1) + connect(sub_sig->pin(idx), sub->pin_DataB(idx)); + + verinum tmp_num (verinum::V0, sub->width(), true); + NetConst*tmp_con = new NetConst(scope, + scope->local_hsymbol(), + tmp_num); + des->add_node(tmp_con); + + NetNet*tmp_sig = new NetNet(scope, scope->local_hsymbol(), + NetNet::WIRE, + sub_sig->pin_count()); + tmp_sig->local_flag(true); + + for (unsigned idx = 0; idx < sig->pin_count(); idx += 1) { + connect(tmp_sig->pin(idx), sub->pin_DataA(idx)); + connect(tmp_sig->pin(idx), tmp_con->pin(idx)); + } break; } break; @@ -2098,6 +2121,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope, /* * $Log: elab_net.cc,v $ + * Revision 1.92 2002/06/22 04:22:40 steve + * Wide unary minus in continuous assignments. + * * Revision 1.91 2002/06/19 04:20:03 steve * Remove NetTmp and add NetSubnet class. *