Forum Discussion
Altera_Forum
Honored Contributor
8 years agoFPGA Development Board - strange shift operation behavior
My development board based on: Cyclone IV EP4CE10E22C8N Quartus: 17.0.0 Lite Edition top-level entity code:
module led4_reg(clk, led);
parameter BASE_LED_SEQUENCE = 12'b000011101101...
Altera_Forum
Honored Contributor
8 years ago --- Quote Start --- Not sure what you mean by this. led[11:0] is a register, so you can access it at any time in any logic equation within that module. The value will only change when the always block that encloses it is triggered and the value is updated. --- Quote End --- 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