Altera_Forum
Honored Contributor
7 years agonewbie question: synchronous versus combinational bus mux using case statement
Hello all-
Can anyone explain why the first (synchronous) version below compiles in quartus, but the second (combinational) does not? In the 2nd case the error is: Error (10137): Verilog HDL Procedural Assignment error at my_first_fpga.v(26): object "LED" on left-hand side of assignment must have a variable data type Error (10137): Verilog HDL Procedural Assignment error at my_first_fpga.v(27): object "LED" on left-hand side of assignment must have a variable data type Is there a proper way to code a combinational bus mux using a case statement? Thanks -J
module my_first_fpga ( input wire CLOCK_50,
input wire KEY,
output reg LED
);
reg count;
always @ (posedge CLOCK_50)
begin
count <= count + 1;
case(KEY)
0 : LED = count;
1 : LED = count;
endcase
end
endmodule
module my_first_fpga ( input wire CLOCK_50,
input wire KEY,
output wire LED
);
reg count;
always @ (posedge CLOCK_50)
begin
count <= count + 1;
end
always @ (KEY, count)
case(KEY)
0 : LED = count;
1 : LED = count;
endcase
endmodule