// ==============================================================
// 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.
// 
// ===========================================================

#include "lcddrv_lcd_send_cmd.h"
#include "AESL_pkg.h"

using namespace std;

namespace ap_rtl {

const sc_logic lcddrv_lcd_send_cmd::ap_const_logic_1 = sc_dt::Log_1;
const sc_logic lcddrv_lcd_send_cmd::ap_const_logic_0 = sc_dt::Log_0;
const sc_lv<9> lcddrv_lcd_send_cmd::ap_ST_st1_fsm_0 = "1";
const sc_lv<9> lcddrv_lcd_send_cmd::ap_ST_st2_fsm_1 = "10";
const sc_lv<9> lcddrv_lcd_send_cmd::ap_ST_st3_fsm_2 = "100";
const sc_lv<9> lcddrv_lcd_send_cmd::ap_ST_st4_fsm_3 = "1000";
const sc_lv<9> lcddrv_lcd_send_cmd::ap_ST_st5_fsm_4 = "10000";
const sc_lv<9> lcddrv_lcd_send_cmd::ap_ST_st6_fsm_5 = "100000";
const sc_lv<9> lcddrv_lcd_send_cmd::ap_ST_st7_fsm_6 = "1000000";
const sc_lv<9> lcddrv_lcd_send_cmd::ap_ST_st8_fsm_7 = "10000000";
const sc_lv<9> lcddrv_lcd_send_cmd::ap_ST_st9_fsm_8 = "100000000";
const sc_lv<32> lcddrv_lcd_send_cmd::ap_const_lv32_0 = "00000000000000000000000000000000";
const sc_lv<1> lcddrv_lcd_send_cmd::ap_const_lv1_1 = "1";
const sc_lv<32> lcddrv_lcd_send_cmd::ap_const_lv32_1 = "1";
const sc_lv<32> lcddrv_lcd_send_cmd::ap_const_lv32_3 = "11";
const sc_lv<32> lcddrv_lcd_send_cmd::ap_const_lv32_5 = "101";
const sc_lv<32> lcddrv_lcd_send_cmd::ap_const_lv32_7 = "111";
const sc_lv<25> lcddrv_lcd_send_cmd::ap_const_lv25_3E8 = "1111101000";
const sc_lv<32> lcddrv_lcd_send_cmd::ap_const_lv32_2 = "10";
const sc_lv<32> lcddrv_lcd_send_cmd::ap_const_lv32_4 = "100";
const sc_lv<32> lcddrv_lcd_send_cmd::ap_const_lv32_6 = "110";
const sc_lv<32> lcddrv_lcd_send_cmd::ap_const_lv32_8 = "1000";
const sc_lv<1> lcddrv_lcd_send_cmd::ap_const_lv1_0 = "0";

lcddrv_lcd_send_cmd::lcddrv_lcd_send_cmd(sc_module_name name) : sc_module(name), mVcdFile(0) {
    grp_lcddrv_wait_tmr_fu_67 = new lcddrv_wait_tmr("grp_lcddrv_wait_tmr_fu_67");
    grp_lcddrv_wait_tmr_fu_67->ap_clk(ap_clk);
    grp_lcddrv_wait_tmr_fu_67->ap_rst(ap_rst);
    grp_lcddrv_wait_tmr_fu_67->ap_start(grp_lcddrv_wait_tmr_fu_67_ap_start);
    grp_lcddrv_wait_tmr_fu_67->ap_done(grp_lcddrv_wait_tmr_fu_67_ap_done);
    grp_lcddrv_wait_tmr_fu_67->ap_idle(grp_lcddrv_wait_tmr_fu_67_ap_idle);
    grp_lcddrv_wait_tmr_fu_67->ap_ready(grp_lcddrv_wait_tmr_fu_67_ap_ready);
    grp_lcddrv_wait_tmr_fu_67->tmr(ap_var_for_const0);
    grp_lcddrv_wait_tmr_fu_67->dummy_tmr_out_i(dummy_tmr_out_i);
    grp_lcddrv_wait_tmr_fu_67->dummy_tmr_out_o(grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o);
    grp_lcddrv_wait_tmr_fu_67->dummy_tmr_out_o_ap_vld(grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o_ap_vld);

    SC_METHOD(thread_ap_clk_no_reset_);
    dont_initialize();
    sensitive << ( ap_clk.pos() );

    SC_METHOD(thread_ap_done);
    sensitive << ( ap_start );
    sensitive << ( ap_sig_cseq_ST_st1_fsm_0 );
    sensitive << ( grp_lcddrv_wait_tmr_fu_67_ap_done );
    sensitive << ( ap_sig_cseq_ST_st9_fsm_8 );

    SC_METHOD(thread_ap_idle);
    sensitive << ( ap_start );
    sensitive << ( ap_sig_cseq_ST_st1_fsm_0 );

    SC_METHOD(thread_ap_ready);
    sensitive << ( grp_lcddrv_wait_tmr_fu_67_ap_done );
    sensitive << ( ap_sig_cseq_ST_st9_fsm_8 );

    SC_METHOD(thread_ap_sig_105);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_113);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_121);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_26);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_66);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_73);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_81);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_89);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_98);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_cseq_ST_st1_fsm_0);
    sensitive << ( ap_sig_26 );

    SC_METHOD(thread_ap_sig_cseq_ST_st2_fsm_1);
    sensitive << ( ap_sig_66 );

    SC_METHOD(thread_ap_sig_cseq_ST_st3_fsm_2);
    sensitive << ( ap_sig_98 );

    SC_METHOD(thread_ap_sig_cseq_ST_st4_fsm_3);
    sensitive << ( ap_sig_73 );

    SC_METHOD(thread_ap_sig_cseq_ST_st5_fsm_4);
    sensitive << ( ap_sig_105 );

    SC_METHOD(thread_ap_sig_cseq_ST_st6_fsm_5);
    sensitive << ( ap_sig_81 );

    SC_METHOD(thread_ap_sig_cseq_ST_st7_fsm_6);
    sensitive << ( ap_sig_113 );

    SC_METHOD(thread_ap_sig_cseq_ST_st8_fsm_7);
    sensitive << ( ap_sig_89 );

    SC_METHOD(thread_ap_sig_cseq_ST_st9_fsm_8);
    sensitive << ( ap_sig_121 );

    SC_METHOD(thread_data);
    sensitive << ( wd );
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );

    SC_METHOD(thread_data_ap_vld);
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );

    SC_METHOD(thread_dummy_tmr_out_o);
    sensitive << ( dummy_tmr_out_i );
    sensitive << ( grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o );
    sensitive << ( grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o_ap_vld );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );
    sensitive << ( ap_sig_cseq_ST_st5_fsm_4 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_6 );
    sensitive << ( ap_sig_cseq_ST_st9_fsm_8 );

    SC_METHOD(thread_dummy_tmr_out_o_ap_vld);
    sensitive << ( grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o_ap_vld );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );
    sensitive << ( ap_sig_cseq_ST_st5_fsm_4 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_6 );
    sensitive << ( ap_sig_cseq_ST_st9_fsm_8 );

    SC_METHOD(thread_en);
    sensitive << ( ap_sig_cseq_ST_st2_fsm_1 );
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );

    SC_METHOD(thread_en_ap_vld);
    sensitive << ( ap_sig_cseq_ST_st2_fsm_1 );
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );

    SC_METHOD(thread_grp_lcddrv_wait_tmr_fu_67_ap_start);
    sensitive << ( ap_reg_grp_lcddrv_wait_tmr_fu_67_ap_start );

    SC_METHOD(thread_rs);
    sensitive << ( mode );
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );

    SC_METHOD(thread_rs_ap_vld);
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );

    SC_METHOD(thread_ap_NS_fsm);
    sensitive << ( ap_start );
    sensitive << ( ap_CS_fsm );
    sensitive << ( grp_lcddrv_wait_tmr_fu_67_ap_done );

    SC_THREAD(thread_ap_var_for_const0);

    ap_CS_fsm = "000000001";
    ap_reg_grp_lcddrv_wait_tmr_fu_67_ap_start = SC_LOGIC_0;
    static int apTFileNum = 0;
    stringstream apTFilenSS;
    apTFilenSS << "lcddrv_lcd_send_cmd_sc_trace_" << apTFileNum ++;
    string apTFn = apTFilenSS.str();
    mVcdFile = sc_create_vcd_trace_file(apTFn.c_str());
    mVcdFile->set_time_unit(1, SC_PS);
    if (1) {
#ifdef __HLS_TRACE_LEVEL_PORT_HIER__
    sc_trace(mVcdFile, ap_clk, "(port)ap_clk");
    sc_trace(mVcdFile, ap_rst, "(port)ap_rst");
    sc_trace(mVcdFile, ap_start, "(port)ap_start");
    sc_trace(mVcdFile, ap_done, "(port)ap_done");
    sc_trace(mVcdFile, ap_idle, "(port)ap_idle");
    sc_trace(mVcdFile, ap_ready, "(port)ap_ready");
    sc_trace(mVcdFile, mode, "(port)mode");
    sc_trace(mVcdFile, wd, "(port)wd");
    sc_trace(mVcdFile, en, "(port)en");
    sc_trace(mVcdFile, en_ap_vld, "(port)en_ap_vld");
    sc_trace(mVcdFile, dummy_tmr_out_i, "(port)dummy_tmr_out_i");
    sc_trace(mVcdFile, dummy_tmr_out_o, "(port)dummy_tmr_out_o");
    sc_trace(mVcdFile, dummy_tmr_out_o_ap_vld, "(port)dummy_tmr_out_o_ap_vld");
    sc_trace(mVcdFile, rs, "(port)rs");
    sc_trace(mVcdFile, rs_ap_vld, "(port)rs_ap_vld");
    sc_trace(mVcdFile, data, "(port)data");
    sc_trace(mVcdFile, data_ap_vld, "(port)data_ap_vld");
#endif
#ifdef __HLS_TRACE_LEVEL_INT__
    sc_trace(mVcdFile, ap_CS_fsm, "ap_CS_fsm");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st1_fsm_0, "ap_sig_cseq_ST_st1_fsm_0");
    sc_trace(mVcdFile, ap_sig_26, "ap_sig_26");
    sc_trace(mVcdFile, grp_lcddrv_wait_tmr_fu_67_ap_start, "grp_lcddrv_wait_tmr_fu_67_ap_start");
    sc_trace(mVcdFile, grp_lcddrv_wait_tmr_fu_67_ap_done, "grp_lcddrv_wait_tmr_fu_67_ap_done");
    sc_trace(mVcdFile, grp_lcddrv_wait_tmr_fu_67_ap_idle, "grp_lcddrv_wait_tmr_fu_67_ap_idle");
    sc_trace(mVcdFile, grp_lcddrv_wait_tmr_fu_67_ap_ready, "grp_lcddrv_wait_tmr_fu_67_ap_ready");
    sc_trace(mVcdFile, grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o, "grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o");
    sc_trace(mVcdFile, grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o_ap_vld, "grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o_ap_vld");
    sc_trace(mVcdFile, ap_reg_grp_lcddrv_wait_tmr_fu_67_ap_start, "ap_reg_grp_lcddrv_wait_tmr_fu_67_ap_start");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st2_fsm_1, "ap_sig_cseq_ST_st2_fsm_1");
    sc_trace(mVcdFile, ap_sig_66, "ap_sig_66");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st4_fsm_3, "ap_sig_cseq_ST_st4_fsm_3");
    sc_trace(mVcdFile, ap_sig_73, "ap_sig_73");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st6_fsm_5, "ap_sig_cseq_ST_st6_fsm_5");
    sc_trace(mVcdFile, ap_sig_81, "ap_sig_81");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st8_fsm_7, "ap_sig_cseq_ST_st8_fsm_7");
    sc_trace(mVcdFile, ap_sig_89, "ap_sig_89");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st3_fsm_2, "ap_sig_cseq_ST_st3_fsm_2");
    sc_trace(mVcdFile, ap_sig_98, "ap_sig_98");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st5_fsm_4, "ap_sig_cseq_ST_st5_fsm_4");
    sc_trace(mVcdFile, ap_sig_105, "ap_sig_105");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st7_fsm_6, "ap_sig_cseq_ST_st7_fsm_6");
    sc_trace(mVcdFile, ap_sig_113, "ap_sig_113");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st9_fsm_8, "ap_sig_cseq_ST_st9_fsm_8");
    sc_trace(mVcdFile, ap_sig_121, "ap_sig_121");
    sc_trace(mVcdFile, ap_NS_fsm, "ap_NS_fsm");
