I'm adapting the Pmod encoder example to use with one of my projects. In the example source code, Encoder.v, there is a state repetition during the FSM - state "R3" occurs twice.
I just want to confirm that this is a mistake - or maybe it's repeated for some reason I have yet to consider?
// R2
"R2" : begin
LED <= 2'b01;
if (A == 1'b1) begin
nextState <= "R1";
end
else if (B == 1'b1) begin
nextState <= "R3";
end
else begin
nextState <= "R2";
end
end
// R3
"R3" : begin
LED <= 2'b01;
if (B == 1'b0) begin
nextState <= "R2";
end
else if (A == 1'b1) begin
nextState <= "add";
end
else begin
nextState <= "R3";
end
end
// R3
"R3" : begin
LED <= 2'b01;
if (B == 1'b0) begin
nextState <= "R2";
end
else if (A == 1'b1) begin
nextState <= "add";
end
else begin
nextState <= "R3";
end
end
// Add
"add" : begin
LED <= 2'b01;
nextState <= "idle";
end
Question
3STTW
I'm adapting the Pmod encoder example to use with one of my projects. In the example source code, Encoder.v, there is a state repetition during the FSM - state "R3" occurs twice.
I just want to confirm that this is a mistake - or maybe it's repeated for some reason I have yet to consider?
// R2 "R2" : begin LED <= 2'b01; if (A == 1'b1) begin nextState <= "R1"; end else if (B == 1'b1) begin nextState <= "R3"; end else begin nextState <= "R2"; end end // R3 "R3" : begin LED <= 2'b01; if (B == 1'b0) begin nextState <= "R2"; end else if (A == 1'b1) begin nextState <= "add"; end else begin nextState <= "R3"; end end // R3 "R3" : begin LED <= 2'b01; if (B == 1'b0) begin nextState <= "R2"; end else if (A == 1'b1) begin nextState <= "add"; end else begin nextState <= "R3"; end end // Add "add" : begin LED <= 2'b01; nextState <= "idle"; end
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now