简体   繁体   English

带有输出的 iverilog 测试台模块

[英]iverilog testbench module with outputs

I'm trying to make a testbench to simulate a working top level module (and child module) however I can't get iverilog to handle the output of top correctly (LEDS,RS232Rx and RS232Tx are physical pins)我正在尝试制作一个测试平台来模拟工作的顶级模块(和子模块),但是我无法让 iverilog 正确处理顶部的输出(LEDS、RS232Rx 和 RS232Tx 是物理引脚)

here's my attempt at a testbench这是我在测试平台上的尝试

module test();
initial begin
    $dumpfile("test.vcd");
    $dumpvars(0,test);
    # 1024 $stop;
end 
reg clk = 0; always #1 clk = !clk;
//reg rx,tx;
reg [7:0] opl;
top top1 ( .clk(clk), .RS232Rx(rx), .RS232Tx(tx), .LEDS(opl) );
endmodule 

I'm seeing error like this我看到这样的错误

iverilog -o test-design testbench.v top.v
top.v:47: error: LEDS is not a valid l-value in test.top1.
top.v:8:      : LEDS is declared here as wire.
testbench.v:10: error: reg opl; cannot be driven by primitives or continuous assignment.
testbench.v:10: error: Output port expression must support continuous assignment.
testbench.v:10:      : Port 4 (LEDS) of top is connected to opl
3 error(s) during elaboration.

I've tried alsorts of things but with not much in the way of an illuminating or different error message, the best LEDS as a testbench output, showing only an error in top.v which is working... I see very similar errors with rx,tx but commented them out to make a shorter output...我也尝试过很多事情,但没有太多启发性或不同的错误消息,最好的 LEDS 作为测试台输出,只显示 top.v 中的一个错误,它正在工作......我看到了非常相似的错误rx,tx 但将它们注释掉以制作更短的输出...

just to reiterate top.v does, not only synthesize but behaves exactly as expected on actual hardware只是重申 top.v 确实如此,不仅可以合成,而且在实际硬件上的行为与预期完全一样

Turns out that despite my top level design was able to output to a wire, iverilog wasn't happy to do this,事实证明,尽管我的顶级设计能够输出到电线,但 iverilog 并不乐意这样做,

adding添加

reg [7:0] leds;
assign LEDS=leds;

allows my top level design to work on hardware (as before), but also iverilog (icarus) now seems able to deal with it...允许我的顶级设计在硬件上工作(和以前一样),而且 iverilog (icarus) 现在似乎能够处理它......

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

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