#endif

    }
}

lcddrv_lcd_send_cmd::~lcddrv_lcd_send_cmd() {
    if (mVcdFile) 
        sc_close_vcd_trace_file(mVcdFile);

    delete grp_lcddrv_wait_tmr_fu_67;
}

void lcddrv_lcd_send_cmd::thread_ap_var_for_const0() {
    ap_var_for_const0 = ap_const_lv25_3E8;
}

void lcddrv_lcd_send_cmd::thread_ap_clk_no_reset_() {
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_CS_fsm = ap_ST_st1_fsm_0;
    } else {
        ap_CS_fsm = ap_NS_fsm.read();
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_reg_grp_lcddrv_wait_tmr_fu_67_ap_start = ap_const_logic_0;
    } else {
        if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st2_fsm_1.read()) || 
             esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read()) || 
             esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read()) || 
             esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_7.read()))) {
            ap_reg_grp_lcddrv_wait_tmr_fu_67_ap_start = ap_const_logic_1;
        } else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_lcddrv_wait_tmr_fu_67_ap_ready.read())) {
            ap_reg_grp_lcddrv_wait_tmr_fu_67_ap_start = ap_const_logic_0;
        }
    }
}

void lcddrv_lcd_send_cmd::thread_ap_done() {
    if (((esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && 
          esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) || 
         (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st9_fsm_8.read()) && 
          !esl_seteq<1,1,1>(ap_const_logic_0, grp_lcddrv_wait_tmr_fu_67_ap_done.read())))) {
        ap_done = ap_const_logic_1;
    } else {
        ap_done = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_idle() {
    if ((esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()))) {
        ap_idle = ap_const_logic_1;
    } else {
        ap_idle = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_ready() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st9_fsm_8.read()) && 
         !esl_seteq<1,1,1>(ap_const_logic_0, grp_lcddrv_wait_tmr_fu_67_ap_done.read()))) {
        ap_ready = ap_const_logic_1;
    } else {
        ap_ready = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_sig_105() {
    ap_sig_105 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(4, 4));
}

