diff --git a/elab_net.cc b/elab_net.cc index ab306724e..71b9e5b14 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.84 2001/12/31 04:23:59 steve Exp $" +#ident "$Id: elab_net.cc,v 1.85 2002/01/03 04:19:01 steve Exp $" #endif # include "config.h" @@ -654,9 +654,12 @@ NetNet* PEBinary::elaborate_net_mod_(Design*des, NetScope*scope, NetNet*rsig = right_->elaborate_net(des, scope, 0, 0, 0, 0); if (rsig == 0) return 0; - unsigned rwidth = lsig->pin_count(); - if (rsig->pin_count() > rwidth) - rwidth = rsig->pin_count(); + unsigned rwidth = lwidth; + if (rwidth == 0) { + rwidth = lsig->pin_count(); + if (rsig->pin_count() > rwidth) + rwidth = rsig->pin_count(); + } NetModulo*mod = new NetModulo(scope, scope->local_hsymbol(), rwidth, lsig->pin_count(), rsig->pin_count()); @@ -1974,6 +1977,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope, /* * $Log: elab_net.cc,v $ + * Revision 1.85 2002/01/03 04:19:01 steve + * Add structural modulus support down to vvp. + * * Revision 1.84 2001/12/31 04:23:59 steve * Elaborate multiply nets with constant operands ad NetConst. * diff --git a/ivl_target.h b/ivl_target.h index 0da1fdfe5..1f31c7380 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: ivl_target.h,v 1.90 2001/12/15 02:13:17 steve Exp $" +#ident "$Id: ivl_target.h,v 1.91 2002/01/03 04:19:01 steve Exp $" #endif #ifdef __cplusplus @@ -210,6 +210,7 @@ typedef enum ivl_lpm_type_e { IVL_LPM_CMP_NE = 11, IVL_LPM_DIVIDE = 12, IVL_LPM_FF = 3, + IVL_LPM_MOD = 13, IVL_LPM_MULT = 4, IVL_LPM_MUX = 5, IVL_LPM_SHIFTL = 6, @@ -976,6 +977,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.91 2002/01/03 04:19:01 steve + * Add structural modulus support down to vvp. + * * Revision 1.90 2001/12/15 02:13:17 steve * The IVL_SIT_WIRE type does not exist, it is a * synonym for IVL_SIT_TRI. diff --git a/t-dll-api.cc b/t-dll-api.cc index bd3d0c124..451f581aa 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-api.cc,v 1.73 2001/12/06 03:11:00 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.74 2002/01/03 04:19:01 steve Exp $" #endif # include "config.h" @@ -564,6 +564,7 @@ extern "C" ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx) case IVL_LPM_CMP_GT: case IVL_LPM_CMP_NE: case IVL_LPM_DIVIDE: + case IVL_LPM_MOD: case IVL_LPM_MULT: case IVL_LPM_SUB: assert(idx < net->u_.arith.width); @@ -599,6 +600,7 @@ extern "C" ivl_nexus_t ivl_lpm_datab(ivl_lpm_t net, unsigned idx) case IVL_LPM_CMP_GT: case IVL_LPM_CMP_NE: case IVL_LPM_DIVIDE: + case IVL_LPM_MOD: case IVL_LPM_MULT: case IVL_LPM_SUB: assert(idx < net->u_.arith.width); @@ -637,6 +639,7 @@ extern "C" ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx) switch (net->type) { case IVL_LPM_ADD: case IVL_LPM_DIVIDE: + case IVL_LPM_MOD: case IVL_LPM_MULT: case IVL_LPM_SUB: assert(idx < net->u_.arith.width); @@ -756,6 +759,7 @@ extern "C" unsigned ivl_lpm_width(ivl_lpm_t net) case IVL_LPM_CMP_GT: case IVL_LPM_CMP_NE: case IVL_LPM_DIVIDE: + case IVL_LPM_MOD: case IVL_LPM_MULT: case IVL_LPM_SUB: return net->u_.arith.width; @@ -1446,6 +1450,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.74 2002/01/03 04:19:01 steve + * Add structural modulus support down to vvp. + * * Revision 1.73 2001/12/06 03:11:00 steve * Add ivl_logic_delay function to ivl_target. * diff --git a/t-dll.cc b/t-dll.cc index abca24b07..f94d96e7a 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.cc,v 1.74 2001/12/18 05:34:02 steve Exp $" +#ident "$Id: t-dll.cc,v 1.75 2002/01/03 04:19:01 steve Exp $" #endif # include "config.h" @@ -1109,6 +1109,73 @@ void dll_target::lpm_divide(const NetDivide*net) scope_add_lpm(obj->scope, obj); } +void dll_target::lpm_modulo(const NetModulo*net) +{ + ivl_lpm_t obj = new struct ivl_lpm_s; + obj->type = IVL_LPM_MOD; + obj->name = strdup(net->name()); + assert(net->scope()); + obj->scope = find_scope(des_, net->scope()); + assert(obj->scope); + + unsigned wid = net->width_r(); + if (wid < net->width_a()) + wid = net->width_a(); + if (wid < net->width_b()) + wid = net->width_b(); + + obj->u_.arith.width = wid; + + obj->u_.arith.q = new ivl_nexus_t[3 * obj->u_.arith.width]; + obj->u_.arith.a = obj->u_.arith.q + obj->u_.arith.width; + obj->u_.arith.b = obj->u_.arith.a + obj->u_.arith.width; + + for (unsigned idx = 0 ; idx < wid ; idx += 1) { + const Nexus*nex; + + if (idx < net->width_r()) { + nex = net->pin_Result(idx).nexus(); + assert(nex->t_cookie()); + + obj->u_.arith.q[idx] = (ivl_nexus_t) nex->t_cookie(); + nexus_lpm_add(obj->u_.arith.q[idx], obj, 0, + IVL_DR_STRONG, IVL_DR_STRONG); + + } else { + obj->u_.arith.q[idx] = 0; + } + + if (idx < net->width_a()) { + nex = net->pin_DataA(idx).nexus(); + assert(nex); + assert(nex->t_cookie()); + + obj->u_.arith.a[idx] = (ivl_nexus_t) nex->t_cookie(); + nexus_lpm_add(obj->u_.arith.a[idx], obj, 0, + IVL_DR_HiZ, IVL_DR_HiZ); + + } else { + obj->u_.arith.a[idx] = 0; + } + + + if (idx < net->width_b()) { + nex = net->pin_DataB(idx).nexus(); + assert(nex); + assert(nex->t_cookie()); + + obj->u_.arith.b[idx] = (ivl_nexus_t) nex->t_cookie(); + nexus_lpm_add(obj->u_.arith.b[idx], obj, 0, + IVL_DR_HiZ, IVL_DR_HiZ); + + } else { + obj->u_.arith.b[idx] = 0; + } + } + + scope_add_lpm(obj->scope, obj); +} + void dll_target::lpm_ff(const NetFF*net) { ivl_lpm_t obj = new struct ivl_lpm_s; @@ -1723,6 +1790,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.75 2002/01/03 04:19:01 steve + * Add structural modulus support down to vvp. + * * Revision 1.74 2001/12/18 05:34:02 steve * Comments about MUX synthesis. * diff --git a/t-dll.h b/t-dll.h index d1c7244a8..c8c614eca 100644 --- a/t-dll.h +++ b/t-dll.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.h,v 1.72 2001/12/06 03:11:01 steve Exp $" +#ident "$Id: t-dll.h,v 1.73 2002/01/03 04:19:01 steve Exp $" #endif # include "target.h" @@ -75,6 +75,7 @@ struct dll_target : public target_t, public expr_scan_t { void lpm_compare(const NetCompare*); void lpm_divide(const NetDivide*); void lpm_ff(const NetFF*); + void lpm_modulo(const NetModulo*); void lpm_mult(const NetMult*); void lpm_mux(const NetMux*); void lpm_ram_dq(const NetRamDq*); @@ -589,6 +590,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.73 2002/01/03 04:19:01 steve + * Add structural modulus support down to vvp. + * * Revision 1.72 2001/12/06 03:11:01 steve * Add ivl_logic_delay function to ivl_target. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 697a22e70..0becfc6b1 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.60 2001/12/15 02:13:33 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.61 2002/01/03 04:19:01 steve Exp $" #endif # include "vvp_priv.h" @@ -247,6 +247,7 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) case IVL_LPM_SUB: case IVL_LPM_MULT: case IVL_LPM_DIVIDE: + case IVL_LPM_MOD: for (idx = 0 ; idx < ivl_lpm_width(lpm) ; idx += 1) if (ivl_lpm_q(lpm, idx) == nex) { sprintf(result, "L_%s[%u]", @@ -1003,6 +1004,9 @@ static void draw_lpm_add(ivl_lpm_t net) case IVL_LPM_DIVIDE: type = "div"; break; + case IVL_LPM_MOD: + type = "mod"; + break; default: assert(0); } @@ -1202,6 +1206,7 @@ static void draw_lpm_in_scope(ivl_lpm_t net) case IVL_LPM_SUB: case IVL_LPM_MULT: case IVL_LPM_DIVIDE: + case IVL_LPM_MOD: draw_lpm_add(net); return; @@ -1321,6 +1326,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.61 2002/01/03 04:19:01 steve + * Add structural modulus support down to vvp. + * * Revision 1.60 2001/12/15 02:13:33 steve * Support all 3 TRI net types. * diff --git a/vvp/README.txt b/vvp/README.txt index 352862e35..77cb9ac01 100644 --- a/vvp/README.txt +++ b/vvp/README.txt @@ -1,7 +1,7 @@ /* * Copyright (c) 2001 Stephen Williams (steve@icarus.com) * - * $Id: README.txt,v 1.38 2001/11/01 03:00:19 steve Exp $ + * $Id: README.txt,v 1.39 2002/01/03 04:19:01 steve Exp $ */ VVP SIMULATION ENGINE @@ -433,6 +433,7 @@ create special statement types for the various arithmetic operators.