求指正verilog测试代码错误
时间:10-02
整理:3721RD
点击:
verilog代码如下:
`timescale10ns/1ns
`defineperiod1
module debounce_tb;
reg clk,rst,key_in;
wire key_out;
always#`periodclk=~clk;
initial
begin
clk=0;
rst=1;
#5rst=0;
#10rst=1;
#10key_in=1;
#100000key_in=0;
#100key_in=1;
#600000key_in=0;
#10000$stop;
end
debounce_key dbk(clk,rst,key_in,key_out);
$monitor($time,,,"clk=%b,rst=%b,key_in=%b,key_out=%b",clk,rst,key_in,key_out);
endmodule
用modelsim编译时提示一个错误Error: D:/Program Files/modelsim/examples/debounce_tb.v(29): near "$monitor": syntax error, unexpected "SYSTEM_IDENTIFIER"
看了半天感觉没错误啊,求高人点拨~
`timescale10ns/1ns
`defineperiod1
module debounce_tb;
reg clk,rst,key_in;
wire key_out;
always#`periodclk=~clk;
initial
begin
clk=0;
rst=1;
#5rst=0;
#10rst=1;
#10key_in=1;
#100000key_in=0;
#100key_in=1;
#600000key_in=0;
#10000$stop;
end
debounce_key dbk(clk,rst,key_in,key_out);
$monitor($time,,,"clk=%b,rst=%b,key_in=%b,key_out=%b",clk,rst,key_in,key_out);
endmodule
用modelsim编译时提示一个错误Error: D:/Program Files/modelsim/examples/debounce_tb.v(29): near "$monitor": syntax error, unexpected "SYSTEM_IDENTIFIER"
看了半天感觉没错误啊,求高人点拨~
$monitor不能单独写
需要放在begin end块里面
你需要在initial begin ... end的语句块里面写这句话
多谢了,弄了一个小时,可能眼看花了,看来基础还是不扎实啊~一定要好好学习
Thanks a lot !
学习了
学到了。
学习了
学习下