简体   繁体   English

从testbench访问子模块中的输入和输出

[英]Accessing inputs and outputs in sub-modules from testbench

My device-under-test (DUT) has many sub-modules and I would like to test some of them. 我的被​​测设备(DUT)有很多子模块,我想测试其中的一些。

My test fixture will be the top level of my project - one level higher than the DUT - and since I can only seem to access the inputs and outputs of the modules one level down, I can only access the top-level inputs and outputs of the DUT. 我的测试夹具将是我项目的顶层 - 比DUT高一级 - 而且由于我似乎只能访问模块的输入和输出一级,我只能访问顶级输入和输出DUT。

I would like to be able to access signals from the modules two or more levels beneath the test fixture, ideally without having to rewrite any modules to add more outputs so the signals I want to test are connected to the top level. 我希望能够从测试夹具下面的两个或更多级别的模块访问信号,理想情况下无需重写任何模块以添加更多输出,因此我想要测试的信号连接到顶层。

I could rewrite the device under test but this seems time-consuming and I feel there should be a quicker way. 可以重写被测试的设备,但这看起来很耗时,我觉得应该有更快的方法。

Is there a way to write a test fixture that can access signals within sub-modules, without rewriting the DUT? 有没有办法编写一个可以访问子模块内的信号的测试夹具,而无需重写DUT?

If you only need to monitor signals inside your top-level dut module, you can use hierarchical path specifiers to scope down into the dut: 如果您只需要监视顶级dut模块中的信号,则可以使用分层路径说明符来确定dut的范围:

dut.read_data

SystemVerilog also offers the bind statement to do something similar. SystemVerilog还提供了bind语句来执行类似的操作。

If you need to drive internal dut signals, you should create a separate testbench for the sub-module. 如果需要驱动内部dut信号,则应为子模块创建单独的测试平台。 This is more time-consuming, but gives you better control and allows you to achieve 100% coverage (which can sometimes be difficult at the top-level). 这更耗时,但可以让您获得更好的控制,并且可以实现100%的覆盖率(有时在顶层很难)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM