如何使用verilog运行tcl proc函数?

如何使用verilog运行tcl proc函数?,tcl,verilog,Tcl,Verilog,目前我有一些tcl文件。在tcl文件中,特别是在one tcl中,我在tcl中找到了下面的proc函数 proc ahb_write {addr data {str s}} { set ahbm top.cpu_subsys ... if {$::verbose > 0} { } silent { ........... ...........

目前我有一些tcl文件。在tcl文件中,特别是在one tcl中,我在tcl中找到了下面的proc函数

proc ahb_write {addr data {str s}} {
    set    ahbm top.cpu_subsys                      
    ...

    if {$::verbose  > 0} {
    }
    silent {
           ...........
           ...........
            delay 1
所以我想在运行模拟时调用并运行这个ahb_write proc函数


当我使用verilog运行模拟时,是否有任何可能的方法来运行proc函数?

您需要SystemVerilog DPI在任何模拟器中执行此操作。在Modelsim中,您可以调用函数
mti\u fli::mti\u com(“command”)
在任何模拟器中都可以使用的另一种方法是在遇到断点时执行命令

我以前做过这样的工作,我想使用verilog任务,在内存中注入位错误。在NCSim中,我必须首先单独存储任务参数的值,然后调用任务本身

deposit tinst.u_buffer.u_fifo.u_sram_0.injectSA.addr 1
deposit tinst.u_buffer.u_fifo.u_sram_0.injectSA.bitn 2
deposit tinst.u_buffer.u_fifo.u_sram_0.injectSA.typen 1
task    tinst.u_buffer.u_fifo.u_sram_0.injectSA
run 0.1
我不确定“运行0.1”是否必要,但我知道这至少在我的示例中起作用

verilog任务在RAM模型中定义如下:

task injectSA;
input [numWordAddr-1:0] addr;
input integer bitn;
input typen;
...

大多数模拟器都有基于tcl的shell,不知道您在使用什么,但很可能模拟器是proc的目标,而不是verilog。请看一下GUI并查找抄本的书写位置-通常这是您可以添加文本的地方。@user2141046谢谢,顺便问一下,您能告诉我有关如何使用proc tcl在ncverilog或irun上运行模拟的任何示例吗?对不起,在离开该区域之前,我只有机会使用Modelsim和slight VNC。他们都使用了tcl接口——我们正在谈论该领域两个最大的公司(Mentor和Synopsys)。希望这个PDFbe能有所帮助。对不起,我们公司刚收到cadence的ncverilog和simvision。你能用cadence告诉我吗?对不起,我帮不了你。