if I am using one hot encoding for the states and want to go from S0 -> S1 -> S2 -> S3 -> S0
Apparently the following code does this. However I am not sure how the state assignment part works in the snippet (comments mention rotation of 1 bit...?)... can someone please explain HOW this rotation works ie. why the "&state(2)" etc. It would also be extremely helpful if you could provide a simple hardware representation of the code snippet.
process (clk) begin
if rising_edge(clk) then
if reset = '1' then
state <= S0;
else
--rotate state 1 bit to left
state <=
state(1 downto 0)
& state(2);
end if;
end if;
end process;
In the architecture we are told that S0 = 0001, S1 = 0010, S2 = 0100, S3 = 1000