// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2016.2
// Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved.
// 
// ===========================================================

`timescale 1 ns / 1 ps 

module lcddrv_wait_tmr (
        ap_clk,
        ap_rst,
        ap_start,
        ap_done,
        ap_idle,
        ap_ready,
        tmr,
        dummy_tmr_out_i,
        dummy_tmr_out_o,
        dummy_tmr_out_o_ap_vld
);

parameter    ap_ST_st1_fsm_0 = 3'b1;
parameter    ap_ST_st2_fsm_1 = 3'b10;
parameter    ap_ST_st3_fsm_2 = 3'b100;
parameter    ap_const_lv32_0 = 32'b00000000000000000000000000000000;
parameter    ap_const_lv32_2 = 32'b10;
parameter    ap_const_lv24_0 = 24'b000000000000000000000000;
parameter    ap_const_lv32_1 = 32'b1;
parameter    ap_const_lv24_1 = 24'b1;

input   ap_clk;
input   ap_rst;
input   ap_start;
output   ap_done;
output   ap_idle;
output   ap_ready;
input  [24:0] tmr;
input  [0:0] dummy_tmr_out_i;
output  [0:0] dummy_tmr_out_o;
output   dummy_tmr_out_o_ap_vld;

reg ap_done;
reg ap_idle;
reg ap_ready;
reg[0:0] dummy_tmr_out_o;
reg dummy_tmr_out_o_ap_vld;

(* fsm_encoding = "none" *) reg   [2:0] ap_CS_fsm;
reg    ap_sig_cseq_ST_st1_fsm_0;
reg    ap_sig_20;
wire   [23:0] t_1_fu_67_p2;
reg    ap_sig_cseq_ST_st3_fsm_2;
reg    ap_sig_41;
reg   [23:0] t_reg_47;
reg    ap_sig_cseq_ST_st2_fsm_1;
reg    ap_sig_51;
wire   [0:0] exitcond_fu_62_p2;
wire   [0:0] not_s_fu_73_p2;
wire   [24:0] t_cast_fu_58_p1;
reg   [2:0] ap_NS_fsm;

// power-on initialization
initial begin
#0 ap_CS_fsm = 3'b1;
end

always @ (posedge ap_clk) begin
    if (ap_rst == 1'b1) begin
        ap_CS_fsm <= ap_ST_st1_fsm_0;
    end else begin
        ap_CS_fsm <= ap_NS_fsm;
    end
end

always @ (posedge ap_clk) begin
    if (((1'b1 == ap_sig_cseq_ST_st3_fsm_2) & (exitcond_fu_62_p2 == 1'b0))) begin
        t_reg_47 <= t_1_fu_67_p2;
    end else if ((1'b1 == ap_sig_cseq_ST_st2_fsm_1)) begin
        t_reg_47 <= ap_const_lv24_0;
    end
end

always @ (*) begin
    if ((((1'b0 == ap_start) & (1'b1 == ap_sig_cseq_ST_st1_fsm_0)) | ((1'b1 == ap_sig_cseq_ST_st3_fsm_2) & ~(exitcond_fu_62_p2 == 1'b0)))) begin
        ap_done = 1'b1;
    end else begin
        ap_done = 1'b0;
    end
end

always @ (*) begin
    if (((1'b0 == ap_start) & (1'b1 == ap_sig_cseq_ST_st1_fsm_0))) begin
        ap_idle = 1'b1;
    end else begin
        ap_idle = 1'b0;
    end
end

always @ (*) begin
    if (((1'b1 == ap_sig_cseq_ST_st3_fsm_2) & ~(exitcond_fu_62_p2 == 1'b0))) begin
        ap_ready = 1'b1;
    end else begin
        ap_ready = 1'b0;
    end
end

always @ (*) begin
    if (ap_sig_20) begin
        ap_sig_cseq_ST_st1_fsm_0 = 1'b1;
    end else begin
        ap_sig_cseq_ST_st1_fsm_0 = 1'b0;
    end
end

always @ (*) begin
    if (ap_sig_51) begin
        ap_sig_cseq_ST_st2_fsm_1 = 1'b1;
    end else begin
        ap_sig_cseq_ST_st2_fsm_1 = 1'b0;
    end
end

always @ (*) begin
    if (ap_sig_41) begin
        ap_sig_cseq_ST_st3_fsm_2 = 1'b1;
    end else begin
        ap_sig_cseq_ST_st3_fsm_2 = 1'b0;
    end
end

always @ (*) begin
    if (((1'b1 == ap_sig_cseq_ST_st3_fsm_2) & (exitcond_fu_62_p2 == 1'b0))) begin
        dummy_tmr_out_o = not_s_fu_73_p2;
    end else begin
        dummy_tmr_out_o = dummy_tmr_out_i;
    end
end

always @ (*) begin
    if (((1'b1 == ap_sig_cseq_ST_st3_fsm_2) & (exitcond_fu_62_p2 == 1'b0))) begin
        dummy_tmr_out_o_ap_vld = 1'b1;
    end else begin
        dummy_tmr_out_o_ap_vld = 1'b0;
    end
end

always @ (*) begin
    case (ap_CS_fsm)
        ap_ST_st1_fsm_0 : begin
            if (~(ap_start == 1'b0)) begin
                ap_NS_fsm = ap_ST_st2_fsm_1;
            end else begin
                ap_NS_fsm = ap_ST_st1_fsm_0;
            end
        end
        ap_ST_st2_fsm_1 : begin
            ap_NS_fsm = ap_ST_st3_fsm_2;
        end
        ap_ST_st3_fsm_2 : begin
            if (~(exitcond_fu_62_p2 == 1'b0)) begin
                ap_NS_fsm = ap_ST_st1_fsm_0;
            end else begin
                ap_NS_fsm = ap_ST_st3_fsm_2;
            end
        end
        default : begin
            ap_NS_fsm = 'bx;
        end
    endcase
end

always @ (*) begin
    ap_sig_20 = (ap_CS_fsm[ap_const_lv32_0] == 1'b1);
end

always @ (*) begin
    ap_sig_41 = (1'b1 == ap_CS_fsm[ap_const_lv32_2]);
end

always @ (*) begin
    ap_sig_51 = (1'b1 == ap_CS_fsm[ap_const_lv32_1]);
end

assign exitcond_fu_62_p2 = ((t_cast_fu_58_p1 == tmr) ? 1'b1 : 1'b0);

assign not_s_fu_73_p2 = (dummy_tmr_out_i ^ 1'b1);

assign t_1_fu_67_p2 = (t_reg_47 + ap_const_lv24_1);

assign t_cast_fu_58_p1 = t_reg_47;

endmodule //lcddrv_wait_tmr
