我的测试平台只显示不关心我的输入

问题描述 投票:0回答:1

当我测试我的数据流模块时,我的所有输入都显示为无关。 我不确定问题出在哪里。可能是我的方程或我的测试台本身?

这是我的代码。

数据流:

module TollSystem(weekDay,rushHour,lateNight,highTraffic,lowRate,mediumRate,highRate);

input weekDay,rushHour,lateNight,highTraffic;

output lowRate,mediumRate,highRate;

assign #6 lowRate = ~weekDay&~rushHour&lateNight&~highTraffic | 
weekDay&~rushHour&lateNight&~highTraffic;

assign #6 mediumRate = (~rushHour&~lateNight&~highTraffic) | (~weekDay&~lateNight&~highTraffic) | 
(rushHour&lateNight);

assign #6 highRate = (weekDay&~lateNight&rushHour) | 
(~lateNight&highTraffic|~rushHour&lateNight&highTraffic);

endmodule

测试台:

module TollSystemtest();

reg weekDay,rushHour,lateNight,highTraffic;

wire lowRate,mediumRate,highRate;

TollSystem TSys(weekDay,rushHour,lateNight,highTraffic,lowRate,mediumRate,highRate);

initial
begin

 weekDay=0;rushHour=0;lateNight=0;highTraffic=0;
 weekDay=0;rushHour=0;lateNight=0;highTraffic=1;
 weekDay=0;rushHour=0;lateNight=1;highTraffic=0;
 weekDay=0;rushHour=0;lateNight=1;highTraffic=1;
 weekDay=0;rushHour=1;lateNight=0;highTraffic=0;
 weekDay=0;rushHour=1;lateNight=0;highTraffic=1;
 weekDay=0;rushHour=1;lateNight=1;highTraffic=0;
 weekDay=0;rushHour=1;lateNight=1;highTraffic=1;
 weekDay=1;rushHour=0;lateNight=0;highTraffic=0;
 weekDay=1;rushHour=0;lateNight=0;highTraffic=1;
 weekDay=1;rushHour=0;lateNight=1;highTraffic=0;
 weekDay=1;rushHour=0;lateNight=1;highTraffic=1;
 weekDay=1;rushHour=1;lateNight=0;highTraffic=0;
 weekDay=1;rushHour=1;lateNight=0;highTraffic=1;
 weekDay=1;rushHour=1;lateNight=1;highTraffic=0;
 weekDay=1;rushHour=1;lateNight=1;highTraffic=1;

 $finish();
end
endmodule

输入/输出结果:

[testBench output1

verilog questasim
1个回答
0
投票

当我运行您的代码时,模拟在时间 0 结束。由于没有时间流逝,因此您的输入报告为 x/z 也就不足为奇了。 您需要在测试平台中添加延迟。 例如:

initial
begin
         weekDay=0;rushHour=0;lateNight=0;highTraffic=0;
    #20; weekDay=0;rushHour=0;lateNight=0;highTraffic=1;
    #20; weekDay=0;rushHour=0;lateNight=1;highTraffic=0;
    #20; weekDay=0;rushHour=0;lateNight=1;highTraffic=1;
    #20; weekDay=0;rushHour=1;lateNight=0;highTraffic=0;
    #20; weekDay=0;rushHour=1;lateNight=0;highTraffic=1;
    #20; weekDay=0;rushHour=1;lateNight=1;highTraffic=0;
    #20; weekDay=0;rushHour=1;lateNight=1;highTraffic=1;
    #20; weekDay=1;rushHour=0;lateNight=0;highTraffic=0;
    #20; weekDay=1;rushHour=0;lateNight=0;highTraffic=1;
    #20; weekDay=1;rushHour=0;lateNight=1;highTraffic=0;
    #20; weekDay=1;rushHour=0;lateNight=1;highTraffic=1;
    #20; weekDay=1;rushHour=1;lateNight=0;highTraffic=0;
    #20; weekDay=1;rushHour=1;lateNight=0;highTraffic=1;
    #20; weekDay=1;rushHour=1;lateNight=1;highTraffic=0;
    #20; weekDay=1;rushHour=1;lateNight=1;highTraffic=1;
    $finish();
end

现在,当我运行模拟并查看波形时,我看到所有信号都达到已知值。

我添加了

#20
的延迟,但您应该将其更改为对您的设计更有意义的东西。

© www.soinside.com 2019 - 2024. All rights reserved.