以下是一些modelsim代码:
begin
tb_in_top = 0;
#5 tb_in_top = 4'b0000;#5 tb_in_top = 4'b0001;
#5 tb_in_top = 4'b0010;#5 tb_in_top = 4'b0011;
#5 tb_in_top = 4'b0100;#5 tb_in_top = 4'b0101;
#5 tb_in_top = 4'b0110;#5 tb_in_top = 4'b0111;
#5 tb_in_top = 4'b1000;#5 tb_in_top = 4'b1001;
#5 tb_in_top = 4'b1010;#5 tb_in_top = 4'b1011;
#5 tb_in_top = 4'b1100;#5 tb_in_top = 4'b1101;
#5 tb_in_top = 4'b1110;#5 tb_in_top = 4'b1111;
#100 $finish;
end#5和#100代表什么?这些是行号吗?这段代码有什么问题吗?
发布于 2010-09-11 05:53:30
它不是"ModelSim“代码,就像是"Visual Studio”代码一样。我是Verilog。
#标记表示以纳秒为单位的延迟。
所以这段代码的意思是:
H111在t= 20 ns时,将tb_in_top设置为4位二进制值0011。<代码>H212<代码>F213
(...继续向上计数,每5 ns将tb_in_top递增1…)
是的,Verilog有for循环,是的,这应该是一个。
附录
for循环将如下所示:
integer index;
reg [3:0] tb_in_top;
begin
tb_in_top = 0;
for(index = 0; index < 16; index = index + 1)
begin
#5 tb_in_top = tb_in_top + 4'h1;
end
#100 $finish;
end最后,请注意,使用#延时操作的Verilog不能合成逻辑;它只能用于模拟。
https://stackoverflow.com/questions/3688560
复制相似问题