When determining if a signal is an array use array_dimensions_

The previous code looked for more than one array word to determine
if the given signal was an array or not. The problem with this is
that a single word memory was considered a signal. This is fixed
here by looking for an array_dimension to be greater than zero.
This commit is contained in:
Cary R 2009-03-30 18:28:16 -07:00 committed by Stephen Williams
parent d7f272d14c
commit 3d449f60a2
2 changed files with 7 additions and 4 deletions

View File

@ -450,10 +450,10 @@ void dll_target::expr_signal(const NetESignal*net)
/* Make account for the special case that this is a reference
to an array as a whole. We detect this case by noting that
this is an array (more than 1 word) and there is no word
select expression. In that case, this is an IVL_EX_ARRAY
expression instead of a SIGNAL expression. */
if (sig->array_words > 1 && word_expr == 0) {
this is an array (more than 0 array dimensions) and that
there is no word select expression. For this case, we have
an IVL_EX_ARRAY expression instead of a SIGNAL expression. */
if (sig->array_dimensions_ > 0 && word_expr == 0) {
expr_->type_ = IVL_EX_ARRAY;
expr_->width_ = 0; // Doesn't make much sense for arrays.
}

View File

@ -125,11 +125,13 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result,
Create the right code to handle it. */
ivl_signal_t sig = ivl_expr_signal(expr);
unsigned use_word = 0;
unsigned use_word_defined = 0;
ivl_expr_t word_ex = ivl_expr_oper1(expr);
if (word_ex) {
/* Some array select have been evaluated. */
if (number_is_immediate(word_ex, IMM_WID, 0)) {
use_word = get_number_immediate(word_ex);
use_word_defined = 1;
word_ex = 0;
}
}
@ -156,6 +158,7 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result,
result->vec = av;
result->vec_flag = 1;
} else {
assert(use_word_defined);
snprintf(buffer, sizeof buffer, "&A<v%p, %u>",
sig, use_word);
}