Question: In the following code, state and nextstate are integers with a range of 0 to 2. always @(state,X) begin case(state) 0:begin if(X == 1'b1) nextstate
In the following code, state and nextstate are integers with a range of 0 to 2.
always @(state,X)
begin
case(state)
0:begin
if(X == 1'b1)
nextstate = 2'b01;
end
1:begin
if(X == 1'b0)
nextstate = 2'b10;
end
2:begin
if(X == 1'b1)
nextstate = 2'b00;
end
endcase
end
(a) Explain why a latch would be created when the code is synthesized.
(b) What signal would appear at the latch output?
(c) Make changes in the case statement that would eliminate the latch.
(d) Can you make changes outside the case statement that would eliminate the latch? If yes, illustrate. If no, explain.
Step by Step Solution
3.39 Rating (165 Votes )
There are 3 Steps involved in it
a nextstate is not always assigned a new value in the condit... View full answer
Get step-by-step solutions from verified subject matter experts