void lcddrv_lcd_send_cmd::thread_ap_sig_113() {
    ap_sig_113 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(6, 6));
}

void lcddrv_lcd_send_cmd::thread_ap_sig_121() {
    ap_sig_121 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(8, 8));
}

void lcddrv_lcd_send_cmd::thread_ap_sig_26() {
    ap_sig_26 = esl_seteq<1,1,1>(ap_CS_fsm.read().range(0, 0), ap_const_lv1_1);
}

void lcddrv_lcd_send_cmd::thread_ap_sig_66() {
    ap_sig_66 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(1, 1));
}

void lcddrv_lcd_send_cmd::thread_ap_sig_73() {
    ap_sig_73 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(3, 3));
}

void lcddrv_lcd_send_cmd::thread_ap_sig_81() {
    ap_sig_81 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(5, 5));
}

void lcddrv_lcd_send_cmd::thread_ap_sig_89() {
    ap_sig_89 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(7, 7));
}

void lcddrv_lcd_send_cmd::thread_ap_sig_98() {
    ap_sig_98 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(2, 2));
}

void lcddrv_lcd_send_cmd::thread_ap_sig_cseq_ST_st1_fsm_0() {
    if (ap_sig_26.read()) {
        ap_sig_cseq_ST_st1_fsm_0 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st1_fsm_0 = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_sig_cseq_ST_st2_fsm_1() {
    if (ap_sig_66.read()) {
        ap_sig_cseq_ST_st2_fsm_1 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st2_fsm_1 = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_sig_cseq_ST_st3_fsm_2() {
    if (ap_sig_98.read()) {
        ap_sig_cseq_ST_st3_fsm_2 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st3_fsm_2 = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_sig_cseq_ST_st4_fsm_3() {
    if (ap_sig_73.read()) {
        ap_sig_cseq_ST_st4_fsm_3 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st4_fsm_3 = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_sig_cseq_ST_st5_fsm_4() {
    if (ap_sig_105.read()) {
        ap_sig_cseq_ST_st5_fsm_4 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st5_fsm_4 = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_sig_cseq_ST_st6_fsm_5() {
    if (ap_sig_81.read()) {
        ap_sig_cseq_ST_st6_fsm_5 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st6_fsm_5 = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_sig_cseq_ST_st7_fsm_6() {
    if (ap_sig_113.read()) {
        ap_sig_cseq_ST_st7_fsm_6 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st7_fsm_6 = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_sig_cseq_ST_st8_fsm_7() {
    if (ap_sig_89.read()) {
        ap_sig_cseq_ST_st8_fsm_7 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st8_fsm_7 = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_sig_cseq_ST_st9_fsm_8() {
    if (ap_sig_121.read()) {
        ap_sig_cseq_ST_st9_fsm_8 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st9_fsm_8 = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_data() {
    data = wd.read();
}

void lcddrv_lcd_send_cmd::thread_data_ap_vld() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_7.read()))) {
        data_ap_vld = ap_const_logic_1;
    } else {
        data_ap_vld = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_dummy_tmr_out_o() {
    if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read()) && 
          esl_seteq<1,1,1>(ap_const_logic_1, grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o_ap_vld.read())) || 
         (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_4.read()) && 
          esl_seteq<1,1,1>(ap_const_logic_1, grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o_ap_vld.read())) || 
         (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_6.read()) && 
          esl_seteq<1,1,1>(ap_const_logic_1, grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o_ap_vld.read())) || 
         (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st9_fsm_8.read()) && 
          esl_seteq<1,1,1>(ap_const_logic_1, grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o_ap_vld.read())))) {
        dummy_tmr_out_o = grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o.read();
    } else {
        dummy_tmr_out_o = dummy_tmr_out_i.read();
    }
}

void lcddrv_lcd_send_cmd::thread_dummy_tmr_out_o_ap_vld() {
    dummy_tmr_out_o_ap_vld = grp_lcddrv_wait_tmr_fu_67_dummy_tmr_out_o_ap_vld.read();
}

void lcddrv_lcd_send_cmd::thread_en() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read())) {
        en = ap_const_lv1_1;
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st2_fsm_1.read()) || 
                esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read()) || 
                esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_7.read()))) {
        en = ap_const_lv1_0;
    } else {
        en = "X";
    }
}

void lcddrv_lcd_send_cmd::thread_en_ap_vld() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st2_fsm_1.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_7.read()))) {
        en_ap_vld = ap_const_logic_1;
    } else {
        en_ap_vld = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_grp_lcddrv_wait_tmr_fu_67_ap_start() {
    grp_lcddrv_wait_tmr_fu_67_ap_start = ap_reg_grp_lcddrv_wait_tmr_fu_67_ap_start.read();
}

void lcddrv_lcd_send_cmd::thread_rs() {
    rs = mode.read();
}

void lcddrv_lcd_send_cmd::thread_rs_ap_vld() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_7.read()))) {
        rs_ap_vld = ap_const_logic_1;
    } else {
        rs_ap_vld = ap_const_logic_0;
    }
}

