【发布时间】:2014-07-16 19:06:56
【问题描述】:
我正在尝试实现一个计数器,该计数器使用输入值对每个时钟脉冲的内部值进行计数。
module Counter(in, clk, out);
input clk;
input [7:0] in;
wire clk;
wire [7:0] in;
output [7:0] out;
reg [7:0] out;
always @ (posedge clk) begin
out <= out + in;
end
endmodule
我得到的输出大部分时间都是正确的,但有时计数器不会按预期增加。 Here is a link to a waveform of the output。可以看出,即使 in 是 3,计数器也会从 5 跳到 10。有人可以帮我吗?
【问题讨论】: