I want to trace the memory value at specific locations during simulation of a hierarchical design using Verilator. A short version of the memory model is defined as follows
`module tc_sram{
parameter int unsigned NumWords = 32'd1024,
parameter int unsigned AddrWidth = (NumWords > 32'd1) ? $clog2(NumWords) : 32'd1,
parameter type data_t = logic [DataWidth-1:0],
}{
data_t sram [NumWords-1:0] /*verilator public*/;
}`
I want to use VPI interface in the design's C++ testbench to trace memory value at any location I want, meaning I provide the address of the memory location in the testbench, and the memory value at this location will return. Does anyone have any idea?