When I use $writememb in Verilog to write contents in a memory to a text file, the result shows as below. But, I don't need the address comment. How can I cancel the comment when using $writememb? I use iverilog to compile my design.
// 0x00000000
00000000000000000000000000000001
00000000000000000000000000000010
00000000000000000000000000010100
00000000000000000000000000010000
00000000000000000000000000000100
00000000000000000000000000000011
11111111111111111111111111111111
11111111111111111111111111111100
00000000000000000000000000000100
00000000000000000000000000000000
00000000000000000000000000000001
11111111111111111111111111111000
11111111111111111111111111110000
00011111111111111111111111111111
00001111111111111111111111111111
11111111111111111111111111111110
// 0x00000010
11111111111111111111111111111100
I want a result like this:
00000000000000000000000000000001
00000000000000000000000000000010
00000000000000000000000000010100
00000000000000000000000000010000
00000000000000000000000000000100
00000000000000000000000000000011
11111111111111111111111111111111
11111111111111111111111111111100
00000000000000000000000000000100
00000000000000000000000000000000
00000000000000000000000000000001
11111111111111111111111111111000
11111111111111111111111111110000
00011111111111111111111111111111
00001111111111111111111111111111
11111111111111111111111111111110
11111111111111111111111111111100
According to IEEE Std 1800-2017, section 21.5 Writing memory array data to a file:
The file contents that you get with the address comply with the standard since the addresses are inside comments (
//).This behavior seems to be unique to the
iverilogsimulator. I don't see comments when I use$writemembwith other simulators.You can try to contact the
iverilogdevelopers to see if there is an option to disable comments.Or, you can try using other simulators.
Or, you can write to an output file using
$fopenand related functions.Or, you can post-process the output files to remove the comments using your favorite software language. If you are on a unix-like OS: