diff --git a/ivl_target.h b/ivl_target.h index c63b3598f..128c05e33 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.64 2001/06/07 02:12:43 steve Exp $" +#ident "$Id: ivl_target.h,v 1.65 2001/06/07 03:09:37 steve Exp $" #endif #ifdef __cplusplus @@ -203,7 +203,8 @@ typedef enum ivl_logic_e { typedef enum ivl_lpm_type_e { IVL_LPM_ADD, IVL_LPM_FF, - IVL_LPM_MUX + IVL_LPM_MUX, + IVL_LPM_SUB } ivl_lpm_type_t; /* Processes are initial or always blocks with a statement. This is @@ -510,13 +511,13 @@ extern unsigned ivl_lpm_width(ivl_lpm_t net); /* IVL_LPM_FF */ extern ivl_nexus_t ivl_lpm_clk(ivl_lpm_t net); - /* IVL_LPM_ADD IVL_LPM_FF */ + /* IVL_LPM_ADD IVL_LPM_FF IVL_LPM_SUB */ extern ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx); - /* IVL_LPM_ADD */ + /* IVL_LPM_ADD IVL_LPM_SUB */ extern ivl_nexus_t ivl_lpm_datab(ivl_lpm_t net, unsigned idx); /* IVL_LPM_MUX */ extern ivl_nexus_t ivl_lpm_data2(ivl_lpm_t net, unsigned sdx, unsigned idx); - /* IVL_LPM_ADD IVL_LPM_FF */ + /* IVL_LPM_ADD IVL_LPM_FF IVL_LPM_SUB */ extern ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx); /* IVL_LPM_MUX */ extern unsigned ivl_lpm_selects(ivl_lpm_t net); @@ -872,6 +873,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.65 2001/06/07 03:09:37 steve + * support subtraction in tgt-vvp. + * * Revision 1.64 2001/06/07 02:12:43 steve * Support structural addition. * diff --git a/t-dll-api.cc b/t-dll-api.cc index ecdf2704c..59444e090 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.47 2001/06/07 02:12:43 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.48 2001/06/07 03:09:37 steve Exp $" #endif # include "t-dll.h" @@ -450,6 +450,7 @@ extern "C" ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx) assert(net); switch (net->type) { case IVL_LPM_ADD: + case IVL_LPM_SUB: assert(idx < net->u_.arith.width); return net->u_.arith.a[idx]; @@ -472,6 +473,7 @@ extern "C" ivl_nexus_t ivl_lpm_datab(ivl_lpm_t net, unsigned idx) switch (net->type) { case IVL_LPM_ADD: + case IVL_LPM_SUB: assert(idx < net->u_.arith.width); return net->u_.arith.b[idx]; @@ -507,6 +509,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_SUB: assert(idx < net->u_.arith.width); return net->u_.arith.q[idx]; @@ -582,6 +585,7 @@ extern "C" unsigned ivl_lpm_width(ivl_lpm_t net) case IVL_LPM_MUX: return net->u_.mux.width; case IVL_LPM_ADD: + case IVL_LPM_SUB: return net->u_.arith.width; default: assert(0); @@ -1171,6 +1175,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.48 2001/06/07 03:09:37 steve + * support subtraction in tgt-vvp. + * * Revision 1.47 2001/06/07 02:12:43 steve * Support structural addition. * diff --git a/t-dll.cc b/t-dll.cc index 274fb889f..205e04441 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.43 2001/06/07 02:12:43 steve Exp $" +#ident "$Id: t-dll.cc,v 1.44 2001/06/07 03:09:37 steve Exp $" #endif # include "compiler.h" @@ -609,7 +609,10 @@ void dll_target::memory(const NetMemory*net) void dll_target::lpm_add_sub(const NetAddSub*net) { ivl_lpm_t obj = new struct ivl_lpm_s; - obj->type = IVL_LPM_ADD; + if (net->attribute("LPM_Direction") == "SUB") + obj->type = IVL_LPM_SUB; + else + obj->type = IVL_LPM_ADD; obj->name = strdup(net->name()); assert(net->scope()); obj->scope = find_scope(des_.root_, net->scope()); @@ -1063,6 +1066,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.44 2001/06/07 03:09:37 steve + * support subtraction in tgt-vvp. + * * Revision 1.43 2001/06/07 02:12:43 steve * Support structural addition. * diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 7a1c25681..aa8b36310 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 */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: stub.c,v 1.43 2001/06/07 02:12:43 steve Exp $" +#ident "$Id: stub.c,v 1.44 2001/06/07 03:09:37 steve Exp $" #endif /* @@ -115,6 +115,21 @@ static void show_lpm(ivl_lpm_t net) break; } + case IVL_LPM_SUB: { + fprintf(out, " LPM_SUB %s: \n", + ivl_lpm_name(net), width); + for (idx = 0 ; idx < width ; idx += 1) + fprintf(out, " Q %u: %s\n", idx, + ivl_nexus_name(ivl_lpm_q(net, idx))); + for (idx = 0 ; idx < width ; idx += 1) + fprintf(out, " Data A %u: %s\n", idx, + ivl_nexus_name(ivl_lpm_data(net, idx))); + for (idx = 0 ; idx < width ; idx += 1) + fprintf(out, " Data B %u: %s\n", idx, + ivl_nexus_name(ivl_lpm_datab(net, idx))); + break; + } + case IVL_LPM_FF: { fprintf(out, " LPM_FF %s: \n", @@ -566,6 +581,9 @@ DECLARE_CYGWIN_DLL(DllMain); /* * $Log: stub.c,v $ + * Revision 1.44 2001/06/07 03:09:37 steve + * support subtraction in tgt-vvp. + * * Revision 1.43 2001/06/07 02:12:43 steve * Support structural addition. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index c1f00b9be..b65be02cd 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.29 2001/06/07 02:12:43 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.30 2001/06/07 03:09:37 steve Exp $" #endif # include "vvp_priv.h" @@ -115,6 +115,7 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) } case IVL_LPM_ADD: + case IVL_LPM_SUB: for (idx = 0 ; idx < ivl_lpm_width(lpm) ; idx += 1) if (ivl_lpm_q(lpm, idx) == nex) { sprintf(result, "L_%s[%u]", @@ -609,10 +610,22 @@ static void draw_event_in_scope(ivl_event_t obj) static void draw_lpm_add(ivl_lpm_t net) { unsigned idx, width; + const char*type = ""; width = ivl_lpm_width(net); - fprintf(vvp_out, "L_%s .arith/sum %u", ivl_lpm_name(net), width); + switch (ivl_lpm_type(net)) { + case IVL_LPM_ADD: + type = "sum"; + break; + case IVL_LPM_SUB: + type = "sub"; + break; + default: + assert(0); + } + + fprintf(vvp_out, "L_%s .arith/%s %u", ivl_lpm_name(net), type, width); for (idx = 0 ; idx < width ; idx += 1) { ivl_nexus_t a = ivl_lpm_data(net, idx); @@ -660,6 +673,7 @@ static void draw_lpm_in_scope(ivl_lpm_t net) { switch (ivl_lpm_type(net)) { case IVL_LPM_ADD: + case IVL_LPM_SUB: draw_lpm_add(net); return; @@ -752,6 +766,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.30 2001/06/07 03:09:37 steve + * support subtraction in tgt-vvp. + * * Revision 1.29 2001/06/07 02:12:43 steve * Support structural addition. *