module FEE_GTU_emu( input clk, input TTCtrd_A, input reset, output reg BUSY); reg [1:0] state; reg [11:0] counter; reg [2:0] counter2; parameter S_GS = 2'b00, S_LM = 2'b01, S_L0 = 2'b10, S_L1 = 2'b11; initial begin BUSY <= 0; state <= 0; end always @(posedge clk) begin if (reset == 1) begin state <= S_GS; end case (state) S_GS: begin BUSY <= 0; if (TTCtrd_A == 1) begin state <= S_LM; end end S_LM: begin if (TTCtrd_A == 1) begin state <= S_L0; end end S_L0: begin if (TTCtrd_A == 1) begin state <= S_L1; end end endcase end always @(state) begin case (state) S_GS: begin counter <= 0; counter2 <= 0; end S_LM: begin counter <= 14; end S_L0: begin counter <= 222; counter2 <= 7; end S_L1: begin counter <= 10; end endcase end always @(posedge clk) begin if (state != S_GS) begin if (counter == 0) begin state <= S_GS; end else begin counter <= counter - 1; end end if (state == S_L0) begin if (counter2 == 0) begin BUSY <= 1; end else begin counter2 <= counter2 - 1; end end end endmodule