1

我的测试台无法编译,因为它一直声称那clk是一个网络。据我了解,reg它不是一个网,应该在方程的 LHS 中被允许。


module testbench // testbench module has no ports
(
reg clk,    
reg [3:0] d,                    //latch inputs
wire [3:0] q        //latch outputs
);
// instantiate circuit under test


ringcounter UUT1( 
    .q(q),
    .d(d),
    .clk(clk)
);

initial
    begin
        clk = 0;
    end


always 
    begin
        #10 clk = ~clk;     //toggle clock every 10ns
    end

endmodule

我得到的错误是

(vlog-2110) 非法引用网络“clk”。

4

1 回答 1

3

如果您的评论是正确的(“testbench 模块没有端口”),那么不要在模块名称后使用括号。在此处使用分号,并在每个 reg/wire 声明之后:

module testbench; // testbench module has no ports
reg clk;   
reg [3:0] d;                    //latch inputs
wire [3:0] q;        //latch outputs
// instantiate circuit under test
于 2014-02-26T22:30:19.240 回答