Assume that a one-hot code is used with the state assignment y[5:0] = 000001(A), 000010(B), 000100(C), 001000(D), 010000(E), 100000(F)
Write a logic expression for the signal Y1, which is the input of state flip-flop y.
Write a logic expression for the signal Y3, which is the input of state flip-flop y.
(Derive the logic equations by inspection assuming a one-hot encoding. The testbench will test with non-one hot inputs to make sure you're not trying to do something more complicated).
module top_module (
input [5:0] y,
parameter A_STATE = 7'b000001;
parameter B_STATE = 6'b000010;
parameter C_STATE = 6'b000100;
parameter D_STATE = 6'b001000;
parameter E_STATE = 6'b010000;
parameter F_STATE = 6'b100000;
wire [5:0] n_state;
//assign n_state = y;
always @(*) begin
A_STATE: n_state = (w) ? B_STATE:A_STATE;
B_STATE: n_state = (w) ? C_STATE:D_STATE;
C_STATE: n_state = (w) ? E_STATE:D_STATE;
D_STATE: n_state = (w) ? F_STATE:A_STATE;
E_STATE: n_state = (w) ? E_STATE:D_STATE;
F_STATE: n_state = (w) ? C_STATE:D_STATE;
assign Y1 = (n_state == B_STATE) ?1:0;
assign Y3 = (n_state == E_STATE) ?1:0;