如何使用 Unix 脚本选择 Verilog 测试文件?
我必须对DPRAM进行验证。
每个测试用例都写在名为 test1.v、test2.v 等的不同文件中。
我想编写一个脚本(unix),这样当我输入 run test1.v 时,只有该测试用例才会运行。
注意:- test1.v 仅包含任务,包括读断言、写断言等。
测试平台是一个单独的文件,其中包括时钟和组件实例化。
当 run test1.v 完成后,它应该将 test1.v 任务链接到测试平台,然后获得输出。
我已经用 verilog 完成了编码
如何做到这一点?
I have to do the verification of DPRAM.
Each test case is written in different file named test1.v,test2.v etc.
I want to write a script(unix) such that when I type run test1.v then only that test case will run.
Note :- test1.v contents only task which includes read assert,write assert etc.
The test bench is a separate file which includes clock and component instantiation.
when run test1.v is done then it should link the test1.v task to the testbench and then output is obtained.
I have done the coding in verilog
How to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此,据我所知,您的不同测试或“测试用例”位于名为
test.v
的文件中。我假设每个测试用例都有一个在所有文件中具有相同名称的任务,例如run_testcase
。这意味着您的测试平台(例如testbench.v
)必须类似于:所以您的问题是
include
行 - 根据测试用例需要包含不同的文件。我可以想到解决这个问题的两种方法,第一种方法是 toolic 建议的 - 使用符号链接“重命名”测试用例文件。因此,启动 sim 的示例包装脚本 (run_sim1
) 可能看起来有点像:另一种方法是使用宏,并在模拟的包装脚本中定义它。您的测试平台将修改为如下所示:
包装脚本 (
run_sim2
):引号在这里很重要,因为 verilog
include
指令需要它们。不幸的是,我们不能在测试台中留下引号,因为它在 verilog 中看起来就像一个字符串,并且TESTCASE
宏不会被扩展。So, as far as I can make out, your different tests, or 'testcases' are in files named
test<n>.v
. And I'll assume that each of these testcases has a task that has the same name in all files, sayrun_testcase
. This means that your testbench (testbench.v
, say) must look something like:So your problem is the
include
line - a different file needs to be included depending on the testcase. I can think of two ways of solving this first one is as toolic suggested - using a symbolic link to 'rename' the testcase file. So an example wrapper script (run_sim1
) to launch your sim might look a bit like:Another way is to use a macro, and define this in the wrapper script for your simulation. Your testbench would be modified to look like:
And the wrapper script (
run_sim2
):The quotes are important here, as the verilog
include
directive expects them. Unfortunately, we can't leave the quotes in the testbench because it will then look like a string to verilog, and theTESTCASE
macro won't be expanded.一种方法是让测试台文件包含一个具有通用名称的测试文件:
然后,让您的脚本创建指向您要运行的测试的符号链接。例如,在 shell 脚本或 Makefile 中,要运行
test1.v
:要运行
test2.v
,您的脚本将用 test2 替换 test1,等等。One way to do it is to have the testbench file include a test file with a generic name:
Then, have your script create a symbolic link to the test you want to run. For example, in a shell script or Makefile, to run
test1.v
:To run
test2.v
, your script would substitute test2 for test1, etc.