verilog HDLBits刷题[Finite State Machines]“Fsm2”---Simple FSM2(asynchronous reset)
1、题目This is a Moore state machine with two states, two inputs, and one output. Implement this state machine.This exercise is the same as fsm2s, but using asynchronous reset.2、代码module top_module( input clk, input areset, // Asynchronous reset to OFF input j, input k, output out); // parameter OFF0, ON1; reg state, next_state; always (*) begin case(state) OFF:if (j0) next_stateOFF; else next_stateON; ON:if (k0) next_stateON; else next_stateOFF; endcase end always (posedge clk, posedge areset) begin if(areset) stateOFF; else statenext_state; end assign out (state ON); endmodule3、结果