From 98c39cfa24c4cbb8cc7464d4af6663f97868e28e Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 18 Sep 2009 17:32:39 -0700 Subject: [PATCH] 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.