vvp: Add support for value change callback on 2-state array word.

This commit is contained in:
Martin Whitaker 2024-02-06 22:04:23 +00:00
parent 8b357d670d
commit c363231b9c
2 changed files with 21 additions and 5 deletions

View File

@ -19,9 +19,7 @@ event e;
logic [3:0] p4;
logic [3:0] a4[3:0];
// this causes a segfault - to be investigated
//bit [3:0] a2[3:0];
logic [3:0] a2[3:0];
bit [3:0] a2[3:0];
assign w4 = v4;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007-2022 Stephen Williams (steve@icarus.com)
* Copyright (c) 2007-2024 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -1319,11 +1319,29 @@ void __vpiArray::word_change(unsigned long addr)
if (addr < vals->get_size())
vals->get_word(addr, val);
vpip_real_get_value(val, cur->cb_data.value);
} else {
} else if (vals4) {
vpip_vec4_get_value(vals4->get_word(addr),
vals_width,
signed_flag,
cur->cb_data.value);
} else if (dynamic_cast<vvp_darray_atom<int8_t>*>(vals)
|| dynamic_cast<vvp_darray_atom<int16_t>*>(vals)
|| dynamic_cast<vvp_darray_atom<int32_t>*>(vals)
|| dynamic_cast<vvp_darray_atom<int64_t>*>(vals)
|| dynamic_cast<vvp_darray_atom<uint8_t>*>(vals)
|| dynamic_cast<vvp_darray_atom<uint16_t>*>(vals)
|| dynamic_cast<vvp_darray_atom<uint32_t>*>(vals)
|| dynamic_cast<vvp_darray_atom<uint64_t>*>(vals)
|| dynamic_cast<vvp_darray_vec2*>(vals)) {
vvp_vector4_t val;
if (addr < vals->get_size())
vals->get_word(addr, val);
vpip_vec4_get_value(val,
vals_width,
signed_flag,
cur->cb_data.value);
} else {
assert(0);
}
}