diff --git a/ivl.def b/ivl.def index 10128972b..2466d09f9 100644 --- a/ivl.def +++ b/ivl.def @@ -54,6 +54,8 @@ ivl_logic_pin ivl_logic_pins ivl_logic_udp +ivl_lpm_async_clr +ivl_lpm_async_set ivl_lpm_basename ivl_lpm_clk ivl_lpm_data diff --git a/ivl_target.h b/ivl_target.h index 4bb1dd062..915e10f9c 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 */ #ifdef HAVE_CVS_IDENT -#ident "$Id: ivl_target.h,v 1.106 2002/09/12 15:49:43 steve Exp $" +#ident "$Id: ivl_target.h,v 1.107 2002/09/26 03:18:04 steve Exp $" #endif #ifdef __cplusplus @@ -612,6 +612,9 @@ extern ivl_scope_t ivl_lpm_scope(ivl_lpm_t net); extern ivl_lpm_type_t ivl_lpm_type(ivl_lpm_t net); extern unsigned ivl_lpm_width(ivl_lpm_t net); + /* IVL_LPM_FF */ +extern ivl_nexus_t ivl_lpm_async_clr(ivl_lpm_t net); +extern ivl_nexus_t ivl_lpm_async_set(ivl_lpm_t net); /* IVL_LPM_FF IVL_LPM_RAM */ extern ivl_nexus_t ivl_lpm_clk(ivl_lpm_t net); /* IVL_LPM_UFUNC */ @@ -1087,6 +1090,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.107 2002/09/26 03:18:04 steve + * Generate vvp code for asynch set/reset of NetFF. + * * Revision 1.106 2002/09/12 15:49:43 steve * Add support for binary nand operator. * diff --git a/netlist.cc b/netlist.cc index 18c082cdb..1e1c1382e 100644 --- a/netlist.cc +++ b/netlist.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: netlist.cc,v 1.199 2002/09/01 03:01:48 steve Exp $" +#ident "$Id: netlist.cc,v 1.200 2002/09/26 03:18:04 steve Exp $" #endif # include "config.h" @@ -592,11 +592,21 @@ Link& NetFF::pin_Aset() return pin(3); } +const Link& NetFF::pin_Aset() const +{ + return pin(3); +} + Link& NetFF::pin_Aclr() { return pin(4); } +const Link& NetFF::pin_Aclr() const +{ + return pin(4); +} + Link& NetFF::pin_Sload() { return pin(5); @@ -2300,6 +2310,9 @@ const NetProc*NetTaskDef::proc() const /* * $Log: netlist.cc,v $ + * Revision 1.200 2002/09/26 03:18:04 steve + * Generate vvp code for asynch set/reset of NetFF. + * * Revision 1.199 2002/09/01 03:01:48 steve * Properly cast signedness of parameters with ranges. * diff --git a/netlist.h b/netlist.h index ed3eacfcc..d3e30ca41 100644 --- a/netlist.h +++ b/netlist.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: netlist.h,v 1.263 2002/09/26 01:13:14 steve Exp $" +#ident "$Id: netlist.h,v 1.264 2002/09/26 03:18:04 steve Exp $" #endif /* @@ -663,6 +663,8 @@ class NetFF : public NetNode { const Link& pin_Clock() const; const Link& pin_Enable() const; + const Link& pin_Aset() const; + const Link& pin_Aclr() const; const Link& pin_Data(unsigned) const; const Link& pin_Q(unsigned) const; @@ -3055,6 +3057,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.264 2002/09/26 03:18:04 steve + * Generate vvp code for asynch set/reset of NetFF. + * * Revision 1.263 2002/09/26 01:13:14 steve * Synthesize async set/reset is certain cases. * diff --git a/synth2.cc b/synth2.cc index 4f9d664da..9a5ffe65a 100644 --- a/synth2.cc +++ b/synth2.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: synth2.cc,v 1.12 2002/09/26 01:13:14 steve Exp $" +#ident "$Id: synth2.cc,v 1.13 2002/09/26 03:18:04 steve Exp $" #endif # include "config.h" @@ -309,7 +309,7 @@ bool NetCondit::synth_sync(Design*des, NetScope*scope, NetFF*ff, asig->local_flag(true); if_->synth_async(des, scope, nex_map, asig); - assert(asig->pin_count() == 1); + assert(asig->pin_count() == ff->width()); assert(asig->pin(0).nexus()->drivers_constant()); switch (asig->pin(0).nexus()->driven_value()) { case verinum::V0: @@ -552,6 +552,9 @@ void synth2(Design*des) /* * $Log: synth2.cc,v $ + * Revision 1.13 2002/09/26 03:18:04 steve + * Generate vvp code for asynch set/reset of NetFF. + * * Revision 1.12 2002/09/26 01:13:14 steve * Synthesize async set/reset is certain cases. * diff --git a/t-dll-api.cc b/t-dll-api.cc index 1d824a123..7a5f053df 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 */ #ifdef HAVE_CVS_IDENT -#ident "$Id: t-dll-api.cc,v 1.86 2002/08/12 01:35:00 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.87 2002/09/26 03:18:04 steve Exp $" #endif # include "config.h" @@ -540,6 +540,29 @@ extern "C" const char* ivl_lpm_basename(ivl_lpm_t net) return basename(net->scope, net->name); } +extern "C" ivl_nexus_t ivl_lpm_async_clr(ivl_lpm_t net) +{ + assert(net); + switch(net->type) { + case IVL_LPM_FF: + return net->u_.ff.aclr; + default: + assert(0); + return 0; + } +} + +extern "C" ivl_nexus_t ivl_lpm_async_set(ivl_lpm_t net) +{ + assert(net); + switch(net->type) { + case IVL_LPM_FF: + return net->u_.ff.aset; + default: + assert(0); + return 0; + } +} extern "C" ivl_nexus_t ivl_lpm_clk(ivl_lpm_t net) { @@ -1550,6 +1573,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.87 2002/09/26 03:18:04 steve + * Generate vvp code for asynch set/reset of NetFF. + * * Revision 1.86 2002/08/12 01:35:00 steve * conditional ident string using autoconfig. * diff --git a/t-dll.cc b/t-dll.cc index b7aa344d4..5cf513de6 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 */ #ifdef HAVE_CVS_IDENT -#ident "$Id: t-dll.cc,v 1.95 2002/08/12 01:35:00 steve Exp $" +#ident "$Id: t-dll.cc,v 1.96 2002/09/26 03:18:04 steve Exp $" #endif # include "config.h" @@ -1361,6 +1361,26 @@ void dll_target::lpm_ff(const NetFF*net) obj->u_.ff.we = 0; } + if (net->pin_Aclr().is_linked()) { + nex = net->pin_Aclr().nexus(); + assert(nex->t_cookie()); + obj->u_.ff.aclr = (ivl_nexus_t) nex->t_cookie(); + assert(obj->u_.ff.aclr); + nexus_lpm_add(obj->u_.ff.aclr, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ); + } else { + obj->u_.ff.aclr = 0; + } + + if (net->pin_Aset().is_linked()) { + nex = net->pin_Aset().nexus(); + assert(nex->t_cookie()); + obj->u_.ff.aset = (ivl_nexus_t) nex->t_cookie(); + assert(obj->u_.ff.aset); + nexus_lpm_add(obj->u_.ff.aclr, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ); + } else { + obj->u_.ff.aset = 0; + } + if (obj->u_.ff.width == 1) { nex = net->pin_Q(0).nexus(); assert(nex->t_cookie()); @@ -1954,6 +1974,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.96 2002/09/26 03:18:04 steve + * Generate vvp code for asynch set/reset of NetFF. + * * Revision 1.95 2002/08/12 01:35:00 steve * conditional ident string using autoconfig. * diff --git a/t-dll.h b/t-dll.h index 77fc5d71f..323d0fe17 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 */ #ifdef HAVE_CVS_IDENT -#ident "$Id: t-dll.h,v 1.93 2002/08/12 01:35:01 steve Exp $" +#ident "$Id: t-dll.h,v 1.94 2002/09/26 03:18:04 steve Exp $" #endif # include "target.h" @@ -267,6 +267,8 @@ struct ivl_lpm_s { unsigned short swid; // ram only ivl_nexus_t clk; ivl_nexus_t we; + ivl_nexus_t aclr; + ivl_nexus_t aset; union { ivl_nexus_t*pins; ivl_nexus_t pin; @@ -617,6 +619,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.94 2002/09/26 03:18:04 steve + * Generate vvp code for asynch set/reset of NetFF. + * * Revision 1.93 2002/08/12 01:35:01 steve * conditional ident string using autoconfig. * diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index c5b443746..fea9d2c7f 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: stub.c,v 1.68 2002/09/18 03:33:10 steve Exp $" +#ident "$Id: stub.c,v 1.69 2002/09/26 03:18:04 steve Exp $" #endif # include "config.h" @@ -191,6 +191,14 @@ static void show_lpm(ivl_lpm_t net) fprintf(out, " clk: %s\n", ivl_nexus_name(ivl_lpm_clk(net))); + if (ivl_lpm_async_clr(net)) + fprintf(out, " Aclr: %s\n", + ivl_nexus_name(ivl_lpm_async_clr(net))); + + if (ivl_lpm_async_set(net)) + fprintf(out, " Aset: %s\n", + ivl_nexus_name(ivl_lpm_async_set(net))); + for (idx = 0 ; idx < width ; idx += 1) fprintf(out, " Data %u: %s\n", idx, ivl_nexus_name(ivl_lpm_data(net, idx))); @@ -717,6 +725,9 @@ int target_design(ivl_design_t des) /* * $Log: stub.c,v $ + * Revision 1.69 2002/09/26 03:18:04 steve + * Generate vvp code for asynch set/reset of NetFF. + * * Revision 1.68 2002/09/18 03:33:10 steve * Fix switch case warnings. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index ef71b8577..e60ea4d21 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 */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vvp_scope.c,v 1.78 2002/09/17 05:37:45 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.79 2002/09/26 03:18:04 steve Exp $" #endif # include "vvp_priv.h" @@ -1265,18 +1265,38 @@ static void draw_lpm_eq(ivl_lpm_t net) } } +/* + * primitive FD (q, clk, ce, d); + * output q; + * reg q; + * input clk, ce, d; + * table + * // clk ce d r s q q+ + * r 1 0 0 0 : ? : 0; + * r 1 1 0 0 : ? : 1; + * f 1 ? 0 0 : ? : -; + * ? 1 ? 0 0 : ? : -; + * * 0 ? 0 0 : ? : -; + * ? ? ? 1 ? : ? : 0; + * ? ? ? 0 1 : ? : 1; + * endtable + * endprimitive + */ static void draw_lpm_ff(ivl_lpm_t net) { unsigned width, idx; width = ivl_lpm_width(net); - fprintf(vvp_out, "L_%s/def .udp/sequ \"DFF\", 3, 2," - " \"?r100\"," - " \"?r111\"," - " \"?f1?-\"," - " \"?\?1?-\"," - " \"?*0\?-\";\n", vvp_mangle_id(ivl_lpm_name(net))); + fprintf(vvp_out, "L_%s/def .udp/sequ \"DFF\", 5, 2," + " \"?r10000\"," + " \"?r11001\"," + " \"?f1?00-\"," + " \"?\?1?00-\"," + " \"?*0\?00-\"," + " \"????1?0\"," + " \"????011\"" + ";\n", vvp_mangle_id(ivl_lpm_name(net))); for (idx = 0 ; idx < width ; idx += 1) { ivl_nexus_t tmp; @@ -1301,6 +1321,22 @@ static void draw_lpm_ff(ivl_lpm_t net) fprintf(vvp_out, ", "); draw_input_from_net(tmp); + /* Connect reset input */ + fprintf(vvp_out, ", "); + tmp = ivl_lpm_async_clr(net); + if (tmp) + draw_input_from_net(tmp); + else + fprintf(vvp_out, "C<0>"); + + /* Connect set input */ + fprintf(vvp_out, ", "); + tmp = ivl_lpm_async_set(net); + if (tmp) + draw_input_from_net(tmp); + else + fprintf(vvp_out, "C<0>"); + fprintf(vvp_out, ";\n"); } } @@ -1533,6 +1569,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.79 2002/09/26 03:18:04 steve + * Generate vvp code for asynch set/reset of NetFF. + * * Revision 1.78 2002/09/17 05:37:45 steve * Generate vvp code for structural flip-flops. *