Forum Discussion
Altera_Forum
Honored Contributor
8 years ago --- Quote Start --- Why not just add the statement:
led <= circle_count == 4'd0 ? BASE_LED_SEQUENCE : led << 1; into the main loop, so it looks like this: always @(posedge clk or negedge reset)
begin
if (!reset)
begin
count <= 28'd0;
circle_count <= 4'd0;
led <= 12'b0;
end
else
begin
if (count == 1)
begin
count <= 1'b0;
circle_count <= circle_count == 4'd12 ? 4'd0 : circle_count + 4'd1;
led <= circle_count == 4'd0 ? BASE_LED_SEQUENCE : led << 1;
end
else
count <= count + 28'd1;
end
end
which I think is a lot easier to follow. --- Quote End --- Thank you, It's pretty well working. But could you explain me why I can't get previous value for `led` in other always blocks?