Verilog中$readmemh和$writememh的作用是什么?
我一直在研究一些大量使用 $readmemh
和 $writememh
的 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我同意找到有关 readmem/writemem 的内容并不容易。 你可以在这里找到一些:
https://www.fullchipdesign.com/readmemh.htm
反正也没什么好说的关于这些函数,语法是:
Verilog 对文件格式非常挑剔,文本文件中的位数必须与数组中的位数相匹配。
我建议您定义一个数组,用数据填充它,然后用 writememh/writememb 写出来,然后打印出来。
像这样的东西应该可以帮助您入门(未尝试过!)。
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!).