I have been looking at some Verilog testbench code that heavily uses $readmemh
and $writememh
.
I have a vague understanding that these functions basically read to and write from memory. What is their specific function and how do they work?
verilog
I have been looking at some Verilog testbench code that heavily uses $readmemh
and $writememh
.
I have a vague understanding that these functions basically read to and write from memory. What is their specific function and how do they work?
Best Answer
I agree its not too easy to find something about readmem/writemem. You can find a little bit here: https://www.fullchipdesign.com/readmemh.htm
Anyway there is not too much to say about these functions, the syntax is:
Verilog is very picky about the file format, the number of bit in the text file have to match the number of bits in the array.
I recommend you play around a little bit by defining an array, filling it up with data write it out with writememh/writememb and print it out afterwards.
Something like this should get you started (not tried out!).