Forum Discussion
Altera_Forum
Honored Contributor
8 years ago --- Quote Start --- Code example:
reg value;
reg circle_count;
reg count;
always @(posedge clk)
begin
count <= count + 1'b1;
if (count == 1) begin
count <= 0;
circle_count <= circle_count + 1'b1;
if (circle_count == 12)
circle_count <= 0;
end
end
always @(circle_count)
begin
case (circle_count)
0: value <= 5'b00101;
1: value <= value; // 5'b00101
2,3,4: value <= (value << 1); // always 0 - why?
// When I start simulation test - it will changes succesfully
// On Board - it always ZERO when I try to shift it.
default: value <= 12'b10101;
endcase
end
endmodule
--- Quote End --- The highlighted code is just bad coding practice. Stop doing it. It will work in simulation but it produces a very poor implementation.