diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 78ad12c2c..0d0c329e9 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.97 2005/01/22 01:06:55 steve Exp $" +#ident "$Id: stub.c,v 1.98 2005/01/22 16:23:06 steve Exp $" #endif # include "config.h" @@ -267,6 +267,23 @@ static void show_lpm_cmp_ge(ivl_lpm_t net) check_cmp_widths(net); } +/* IVL_LPM_CMP_NE + * This LPM node supports two-input compare. The output width is + * actually always 1, the lpm_width is the expected width of the inputs. + */ +static void show_lpm_cmp_ne(ivl_lpm_t net) +{ + unsigned width = ivl_lpm_width(net); + + fprintf(out, " LPM_CMP_NE %s: \n", + ivl_lpm_basename(net), width); + + fprintf(out, " O: %s\n", ivl_nexus_name(ivl_lpm_q(net,0))); + fprintf(out, " A: %s\n", ivl_nexus_name(ivl_lpm_data(net,0))); + fprintf(out, " B: %s\n", ivl_nexus_name(ivl_lpm_data(net,1))); + check_cmp_widths(net); +} + /* IVL_LPM_CONCAT * The concat device takes N inputs (N=ivl_lpm_selects) and generates * a single output. The total output is known from the ivl_lpm_width @@ -347,22 +364,9 @@ static void show_lpm(ivl_lpm_t net) show_lpm_cmp_ge(net); break; - case IVL_LPM_CMP_NE: { - fprintf(out, " LPM_COMPARE(NE) %s: \n", - ivl_lpm_basename(net), width); - fprintf(out, " Q: %s\n", ivl_nexus_name(ivl_lpm_q(net, 0))); - for (idx = 0 ; idx < width ; idx += 1) { - ivl_nexus_t nex = ivl_lpm_data(net, idx); - fprintf(out, " Data A %u: %s\n", idx, - nex? ivl_nexus_name(nex) : ""); - } - for (idx = 0 ; idx < width ; idx += 1) { - ivl_nexus_t nex = ivl_lpm_datab(net, idx); - fprintf(out, " Data B %u: %s\n", idx, - nex? ivl_nexus_name(nex) : ""); - } - break; - } + case IVL_LPM_CMP_NE: + show_lpm_cmp_ne(net); + break; case IVL_LPM_CONCAT: show_lpm_concat(net); @@ -919,6 +923,9 @@ int target_design(ivl_design_t des) /* * $Log: stub.c,v $ + * Revision 1.98 2005/01/22 16:23:06 steve + * LPM_CMP_NE/EQ are vectored devices. + * * Revision 1.97 2005/01/22 01:06:55 steve * Change case compare from logic to an LPM node. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 7a373dfe0..aadee16bb 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.111 2005/01/22 01:06:55 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.112 2005/01/22 16:22:13 steve Exp $" #endif # include "vvp_priv.h" @@ -433,8 +433,11 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) case IVL_LPM_ADD: case IVL_LPM_CONCAT: case IVL_LPM_CMP_EEQ: + case IVL_LPM_CMP_EQ: case IVL_LPM_CMP_GE: case IVL_LPM_CMP_GT: + case IVL_LPM_CMP_NE: + case IVL_LPM_CMP_NEE: case IVL_LPM_SHIFTL: case IVL_LPM_SHIFTR: case IVL_LPM_SUB: @@ -451,16 +454,6 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) break; - case IVL_LPM_CMP_EQ: - case IVL_LPM_CMP_NE: - if (ivl_lpm_q(lpm, 0) == nex) { - sprintf(result, "L_%s.%s", - vvp_mangle_id(ivl_scope_name(ivl_lpm_scope(lpm))), - vvp_mangle_id(ivl_lpm_basename(lpm))); - return result; - } - break; - } fprintf(stderr, "internal error: no input to nexus %s\n", @@ -1265,12 +1258,20 @@ static void draw_lpm_cmp(ivl_lpm_t net) type = "eeq"; signed_string = ""; break; + case IVL_LPM_CMP_EQ: + type = "eq"; + signed_string = ""; + break; case IVL_LPM_CMP_GE: type = "ge"; break; case IVL_LPM_CMP_GT: type = "gt"; break; + case IVL_LPM_CMP_NE: + type = "ne"; + signed_string = ""; + break; default: assert(0); } @@ -1381,34 +1382,6 @@ static void draw_lpm_concat(ivl_lpm_t net) } } -/* - * XXXX OBSOLETE - */ -static void draw_lpm_eq(ivl_lpm_t net) -{ - unsigned width = ivl_lpm_width(net); - const char*type = ""; - - switch (ivl_lpm_type(net)) { - case IVL_LPM_CMP_EQ: - type = "eq"; - break; - case IVL_LPM_CMP_NE: - type = "ne"; - break; - default: - assert(0); - } - - fprintf(vvp_out, "L_%s.%s .cmp/%s %u", - vvp_mangle_id(ivl_scope_name(ivl_lpm_scope(net))), - vvp_mangle_id(ivl_lpm_basename(net)), type, width); - - draw_lpm_arith_a_b_inputs(net); - - fprintf(vvp_out, ";\n"); -} - /* * primitive FD (q, clk, ce, d); * output q; @@ -1673,18 +1646,15 @@ static void draw_lpm_in_scope(ivl_lpm_t net) draw_lpm_concat(net); return; - case IVL_LPM_CMP_EQ: - case IVL_LPM_CMP_NE: - draw_lpm_eq(net); - return; - case IVL_LPM_FF: draw_lpm_ff(net); return; case IVL_LPM_CMP_EEQ: + case IVL_LPM_CMP_EQ: case IVL_LPM_CMP_GE: case IVL_LPM_CMP_GT: + case IVL_LPM_CMP_NE: draw_lpm_cmp(net); return; @@ -1824,6 +1794,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.112 2005/01/22 16:22:13 steve + * LPM_CMP_NE/EQ are vectored devices. + * * Revision 1.111 2005/01/22 01:06:55 steve * Change case compare from logic to an LPM node. *