ECEN 248-511
Pre-lab 11
1. The completed state diagram for the combination-lock FSM.
Right == 1
&&
Count == 7
Locked = 1
Otherwise
Locked = 0
Center == 1
&&
Count != 17
Otherwise
S3: begin
if(Center)
if(Count == 5'b10001)
nextState = S4;
else
nextState = S0;
else
nextState = S3;
end
S4: begin
nextState = S4;
end
default: begin
nextState = S0;
end
endcase
assign Locked = (state==S4)?0:1;
always@(posedge Clk)
if(South)
state<= S0;
else
state<= nextState;
endmodule