From 0b6bd343e8bbbf391f72d4def9c88381c2fc6961 Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 15 Sep 2009 17:09:24 -0700 Subject: [PATCH 1/8] Don't check the scope for array words. We do not want to check an array word scope to see if the scope was already included since a scope does not include array words. They must be explicitly specified. --- vpi/sys_vcd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index 904a80056..53f24e48c 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -782,10 +782,11 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name) const char *fullname; int add_var = 0; int dep; + PLI_INT32 item_type = vpi_get(vpiType, item); /* If this is a signal make sure it has not already * been included. */ - switch (vpi_get(vpiType, item)) { + switch (item_type) { case vpiIntegerVar: case vpiMemoryWord: case vpiNamedEvent: @@ -796,11 +797,13 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name) case vpiTimeVar: /* Warn if the variables scope (which includes the * variable) or the variable itself was already - * included. */ + * included. A scope does not automatically include + * memory words so do not check the scope for them. */ scname = strdup(vpi_get_str(vpiFullName, vpi_handle(vpiScope, item))); fullname = vpi_get_str(vpiFullName, item); - if (vcd_names_search(&vcd_tab, scname) || + if (((item_type != vpiMemoryWord) && + vcd_names_search(&vcd_tab, scname)) || vcd_names_search(&vcd_var, fullname)) { vpi_printf("VCD warning: skipping signal %s, " "it was previously included.\n", From 617897f3bf52b9fc9b1fc71127210cfe2d44c95a Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 17 Sep 2009 09:47:57 -0700 Subject: [PATCH 2/8] Add support to &PV<> for signed base values from thread space. When calculating a value from thread space we need to tell &PV<> if the base value is signed or not. This patch adds support for that functionality. --- tgt-vvp/draw_vpi.c | 14 +++----------- vvp/README.txt | 9 ++++++--- vvp/parse.y | 4 ++-- vvp/vpi_priv.h | 4 +++- vvp/vpi_signal.cc | 14 +++++++++++++- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/tgt-vvp/draw_vpi.c b/tgt-vvp/draw_vpi.c index 2695f56db..0cc66d9e6 100644 --- a/tgt-vvp/draw_vpi.c +++ b/tgt-vvp/draw_vpi.c @@ -212,19 +212,11 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result, /* Fallback case: evaluate the expression. */ struct vector_info rv; rv = draw_eval_expr(bexpr, STUFF_OK_XZ); - /* We need to enhance &PV<> to support a signed index. */ - if (ivl_expr_signed(bexpr) && - (ivl_expr_width(bexpr) < 8*sizeof(int))) { - fprintf(stderr, "%s:%u: tgt-vvp warning: V0.9 may give " - "incorrect results for a select with a " - "signed index less than %zu bits.\n", - ivl_expr_file(expr), - ivl_expr_lineno(expr), - 8*sizeof(int)); - } - snprintf(buffer, sizeof buffer, "&PV", + snprintf(buffer, sizeof buffer, + "&PV", ivl_expr_signal(vexpr), rv.base, rv.wid, + (ivl_expr_signed(bexpr) ? "s" : "u"), ivl_expr_width(expr)); result->vec = rv; result->vec_flag = 1; diff --git a/vvp/README.txt b/vvp/README.txt index d13fdcc42..c848c7041 100644 --- a/vvp/README.txt +++ b/vvp/README.txt @@ -824,12 +824,15 @@ retrieves the index from thread space ( bits starting at ). The &PV<> argument is a reference to part of a signal. The syntax is: &PV '<' , , '>' - &PV '<' , , '>' + &PV '<' , , '>' + &PV '<' , <"s" or "u"> , '>' The is the label for a signal, the is the canonical starting bit of the part select and is the number of bits in -the select. The second form retrieves the from thread space -using bits starting at . +the select. The second form retrieves the from the given signal +or &A<>/&PV<> select. The third form retrieves the from thread +space using bits starting at . The base value may be +signed or unsigned. * The T<> argument diff --git a/vvp/parse.y b/vvp/parse.y index 47e0d5e5b..cd23a7e89 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -887,8 +887,8 @@ symbol_access { $$ = vpip_make_PV($3, $5, $7); } | K_PV '<' T_SYMBOL ',' symbol_access ',' T_NUMBER '>' { $$ = vpip_make_PV($3, $5, $7); } - | K_PV '<' T_SYMBOL ',' T_NUMBER T_NUMBER ',' T_NUMBER '>' - { $$ = vpip_make_PV($3, $5, $6, $8); } + | K_PV '<' T_SYMBOL ',' T_NUMBER T_NUMBER T_STRING ',' T_NUMBER '>' + { $$ = vpip_make_PV($3, $5, $6, $7, $9); } /* functor operands can only be a list of symbols. */ symbols diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index a1d0ba6e8..4d0eba18c 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -264,11 +264,13 @@ struct __vpiPV { vpiHandle sbase; int tbase; unsigned twid, width; + bool is_signed; }; extern vpiHandle vpip_make_PV(char*name, int base, int width); extern vpiHandle vpip_make_PV(char*name, char*symbol, int width); extern vpiHandle vpip_make_PV(char*name, vpiHandle handle, int width); -extern vpiHandle vpip_make_PV(char*name, int tbase, int twid, int width); +extern vpiHandle vpip_make_PV(char*name, int tbase, int twid, char*is_signed, + int width); extern struct __vpiPV* vpip_PV_from_handle(vpiHandle obj); extern void vpip_part_select_value_change(struct __vpiCallback*cbh, vpiHandle obj); diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index 5e33f2846..4a809bd02 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -1027,6 +1027,15 @@ static int PV_get_base(struct __vpiPV*rfp) } } + /* Check to see if we need to sign extend the result. */ + if (rfp->is_signed && (rfp->twid < 8*sizeof(tval))) { + vvp_bit4_t msb = vthread_get_bit(vpip_current_vthread, + rfp->tbase + rfp->twid - 1); + if (msb == BIT4_1) { + tval |= ~((1 << rfp->twid) - 1); + } + } + return tval; } @@ -1281,7 +1290,7 @@ vpiHandle vpip_make_PV(char*var, vpiHandle handle, int width) return &obj->base; } -vpiHandle vpip_make_PV(char*var, int tbase, int twid, int width) +vpiHandle vpip_make_PV(char*var, int tbase, int twid, char*is_signed, int width) { struct __vpiPV*obj = (struct __vpiPV*) malloc(sizeof(struct __vpiPV)); obj->base.vpi_type = &vpip_PV_rt; @@ -1289,10 +1298,13 @@ vpiHandle vpip_make_PV(char*var, int tbase, int twid, int width) obj->sbase = 0; obj->tbase = tbase; obj->twid = (unsigned) twid; + obj->is_signed = strcmp(is_signed, "s") == 0; obj->width = (unsigned) width; obj->net = 0; functor_ref_lookup(&obj->net, var); + delete [] is_signed; + return &obj->base; } From 1851cba95523f885631057788eeeab1a96f25c14 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 17 Sep 2009 10:47:35 -0700 Subject: [PATCH 3/8] Warn that &A<> may have problems with a signed select from thread space. Like the &PV<> code we should warn the user that a signed select from thread space may not work correctly for &A<>. This will be fixed in development. --- tgt-vvp/draw_vpi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tgt-vvp/draw_vpi.c b/tgt-vvp/draw_vpi.c index 0cc66d9e6..bac5d3176 100644 --- a/tgt-vvp/draw_vpi.c +++ b/tgt-vvp/draw_vpi.c @@ -155,6 +155,17 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result, /* Fallback case: evaluate expression. */ struct vector_info av; av = draw_eval_expr(word_ex, STUFF_OK_XZ); + /* We need to enhance &A<> to support a signed index. */ + if (ivl_expr_signed(word_ex) && + (ivl_expr_width(word_ex) < 8*sizeof(int))) { + fprintf(stderr, "%s:%u: tgt-vvp warning: V0.9 " + "may give incorrect results for " + "an array select with a signed " + "index less than %zu bits.\n", + ivl_expr_file(expr), + ivl_expr_lineno(expr), + 8*sizeof(int)); + } snprintf(buffer, sizeof buffer, "&A", sig, av.base, av.wid); result->vec = av; From c82baa2793c53f2b185c4dbe4fd41d619ffb7af6 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 17 Sep 2009 14:28:49 -0700 Subject: [PATCH 4/8] Only process the first 32 bits of the part select base. When reading from thread space only read the first 32 bits (sizeof int) for the part select base. This matches the other parts of the PV_get_base() code. --- vvp/vpi_signal.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index 4a809bd02..b85fa2efb 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -1008,7 +1008,8 @@ static int PV_get_base(struct __vpiPV*rfp) /* Get the value from thread space. */ int tval = 0; - for (unsigned idx = 0 ; idx < rfp->twid ; idx += 1) { + for (unsigned idx = 0 ; (idx < rfp->twid) && (idx < 8*sizeof(tval)); + idx += 1) { vvp_bit4_t bit = vthread_get_bit(vpip_current_vthread, rfp->tbase + idx); switch (bit) { From e54fd4df51b99df2ea237ca5f37ae9eaeceb28ea Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 17 Sep 2009 14:00:28 -0700 Subject: [PATCH 5/8] Add support for signed thread base index for &A<> This patch adds support for getting a signed index for &A<> from thread space. This mimics what was done for &PV<>. --- tgt-vvp/draw_vpi.c | 16 +++------------- vvp/README.txt | 7 +++++-- vvp/array.cc | 46 +++++++++++++++++++++++++++++++++++++--------- vvp/parse.y | 4 ++-- vvp/vpi_priv.h | 3 ++- 5 files changed, 49 insertions(+), 27 deletions(-) diff --git a/tgt-vvp/draw_vpi.c b/tgt-vvp/draw_vpi.c index bac5d3176..02159e839 100644 --- a/tgt-vvp/draw_vpi.c +++ b/tgt-vvp/draw_vpi.c @@ -155,19 +155,9 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result, /* Fallback case: evaluate expression. */ struct vector_info av; av = draw_eval_expr(word_ex, STUFF_OK_XZ); - /* We need to enhance &A<> to support a signed index. */ - if (ivl_expr_signed(word_ex) && - (ivl_expr_width(word_ex) < 8*sizeof(int))) { - fprintf(stderr, "%s:%u: tgt-vvp warning: V0.9 " - "may give incorrect results for " - "an array select with a signed " - "index less than %zu bits.\n", - ivl_expr_file(expr), - ivl_expr_lineno(expr), - 8*sizeof(int)); - } - snprintf(buffer, sizeof buffer, "&A", - sig, av.base, av.wid); + snprintf(buffer, sizeof buffer, "&A", + sig, av.base, av.wid, + (ivl_expr_signed(word_ex) ? "s" : "u")); result->vec = av; result->vec_flag = 1; } else { diff --git a/vvp/README.txt b/vvp/README.txt index c848c7041..6e9ad1876 100644 --- a/vvp/README.txt +++ b/vvp/README.txt @@ -813,11 +813,14 @@ The &A<> argument is a reference to the word of a variable array. The syntax is: &A '<' , '>' - &A '<' , '>' + &A '<' , '>' + &A '<' , <"s" or "u"> '>' The is the label for a variable array, and the is the canonical word index as an unsigned integer. The second form -retrieves the index from thread space ( bits starting at ). +retrieves the from the given signal or &A<>/&PV<> select. +The third form retrieves the index from thread space ( bits +starting at ). The base value may be signed or unsigned. * The &PV<> argument diff --git a/vvp/array.cc b/vvp/array.cc index 577b8cec5..9b301fbec 100644 --- a/vvp/array.cc +++ b/vvp/array.cc @@ -128,6 +128,7 @@ struct __vpiArrayVthrA { // If wid >0, then the address is the base and wid the vector // width of the index to pull from the thread. unsigned wid; + bool is_signed; unsigned get_address() const { @@ -150,14 +151,37 @@ struct __vpiArrayVthrA { if (wid == 0) return address; - vvp_vector4_t tmp (wid); - for (unsigned idx = 0 ; idx < wid ; idx += 1) { - vvp_bit4_t bit = vthread_get_bit(vpip_current_vthread, address+idx); - tmp.set_bit(idx, bit); + /* Get the value from thread space. */ + int tval = 0; + for (unsigned idx = 0 ; (idx < wid) && (idx < 8*sizeof(tval)); + idx += 1) { + vvp_bit4_t bit = vthread_get_bit(vpip_current_vthread, + address + idx); + switch (bit) { + case BIT4_X: + case BIT4_Z: + /* Return UINT_MAX to indicate an X base. */ + return UINT_MAX; + break; + + case BIT4_1: + tval |= 1<base); } -vpiHandle vpip_make_vthr_A(char*label, unsigned tbase, unsigned twid) +vpiHandle vpip_make_vthr_A(char*label, unsigned tbase, unsigned twid, + char*is_signed) { struct __vpiArrayVthrA*obj = (struct __vpiArrayVthrA*) malloc(sizeof (struct __vpiArrayVthrA)); @@ -1562,7 +1587,10 @@ vpiHandle vpip_make_vthr_A(char*label, unsigned tbase, unsigned twid) obj->address_handle = 0; obj->address = tbase; - obj->wid = twid; + obj->wid = twid; + obj->is_signed = strcmp(is_signed, "s") == 0; + + delete [] is_signed; return &(obj->base); } diff --git a/vvp/parse.y b/vvp/parse.y index cd23a7e89..92e7d34c3 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -873,8 +873,8 @@ argument symbol_access : K_A '<' T_SYMBOL ',' T_NUMBER '>' { $$ = vpip_make_vthr_A($3, $5); } - | K_A '<' T_SYMBOL ',' T_NUMBER T_NUMBER '>' - { $$ = vpip_make_vthr_A($3, $5, $6); } + | K_A '<' T_SYMBOL ',' T_NUMBER T_NUMBER T_STRING '>' + { $$ = vpip_make_vthr_A($3, $5, $6, $7); } | K_A '<' T_SYMBOL ',' T_SYMBOL '>' { $$ = vpip_make_vthr_A($3, $5); } | K_A '<' T_SYMBOL ',' symbol_access '>' diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index 4d0eba18c..2a3b538d5 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -496,7 +496,8 @@ vpiHandle vpip_make_vthr_word(unsigned base, const char*type); vpiHandle vpip_make_vthr_A(char*label, unsigned index); vpiHandle vpip_make_vthr_A(char*label, char*symbol); -vpiHandle vpip_make_vthr_A(char*label, unsigned tbase, unsigned twid); +vpiHandle vpip_make_vthr_A(char*label, unsigned tbase, unsigned twid, + char*is_signed); vpiHandle vpip_make_vthr_A(char*label, vpiHandle handle); /* From 09fa57742a72f18fc11335fe292420f19a786c34 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 17 Sep 2009 19:06:40 -0700 Subject: [PATCH 6/8] Optimize a full L-value indexed part select, etc. This patch adds an optimization when a constant indexed part select covers the entire L-value. It also fixes a few issues in the code generator related to part selects. --- elab_lval.cc | 6 ++++-- tgt-vvp/vvp_process.c | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/elab_lval.cc b/elab_lval.cc index 95808a208..f3ca7d083 100644 --- a/elab_lval.cc +++ b/elab_lval.cc @@ -491,9 +491,11 @@ bool PEIdent::elaborate_lval_net_idx_(Design*des, offset = -wid + 1; } delete base; - base = new NetEConst(verinum(reg->sb_to_idx(lsv) + offset)); + long rel_base = reg->sb_to_idx(lsv) + offset; + /* If we cover the entire lvalue just skip the select. */ + if (rel_base == 0 && wid == reg->vector_width()) return true; + base = new NetEConst(verinum(rel_base)); if (warn_ob_select) { - long rel_base = reg->sb_to_idx(lsv) + offset; if (rel_base < 0) { cerr << get_fileline() << ": warning: " << reg->name(); if (reg->array_dimensions() > 0) cerr << "[]"; diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index 37d87ec69..ed00cf696 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -1189,7 +1189,6 @@ static void force_vector_to_lval(ivl_statement_t net, struct vector_info rvec) } else { /* Do not support bit or part selects of l-values yet. */ assert(ivl_lval_mux(lval) == 0); - assert(ivl_lval_part_off(lval) == 0); assert(ivl_lval_width(lval) == ivl_signal_width(lsig)); assert((roff + use_wid) <= rvec.wid); @@ -1238,8 +1237,13 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval) /* We do not currently support driving a signal to a bit or * part select (this could give us multiple drivers). */ part_off_ex = ivl_lval_part_off(lval); + /* This should be verified in force_vector_to_lval() which is called + * before this procedure. */ + if (part_off_ex) { + assert(number_is_immediate(part_off_ex, IMM_WID, 0)); + assert(! number_is_unknown(part_off_ex)); + } if (ivl_signal_width(lsig) > ivl_signal_width(rsig) || - // Do we need checks for number_is{immediate,unknown} of part_of_ex? (part_off_ex && get_number_immediate(part_off_ex) != 0)) { fprintf(stderr, "%s:%u: vvp-tgt sorry: cannot %s signal to " "a bit/part select.\n", ivl_expr_file(rval), From e1af002a327e62c72f4970e3164b9b5313f0f75c Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 18 Sep 2009 15:43:09 -0700 Subject: [PATCH 7/8] Warn that a signed part select may not work for signals < 32 bits. If a signed signal is driving a part select in a CA and the width is less than 32 bits. the value will be zero extended and will not work for negative values. This patch adds a warning that this could happen. This will be fixed in development. --- expr_synth.cc | 3 ++- netlist.cc | 6 +++--- netlist.h | 5 ++++- t-dll.cc | 8 ++++++-- tgt-vvp/vvp_scope.c | 8 ++++++++ 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/expr_synth.cc b/expr_synth.cc index 444c00bb3..005617959 100644 --- a/expr_synth.cc +++ b/expr_synth.cc @@ -1089,7 +1089,8 @@ NetNet* NetESelect::synthesize(Design *des, NetScope*scope, NetExpr*root) if (base_ != 0) { off = base_->synthesize(des, scope, root); - NetPartSelect*sel = new NetPartSelect(sub, off, expr_width()); + NetPartSelect*sel = new NetPartSelect(sub, off, expr_width(), + base_->has_sign()); sel->set_line(*this); des->add_node(sel); diff --git a/netlist.cc b/netlist.cc index 095338ff3..add9690f0 100644 --- a/netlist.cc +++ b/netlist.cc @@ -885,7 +885,7 @@ const NetDelaySrc* NetNet::delay_path(unsigned idx) const NetPartSelect::NetPartSelect(NetNet*sig, unsigned off, unsigned wid, NetPartSelect::dir_t dir__) : NetNode(sig->scope(), sig->scope()->local_symbol(), 2), - off_(off), wid_(wid), dir_(dir__) + off_(off), wid_(wid), dir_(dir__), signed_flag_(false) { set_line(*sig); @@ -904,9 +904,9 @@ NetPartSelect::NetPartSelect(NetNet*sig, unsigned off, unsigned wid, } NetPartSelect::NetPartSelect(NetNet*sig, NetNet*sel, - unsigned wid) + unsigned wid, bool signed_flag) : NetNode(sig->scope(), sig->scope()->local_symbol(), 3), - off_(0), wid_(wid), dir_(VP) + off_(0), wid_(wid), dir_(VP), signed_flag_(signed_flag) { switch (dir_) { case NetPartSelect::VP: diff --git a/netlist.h b/netlist.h index 9162e7b71..40efe0b47 100644 --- a/netlist.h +++ b/netlist.h @@ -1795,12 +1795,14 @@ class NetPartSelect : public NetNode { explicit NetPartSelect(NetNet*sig, unsigned off, unsigned wid, dir_t dir); explicit NetPartSelect(NetNet*sig, NetNet*sel, - unsigned wid); + unsigned wid, bool signed_flag = false); ~NetPartSelect(); unsigned base() const; unsigned width() const; dir_t dir() const; + /* Is the select signal signed? */ + bool signed_flag() const { return signed_flag_; } virtual void dump_node(ostream&, unsigned ind) const; bool emit_node(struct target_t*tgt) const; @@ -1809,6 +1811,7 @@ class NetPartSelect : public NetNode { unsigned off_; unsigned wid_; dir_t dir_; + bool signed_flag_; }; /* diff --git a/t-dll.cc b/t-dll.cc index 45d7851d7..d89bc58d0 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -2153,8 +2153,12 @@ bool dll_target::part_select(const NetPartSelect*net) obj->scope = find_scope(des_, net->scope()); assert(obj->scope); - /* Part selects are always unsigned. */ - obj->u_.part.signed_flag = 0; + /* Part selects are always unsigned, so we use this to indicate + * if the part select base signal is signed or not. */ + if (net->signed_flag()) + obj->u_.part.signed_flag = 1; + else + obj->u_.part.signed_flag = 0; /* Choose the width of the part select. */ obj->width = net->width(); diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 3b54dfdc9..bb8cb76e2 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -1654,6 +1654,14 @@ static void draw_lpm_part(ivl_lpm_t net) fprintf(vvp_out, ", %u, %u;\n", base, width); } else { const char*sel_symbol = draw_net_input(sel); + /* We need to enhance .part/v to support a signed index. */ + if (ivl_lpm_signed(net) && width_of_nexus(sel) < 8*sizeof(int)) { + fprintf(stderr, "%s:%u: tgt-vvp warning: V0.9 may give " + "incorrect results for a select with a " + "signed index less than %zu bits.\n", + ivl_lpm_file(net), ivl_lpm_lineno(net), + 8*sizeof(int)); + } fprintf(vvp_out, "L_%p%s .part/v %s", net, dly, draw_net_input(ivl_lpm_data(net,0))); fprintf(vvp_out, ", %s", sel_symbol); From 98c39cfa24c4cbb8cc7464d4af6663f97868e28e Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 18 Sep 2009 17:32:39 -0700 Subject: [PATCH 8/8] Add support for .part/v.s This patch adds support for .part/v.s. A variable part select with a signed select expression in a continuous assign. --- tgt-vvp/vvp_scope.c | 13 +++---------- vvp/README.txt | 8 +++++--- vvp/compile.h | 2 +- vvp/lexor.lex | 1 + vvp/parse.y | 6 ++++-- vvp/part.cc | 22 ++++++++++------------ vvp/part.h | 7 ++++--- 7 files changed, 28 insertions(+), 31 deletions(-) diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index bb8cb76e2..a7d8591cb 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -1654,16 +1654,9 @@ static void draw_lpm_part(ivl_lpm_t net) fprintf(vvp_out, ", %u, %u;\n", base, width); } else { const char*sel_symbol = draw_net_input(sel); - /* We need to enhance .part/v to support a signed index. */ - if (ivl_lpm_signed(net) && width_of_nexus(sel) < 8*sizeof(int)) { - fprintf(stderr, "%s:%u: tgt-vvp warning: V0.9 may give " - "incorrect results for a select with a " - "signed index less than %zu bits.\n", - ivl_lpm_file(net), ivl_lpm_lineno(net), - 8*sizeof(int)); - } - fprintf(vvp_out, "L_%p%s .part/v %s", - net, dly, draw_net_input(ivl_lpm_data(net,0))); + fprintf(vvp_out, "L_%p%s .part/v%s %s", net, dly, + (ivl_lpm_signed(net) ? ".s" : ""), + draw_net_input(ivl_lpm_data(net,0))); fprintf(vvp_out, ", %s", sel_symbol); fprintf(vvp_out, ", %u;\n", width); } diff --git a/vvp/README.txt b/vvp/README.txt index 6e9ad1876..abb57e775 100644 --- a/vvp/README.txt +++ b/vvp/README.txt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * */ @@ -473,6 +473,7 @@ bit number, and a width. Normally, those bits are constant values.