From fa0ecb3761fd3184be510d2d27a206f291bf0c92 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 2 Sep 2009 10:44:29 -0700 Subject: [PATCH] Convert IVL_LPM_CONCAT to use ivl_lpm_size() instead of ivl_lpm_selects() It was documented that a IVL_LPM_CONCAT would use _size() instead of _selects(). This patch adds the functionality to _size() and converts all the Icarus provided code generators to use _size(). _select() will be kept for compatibility in V0.9. (cherry picked from commit 4cd790a2d206c78ed6f4c9cc4567981df11c3491) --- t-dll-api.cc | 2 ++ tgt-stub/stub.c | 6 +++--- tgt-vhdl/lpm.cc | 2 +- tgt-vvp/vvp_scope.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/t-dll-api.cc b/t-dll-api.cc index e5a513e8d..e9f6f9538 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -1268,6 +1268,8 @@ extern "C" unsigned ivl_lpm_size(ivl_lpm_t net) return net->u_.ufunc.ports - 1; case IVL_LPM_REPEAT: return net->u_.repeat.count; + case IVL_LPM_CONCAT: + return net->u_.concat.inputs; default: assert(0); return 0; diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 2a378b737..d1d745978 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -430,7 +430,7 @@ static void show_lpm_cmp_ne(ivl_lpm_t net) } /* IVL_LPM_CONCAT - * The concat device takes N inputs (N=ivl_lpm_selects) and generates + * The concat device takes N inputs (N=ivl_lpm_size) and generates * a single output. The total output is known from the ivl_lpm_width * function. The widths of all the inputs are inferred from the widths * of the signals connected to the nexus of the inputs. The compiler @@ -444,10 +444,10 @@ static void show_lpm_concat(ivl_lpm_t net) unsigned width = ivl_lpm_width(net); fprintf(out, " LPM_CONCAT %s: \n", - ivl_lpm_basename(net), width, ivl_lpm_selects(net)); + ivl_lpm_basename(net), width, ivl_lpm_size(net)); fprintf(out, " O: %p\n", ivl_lpm_q(net,0)); - for (idx = 0 ; idx < ivl_lpm_selects(net) ; idx += 1) { + for (idx = 0 ; idx < ivl_lpm_size(net) ; idx += 1) { ivl_nexus_t nex = ivl_lpm_data(net, idx); unsigned signal_width = width_of_nexus(nex); diff --git a/tgt-vhdl/lpm.cc b/tgt-vhdl/lpm.cc index adde5b487..79309489e 100644 --- a/tgt-vhdl/lpm.cc +++ b/tgt-vhdl/lpm.cc @@ -48,7 +48,7 @@ static vhdl_expr *concat_lpm_to_expr(vhdl_scope *scope, ivl_lpm_t lpm) vhdl_binop_expr *expr = new vhdl_binop_expr(VHDL_BINOP_CONCAT, result_type); - for (int i = ivl_lpm_selects(lpm) - 1; i >= 0; i--) { + for (int i = ivl_lpm_size(lpm) - 1; i >= 0; i--) { vhdl_expr *e = readable_ref(scope, ivl_lpm_data(lpm, i)); if (NULL == e) { delete expr; diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 431e8ba53..2b0e55361 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -1335,7 +1335,7 @@ static unsigned lpm_concat_inputs(ivl_lpm_t net, unsigned start, static void draw_lpm_concat(ivl_lpm_t net) { const char*src_table[4]; - unsigned icnt = ivl_lpm_selects(net); + unsigned icnt = ivl_lpm_size(net); const char*dly = draw_lpm_output_delay(net); if (icnt <= 4) {