EUverNE
Newbie level 5

up down counter.v
Hi all,
I'm new in learning digital design for FPGA using Verilog HDL and encounter some difficulties trying to experiment designing a simple up_down counter. While compiling the design, Quartus v.9 web edition reports too many warnings regarding "combinatinal loops..." and "latches inferred for reg [out]...", and the simulator stops, reporting "zero-time oscillation on node..."
The code is:
module up_down_counter (up, down, reset, out);
input up, down, reset;
output out;
wire up, down, reset;
reg [3:0] out ;
always @ (negedge up, negedge down, negedge reset) begin
if (!reset)
out <= 0;
else if (!up)
out <= out + 1'b1;
else if (!down)
out <= out - 1'b1;
else
out <= out;
end
endmodule
I can't see where is the problem, and why i got those warning & errors. The textbooks doesn't seem to help enough, so any help greatly appreciated.
Thanks in advance
Hi all,
I'm new in learning digital design for FPGA using Verilog HDL and encounter some difficulties trying to experiment designing a simple up_down counter. While compiling the design, Quartus v.9 web edition reports too many warnings regarding "combinatinal loops..." and "latches inferred for reg [out]...", and the simulator stops, reporting "zero-time oscillation on node..."
The code is:
module up_down_counter (up, down, reset, out);
input up, down, reset;
output out;
wire up, down, reset;
reg [3:0] out ;
always @ (negedge up, negedge down, negedge reset) begin
if (!reset)
out <= 0;
else if (!up)
out <= out + 1'b1;
else if (!down)
out <= out - 1'b1;
else
out <= out;
end
endmodule
I can't see where is the problem, and why i got those warning & errors. The textbooks doesn't seem to help enough, so any help greatly appreciated.
Thanks in advance