void lcddrv_lcd_send_cmd::thread_ap_NS_fsm() {
    switch (ap_CS_fsm.read().to_uint64()) {
        case 1 : 
            if (!esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0)) {
                ap_NS_fsm = ap_ST_st2_fsm_1;
            } else {
                ap_NS_fsm = ap_ST_st1_fsm_0;
            }
            break;
        case 2 : 
            ap_NS_fsm = ap_ST_st3_fsm_2;
            break;
        case 4 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_lcddrv_wait_tmr_fu_67_ap_done.read())) {
                ap_NS_fsm = ap_ST_st4_fsm_3;
            } else {
                ap_NS_fsm = ap_ST_st3_fsm_2;
            }
            break;
        case 8 : 
            ap_NS_fsm = ap_ST_st5_fsm_4;
            break;
        case 16 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_lcddrv_wait_tmr_fu_67_ap_done.read())) {
                ap_NS_fsm = ap_ST_st6_fsm_5;
            } else {
                ap_NS_fsm = ap_ST_st5_fsm_4;
            }
            break;
        case 32 : 
            ap_NS_fsm = ap_ST_st7_fsm_6;
            break;
        case 64 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_lcddrv_wait_tmr_fu_67_ap_done.read())) {
                ap_NS_fsm = ap_ST_st8_fsm_7;
            } else {
                ap_NS_fsm = ap_ST_st7_fsm_6;
            }
            break;
        case 128 : 
            ap_NS_fsm = ap_ST_st9_fsm_8;
            break;
        case 256 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_lcddrv_wait_tmr_fu_67_ap_done.read())) {
                ap_NS_fsm = ap_ST_st1_fsm_0;
            } else {
                ap_NS_fsm = ap_ST_st9_fsm_8;
            }
            break;
        default : 
            ap_NS_fsm =  (sc_lv<9>) ("XXXXXXXXX");
            break;
    }
}

}

