问题遇到的现象和发生背景
quartus和modelsim-altera联合调试中,modelsim中被调用的模块只显示最后部分波形,其余部分都是no data
用代码块功能插入代码,请勿粘贴截图
`timescale 1 ns/ 1 ns
module tb;
reg clk,rst,pin;
wire led;
delay20_detect_module1 inst1(clk,rst,pin,led);
initial
begin
rst =0;
pin =1;
clk =0;
#20 rst =1;
end
always
begin
#10 clk <= ~clk;
end
always
begin
#25_000_000 pin <= ~pin;
end
endmodule
module delay20_detect_module1
(
clk, rstn, pin, led
);
input clk;
input rstn;
input pin;
output reg led;
parameter T20MS = 16'd1_000_000;//20ns*10^6=20ms
reg [15:0] Count1;
reg count_clear,pin_detect;
always @ ( posedge clk or negedge rstn )//counter20
begin
if( !rstn )//reset
Count1 <= 0;
else if (count_clear == 1)
begin
Count1 <= 0;
end
else
begin
Count1 <= Count1 + 1'b1;
end
end
always @ ( posedge clk or negedge rstn )//pin push down detect
begin
if( !rstn )//reset
begin
pin_detect <= 0;
count_clear <= 0;
end
else if(pin == 0)//counter if full
begin
if(Count1 == T20MS )//counter if full
begin
pin_detect <= 1;
count_clear <= 0;
end
else if(Count1 == 0)//counter if full
begin
count_clear <= 1;
end
else
begin
pin_detect <= 0;
count_clear <= 0;
end
end
end
always @ ( posedge clk )//led
begin
if( !rstn )//reset
led <= 0;
else if (pin_detect == 1)led <= ~ led;
else led <= led;
end
endmodule
运行结果及报错内容
https://img-mid.csdnimg.cn/release/static/image/mid/ask/856116380666184.png "#left")
我的解答思路和尝试过的方法
猜测应该是代码内部有问题,但按道理如果模块没被调用,内部也会有不确定值x啊,也不至于no data吧
我想要达到的结果
如何看到全部的波形