From 177fa4062b6792ecbbb958162253a705f2268da6 Mon Sep 17 00:00:00 2001 From: steve Date: Tue, 16 Oct 2001 02:19:26 +0000 Subject: [PATCH] Support IVL_LPM_DIVIDE for structural divide. --- elab_net.cc | 7 +++-- ivl_target.h | 6 ++++- netlist.cc | 9 ++++--- netlist.h | 8 ++++-- t-dll-api.cc | 9 ++++++- t-dll.cc | 63 ++++++++++++++++++++++++++++++++++++++++++++- t-dll.h | 6 ++++- tgt-vvp/vvp_scope.c | 10 ++++++- 8 files changed, 106 insertions(+), 12 deletions(-) diff --git a/elab_net.cc b/elab_net.cc index a415aa8c8..c63c667c5 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.75 2001/09/14 04:20:49 steve Exp $" +#ident "$Id: elab_net.cc,v 1.76 2001/10/16 02:19:26 steve Exp $" #endif # include "config.h" @@ -586,7 +586,7 @@ NetNet* PEBinary::elaborate_net_div_(Design*des, const string&path, } // Create a device with the calculated dimensions. - NetDivide*div = new NetDivide(des->local_symbol(path), rwidth, + NetDivide*div = new NetDivide(scope, des->local_symbol(path), rwidth, lsig->pin_count(), rsig->pin_count()); des->add_node(div); @@ -1897,6 +1897,9 @@ NetNet* PEUnary::elaborate_net(Design*des, const string&path, /* * $Log: elab_net.cc,v $ + * Revision 1.76 2001/10/16 02:19:26 steve + * Support IVL_LPM_DIVIDE for structural divide. + * * Revision 1.75 2001/09/14 04:20:49 steve * dead code. * diff --git a/ivl_target.h b/ivl_target.h index 3bc0a1b73..0ab8ea018 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.83 2001/09/30 16:45:10 steve Exp $" +#ident "$Id: ivl_target.h,v 1.84 2001/10/16 02:19:27 steve Exp $" #endif #ifdef __cplusplus @@ -208,6 +208,7 @@ typedef enum ivl_lpm_type_e { IVL_LPM_CMP_GE = 1, IVL_LPM_CMP_GT = 2, IVL_LPM_CMP_NE = 11, + IVL_LPM_DIVIDE = 12, IVL_LPM_FF = 3, IVL_LPM_MULT = 4, IVL_LPM_MUX = 5, @@ -963,6 +964,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.84 2001/10/16 02:19:27 steve + * Support IVL_LPM_DIVIDE for structural divide. + * * Revision 1.83 2001/09/30 16:45:10 steve * Fix some Cygwin DLL handling. (Venkat Iyer) * diff --git a/netlist.cc b/netlist.cc index fb4da5007..aafb196aa 100644 --- a/netlist.cc +++ b/netlist.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: netlist.cc,v 1.172 2001/10/07 03:38:08 steve Exp $" +#ident "$Id: netlist.cc,v 1.173 2001/10/16 02:19:27 steve Exp $" #endif # include "config.h" @@ -973,9 +973,9 @@ const Link& NetCompare::pin_DataB(unsigned idx) const return pin(8+width_+idx); } -NetDivide::NetDivide(const string&n, unsigned wr, +NetDivide::NetDivide(NetScope*sc, const string&n, unsigned wr, unsigned wa, unsigned wb) -: NetNode(n, wr+wa+wb), width_r_(wr), width_a_(wa), width_b_(wb) +: NetNode(sc, n, wr+wa+wb), width_r_(wr), width_a_(wa), width_b_(wb) { unsigned p = 0; for (unsigned idx = 0 ; idx < width_r_ ; idx += 1, p += 1) { @@ -2429,6 +2429,9 @@ const NetProc*NetTaskDef::proc() const /* * $Log: netlist.cc,v $ + * Revision 1.173 2001/10/16 02:19:27 steve + * Support IVL_LPM_DIVIDE for structural divide. + * * Revision 1.172 2001/10/07 03:38:08 steve * parameter names do not have defined size. * diff --git a/netlist.h b/netlist.h index dbac47b95..8c3bea561 100644 --- a/netlist.h +++ b/netlist.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: netlist.h,v 1.215 2001/10/07 03:38:08 steve Exp $" +#ident "$Id: netlist.h,v 1.216 2001/10/16 02:19:27 steve Exp $" #endif /* @@ -523,7 +523,8 @@ class NetCompare : public NetNode { class NetDivide : public NetNode { public: - NetDivide(const string&n, unsigned width, unsigned wa, unsigned wb); + NetDivide(NetScope*scope, const string&n, + unsigned width, unsigned wa, unsigned wb); ~NetDivide(); unsigned width_r() const; @@ -2848,6 +2849,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.216 2001/10/16 02:19:27 steve + * Support IVL_LPM_DIVIDE for structural divide. + * * Revision 1.215 2001/10/07 03:38:08 steve * parameter names do not have defined size. * diff --git a/t-dll-api.cc b/t-dll-api.cc index 992921751..c1c12fa26 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.67 2001/09/16 22:19:42 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.68 2001/10/16 02:19:27 steve Exp $" #endif # include "config.h" @@ -548,6 +548,7 @@ extern "C" ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx) case IVL_LPM_CMP_GE: case IVL_LPM_CMP_GT: case IVL_LPM_CMP_NE: + case IVL_LPM_DIVIDE: case IVL_LPM_MULT: case IVL_LPM_SUB: assert(idx < net->u_.arith.width); @@ -582,6 +583,7 @@ extern "C" ivl_nexus_t ivl_lpm_datab(ivl_lpm_t net, unsigned idx) case IVL_LPM_CMP_GE: case IVL_LPM_CMP_GT: case IVL_LPM_CMP_NE: + case IVL_LPM_DIVIDE: case IVL_LPM_MULT: case IVL_LPM_SUB: assert(idx < net->u_.arith.width); @@ -619,6 +621,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_MULT: case IVL_LPM_SUB: assert(idx < net->u_.arith.width); @@ -737,6 +740,7 @@ extern "C" unsigned ivl_lpm_width(ivl_lpm_t net) case IVL_LPM_CMP_GE: case IVL_LPM_CMP_GT: case IVL_LPM_CMP_NE: + case IVL_LPM_DIVIDE: case IVL_LPM_MULT: case IVL_LPM_SUB: return net->u_.arith.width; @@ -1385,6 +1389,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.68 2001/10/16 02:19:27 steve + * Support IVL_LPM_DIVIDE for structural divide. + * * Revision 1.67 2001/09/16 22:19:42 steve * Support attributes to logic gates. * diff --git a/t-dll.cc b/t-dll.cc index 618877f59..e29193791 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.65 2001/10/11 00:13:19 steve Exp $" +#ident "$Id: t-dll.cc,v 1.66 2001/10/16 02:19:27 steve Exp $" #endif # include "config.h" @@ -954,6 +954,64 @@ void dll_target::lpm_compare(const NetCompare*net) scope_add_lpm(obj->scope, obj); } +void dll_target::lpm_divide(const NetDivide*net) +{ + ivl_lpm_t obj = new struct ivl_lpm_s; + obj->type = IVL_LPM_DIVIDE; + obj->name = strdup(net->name()); + assert(net->scope()); + obj->scope = find_scope(des_.root_, net->scope()); + assert(obj->scope); + + unsigned wid = net->width_r(); + + 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; + + 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); + + 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; @@ -1559,6 +1617,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.66 2001/10/16 02:19:27 steve + * Support IVL_LPM_DIVIDE for structural divide. + * * Revision 1.65 2001/10/11 00:13:19 steve * Initialize attributes for bufz devices. * diff --git a/t-dll.h b/t-dll.h index 6f718e015..5304b2074 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.64 2001/09/16 22:19:42 steve Exp $" +#ident "$Id: t-dll.h,v 1.65 2001/10/16 02:19:27 steve Exp $" #endif # include "target.h" @@ -70,6 +70,7 @@ struct dll_target : public target_t, public expr_scan_t { void lpm_add_sub(const NetAddSub*); void lpm_clshift(const NetCLShift*); void lpm_compare(const NetCompare*); + void lpm_divide(const NetDivide*); void lpm_ff(const NetFF*); void lpm_mult(const NetMult*); void lpm_mux(const NetMux*); @@ -569,6 +570,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.65 2001/10/16 02:19:27 steve + * Support IVL_LPM_DIVIDE for structural divide. + * * Revision 1.64 2001/09/16 22:19:42 steve * Support attributes to logic gates. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index c736fc56a..f54350250 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.49 2001/10/15 02:58:27 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.50 2001/10/16 02:19:27 steve Exp $" #endif # include "vvp_priv.h" @@ -230,6 +230,7 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) case IVL_LPM_SHIFTR: case IVL_LPM_SUB: case IVL_LPM_MULT: + case IVL_LPM_DIVIDE: for (idx = 0 ; idx < ivl_lpm_width(lpm) ; idx += 1) if (ivl_lpm_q(lpm, idx) == nex) { sprintf(result, "L_%s[%u]", @@ -891,6 +892,9 @@ static void draw_lpm_add(ivl_lpm_t net) case IVL_LPM_MULT: type = "mult"; break; + case IVL_LPM_DIVIDE: + type = "div"; + break; default: assert(0); } @@ -1089,6 +1093,7 @@ static void draw_lpm_in_scope(ivl_lpm_t net) case IVL_LPM_ADD: case IVL_LPM_SUB: case IVL_LPM_MULT: + case IVL_LPM_DIVIDE: draw_lpm_add(net); return; @@ -1208,6 +1213,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.50 2001/10/16 02:19:27 steve + * Support IVL_LPM_DIVIDE for structural divide. + * * Revision 1.49 2001/10/15 02:58:27 steve * Carry the type of the scope (Stephan Boettcher) *