From 0fca1bdab059ffbe19b08dfdcbe7743d6382c564 Mon Sep 17 00:00:00 2001 From: Cary R Date: Sun, 31 May 2020 14:26:03 -0700 Subject: [PATCH] Add vpiIndex for array words --- vvp/array.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/vvp/array.cc b/vvp/array.cc index 0249ea3c5..8ad909505 100644 --- a/vvp/array.cc +++ b/vvp/array.cc @@ -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;