module top_module( input clk, input areset, // Asynchronous reset to state B input in, output out);//
parameter A=0, B=1; reg state, next_state;
always @(*) begin// This is a combinational always block case(state) A:begin if(in == 1'b1)begin next_state = A; end elsebegin next_state = B; end end B:begin if(in == 1'b1)begin next_state = B; end elsebegin next_state = A; end end endcase end
always @(posedge clk, posedge areset) begin// This is a sequential always block if(areset)begin state <= B; end elsebegin state <= next_state; end end
module top_module( input clk, input reset, // Asynchronous reset to state B input in, output out);//
parameter A=0, B=1; reg state, next_state;
always @(*) begin// This is a combinational always block case(state) A:begin if(in == 1'b1)begin next_state = A; end elsebegin next_state = B; end end B:begin if(in == 1'b1)begin next_state = B; end elsebegin next_state = A; end end endcase end
always @(posedge clk) begin// This is a sequential always block if(reset)begin state <= B; end elsebegin state <= next_state; end end
module top_module( input clk, input areset, // Asynchronous reset to OFF input j, input k, output out); //
parameter OFF=0, ON=1; reg state, next_state;
always @(*) begin case(state) OFF:begin if(j == 0)begin next_state = OFF; end elsebegin next_state = ON; end end ON:begin if(k == 0)begin next_state = ON; end elsebegin next_state = OFF; end end endcase end
always @(posedge clk, posedge areset) begin if(areset)begin state <= OFF; end elsebegin state <= next_state; end end
module top_module( input clk, input reset, // Synchronous reset to OFF input j, input k, output out); //
parameter OFF=0, ON=1; reg state, next_state;
always @(*) begin case(state) OFF:begin if(j == 0)begin next_state = OFF; end elsebegin next_state = ON; end end ON:begin if(k == 0)begin next_state = ON; end elsebegin next_state = OFF; end end endcase end
always @(posedge clk) begin if(reset)begin state <= OFF; end elsebegin state <= next_state; end end
always @(*)begin case(state) A:begin if(in == 0)begin next_state = A; end elsebegin next_state = B; end end B:begin if(in == 0)begin next_state = C; end elsebegin next_state = B; end end C:begin if(in == 0)begin next_state = A; end elsebegin next_state = D; end end D:begin if(in == 0)begin next_state = C; end elsebegin next_state = B; end end endcase end