意图
我想用Verilog制作一个重击模块,为了完成这个任务,我想用10个开关作为输入信号,让用户点击gopher,如果出现信号(开关状态0->1或1->0)并且相应的LED灯亮起(每个周期只有一个LED会亮起来,每个周期是1秒),得分计数器加1。
是我的变量的一部分
下面是我的一些变量。
input [9:0]SW; // 10 switch input as an array
output reg[9:0] LED; // 10 LED output as an array
reg [5:0] score; // the score counter, in the beginning initialize to 0
reg [4:0] clk; // this clk is a 1 Hz clock为什么我不能这么做?
这样做后,分数计数器只是随机跳转到不同的值。我该怎么做才能修好?
always@(SW[0])begin // if switch 0 goes from 0 to 1 or 1 to 0
if(LED[0]) // if LED lights up
begin
score=score+1; // score counter +1
end
end 发布于 2022-06-05 19:29:12
我会看一看数字故障过滤器,我总是将它们用于这样的用例。或者,您可以查看模拟故障过滤器。通常,我实现这样的数字:
F 213/code>。
https://stackoverflow.com/questions/72507754
复制相似问题