Add vpiIndex for array words

This commit is contained in:
Cary R 2020-05-31 14:26:03 -07:00
parent fb237fb006
commit 0fca1bdab0
1 changed files with 15 additions and 0 deletions

View File

@ -361,6 +361,21 @@ int __vpiArrayWord::as_word_t::vpi_get(int code)
assert(val.format == vpiIntVal);
return val.value.integer;
case vpiIndex:
{
int base_offset = 0;
struct __vpiArray*base = dynamic_cast<__vpiArray*> (parent);
if (base) {
val.format = vpiIntVal;
base->first_addr.vpi_get_value(&val);
base_offset += val.value.integer;
}
val.format = vpiIntVal;
obj->as_index.vpi_get_value(&val);
assert(val.format == vpiIntVal);
return val.value.integer + base_offset;
}
case vpiAutomatic:
return parent->get_scope()->is_automatic()? 1 : 0;