#include "dct.h"
#include "AESL_pkg.h"

using namespace std;

namespace ap_rtl {

const sc_logic dct::ap_const_logic_1 = sc_dt::Log_1;
const sc_logic dct::ap_const_logic_0 = sc_dt::Log_0;
const sc_lv<6> dct::ap_ST_st1_fsm_0 = "1";
const sc_lv<6> dct::ap_ST_pp0_stg0_fsm_1 = "10";
const sc_lv<6> dct::ap_ST_st4_fsm_2 = "100";
const sc_lv<6> dct::ap_ST_st5_fsm_3 = "1000";
const sc_lv<6> dct::ap_ST_pp1_stg0_fsm_4 = "10000";
const sc_lv<6> dct::ap_ST_st8_fsm_5 = "100000";
const sc_lv<32> dct::ap_const_lv32_0 = "00000000000000000000000000000000";
const sc_lv<1> dct::ap_const_lv1_1 = "1";
const sc_lv<32> dct::ap_const_lv32_1 = "1";
const sc_lv<1> dct::ap_const_lv1_0 = "0";
const sc_lv<32> dct::ap_const_lv32_4 = "100";
const sc_lv<32> dct::ap_const_lv32_3 = "11";
const sc_lv<7> dct::ap_const_lv7_0 = "0000000";
const sc_lv<4> dct::ap_const_lv4_0 = "0000";
const sc_lv<32> dct::ap_const_lv32_2 = "10";
const sc_lv<7> dct::ap_const_lv7_40 = "1000000";
const sc_lv<7> dct::ap_const_lv7_1 = "1";
const sc_lv<4> dct::ap_const_lv4_8 = "1000";
const sc_lv<4> dct::ap_const_lv4_1 = "1";
const sc_lv<3> dct::ap_const_lv3_0 = "000";
const sc_lv<32> dct::ap_const_lv32_5 = "101";

dct::dct(sc_module_name name) : sc_module(name), mVcdFile(0) {
    buf_2d_in_U = new dct_dct_2d_row_outbuf("buf_2d_in_U");
    buf_2d_in_U->clk(ap_clk);
    buf_2d_in_U->reset(ap_rst);
    buf_2d_in_U->address0(buf_2d_in_address0);
    buf_2d_in_U->ce0(buf_2d_in_ce0);
    buf_2d_in_U->we0(buf_2d_in_we0);
    buf_2d_in_U->d0(buf_2d_in_d0);
    buf_2d_in_U->q0(buf_2d_in_q0);
    buf_2d_out_U = new dct_dct_2d_row_outbuf("buf_2d_out_U");
    buf_2d_out_U->clk(ap_clk);
    buf_2d_out_U->reset(ap_rst);
    buf_2d_out_U->address0(buf_2d_out_address0);
    buf_2d_out_U->ce0(buf_2d_out_ce0);
    buf_2d_out_U->we0(buf_2d_out_we0);
    buf_2d_out_U->d0(buf_2d_out_d0);
    buf_2d_out_U->q0(buf_2d_out_q0);
    grp_dct_dct_2d_fu_184 = new dct_dct_2d("grp_dct_dct_2d_fu_184");
    grp_dct_dct_2d_fu_184->ap_clk(ap_clk);
    grp_dct_dct_2d_fu_184->ap_rst(ap_rst);
    grp_dct_dct_2d_fu_184->ap_start(grp_dct_dct_2d_fu_184_ap_start);
    grp_dct_dct_2d_fu_184->ap_done(grp_dct_dct_2d_fu_184_ap_done);
    grp_dct_dct_2d_fu_184->ap_idle(grp_dct_dct_2d_fu_184_ap_idle);
    grp_dct_dct_2d_fu_184->ap_ready(grp_dct_dct_2d_fu_184_ap_ready);
    grp_dct_dct_2d_fu_184->in_block_address0(grp_dct_dct_2d_fu_184_in_block_address0);
    grp_dct_dct_2d_fu_184->in_block_ce0(grp_dct_dct_2d_fu_184_in_block_ce0);
    grp_dct_dct_2d_fu_184->in_block_q0(grp_dct_dct_2d_fu_184_in_block_q0);
    grp_dct_dct_2d_fu_184->out_block_address0(grp_dct_dct_2d_fu_184_out_block_address0);
    grp_dct_dct_2d_fu_184->out_block_ce0(grp_dct_dct_2d_fu_184_out_block_ce0);
    grp_dct_dct_2d_fu_184->out_block_we0(grp_dct_dct_2d_fu_184_out_block_we0);
    grp_dct_dct_2d_fu_184->out_block_d0(grp_dct_dct_2d_fu_184_out_block_d0);

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

    SC_METHOD(thread_ap_done);
    sensitive << ( ap_sig_cseq_ST_st8_fsm_5 );

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

    SC_METHOD(thread_ap_ready);
    sensitive << ( ap_sig_cseq_ST_st8_fsm_5 );

    SC_METHOD(thread_ap_sig_bdd_120);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_181);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_22);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_323);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_61);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_89);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_cseq_ST_pp0_stg0_fsm_1);
    sensitive << ( ap_sig_bdd_61 );

    SC_METHOD(thread_ap_sig_cseq_ST_pp1_stg0_fsm_4);
    sensitive << ( ap_sig_bdd_89 );

    SC_METHOD(thread_ap_sig_cseq_ST_st1_fsm_0);
    sensitive << ( ap_sig_bdd_22 );

    SC_METHOD(thread_ap_sig_cseq_ST_st4_fsm_2);
    sensitive << ( ap_sig_bdd_181 );

    SC_METHOD(thread_ap_sig_cseq_ST_st5_fsm_3);
    sensitive << ( ap_sig_bdd_120 );

    SC_METHOD(thread_ap_sig_cseq_ST_st8_fsm_5);
    sensitive << ( ap_sig_bdd_323 );

    SC_METHOD(thread_buf_2d_in_address0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_in_block_address0 );
    sensitive << ( tmp_2_fu_285_p1 );

    SC_METHOD(thread_buf_2d_in_ce0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_in_block_ce0 );

    SC_METHOD(thread_buf_2d_in_d0);
    sensitive << ( input_r_q0 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );

    SC_METHOD(thread_buf_2d_in_we0);
    sensitive << ( exitcond_flatten_reg_389 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );

    SC_METHOD(thread_buf_2d_out_address0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_out_block_address0 );
    sensitive << ( tmp_5_fu_368_p1 );

    SC_METHOD(thread_buf_2d_out_ce0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_out_block_ce0 );

    SC_METHOD(thread_buf_2d_out_d0);
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_out_block_d0 );

    SC_METHOD(thread_buf_2d_out_we0);
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_out_block_we0 );

    SC_METHOD(thread_c_1_fu_379_p2);
    sensitive << ( c_i6_mid2_fu_308_p3 );

    SC_METHOD(thread_c_fu_259_p2);
    sensitive << ( c_i_mid2_fu_210_p3 );

    SC_METHOD(thread_c_i6_cast2_fu_342_p1);
    sensitive << ( c_i6_mid2_fu_308_p3 );

    SC_METHOD(thread_c_i6_mid2_fu_308_p3);
    sensitive << ( c_i6_reg_173 );
    sensitive << ( exitcond_i1_fu_302_p2 );

    SC_METHOD(thread_c_i_cast6_fu_244_p1);
    sensitive << ( c_i_mid2_fu_210_p3 );

    SC_METHOD(thread_c_i_mid2_fu_210_p3);
    sensitive << ( c_i_reg_140 );
    sensitive << ( exitcond_i_fu_204_p2 );

    SC_METHOD(thread_exitcond_flatten1_fu_290_p2);
    sensitive << ( indvar_flatten1_reg_151 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );

    SC_METHOD(thread_exitcond_flatten_fu_192_p2);
    sensitive << ( indvar_flatten_reg_118 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );

    SC_METHOD(thread_exitcond_i1_fu_302_p2);
    sensitive << ( c_i6_reg_173 );
    sensitive << ( exitcond_flatten1_fu_290_p2 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );

    SC_METHOD(thread_exitcond_i_fu_204_p2);
    sensitive << ( c_i_reg_140 );
    sensitive << ( exitcond_flatten_fu_192_p2 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );

    SC_METHOD(thread_grp_dct_dct_2d_fu_184_ap_start);
    sensitive << ( grp_dct_dct_2d_fu_184_ap_start_ap_start_reg );

    SC_METHOD(thread_grp_dct_dct_2d_fu_184_in_block_q0);
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( buf_2d_in_q0 );

    SC_METHOD(thread_indvar_flatten_next1_fu_296_p2);
    sensitive << ( indvar_flatten1_reg_151 );

    SC_METHOD(thread_indvar_flatten_next_fu_198_p2);
    sensitive << ( indvar_flatten_reg_118 );

    SC_METHOD(thread_input_r_address0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );
    sensitive << ( tmp_6_i_fu_254_p1 );

    SC_METHOD(thread_input_r_ce0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );

    SC_METHOD(thread_output_r_address0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );
    sensitive << ( tmp_3_i_fu_385_p1 );

    SC_METHOD(thread_output_r_ce0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );

    SC_METHOD(thread_output_r_d0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );
    sensitive << ( buf_2d_out_q0 );

    SC_METHOD(thread_output_r_we0);
    sensitive << ( exitcond_flatten1_reg_419 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );

    SC_METHOD(thread_p_addr1_fu_279_p2);
    sensitive << ( p_addr_cast_fu_275_p1 );
    sensitive << ( tmp_7_i_trn_cast_fu_265_p1 );

    SC_METHOD(thread_p_addr2_cast_fu_358_p1);
    sensitive << ( tmp_4_fu_350_p3 );

    SC_METHOD(thread_p_addr3_fu_362_p2);
    sensitive << ( p_addr2_cast_fu_358_p1 );
    sensitive << ( tmp_8_i_trn_cast_fu_346_p1 );

    SC_METHOD(thread_p_addr_cast_fu_275_p1);
    sensitive << ( tmp_1_fu_268_p3 );

    SC_METHOD(thread_r_fu_218_p2);
    sensitive << ( r_i_phi_fu_133_p4 );

    SC_METHOD(thread_r_i2_mid2_fu_322_p3);
    sensitive << ( r_i2_phi_fu_166_p4 );
    sensitive << ( exitcond_i1_fu_302_p2 );
    sensitive << ( r_s_fu_316_p2 );

    SC_METHOD(thread_r_i2_phi_fu_166_p4);
    sensitive << ( r_i2_reg_162 );
    sensitive << ( exitcond_flatten1_reg_419 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );
    sensitive << ( r_i2_mid2_reg_428 );

    SC_METHOD(thread_r_i_mid2_fu_224_p3);
    sensitive << ( r_i_phi_fu_133_p4 );
    sensitive << ( exitcond_i_fu_204_p2 );
    sensitive << ( r_fu_218_p2 );

    SC_METHOD(thread_r_i_phi_fu_133_p4);
    sensitive << ( r_i_reg_129 );
    sensitive << ( exitcond_flatten_reg_389 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );
    sensitive << ( r_i_mid2_reg_403 );

    SC_METHOD(thread_r_s_fu_316_p2);
    sensitive << ( r_i2_phi_fu_166_p4 );

    SC_METHOD(thread_tmp_1_fu_268_p3);
    sensitive << ( r_i_mid2_reg_403 );

    SC_METHOD(thread_tmp_2_fu_285_p1);
    sensitive << ( p_addr1_fu_279_p2 );

    SC_METHOD(thread_tmp_3_fu_330_p1);
    sensitive << ( r_i2_mid2_fu_322_p3 );

    SC_METHOD(thread_tmp_3_i_fu_385_p1);
    sensitive << ( tmp_9_i_reg_438 );

    SC_METHOD(thread_tmp_4_fu_350_p3);
    sensitive << ( r_i2_mid2_fu_322_p3 );

    SC_METHOD(thread_tmp_5_fu_368_p1);
    sensitive << ( p_addr3_fu_362_p2 );

    SC_METHOD(thread_tmp_5_i_fu_248_p2);
    sensitive << ( c_i_cast6_fu_244_p1 );
    sensitive << ( tmp_i_fu_236_p3 );

    SC_METHOD(thread_tmp_6_i_fu_254_p1);
    sensitive << ( tmp_5_i_fu_248_p2 );

    SC_METHOD(thread_tmp_7_i_trn_cast_fu_265_p1);
    sensitive << ( c_i_mid2_reg_398 );

    SC_METHOD(thread_tmp_8_i_trn_cast_fu_346_p1);
    sensitive << ( c_i6_mid2_fu_308_p3 );

    SC_METHOD(thread_tmp_9_i_fu_373_p2);
    sensitive << ( c_i6_cast2_fu_342_p1 );
    sensitive << ( tmp_i5_fu_334_p3 );

    SC_METHOD(thread_tmp_fu_232_p1);
    sensitive << ( r_i_mid2_fu_224_p3 );

    SC_METHOD(thread_tmp_i5_fu_334_p3);
    sensitive << ( tmp_3_fu_330_p1 );

    SC_METHOD(thread_tmp_i_fu_236_p3);
    sensitive << ( tmp_fu_232_p1 );

    SC_METHOD(thread_ap_NS_fsm);
    sensitive << ( ap_start );
    sensitive << ( ap_CS_fsm );
    sensitive << ( exitcond_flatten_fu_192_p2 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );
    sensitive << ( exitcond_flatten1_fu_290_p2 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );
    sensitive << ( grp_dct_dct_2d_fu_184_ap_done );

    SC_THREAD(thread_hdltv_gen);
    sensitive << ( ap_clk.pos() );

    ap_CS_fsm = "000001";
    ap_reg_ppiten_pp0_it0 = SC_LOGIC_0;
    ap_reg_ppiten_pp0_it1 = SC_LOGIC_0;
    ap_reg_ppiten_pp1_it0 = SC_LOGIC_0;
    ap_reg_ppiten_pp1_it1 = SC_LOGIC_0;
    grp_dct_dct_2d_fu_184_ap_start_ap_start_reg = SC_LOGIC_0;
    static int apTFileNum = 0;
    stringstream apTFilenSS;
    apTFilenSS << "dct_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__
    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, input_r_address0, "(port)input_r_address0");
    sc_trace(mVcdFile, input_r_ce0, "(port)input_r_ce0");
    sc_trace(mVcdFile, input_r_q0, "(port)input_r_q0");
    sc_trace(mVcdFile, output_r_address0, "(port)output_r_address0");
    sc_trace(mVcdFile, output_r_ce0, "(port)output_r_ce0");
    sc_trace(mVcdFile, output_r_we0, "(port)output_r_we0");
    sc_trace(mVcdFile, output_r_d0, "(port)output_r_d0");
#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_bdd_22, "ap_sig_bdd_22");
    sc_trace(mVcdFile, indvar_flatten_reg_118, "indvar_flatten_reg_118");
    sc_trace(mVcdFile, r_i_reg_129, "r_i_reg_129");
    sc_trace(mVcdFile, c_i_reg_140, "c_i_reg_140");
    sc_trace(mVcdFile, indvar_flatten1_reg_151, "indvar_flatten1_reg_151");
    sc_trace(mVcdFile, r_i2_reg_162, "r_i2_reg_162");
    sc_trace(mVcdFile, c_i6_reg_173, "c_i6_reg_173");
    sc_trace(mVcdFile, exitcond_flatten_fu_192_p2, "exitcond_flatten_fu_192_p2");
    sc_trace(mVcdFile, exitcond_flatten_reg_389, "exitcond_flatten_reg_389");
    sc_trace(mVcdFile, ap_sig_cseq_ST_pp0_stg0_fsm_1, "ap_sig_cseq_ST_pp0_stg0_fsm_1");
    sc_trace(mVcdFile, ap_sig_bdd_61, "ap_sig_bdd_61");
    sc_trace(mVcdFile, ap_reg_ppiten_pp0_it0, "ap_reg_ppiten_pp0_it0");
    sc_trace(mVcdFile, ap_reg_ppiten_pp0_it1, "ap_reg_ppiten_pp0_it1");
    sc_trace(mVcdFile, indvar_flatten_next_fu_198_p2, "indvar_flatten_next_fu_198_p2");
    sc_trace(mVcdFile, c_i_mid2_fu_210_p3, "c_i_mid2_fu_210_p3");
    sc_trace(mVcdFile, c_i_mid2_reg_398, "c_i_mid2_reg_398");
    sc_trace(mVcdFile, r_i_mid2_fu_224_p3, "r_i_mid2_fu_224_p3");
    sc_trace(mVcdFile, r_i_mid2_reg_403, "r_i_mid2_reg_403");
    sc_trace(mVcdFile, c_fu_259_p2, "c_fu_259_p2");
    sc_trace(mVcdFile, exitcond_flatten1_fu_290_p2, "exitcond_flatten1_fu_290_p2");
    sc_trace(mVcdFile, exitcond_flatten1_reg_419, "exitcond_flatten1_reg_419");
    sc_trace(mVcdFile, ap_sig_cseq_ST_pp1_stg0_fsm_4, "ap_sig_cseq_ST_pp1_stg0_fsm_4");
    sc_trace(mVcdFile, ap_sig_bdd_89, "ap_sig_bdd_89");
    sc_trace(mVcdFile, ap_reg_ppiten_pp1_it0, "ap_reg_ppiten_pp1_it0");
    sc_trace(mVcdFile, ap_reg_ppiten_pp1_it1, "ap_reg_ppiten_pp1_it1");
    sc_trace(mVcdFile, indvar_flatten_next1_fu_296_p2, "indvar_flatten_next1_fu_296_p2");
    sc_trace(mVcdFile, r_i2_mid2_fu_322_p3, "r_i2_mid2_fu_322_p3");
    sc_trace(mVcdFile, r_i2_mid2_reg_428, "r_i2_mid2_reg_428");
    sc_trace(mVcdFile, tmp_9_i_fu_373_p2, "tmp_9_i_fu_373_p2");
    sc_trace(mVcdFile, tmp_9_i_reg_438, "tmp_9_i_reg_438");
    sc_trace(mVcdFile, c_1_fu_379_p2, "c_1_fu_379_p2");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st5_fsm_3, "ap_sig_cseq_ST_st5_fsm_3");
    sc_trace(mVcdFile, ap_sig_bdd_120, "ap_sig_bdd_120");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_ap_done, "grp_dct_dct_2d_fu_184_ap_done");
    sc_trace(mVcdFile, buf_2d_in_address0, "buf_2d_in_address0");
    sc_trace(mVcdFile, buf_2d_in_ce0, "buf_2d_in_ce0");
    sc_trace(mVcdFile, buf_2d_in_we0, "buf_2d_in_we0");
    sc_trace(mVcdFile, buf_2d_in_d0, "buf_2d_in_d0");
    sc_trace(mVcdFile, buf_2d_in_q0, "buf_2d_in_q0");
    sc_trace(mVcdFile, buf_2d_out_address0, "buf_2d_out_address0");
    sc_trace(mVcdFile, buf_2d_out_ce0, "buf_2d_out_ce0");
    sc_trace(mVcdFile, buf_2d_out_we0, "buf_2d_out_we0");
    sc_trace(mVcdFile, buf_2d_out_d0, "buf_2d_out_d0");
    sc_trace(mVcdFile, buf_2d_out_q0, "buf_2d_out_q0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_ap_start, "grp_dct_dct_2d_fu_184_ap_start");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_ap_idle, "grp_dct_dct_2d_fu_184_ap_idle");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_ap_ready, "grp_dct_dct_2d_fu_184_ap_ready");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_in_block_address0, "grp_dct_dct_2d_fu_184_in_block_address0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_in_block_ce0, "grp_dct_dct_2d_fu_184_in_block_ce0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_in_block_q0, "grp_dct_dct_2d_fu_184_in_block_q0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_out_block_address0, "grp_dct_dct_2d_fu_184_out_block_address0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_out_block_ce0, "grp_dct_dct_2d_fu_184_out_block_ce0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_out_block_we0, "grp_dct_dct_2d_fu_184_out_block_we0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_out_block_d0, "grp_dct_dct_2d_fu_184_out_block_d0");
    sc_trace(mVcdFile, r_i_phi_fu_133_p4, "r_i_phi_fu_133_p4");
    sc_trace(mVcdFile, r_i2_phi_fu_166_p4, "r_i2_phi_fu_166_p4");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_ap_start_ap_start_reg, "grp_dct_dct_2d_fu_184_ap_start_ap_start_reg");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st4_fsm_2, "ap_sig_cseq_ST_st4_fsm_2");
    sc_trace(mVcdFile, ap_sig_bdd_181, "ap_sig_bdd_181");
    sc_trace(mVcdFile, tmp_6_i_fu_254_p1, "tmp_6_i_fu_254_p1");
    sc_trace(mVcdFile, tmp_2_fu_285_p1, "tmp_2_fu_285_p1");
    sc_trace(mVcdFile, tmp_5_fu_368_p1, "tmp_5_fu_368_p1");
    sc_trace(mVcdFile, tmp_3_i_fu_385_p1, "tmp_3_i_fu_385_p1");
    sc_trace(mVcdFile, exitcond_i_fu_204_p2, "exitcond_i_fu_204_p2");
    sc_trace(mVcdFile, r_fu_218_p2, "r_fu_218_p2");
    sc_trace(mVcdFile, tmp_fu_232_p1, "tmp_fu_232_p1");
    sc_trace(mVcdFile, c_i_cast6_fu_244_p1, "c_i_cast6_fu_244_p1");
    sc_trace(mVcdFile, tmp_i_fu_236_p3, "tmp_i_fu_236_p3");
    sc_trace(mVcdFile, tmp_5_i_fu_248_p2, "tmp_5_i_fu_248_p2");
    sc_trace(mVcdFile, tmp_1_fu_268_p3, "tmp_1_fu_268_p3");
    sc_trace(mVcdFile, p_addr_cast_fu_275_p1, "p_addr_cast_fu_275_p1");
    sc_trace(mVcdFile, tmp_7_i_trn_cast_fu_265_p1, "tmp_7_i_trn_cast_fu_265_p1");
    sc_trace(mVcdFile, p_addr1_fu_279_p2, "p_addr1_fu_279_p2");
    sc_trace(mVcdFile, exitcond_i1_fu_302_p2, "exitcond_i1_fu_302_p2");
    sc_trace(mVcdFile, r_s_fu_316_p2, "r_s_fu_316_p2");
    sc_trace(mVcdFile, tmp_3_fu_330_p1, "tmp_3_fu_330_p1");
    sc_trace(mVcdFile, c_i6_mid2_fu_308_p3, "c_i6_mid2_fu_308_p3");
    sc_trace(mVcdFile, tmp_4_fu_350_p3, "tmp_4_fu_350_p3");
    sc_trace(mVcdFile, p_addr2_cast_fu_358_p1, "p_addr2_cast_fu_358_p1");
    sc_trace(mVcdFile, tmp_8_i_trn_cast_fu_346_p1, "tmp_8_i_trn_cast_fu_346_p1");
    sc_trace(mVcdFile, p_addr3_fu_362_p2, "p_addr3_fu_362_p2");
    sc_trace(mVcdFile, c_i6_cast2_fu_342_p1, "c_i6_cast2_fu_342_p1");
    sc_trace(mVcdFile, tmp_i5_fu_334_p3, "tmp_i5_fu_334_p3");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st8_fsm_5, "ap_sig_cseq_ST_st8_fsm_5");
    sc_trace(mVcdFile, ap_sig_bdd_323, "ap_sig_bdd_323");
    sc_trace(mVcdFile, ap_NS_fsm, "ap_NS_fsm");
#endif

    }
    mHdltvinHandle.open("dct.hdltvin.dat");
    mHdltvoutHandle.open("dct.hdltvout.dat");
}

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

    mHdltvinHandle << "] " << endl;
    mHdltvoutHandle << "] " << endl;
    mHdltvinHandle.close();
    mHdltvoutHandle.close();
    delete buf_2d_in_U;
    delete buf_2d_out_U;
    delete grp_dct_dct_2d_fu_184;
}

void dct::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_ppiten_pp0_it0 = ap_const_logic_0;
    } else {
        if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
             !esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
            ap_reg_ppiten_pp0_it0 = ap_const_logic_0;
        } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()) && 
                    !esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0))) {
            ap_reg_ppiten_pp0_it0 = ap_const_logic_1;
        }
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_reg_ppiten_pp0_it1 = ap_const_logic_0;
    } else {
        if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
             esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
            ap_reg_ppiten_pp0_it1 = ap_const_logic_1;
        } else if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()) && 
                     !esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0)) || 
                    (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
                     !esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0)))) {
            ap_reg_ppiten_pp0_it1 = ap_const_logic_0;
        }
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_reg_ppiten_pp1_it0 = ap_const_logic_0;
    } else {
        if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
             !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
            ap_reg_ppiten_pp1_it0 = ap_const_logic_0;
        } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read()) && 
                    !esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read()))) {
            ap_reg_ppiten_pp1_it0 = ap_const_logic_1;
        }
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_reg_ppiten_pp1_it1 = ap_const_logic_0;
    } else {
        if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
             esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
            ap_reg_ppiten_pp1_it1 = ap_const_logic_1;
        } else if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read()) && 
                     !esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read())) || 
                    (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
                     !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read())))) {
            ap_reg_ppiten_pp1_it1 = ap_const_logic_0;
        }
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
        c_i6_reg_173 = c_1_fu_379_p2.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read()) && 
                !esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read()))) {
        c_i6_reg_173 = ap_const_lv4_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && 
         esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
        c_i_reg_140 = c_fu_259_p2.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()) && 
                !esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0))) {
        c_i_reg_140 = ap_const_lv4_0;
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        grp_dct_dct_2d_fu_184_ap_start_ap_start_reg = ap_const_logic_0;
    } else {
        if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_2.read())) {
            grp_dct_dct_2d_fu_184_ap_start_ap_start_reg = ap_const_logic_1;
        } else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_dct_dct_2d_fu_184_ap_ready.read())) {
            grp_dct_dct_2d_fu_184_ap_start_ap_start_reg = ap_const_logic_0;
        }
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
        indvar_flatten1_reg_151 = indvar_flatten_next1_fu_296_p2.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read()) && 
                !esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read()))) {
        indvar_flatten1_reg_151 = ap_const_lv7_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && 
         esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
        indvar_flatten_reg_118 = indvar_flatten_next_fu_198_p2.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()) && 
                !esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0))) {
        indvar_flatten_reg_118 = ap_const_lv7_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_reg_419.read()))) {
        r_i2_reg_162 = r_i2_mid2_reg_428.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read()) && 
                !esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read()))) {
        r_i2_reg_162 = ap_const_lv4_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()) && 
         esl_seteq<1,1,1>(exitcond_flatten_reg_389.read(), ap_const_lv1_0))) {
        r_i_reg_129 = r_i_mid2_reg_403.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()) && 
                !esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0))) {
        r_i_reg_129 = ap_const_lv4_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
        c_i_mid2_reg_398 = c_i_mid2_fu_210_p3.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read())) {
        exitcond_flatten1_reg_419 = exitcond_flatten1_fu_290_p2.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read())) {
        exitcond_flatten_reg_389 = exitcond_flatten_fu_192_p2.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
        r_i2_mid2_reg_428 = r_i2_mid2_fu_322_p3.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
        r_i_mid2_reg_403 = r_i_mid2_fu_224_p3.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
        tmp_9_i_reg_438 = tmp_9_i_fu_373_p2.read();
    }
}

void dct::thread_ap_done() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_5.read())) {
        ap_done = ap_const_logic_1;
    } else {
        ap_done = ap_const_logic_0;
    }
}

void dct::thread_ap_idle() {
    if ((!esl_seteq<1,1,1>(ap_const_logic_1, 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 dct::thread_ap_ready() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_5.read())) {
        ap_ready = ap_const_logic_1;
    } else {
        ap_ready = ap_const_logic_0;
    }
}

void dct::thread_ap_sig_bdd_120() {
    ap_sig_bdd_120 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(3, 3));
}

void dct::thread_ap_sig_bdd_181() {
    ap_sig_bdd_181 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(2, 2));
}

void dct::thread_ap_sig_bdd_22() {
    ap_sig_bdd_22 = esl_seteq<1,1,1>(ap_CS_fsm.read().range(0, 0), ap_const_lv1_1);
}

void dct::thread_ap_sig_bdd_323() {
    ap_sig_bdd_323 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(5, 5));
}

void dct::thread_ap_sig_bdd_61() {
    ap_sig_bdd_61 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(1, 1));
}

void dct::thread_ap_sig_bdd_89() {
    ap_sig_bdd_89 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(4, 4));
}

void dct::thread_ap_sig_cseq_ST_pp0_stg0_fsm_1() {
    if (ap_sig_bdd_61.read()) {
        ap_sig_cseq_ST_pp0_stg0_fsm_1 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_pp0_stg0_fsm_1 = ap_const_logic_0;
    }
}

void dct::thread_ap_sig_cseq_ST_pp1_stg0_fsm_4() {
    if (ap_sig_bdd_89.read()) {
        ap_sig_cseq_ST_pp1_stg0_fsm_4 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_pp1_stg0_fsm_4 = ap_const_logic_0;
    }
}

void dct::thread_ap_sig_cseq_ST_st1_fsm_0() {
    if (ap_sig_bdd_22.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 dct::thread_ap_sig_cseq_ST_st4_fsm_2() {
    if (ap_sig_bdd_181.read()) {
        ap_sig_cseq_ST_st4_fsm_2 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st4_fsm_2 = ap_const_logic_0;
    }
}

void dct::thread_ap_sig_cseq_ST_st5_fsm_3() {
    if (ap_sig_bdd_120.read()) {
        ap_sig_cseq_ST_st5_fsm_3 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st5_fsm_3 = ap_const_logic_0;
    }
}

void dct::thread_ap_sig_cseq_ST_st8_fsm_5() {
    if (ap_sig_bdd_323.read()) {
        ap_sig_cseq_ST_st8_fsm_5 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st8_fsm_5 = ap_const_logic_0;
    }
}

void dct::thread_buf_2d_in_address0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()))) {
        buf_2d_in_address0 =  (sc_lv<6>) (tmp_2_fu_285_p1.read());
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read())) {
        buf_2d_in_address0 = grp_dct_dct_2d_fu_184_in_block_address0.read();
    } else {
        buf_2d_in_address0 = "XXXXXX";
    }
}

void dct::thread_buf_2d_in_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()))) {
        buf_2d_in_ce0 = ap_const_logic_1;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read())) {
        buf_2d_in_ce0 = grp_dct_dct_2d_fu_184_in_block_ce0.read();
    } else {
        buf_2d_in_ce0 = ap_const_logic_0;
    }
}

void dct::thread_buf_2d_in_d0() {
    buf_2d_in_d0 = input_r_q0.read();
}

void dct::thread_buf_2d_in_we0() {
    if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
          esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()) && 
          esl_seteq<1,1,1>(exitcond_flatten_reg_389.read(), ap_const_lv1_0)))) {
        buf_2d_in_we0 = ap_const_logic_1;
    } else {
        buf_2d_in_we0 = ap_const_logic_0;
    }
}

void dct::thread_buf_2d_out_address0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()))) {
        buf_2d_out_address0 =  (sc_lv<6>) (tmp_5_fu_368_p1.read());
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read())) {
        buf_2d_out_address0 = grp_dct_dct_2d_fu_184_out_block_address0.read();
    } else {
        buf_2d_out_address0 = "XXXXXX";
    }
}

void dct::thread_buf_2d_out_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()))) {
        buf_2d_out_ce0 = ap_const_logic_1;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read())) {
        buf_2d_out_ce0 = grp_dct_dct_2d_fu_184_out_block_ce0.read();
    } else {
        buf_2d_out_ce0 = ap_const_logic_0;
    }
}

void dct::thread_buf_2d_out_d0() {
    buf_2d_out_d0 = grp_dct_dct_2d_fu_184_out_block_d0.read();
}

void dct::thread_buf_2d_out_we0() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read())) {
        buf_2d_out_we0 = grp_dct_dct_2d_fu_184_out_block_we0.read();
    } else {
        buf_2d_out_we0 = ap_const_logic_0;
    }
}

void dct::thread_c_1_fu_379_p2() {
    c_1_fu_379_p2 = (!ap_const_lv4_1.is_01() || !c_i6_mid2_fu_308_p3.read().is_01())? sc_lv<4>(): (sc_biguint<4>(ap_const_lv4_1) + sc_biguint<4>(c_i6_mid2_fu_308_p3.read()));
}

void dct::thread_c_fu_259_p2() {
    c_fu_259_p2 = (!ap_const_lv4_1.is_01() || !c_i_mid2_fu_210_p3.read().is_01())? sc_lv<4>(): (sc_biguint<4>(ap_const_lv4_1) + sc_biguint<4>(c_i_mid2_fu_210_p3.read()));
}

void dct::thread_c_i6_cast2_fu_342_p1() {
    c_i6_cast2_fu_342_p1 = esl_zext<6,4>(c_i6_mid2_fu_308_p3.read());
}

void dct::thread_c_i6_mid2_fu_308_p3() {
    c_i6_mid2_fu_308_p3 = (!exitcond_i1_fu_302_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond_i1_fu_302_p2.read()[0].to_bool())? ap_const_lv4_0: c_i6_reg_173.read());
}

void dct::thread_c_i_cast6_fu_244_p1() {
    c_i_cast6_fu_244_p1 = esl_zext<6,4>(c_i_mid2_fu_210_p3.read());
}

void dct::thread_c_i_mid2_fu_210_p3() {
    c_i_mid2_fu_210_p3 = (!exitcond_i_fu_204_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond_i_fu_204_p2.read()[0].to_bool())? ap_const_lv4_0: c_i_reg_140.read());
}

void dct::thread_exitcond_flatten1_fu_290_p2() {
    exitcond_flatten1_fu_290_p2 = (!indvar_flatten1_reg_151.read().is_01() || !ap_const_lv7_40.is_01())? sc_lv<1>(): sc_lv<1>(indvar_flatten1_reg_151.read() == ap_const_lv7_40);
}

void dct::thread_exitcond_flatten_fu_192_p2() {
    exitcond_flatten_fu_192_p2 = (!indvar_flatten_reg_118.read().is_01() || !ap_const_lv7_40.is_01())? sc_lv<1>(): sc_lv<1>(indvar_flatten_reg_118.read() == ap_const_lv7_40);
}

void dct::thread_exitcond_i1_fu_302_p2() {
    exitcond_i1_fu_302_p2 = (!c_i6_reg_173.read().is_01() || !ap_const_lv4_8.is_01())? sc_lv<1>(): sc_lv<1>(c_i6_reg_173.read() == ap_const_lv4_8);
}

void dct::thread_exitcond_i_fu_204_p2() {
    exitcond_i_fu_204_p2 = (!c_i_reg_140.read().is_01() || !ap_const_lv4_8.is_01())? sc_lv<1>(): sc_lv<1>(c_i_reg_140.read() == ap_const_lv4_8);
}

void dct::thread_grp_dct_dct_2d_fu_184_ap_start() {
    grp_dct_dct_2d_fu_184_ap_start = grp_dct_dct_2d_fu_184_ap_start_ap_start_reg.read();
}

void dct::thread_grp_dct_dct_2d_fu_184_in_block_q0() {
    grp_dct_dct_2d_fu_184_in_block_q0 = buf_2d_in_q0.read();
}

void dct::thread_indvar_flatten_next1_fu_296_p2() {
    indvar_flatten_next1_fu_296_p2 = (!indvar_flatten1_reg_151.read().is_01() || !ap_const_lv7_1.is_01())? sc_lv<7>(): (sc_biguint<7>(indvar_flatten1_reg_151.read()) + sc_biguint<7>(ap_const_lv7_1));
}

void dct::thread_indvar_flatten_next_fu_198_p2() {
    indvar_flatten_next_fu_198_p2 = (!indvar_flatten_reg_118.read().is_01() || !ap_const_lv7_1.is_01())? sc_lv<7>(): (sc_biguint<7>(indvar_flatten_reg_118.read()) + sc_biguint<7>(ap_const_lv7_1));
}

void dct::thread_input_r_address0() {
    input_r_address0 =  (sc_lv<6>) (tmp_6_i_fu_254_p1.read());
}

void dct::thread_input_r_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()))) {
        input_r_ce0 = ap_const_logic_1;
    } else {
        input_r_ce0 = ap_const_logic_0;
    }
}

void dct::thread_output_r_address0() {
    output_r_address0 =  (sc_lv<6>) (tmp_3_i_fu_385_p1.read());
}

void dct::thread_output_r_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()))) {
        output_r_ce0 = ap_const_logic_1;
    } else {
        output_r_ce0 = ap_const_logic_0;
    }
}

void dct::thread_output_r_d0() {
    output_r_d0 = buf_2d_out_q0.read();
}

void dct::thread_output_r_we0() {
    if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
          esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) && 
          esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_reg_419.read())))) {
        output_r_we0 = ap_const_logic_1;
    } else {
        output_r_we0 = ap_const_logic_0;
    }
}

void dct::thread_p_addr1_fu_279_p2() {
    p_addr1_fu_279_p2 = (!p_addr_cast_fu_275_p1.read().is_01() || !tmp_7_i_trn_cast_fu_265_p1.read().is_01())? sc_lv<8>(): (sc_biguint<8>(p_addr_cast_fu_275_p1.read()) + sc_biguint<8>(tmp_7_i_trn_cast_fu_265_p1.read()));
}

void dct::thread_p_addr2_cast_fu_358_p1() {
    p_addr2_cast_fu_358_p1 = esl_zext<8,7>(tmp_4_fu_350_p3.read());
}

void dct::thread_p_addr3_fu_362_p2() {
    p_addr3_fu_362_p2 = (!p_addr2_cast_fu_358_p1.read().is_01() || !tmp_8_i_trn_cast_fu_346_p1.read().is_01())? sc_lv<8>(): (sc_biguint<8>(p_addr2_cast_fu_358_p1.read()) + sc_biguint<8>(tmp_8_i_trn_cast_fu_346_p1.read()));
}

void dct::thread_p_addr_cast_fu_275_p1() {
    p_addr_cast_fu_275_p1 = esl_zext<8,7>(tmp_1_fu_268_p3.read());
}

void dct::thread_r_fu_218_p2() {
    r_fu_218_p2 = (!ap_const_lv4_1.is_01() || !r_i_phi_fu_133_p4.read().is_01())? sc_lv<4>(): (sc_biguint<4>(ap_const_lv4_1) + sc_biguint<4>(r_i_phi_fu_133_p4.read()));
}

void dct::thread_r_i2_mid2_fu_322_p3() {
    r_i2_mid2_fu_322_p3 = (!exitcond_i1_fu_302_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond_i1_fu_302_p2.read()[0].to_bool())? r_s_fu_316_p2.read(): r_i2_phi_fu_166_p4.read());
}

void dct::thread_r_i2_phi_fu_166_p4() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_reg_419.read()))) {
        r_i2_phi_fu_166_p4 = r_i2_mid2_reg_428.read();
    } else {
        r_i2_phi_fu_166_p4 = r_i2_reg_162.read();
    }
}

void dct::thread_r_i_mid2_fu_224_p3() {
    r_i_mid2_fu_224_p3 = (!exitcond_i_fu_204_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond_i_fu_204_p2.read()[0].to_bool())? r_fu_218_p2.read(): r_i_phi_fu_133_p4.read());
}

void dct::thread_r_i_phi_fu_133_p4() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()) && 
         esl_seteq<1,1,1>(exitcond_flatten_reg_389.read(), ap_const_lv1_0))) {
        r_i_phi_fu_133_p4 = r_i_mid2_reg_403.read();
    } else {
        r_i_phi_fu_133_p4 = r_i_reg_129.read();
    }
}

void dct::thread_r_s_fu_316_p2() {
    r_s_fu_316_p2 = (!ap_const_lv4_1.is_01() || !r_i2_phi_fu_166_p4.read().is_01())? sc_lv<4>(): (sc_biguint<4>(ap_const_lv4_1) + sc_biguint<4>(r_i2_phi_fu_166_p4.read()));
}

void dct::thread_tmp_1_fu_268_p3() {
    tmp_1_fu_268_p3 = esl_concat<4,3>(r_i_mid2_reg_403.read(), ap_const_lv3_0);
}

void dct::thread_tmp_2_fu_285_p1() {
    tmp_2_fu_285_p1 = esl_zext<64,8>(p_addr1_fu_279_p2.read());
}

void dct::thread_tmp_3_fu_330_p1() {
    tmp_3_fu_330_p1 = r_i2_mid2_fu_322_p3.read().range(3-1, 0);
}

void dct::thread_tmp_3_i_fu_385_p1() {
    tmp_3_i_fu_385_p1 = esl_zext<64,6>(tmp_9_i_reg_438.read());
}

void dct::thread_tmp_4_fu_350_p3() {
    tmp_4_fu_350_p3 = esl_concat<4,3>(r_i2_mid2_fu_322_p3.read(), ap_const_lv3_0);
}

void dct::thread_tmp_5_fu_368_p1() {
    tmp_5_fu_368_p1 = esl_zext<64,8>(p_addr3_fu_362_p2.read());
}

void dct::thread_tmp_5_i_fu_248_p2() {
    tmp_5_i_fu_248_p2 = (!c_i_cast6_fu_244_p1.read().is_01() || !tmp_i_fu_236_p3.read().is_01())? sc_lv<6>(): (sc_biguint<6>(c_i_cast6_fu_244_p1.read()) + sc_biguint<6>(tmp_i_fu_236_p3.read()));
}

void dct::thread_tmp_6_i_fu_254_p1() {
    tmp_6_i_fu_254_p1 = esl_zext<64,6>(tmp_5_i_fu_248_p2.read());
}

void dct::thread_tmp_7_i_trn_cast_fu_265_p1() {
    tmp_7_i_trn_cast_fu_265_p1 = esl_zext<8,4>(c_i_mid2_reg_398.read());
}

void dct::thread_tmp_8_i_trn_cast_fu_346_p1() {
    tmp_8_i_trn_cast_fu_346_p1 = esl_zext<8,4>(c_i6_mid2_fu_308_p3.read());
}

void dct::thread_tmp_9_i_fu_373_p2() {
    tmp_9_i_fu_373_p2 = (!c_i6_cast2_fu_342_p1.read().is_01() || !tmp_i5_fu_334_p3.read().is_01())? sc_lv<6>(): (sc_biguint<6>(c_i6_cast2_fu_342_p1.read()) + sc_biguint<6>(tmp_i5_fu_334_p3.read()));
}

void dct::thread_tmp_fu_232_p1() {
    tmp_fu_232_p1 = r_i_mid2_fu_224_p3.read().range(3-1, 0);
}

void dct::thread_tmp_i5_fu_334_p3() {
    tmp_i5_fu_334_p3 = esl_concat<3,3>(tmp_3_fu_330_p1.read(), ap_const_lv3_0);
}

void dct::thread_tmp_i_fu_236_p3() {
    tmp_i_fu_236_p3 = esl_concat<3,3>(tmp_fu_232_p1.read(), ap_const_lv3_0);
}

void dct::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_pp0_stg0_fsm_1;
            } else {
                ap_NS_fsm = ap_ST_st1_fsm_0;
            }
            break;
        case 2 : 
            if (!(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && !esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
                ap_NS_fsm = ap_ST_pp0_stg0_fsm_1;
            } else {
                ap_NS_fsm = ap_ST_st4_fsm_2;
            }
            break;
        case 4 : 
            ap_NS_fsm = ap_ST_st5_fsm_3;
            break;
        case 8 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read())) {
                ap_NS_fsm = ap_ST_pp1_stg0_fsm_4;
            } else {
                ap_NS_fsm = ap_ST_st5_fsm_3;
            }
            break;
        case 16 : 
            if (!(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
                ap_NS_fsm = ap_ST_pp1_stg0_fsm_4;
            } else {
                ap_NS_fsm = ap_ST_st8_fsm_5;
            }
            break;
        case 32 : 
            ap_NS_fsm = ap_ST_st1_fsm_0;
            break;
        default : 
            ap_NS_fsm = "XXXXXX";
            break;
    }
}

void dct::thread_hdltv_gen() {
    const char* dump_tv = std::getenv("AP_WRITE_TV");
    if (!(dump_tv && string(dump_tv) == "on")) return;

    wait();

    mHdltvinHandle << "[ " << endl;
    mHdltvoutHandle << "[ " << endl;
    int ap_cycleNo = 0;
    while (1) {
        wait();
        const char* mComma = ap_cycleNo == 0 ? " " : ", " ;
        mHdltvinHandle << mComma << "{"  <<  " \"ap_rst\" :  \"" << ap_rst.read() << "\" ";
        mHdltvinHandle << " , " <<  " \"ap_start\" :  \"" << ap_start.read() << "\" ";
        mHdltvoutHandle << mComma << "{"  <<  " \"ap_done\" :  \"" << ap_done.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"ap_idle\" :  \"" << ap_idle.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"ap_ready\" :  \"" << ap_ready.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"input_r_address0\" :  \"" << input_r_address0.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"input_r_ce0\" :  \"" << input_r_ce0.read() << "\" ";
        mHdltvinHandle << " , " <<  " \"input_r_q0\" :  \"" << input_r_q0.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"output_r_address0\" :  \"" << output_r_address0.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"output_r_ce0\" :  \"" << output_r_ce0.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"output_r_we0\" :  \"" << output_r_we0.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"output_r_d0\" :  \"" << output_r_d0.read() << "\" ";
        mHdltvinHandle << "}" << std::endl;
        mHdltvoutHandle << "}" << std::endl;
        ap_cycleNo++;
    }
}

}
// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.2
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
// 
// ===========================================================

#include "dct.h"
#include "AESL_pkg.h"

using namespace std;

namespace ap_rtl {

const sc_logic dct::ap_const_logic_1 = sc_dt::Log_1;
const sc_logic dct::ap_const_logic_0 = sc_dt::Log_0;
const sc_lv<6> dct::ap_ST_st1_fsm_0 = "1";
const sc_lv<6> dct::ap_ST_pp0_stg0_fsm_1 = "10";
const sc_lv<6> dct::ap_ST_st4_fsm_2 = "100";
const sc_lv<6> dct::ap_ST_st5_fsm_3 = "1000";
const sc_lv<6> dct::ap_ST_pp1_stg0_fsm_4 = "10000";
const sc_lv<6> dct::ap_ST_st8_fsm_5 = "100000";
const sc_lv<32> dct::ap_const_lv32_0 = "00000000000000000000000000000000";
const sc_lv<1> dct::ap_const_lv1_1 = "1";
const sc_lv<32> dct::ap_const_lv32_1 = "1";
const sc_lv<1> dct::ap_const_lv1_0 = "0";
const sc_lv<32> dct::ap_const_lv32_4 = "100";
const sc_lv<32> dct::ap_const_lv32_3 = "11";
const sc_lv<7> dct::ap_const_lv7_0 = "0000000";
const sc_lv<4> dct::ap_const_lv4_0 = "0000";
const sc_lv<32> dct::ap_const_lv32_2 = "10";
const sc_lv<7> dct::ap_const_lv7_40 = "1000000";
const sc_lv<7> dct::ap_const_lv7_1 = "1";
const sc_lv<4> dct::ap_const_lv4_8 = "1000";
const sc_lv<4> dct::ap_const_lv4_1 = "1";
const sc_lv<3> dct::ap_const_lv3_0 = "000";
const sc_lv<32> dct::ap_const_lv32_5 = "101";

dct::dct(sc_module_name name) : sc_module(name), mVcdFile(0) {
    buf_2d_in_U = new dct_dct_2d_row_outbuf("buf_2d_in_U");
    buf_2d_in_U->clk(ap_clk);
    buf_2d_in_U->reset(ap_rst);
    buf_2d_in_U->address0(buf_2d_in_address0);
    buf_2d_in_U->ce0(buf_2d_in_ce0);
    buf_2d_in_U->we0(buf_2d_in_we0);
    buf_2d_in_U->d0(buf_2d_in_d0);
    buf_2d_in_U->q0(buf_2d_in_q0);
    buf_2d_out_U = new dct_dct_2d_row_outbuf("buf_2d_out_U");
    buf_2d_out_U->clk(ap_clk);
    buf_2d_out_U->reset(ap_rst);
    buf_2d_out_U->address0(buf_2d_out_address0);
    buf_2d_out_U->ce0(buf_2d_out_ce0);
    buf_2d_out_U->we0(buf_2d_out_we0);
    buf_2d_out_U->d0(buf_2d_out_d0);
    buf_2d_out_U->q0(buf_2d_out_q0);
    grp_dct_dct_2d_fu_184 = new dct_dct_2d("grp_dct_dct_2d_fu_184");
    grp_dct_dct_2d_fu_184->ap_clk(ap_clk);
    grp_dct_dct_2d_fu_184->ap_rst(ap_rst);
    grp_dct_dct_2d_fu_184->ap_start(grp_dct_dct_2d_fu_184_ap_start);
    grp_dct_dct_2d_fu_184->ap_done(grp_dct_dct_2d_fu_184_ap_done);
    grp_dct_dct_2d_fu_184->ap_idle(grp_dct_dct_2d_fu_184_ap_idle);
    grp_dct_dct_2d_fu_184->ap_ready(grp_dct_dct_2d_fu_184_ap_ready);
    grp_dct_dct_2d_fu_184->in_block_address0(grp_dct_dct_2d_fu_184_in_block_address0);
    grp_dct_dct_2d_fu_184->in_block_ce0(grp_dct_dct_2d_fu_184_in_block_ce0);
    grp_dct_dct_2d_fu_184->in_block_q0(grp_dct_dct_2d_fu_184_in_block_q0);
    grp_dct_dct_2d_fu_184->out_block_address0(grp_dct_dct_2d_fu_184_out_block_address0);
    grp_dct_dct_2d_fu_184->out_block_ce0(grp_dct_dct_2d_fu_184_out_block_ce0);
    grp_dct_dct_2d_fu_184->out_block_we0(grp_dct_dct_2d_fu_184_out_block_we0);
    grp_dct_dct_2d_fu_184->out_block_d0(grp_dct_dct_2d_fu_184_out_block_d0);

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

    SC_METHOD(thread_ap_done);
    sensitive << ( ap_sig_cseq_ST_st8_fsm_5 );

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

    SC_METHOD(thread_ap_ready);
    sensitive << ( ap_sig_cseq_ST_st8_fsm_5 );

    SC_METHOD(thread_ap_sig_bdd_120);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_181);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_22);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_323);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_61);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_89);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_cseq_ST_pp0_stg0_fsm_1);
    sensitive << ( ap_sig_bdd_61 );

    SC_METHOD(thread_ap_sig_cseq_ST_pp1_stg0_fsm_4);
    sensitive << ( ap_sig_bdd_89 );

    SC_METHOD(thread_ap_sig_cseq_ST_st1_fsm_0);
    sensitive << ( ap_sig_bdd_22 );

    SC_METHOD(thread_ap_sig_cseq_ST_st4_fsm_2);
    sensitive << ( ap_sig_bdd_181 );

    SC_METHOD(thread_ap_sig_cseq_ST_st5_fsm_3);
    sensitive << ( ap_sig_bdd_120 );

    SC_METHOD(thread_ap_sig_cseq_ST_st8_fsm_5);
    sensitive << ( ap_sig_bdd_323 );

    SC_METHOD(thread_buf_2d_in_address0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_in_block_address0 );
    sensitive << ( tmp_2_fu_285_p1 );

    SC_METHOD(thread_buf_2d_in_ce0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_in_block_ce0 );

    SC_METHOD(thread_buf_2d_in_d0);
    sensitive << ( input_r_q0 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );

    SC_METHOD(thread_buf_2d_in_we0);
    sensitive << ( exitcond_flatten_reg_389 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );

    SC_METHOD(thread_buf_2d_out_address0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_out_block_address0 );
    sensitive << ( tmp_5_fu_368_p1 );

    SC_METHOD(thread_buf_2d_out_ce0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_out_block_ce0 );

    SC_METHOD(thread_buf_2d_out_d0);
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_out_block_d0 );

    SC_METHOD(thread_buf_2d_out_we0);
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( grp_dct_dct_2d_fu_184_out_block_we0 );

    SC_METHOD(thread_c_1_fu_379_p2);
    sensitive << ( c_i6_mid2_fu_308_p3 );

    SC_METHOD(thread_c_fu_259_p2);
    sensitive << ( c_i_mid2_fu_210_p3 );

    SC_METHOD(thread_c_i6_cast2_fu_342_p1);
    sensitive << ( c_i6_mid2_fu_308_p3 );

    SC_METHOD(thread_c_i6_mid2_fu_308_p3);
    sensitive << ( c_i6_reg_173 );
    sensitive << ( exitcond_i1_fu_302_p2 );

    SC_METHOD(thread_c_i_cast6_fu_244_p1);
    sensitive << ( c_i_mid2_fu_210_p3 );

    SC_METHOD(thread_c_i_mid2_fu_210_p3);
    sensitive << ( c_i_reg_140 );
    sensitive << ( exitcond_i_fu_204_p2 );

    SC_METHOD(thread_exitcond_flatten1_fu_290_p2);
    sensitive << ( indvar_flatten1_reg_151 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );

    SC_METHOD(thread_exitcond_flatten_fu_192_p2);
    sensitive << ( indvar_flatten_reg_118 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );

    SC_METHOD(thread_exitcond_i1_fu_302_p2);
    sensitive << ( c_i6_reg_173 );
    sensitive << ( exitcond_flatten1_fu_290_p2 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );

    SC_METHOD(thread_exitcond_i_fu_204_p2);
    sensitive << ( c_i_reg_140 );
    sensitive << ( exitcond_flatten_fu_192_p2 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );

    SC_METHOD(thread_grp_dct_dct_2d_fu_184_ap_start);
    sensitive << ( grp_dct_dct_2d_fu_184_ap_start_ap_start_reg );

    SC_METHOD(thread_grp_dct_dct_2d_fu_184_in_block_q0);
    sensitive << ( ap_sig_cseq_ST_st5_fsm_3 );
    sensitive << ( buf_2d_in_q0 );

    SC_METHOD(thread_indvar_flatten_next1_fu_296_p2);
    sensitive << ( indvar_flatten1_reg_151 );

    SC_METHOD(thread_indvar_flatten_next_fu_198_p2);
    sensitive << ( indvar_flatten_reg_118 );

    SC_METHOD(thread_input_r_address0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );
    sensitive << ( tmp_6_i_fu_254_p1 );

    SC_METHOD(thread_input_r_ce0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );

    SC_METHOD(thread_output_r_address0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );
    sensitive << ( tmp_3_i_fu_385_p1 );

    SC_METHOD(thread_output_r_ce0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );

    SC_METHOD(thread_output_r_d0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );
    sensitive << ( buf_2d_out_q0 );

    SC_METHOD(thread_output_r_we0);
    sensitive << ( exitcond_flatten1_reg_419 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );

    SC_METHOD(thread_p_addr1_fu_279_p2);
    sensitive << ( p_addr_cast_fu_275_p1 );
    sensitive << ( tmp_7_i_trn_cast_fu_265_p1 );

    SC_METHOD(thread_p_addr2_cast_fu_358_p1);
    sensitive << ( tmp_4_fu_350_p3 );

    SC_METHOD(thread_p_addr3_fu_362_p2);
    sensitive << ( p_addr2_cast_fu_358_p1 );
    sensitive << ( tmp_8_i_trn_cast_fu_346_p1 );

    SC_METHOD(thread_p_addr_cast_fu_275_p1);
    sensitive << ( tmp_1_fu_268_p3 );

    SC_METHOD(thread_r_fu_218_p2);
    sensitive << ( r_i_phi_fu_133_p4 );

    SC_METHOD(thread_r_i2_mid2_fu_322_p3);
    sensitive << ( r_i2_phi_fu_166_p4 );
    sensitive << ( exitcond_i1_fu_302_p2 );
    sensitive << ( r_s_fu_316_p2 );

    SC_METHOD(thread_r_i2_phi_fu_166_p4);
    sensitive << ( r_i2_reg_162 );
    sensitive << ( exitcond_flatten1_reg_419 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_4 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );
    sensitive << ( r_i2_mid2_reg_428 );

    SC_METHOD(thread_r_i_mid2_fu_224_p3);
    sensitive << ( r_i_phi_fu_133_p4 );
    sensitive << ( exitcond_i_fu_204_p2 );
    sensitive << ( r_fu_218_p2 );

    SC_METHOD(thread_r_i_phi_fu_133_p4);
    sensitive << ( r_i_reg_129 );
    sensitive << ( exitcond_flatten_reg_389 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_1 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );
    sensitive << ( r_i_mid2_reg_403 );

    SC_METHOD(thread_r_s_fu_316_p2);
    sensitive << ( r_i2_phi_fu_166_p4 );

    SC_METHOD(thread_tmp_1_fu_268_p3);
    sensitive << ( r_i_mid2_reg_403 );

    SC_METHOD(thread_tmp_2_fu_285_p1);
    sensitive << ( p_addr1_fu_279_p2 );

    SC_METHOD(thread_tmp_3_fu_330_p1);
    sensitive << ( r_i2_mid2_fu_322_p3 );

    SC_METHOD(thread_tmp_3_i_fu_385_p1);
    sensitive << ( tmp_9_i_reg_438 );

    SC_METHOD(thread_tmp_4_fu_350_p3);
    sensitive << ( r_i2_mid2_fu_322_p3 );

    SC_METHOD(thread_tmp_5_fu_368_p1);
    sensitive << ( p_addr3_fu_362_p2 );

    SC_METHOD(thread_tmp_5_i_fu_248_p2);
    sensitive << ( c_i_cast6_fu_244_p1 );
    sensitive << ( tmp_i_fu_236_p3 );

    SC_METHOD(thread_tmp_6_i_fu_254_p1);
    sensitive << ( tmp_5_i_fu_248_p2 );

    SC_METHOD(thread_tmp_7_i_trn_cast_fu_265_p1);
    sensitive << ( c_i_mid2_reg_398 );

    SC_METHOD(thread_tmp_8_i_trn_cast_fu_346_p1);
    sensitive << ( c_i6_mid2_fu_308_p3 );

    SC_METHOD(thread_tmp_9_i_fu_373_p2);
    sensitive << ( c_i6_cast2_fu_342_p1 );
    sensitive << ( tmp_i5_fu_334_p3 );

    SC_METHOD(thread_tmp_fu_232_p1);
    sensitive << ( r_i_mid2_fu_224_p3 );

    SC_METHOD(thread_tmp_i5_fu_334_p3);
    sensitive << ( tmp_3_fu_330_p1 );

    SC_METHOD(thread_tmp_i_fu_236_p3);
    sensitive << ( tmp_fu_232_p1 );

    SC_METHOD(thread_ap_NS_fsm);
    sensitive << ( ap_start );
    sensitive << ( ap_CS_fsm );
    sensitive << ( exitcond_flatten_fu_192_p2 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );
    sensitive << ( exitcond_flatten1_fu_290_p2 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );
    sensitive << ( grp_dct_dct_2d_fu_184_ap_done );

    SC_THREAD(thread_hdltv_gen);
    sensitive << ( ap_clk.pos() );

    ap_CS_fsm = "000001";
    ap_reg_ppiten_pp0_it0 = SC_LOGIC_0;
    ap_reg_ppiten_pp0_it1 = SC_LOGIC_0;
    ap_reg_ppiten_pp1_it0 = SC_LOGIC_0;
    ap_reg_ppiten_pp1_it1 = SC_LOGIC_0;
    grp_dct_dct_2d_fu_184_ap_start_ap_start_reg = SC_LOGIC_0;
    static int apTFileNum = 0;
    stringstream apTFilenSS;
    apTFilenSS << "dct_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__
    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, input_r_address0, "(port)input_r_address0");
    sc_trace(mVcdFile, input_r_ce0, "(port)input_r_ce0");
    sc_trace(mVcdFile, input_r_q0, "(port)input_r_q0");
    sc_trace(mVcdFile, output_r_address0, "(port)output_r_address0");
    sc_trace(mVcdFile, output_r_ce0, "(port)output_r_ce0");
    sc_trace(mVcdFile, output_r_we0, "(port)output_r_we0");
    sc_trace(mVcdFile, output_r_d0, "(port)output_r_d0");
#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_bdd_22, "ap_sig_bdd_22");
    sc_trace(mVcdFile, indvar_flatten_reg_118, "indvar_flatten_reg_118");
    sc_trace(mVcdFile, r_i_reg_129, "r_i_reg_129");
    sc_trace(mVcdFile, c_i_reg_140, "c_i_reg_140");
    sc_trace(mVcdFile, indvar_flatten1_reg_151, "indvar_flatten1_reg_151");
    sc_trace(mVcdFile, r_i2_reg_162, "r_i2_reg_162");
    sc_trace(mVcdFile, c_i6_reg_173, "c_i6_reg_173");
    sc_trace(mVcdFile, exitcond_flatten_fu_192_p2, "exitcond_flatten_fu_192_p2");
    sc_trace(mVcdFile, exitcond_flatten_reg_389, "exitcond_flatten_reg_389");
    sc_trace(mVcdFile, ap_sig_cseq_ST_pp0_stg0_fsm_1, "ap_sig_cseq_ST_pp0_stg0_fsm_1");
    sc_trace(mVcdFile, ap_sig_bdd_61, "ap_sig_bdd_61");
    sc_trace(mVcdFile, ap_reg_ppiten_pp0_it0, "ap_reg_ppiten_pp0_it0");
    sc_trace(mVcdFile, ap_reg_ppiten_pp0_it1, "ap_reg_ppiten_pp0_it1");
    sc_trace(mVcdFile, indvar_flatten_next_fu_198_p2, "indvar_flatten_next_fu_198_p2");
    sc_trace(mVcdFile, c_i_mid2_fu_210_p3, "c_i_mid2_fu_210_p3");
    sc_trace(mVcdFile, c_i_mid2_reg_398, "c_i_mid2_reg_398");
    sc_trace(mVcdFile, r_i_mid2_fu_224_p3, "r_i_mid2_fu_224_p3");
    sc_trace(mVcdFile, r_i_mid2_reg_403, "r_i_mid2_reg_403");
    sc_trace(mVcdFile, c_fu_259_p2, "c_fu_259_p2");
    sc_trace(mVcdFile, exitcond_flatten1_fu_290_p2, "exitcond_flatten1_fu_290_p2");
    sc_trace(mVcdFile, exitcond_flatten1_reg_419, "exitcond_flatten1_reg_419");
    sc_trace(mVcdFile, ap_sig_cseq_ST_pp1_stg0_fsm_4, "ap_sig_cseq_ST_pp1_stg0_fsm_4");
    sc_trace(mVcdFile, ap_sig_bdd_89, "ap_sig_bdd_89");
    sc_trace(mVcdFile, ap_reg_ppiten_pp1_it0, "ap_reg_ppiten_pp1_it0");
    sc_trace(mVcdFile, ap_reg_ppiten_pp1_it1, "ap_reg_ppiten_pp1_it1");
    sc_trace(mVcdFile, indvar_flatten_next1_fu_296_p2, "indvar_flatten_next1_fu_296_p2");
    sc_trace(mVcdFile, r_i2_mid2_fu_322_p3, "r_i2_mid2_fu_322_p3");
    sc_trace(mVcdFile, r_i2_mid2_reg_428, "r_i2_mid2_reg_428");
    sc_trace(mVcdFile, tmp_9_i_fu_373_p2, "tmp_9_i_fu_373_p2");
    sc_trace(mVcdFile, tmp_9_i_reg_438, "tmp_9_i_reg_438");
    sc_trace(mVcdFile, c_1_fu_379_p2, "c_1_fu_379_p2");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st5_fsm_3, "ap_sig_cseq_ST_st5_fsm_3");
    sc_trace(mVcdFile, ap_sig_bdd_120, "ap_sig_bdd_120");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_ap_done, "grp_dct_dct_2d_fu_184_ap_done");
    sc_trace(mVcdFile, buf_2d_in_address0, "buf_2d_in_address0");
    sc_trace(mVcdFile, buf_2d_in_ce0, "buf_2d_in_ce0");
    sc_trace(mVcdFile, buf_2d_in_we0, "buf_2d_in_we0");
    sc_trace(mVcdFile, buf_2d_in_d0, "buf_2d_in_d0");
    sc_trace(mVcdFile, buf_2d_in_q0, "buf_2d_in_q0");
    sc_trace(mVcdFile, buf_2d_out_address0, "buf_2d_out_address0");
    sc_trace(mVcdFile, buf_2d_out_ce0, "buf_2d_out_ce0");
    sc_trace(mVcdFile, buf_2d_out_we0, "buf_2d_out_we0");
    sc_trace(mVcdFile, buf_2d_out_d0, "buf_2d_out_d0");
    sc_trace(mVcdFile, buf_2d_out_q0, "buf_2d_out_q0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_ap_start, "grp_dct_dct_2d_fu_184_ap_start");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_ap_idle, "grp_dct_dct_2d_fu_184_ap_idle");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_ap_ready, "grp_dct_dct_2d_fu_184_ap_ready");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_in_block_address0, "grp_dct_dct_2d_fu_184_in_block_address0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_in_block_ce0, "grp_dct_dct_2d_fu_184_in_block_ce0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_in_block_q0, "grp_dct_dct_2d_fu_184_in_block_q0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_out_block_address0, "grp_dct_dct_2d_fu_184_out_block_address0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_out_block_ce0, "grp_dct_dct_2d_fu_184_out_block_ce0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_out_block_we0, "grp_dct_dct_2d_fu_184_out_block_we0");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_out_block_d0, "grp_dct_dct_2d_fu_184_out_block_d0");
    sc_trace(mVcdFile, r_i_phi_fu_133_p4, "r_i_phi_fu_133_p4");
    sc_trace(mVcdFile, r_i2_phi_fu_166_p4, "r_i2_phi_fu_166_p4");
    sc_trace(mVcdFile, grp_dct_dct_2d_fu_184_ap_start_ap_start_reg, "grp_dct_dct_2d_fu_184_ap_start_ap_start_reg");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st4_fsm_2, "ap_sig_cseq_ST_st4_fsm_2");
    sc_trace(mVcdFile, ap_sig_bdd_181, "ap_sig_bdd_181");
    sc_trace(mVcdFile, tmp_6_i_fu_254_p1, "tmp_6_i_fu_254_p1");
    sc_trace(mVcdFile, tmp_2_fu_285_p1, "tmp_2_fu_285_p1");
    sc_trace(mVcdFile, tmp_5_fu_368_p1, "tmp_5_fu_368_p1");
    sc_trace(mVcdFile, tmp_3_i_fu_385_p1, "tmp_3_i_fu_385_p1");
    sc_trace(mVcdFile, exitcond_i_fu_204_p2, "exitcond_i_fu_204_p2");
    sc_trace(mVcdFile, r_fu_218_p2, "r_fu_218_p2");
    sc_trace(mVcdFile, tmp_fu_232_p1, "tmp_fu_232_p1");
    sc_trace(mVcdFile, c_i_cast6_fu_244_p1, "c_i_cast6_fu_244_p1");
    sc_trace(mVcdFile, tmp_i_fu_236_p3, "tmp_i_fu_236_p3");
    sc_trace(mVcdFile, tmp_5_i_fu_248_p2, "tmp_5_i_fu_248_p2");
    sc_trace(mVcdFile, tmp_1_fu_268_p3, "tmp_1_fu_268_p3");
    sc_trace(mVcdFile, p_addr_cast_fu_275_p1, "p_addr_cast_fu_275_p1");
    sc_trace(mVcdFile, tmp_7_i_trn_cast_fu_265_p1, "tmp_7_i_trn_cast_fu_265_p1");
    sc_trace(mVcdFile, p_addr1_fu_279_p2, "p_addr1_fu_279_p2");
    sc_trace(mVcdFile, exitcond_i1_fu_302_p2, "exitcond_i1_fu_302_p2");
    sc_trace(mVcdFile, r_s_fu_316_p2, "r_s_fu_316_p2");
    sc_trace(mVcdFile, tmp_3_fu_330_p1, "tmp_3_fu_330_p1");
    sc_trace(mVcdFile, c_i6_mid2_fu_308_p3, "c_i6_mid2_fu_308_p3");
    sc_trace(mVcdFile, tmp_4_fu_350_p3, "tmp_4_fu_350_p3");
    sc_trace(mVcdFile, p_addr2_cast_fu_358_p1, "p_addr2_cast_fu_358_p1");
    sc_trace(mVcdFile, tmp_8_i_trn_cast_fu_346_p1, "tmp_8_i_trn_cast_fu_346_p1");
    sc_trace(mVcdFile, p_addr3_fu_362_p2, "p_addr3_fu_362_p2");
    sc_trace(mVcdFile, c_i6_cast2_fu_342_p1, "c_i6_cast2_fu_342_p1");
    sc_trace(mVcdFile, tmp_i5_fu_334_p3, "tmp_i5_fu_334_p3");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st8_fsm_5, "ap_sig_cseq_ST_st8_fsm_5");
    sc_trace(mVcdFile, ap_sig_bdd_323, "ap_sig_bdd_323");
    sc_trace(mVcdFile, ap_NS_fsm, "ap_NS_fsm");
#endif

    }
    mHdltvinHandle.open("dct.hdltvin.dat");
    mHdltvoutHandle.open("dct.hdltvout.dat");
}

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

    mHdltvinHandle << "] " << endl;
    mHdltvoutHandle << "] " << endl;
    mHdltvinHandle.close();
    mHdltvoutHandle.close();
    delete buf_2d_in_U;
    delete buf_2d_out_U;
    delete grp_dct_dct_2d_fu_184;
}

void dct::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_ppiten_pp0_it0 = ap_const_logic_0;
    } else {
        if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
             !esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
            ap_reg_ppiten_pp0_it0 = ap_const_logic_0;
        } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()) && 
                    !esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0))) {
            ap_reg_ppiten_pp0_it0 = ap_const_logic_1;
        }
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_reg_ppiten_pp0_it1 = ap_const_logic_0;
    } else {
        if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
             esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
            ap_reg_ppiten_pp0_it1 = ap_const_logic_1;
        } else if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()) && 
                     !esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0)) || 
                    (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
                     !esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0)))) {
            ap_reg_ppiten_pp0_it1 = ap_const_logic_0;
        }
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_reg_ppiten_pp1_it0 = ap_const_logic_0;
    } else {
        if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
             !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
            ap_reg_ppiten_pp1_it0 = ap_const_logic_0;
        } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read()) && 
                    !esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read()))) {
            ap_reg_ppiten_pp1_it0 = ap_const_logic_1;
        }
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_reg_ppiten_pp1_it1 = ap_const_logic_0;
    } else {
        if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
             esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
            ap_reg_ppiten_pp1_it1 = ap_const_logic_1;
        } else if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read()) && 
                     !esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read())) || 
                    (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
                     !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read())))) {
            ap_reg_ppiten_pp1_it1 = ap_const_logic_0;
        }
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
        c_i6_reg_173 = c_1_fu_379_p2.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read()) && 
                !esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read()))) {
        c_i6_reg_173 = ap_const_lv4_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && 
         esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
        c_i_reg_140 = c_fu_259_p2.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()) && 
                !esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0))) {
        c_i_reg_140 = ap_const_lv4_0;
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        grp_dct_dct_2d_fu_184_ap_start_ap_start_reg = ap_const_logic_0;
    } else {
        if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_2.read())) {
            grp_dct_dct_2d_fu_184_ap_start_ap_start_reg = ap_const_logic_1;
        } else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_dct_dct_2d_fu_184_ap_ready.read())) {
            grp_dct_dct_2d_fu_184_ap_start_ap_start_reg = ap_const_logic_0;
        }
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
        indvar_flatten1_reg_151 = indvar_flatten_next1_fu_296_p2.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read()) && 
                !esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read()))) {
        indvar_flatten1_reg_151 = ap_const_lv7_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && 
         esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
        indvar_flatten_reg_118 = indvar_flatten_next_fu_198_p2.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()) && 
                !esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0))) {
        indvar_flatten_reg_118 = ap_const_lv7_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_reg_419.read()))) {
        r_i2_reg_162 = r_i2_mid2_reg_428.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read()) && 
                !esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read()))) {
        r_i2_reg_162 = ap_const_lv4_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()) && 
         esl_seteq<1,1,1>(exitcond_flatten_reg_389.read(), ap_const_lv1_0))) {
        r_i_reg_129 = r_i_mid2_reg_403.read();
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read()) && 
                !esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0))) {
        r_i_reg_129 = ap_const_lv4_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
        c_i_mid2_reg_398 = c_i_mid2_fu_210_p3.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read())) {
        exitcond_flatten1_reg_419 = exitcond_flatten1_fu_290_p2.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read())) {
        exitcond_flatten_reg_389 = exitcond_flatten_fu_192_p2.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
        r_i2_mid2_reg_428 = r_i2_mid2_fu_322_p3.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
        r_i_mid2_reg_403 = r_i_mid2_fu_224_p3.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
        tmp_9_i_reg_438 = tmp_9_i_fu_373_p2.read();
    }
}

void dct::thread_ap_done() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_5.read())) {
        ap_done = ap_const_logic_1;
    } else {
        ap_done = ap_const_logic_0;
    }
}

void dct::thread_ap_idle() {
    if ((!esl_seteq<1,1,1>(ap_const_logic_1, 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 dct::thread_ap_ready() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_5.read())) {
        ap_ready = ap_const_logic_1;
    } else {
        ap_ready = ap_const_logic_0;
    }
}

void dct::thread_ap_sig_bdd_120() {
    ap_sig_bdd_120 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(3, 3));
}

void dct::thread_ap_sig_bdd_181() {
    ap_sig_bdd_181 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(2, 2));
}

void dct::thread_ap_sig_bdd_22() {
    ap_sig_bdd_22 = esl_seteq<1,1,1>(ap_CS_fsm.read().range(0, 0), ap_const_lv1_1);
}

void dct::thread_ap_sig_bdd_323() {
    ap_sig_bdd_323 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(5, 5));
}

void dct::thread_ap_sig_bdd_61() {
    ap_sig_bdd_61 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(1, 1));
}

void dct::thread_ap_sig_bdd_89() {
    ap_sig_bdd_89 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(4, 4));
}

void dct::thread_ap_sig_cseq_ST_pp0_stg0_fsm_1() {
    if (ap_sig_bdd_61.read()) {
        ap_sig_cseq_ST_pp0_stg0_fsm_1 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_pp0_stg0_fsm_1 = ap_const_logic_0;
    }
}

void dct::thread_ap_sig_cseq_ST_pp1_stg0_fsm_4() {
    if (ap_sig_bdd_89.read()) {
        ap_sig_cseq_ST_pp1_stg0_fsm_4 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_pp1_stg0_fsm_4 = ap_const_logic_0;
    }
}

void dct::thread_ap_sig_cseq_ST_st1_fsm_0() {
    if (ap_sig_bdd_22.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 dct::thread_ap_sig_cseq_ST_st4_fsm_2() {
    if (ap_sig_bdd_181.read()) {
        ap_sig_cseq_ST_st4_fsm_2 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st4_fsm_2 = ap_const_logic_0;
    }
}

void dct::thread_ap_sig_cseq_ST_st5_fsm_3() {
    if (ap_sig_bdd_120.read()) {
        ap_sig_cseq_ST_st5_fsm_3 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st5_fsm_3 = ap_const_logic_0;
    }
}

void dct::thread_ap_sig_cseq_ST_st8_fsm_5() {
    if (ap_sig_bdd_323.read()) {
        ap_sig_cseq_ST_st8_fsm_5 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st8_fsm_5 = ap_const_logic_0;
    }
}

void dct::thread_buf_2d_in_address0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()))) {
        buf_2d_in_address0 =  (sc_lv<6>) (tmp_2_fu_285_p1.read());
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read())) {
        buf_2d_in_address0 = grp_dct_dct_2d_fu_184_in_block_address0.read();
    } else {
        buf_2d_in_address0 = "XXXXXX";
    }
}

void dct::thread_buf_2d_in_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()))) {
        buf_2d_in_ce0 = ap_const_logic_1;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read())) {
        buf_2d_in_ce0 = grp_dct_dct_2d_fu_184_in_block_ce0.read();
    } else {
        buf_2d_in_ce0 = ap_const_logic_0;
    }
}

void dct::thread_buf_2d_in_d0() {
    buf_2d_in_d0 = input_r_q0.read();
}

void dct::thread_buf_2d_in_we0() {
    if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
          esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()) && 
          esl_seteq<1,1,1>(exitcond_flatten_reg_389.read(), ap_const_lv1_0)))) {
        buf_2d_in_we0 = ap_const_logic_1;
    } else {
        buf_2d_in_we0 = ap_const_logic_0;
    }
}

void dct::thread_buf_2d_out_address0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()))) {
        buf_2d_out_address0 =  (sc_lv<6>) (tmp_5_fu_368_p1.read());
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read())) {
        buf_2d_out_address0 = grp_dct_dct_2d_fu_184_out_block_address0.read();
    } else {
        buf_2d_out_address0 = "XXXXXX";
    }
}

void dct::thread_buf_2d_out_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()))) {
        buf_2d_out_ce0 = ap_const_logic_1;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read())) {
        buf_2d_out_ce0 = grp_dct_dct_2d_fu_184_out_block_ce0.read();
    } else {
        buf_2d_out_ce0 = ap_const_logic_0;
    }
}

void dct::thread_buf_2d_out_d0() {
    buf_2d_out_d0 = grp_dct_dct_2d_fu_184_out_block_d0.read();
}

void dct::thread_buf_2d_out_we0() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_3.read())) {
        buf_2d_out_we0 = grp_dct_dct_2d_fu_184_out_block_we0.read();
    } else {
        buf_2d_out_we0 = ap_const_logic_0;
    }
}

void dct::thread_c_1_fu_379_p2() {
    c_1_fu_379_p2 = (!ap_const_lv4_1.is_01() || !c_i6_mid2_fu_308_p3.read().is_01())? sc_lv<4>(): (sc_biguint<4>(ap_const_lv4_1) + sc_biguint<4>(c_i6_mid2_fu_308_p3.read()));
}

void dct::thread_c_fu_259_p2() {
    c_fu_259_p2 = (!ap_const_lv4_1.is_01() || !c_i_mid2_fu_210_p3.read().is_01())? sc_lv<4>(): (sc_biguint<4>(ap_const_lv4_1) + sc_biguint<4>(c_i_mid2_fu_210_p3.read()));
}

void dct::thread_c_i6_cast2_fu_342_p1() {
    c_i6_cast2_fu_342_p1 = esl_zext<6,4>(c_i6_mid2_fu_308_p3.read());
}

void dct::thread_c_i6_mid2_fu_308_p3() {
    c_i6_mid2_fu_308_p3 = (!exitcond_i1_fu_302_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond_i1_fu_302_p2.read()[0].to_bool())? ap_const_lv4_0: c_i6_reg_173.read());
}

void dct::thread_c_i_cast6_fu_244_p1() {
    c_i_cast6_fu_244_p1 = esl_zext<6,4>(c_i_mid2_fu_210_p3.read());
}

void dct::thread_c_i_mid2_fu_210_p3() {
    c_i_mid2_fu_210_p3 = (!exitcond_i_fu_204_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond_i_fu_204_p2.read()[0].to_bool())? ap_const_lv4_0: c_i_reg_140.read());
}

void dct::thread_exitcond_flatten1_fu_290_p2() {
    exitcond_flatten1_fu_290_p2 = (!indvar_flatten1_reg_151.read().is_01() || !ap_const_lv7_40.is_01())? sc_lv<1>(): sc_lv<1>(indvar_flatten1_reg_151.read() == ap_const_lv7_40);
}

void dct::thread_exitcond_flatten_fu_192_p2() {
    exitcond_flatten_fu_192_p2 = (!indvar_flatten_reg_118.read().is_01() || !ap_const_lv7_40.is_01())? sc_lv<1>(): sc_lv<1>(indvar_flatten_reg_118.read() == ap_const_lv7_40);
}

void dct::thread_exitcond_i1_fu_302_p2() {
    exitcond_i1_fu_302_p2 = (!c_i6_reg_173.read().is_01() || !ap_const_lv4_8.is_01())? sc_lv<1>(): sc_lv<1>(c_i6_reg_173.read() == ap_const_lv4_8);
}

void dct::thread_exitcond_i_fu_204_p2() {
    exitcond_i_fu_204_p2 = (!c_i_reg_140.read().is_01() || !ap_const_lv4_8.is_01())? sc_lv<1>(): sc_lv<1>(c_i_reg_140.read() == ap_const_lv4_8);
}

void dct::thread_grp_dct_dct_2d_fu_184_ap_start() {
    grp_dct_dct_2d_fu_184_ap_start = grp_dct_dct_2d_fu_184_ap_start_ap_start_reg.read();
}

void dct::thread_grp_dct_dct_2d_fu_184_in_block_q0() {
    grp_dct_dct_2d_fu_184_in_block_q0 = buf_2d_in_q0.read();
}

void dct::thread_indvar_flatten_next1_fu_296_p2() {
    indvar_flatten_next1_fu_296_p2 = (!indvar_flatten1_reg_151.read().is_01() || !ap_const_lv7_1.is_01())? sc_lv<7>(): (sc_biguint<7>(indvar_flatten1_reg_151.read()) + sc_biguint<7>(ap_const_lv7_1));
}

void dct::thread_indvar_flatten_next_fu_198_p2() {
    indvar_flatten_next_fu_198_p2 = (!indvar_flatten_reg_118.read().is_01() || !ap_const_lv7_1.is_01())? sc_lv<7>(): (sc_biguint<7>(indvar_flatten_reg_118.read()) + sc_biguint<7>(ap_const_lv7_1));
}

void dct::thread_input_r_address0() {
    input_r_address0 =  (sc_lv<6>) (tmp_6_i_fu_254_p1.read());
}

void dct::thread_input_r_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()))) {
        input_r_ce0 = ap_const_logic_1;
    } else {
        input_r_ce0 = ap_const_logic_0;
    }
}

void dct::thread_output_r_address0() {
    output_r_address0 =  (sc_lv<6>) (tmp_3_i_fu_385_p1.read());
}

void dct::thread_output_r_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()))) {
        output_r_ce0 = ap_const_logic_1;
    } else {
        output_r_ce0 = ap_const_logic_0;
    }
}

void dct::thread_output_r_d0() {
    output_r_d0 = buf_2d_out_q0.read();
}

void dct::thread_output_r_we0() {
    if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
          esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) && 
          esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_reg_419.read())))) {
        output_r_we0 = ap_const_logic_1;
    } else {
        output_r_we0 = ap_const_logic_0;
    }
}

void dct::thread_p_addr1_fu_279_p2() {
    p_addr1_fu_279_p2 = (!p_addr_cast_fu_275_p1.read().is_01() || !tmp_7_i_trn_cast_fu_265_p1.read().is_01())? sc_lv<8>(): (sc_biguint<8>(p_addr_cast_fu_275_p1.read()) + sc_biguint<8>(tmp_7_i_trn_cast_fu_265_p1.read()));
}

void dct::thread_p_addr2_cast_fu_358_p1() {
    p_addr2_cast_fu_358_p1 = esl_zext<8,7>(tmp_4_fu_350_p3.read());
}

void dct::thread_p_addr3_fu_362_p2() {
    p_addr3_fu_362_p2 = (!p_addr2_cast_fu_358_p1.read().is_01() || !tmp_8_i_trn_cast_fu_346_p1.read().is_01())? sc_lv<8>(): (sc_biguint<8>(p_addr2_cast_fu_358_p1.read()) + sc_biguint<8>(tmp_8_i_trn_cast_fu_346_p1.read()));
}

void dct::thread_p_addr_cast_fu_275_p1() {
    p_addr_cast_fu_275_p1 = esl_zext<8,7>(tmp_1_fu_268_p3.read());
}

void dct::thread_r_fu_218_p2() {
    r_fu_218_p2 = (!ap_const_lv4_1.is_01() || !r_i_phi_fu_133_p4.read().is_01())? sc_lv<4>(): (sc_biguint<4>(ap_const_lv4_1) + sc_biguint<4>(r_i_phi_fu_133_p4.read()));
}

void dct::thread_r_i2_mid2_fu_322_p3() {
    r_i2_mid2_fu_322_p3 = (!exitcond_i1_fu_302_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond_i1_fu_302_p2.read()[0].to_bool())? r_s_fu_316_p2.read(): r_i2_phi_fu_166_p4.read());
}

void dct::thread_r_i2_phi_fu_166_p4() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_4.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_reg_419.read()))) {
        r_i2_phi_fu_166_p4 = r_i2_mid2_reg_428.read();
    } else {
        r_i2_phi_fu_166_p4 = r_i2_reg_162.read();
    }
}

void dct::thread_r_i_mid2_fu_224_p3() {
    r_i_mid2_fu_224_p3 = (!exitcond_i_fu_204_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond_i_fu_204_p2.read()[0].to_bool())? r_fu_218_p2.read(): r_i_phi_fu_133_p4.read());
}

void dct::thread_r_i_phi_fu_133_p4() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_1.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()) && 
         esl_seteq<1,1,1>(exitcond_flatten_reg_389.read(), ap_const_lv1_0))) {
        r_i_phi_fu_133_p4 = r_i_mid2_reg_403.read();
    } else {
        r_i_phi_fu_133_p4 = r_i_reg_129.read();
    }
}

void dct::thread_r_s_fu_316_p2() {
    r_s_fu_316_p2 = (!ap_const_lv4_1.is_01() || !r_i2_phi_fu_166_p4.read().is_01())? sc_lv<4>(): (sc_biguint<4>(ap_const_lv4_1) + sc_biguint<4>(r_i2_phi_fu_166_p4.read()));
}

void dct::thread_tmp_1_fu_268_p3() {
    tmp_1_fu_268_p3 = esl_concat<4,3>(r_i_mid2_reg_403.read(), ap_const_lv3_0);
}

void dct::thread_tmp_2_fu_285_p1() {
    tmp_2_fu_285_p1 = esl_zext<64,8>(p_addr1_fu_279_p2.read());
}

void dct::thread_tmp_3_fu_330_p1() {
    tmp_3_fu_330_p1 = r_i2_mid2_fu_322_p3.read().range(3-1, 0);
}

void dct::thread_tmp_3_i_fu_385_p1() {
    tmp_3_i_fu_385_p1 = esl_zext<64,6>(tmp_9_i_reg_438.read());
}

void dct::thread_tmp_4_fu_350_p3() {
    tmp_4_fu_350_p3 = esl_concat<4,3>(r_i2_mid2_fu_322_p3.read(), ap_const_lv3_0);
}

void dct::thread_tmp_5_fu_368_p1() {
    tmp_5_fu_368_p1 = esl_zext<64,8>(p_addr3_fu_362_p2.read());
}

void dct::thread_tmp_5_i_fu_248_p2() {
    tmp_5_i_fu_248_p2 = (!c_i_cast6_fu_244_p1.read().is_01() || !tmp_i_fu_236_p3.read().is_01())? sc_lv<6>(): (sc_biguint<6>(c_i_cast6_fu_244_p1.read()) + sc_biguint<6>(tmp_i_fu_236_p3.read()));
}

void dct::thread_tmp_6_i_fu_254_p1() {
    tmp_6_i_fu_254_p1 = esl_zext<64,6>(tmp_5_i_fu_248_p2.read());
}

void dct::thread_tmp_7_i_trn_cast_fu_265_p1() {
    tmp_7_i_trn_cast_fu_265_p1 = esl_zext<8,4>(c_i_mid2_reg_398.read());
}

void dct::thread_tmp_8_i_trn_cast_fu_346_p1() {
    tmp_8_i_trn_cast_fu_346_p1 = esl_zext<8,4>(c_i6_mid2_fu_308_p3.read());
}

void dct::thread_tmp_9_i_fu_373_p2() {
    tmp_9_i_fu_373_p2 = (!c_i6_cast2_fu_342_p1.read().is_01() || !tmp_i5_fu_334_p3.read().is_01())? sc_lv<6>(): (sc_biguint<6>(c_i6_cast2_fu_342_p1.read()) + sc_biguint<6>(tmp_i5_fu_334_p3.read()));
}

void dct::thread_tmp_fu_232_p1() {
    tmp_fu_232_p1 = r_i_mid2_fu_224_p3.read().range(3-1, 0);
}

void dct::thread_tmp_i5_fu_334_p3() {
    tmp_i5_fu_334_p3 = esl_concat<3,3>(tmp_3_fu_330_p1.read(), ap_const_lv3_0);
}

void dct::thread_tmp_i_fu_236_p3() {
    tmp_i_fu_236_p3 = esl_concat<3,3>(tmp_fu_232_p1.read(), ap_const_lv3_0);
}

void dct::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_pp0_stg0_fsm_1;
            } else {
                ap_NS_fsm = ap_ST_st1_fsm_0;
            }
            break;
        case 2 : 
            if (!(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && !esl_seteq<1,1,1>(exitcond_flatten_fu_192_p2.read(), ap_const_lv1_0))) {
                ap_NS_fsm = ap_ST_pp0_stg0_fsm_1;
            } else {
                ap_NS_fsm = ap_ST_st4_fsm_2;
            }
            break;
        case 4 : 
            ap_NS_fsm = ap_ST_st5_fsm_3;
            break;
        case 8 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_2d_fu_184_ap_done.read())) {
                ap_NS_fsm = ap_ST_pp1_stg0_fsm_4;
            } else {
                ap_NS_fsm = ap_ST_st5_fsm_3;
            }
            break;
        case 16 : 
            if (!(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten1_fu_290_p2.read()))) {
                ap_NS_fsm = ap_ST_pp1_stg0_fsm_4;
            } else {
                ap_NS_fsm = ap_ST_st8_fsm_5;
            }
            break;
        case 32 : 
            ap_NS_fsm = ap_ST_st1_fsm_0;
            break;
        default : 
            ap_NS_fsm = "XXXXXX";
            break;
    }
}

void dct::thread_hdltv_gen() {
    const char* dump_tv = std::getenv("AP_WRITE_TV");
    if (!(dump_tv && string(dump_tv) == "on")) return;

    wait();

    mHdltvinHandle << "[ " << endl;
    mHdltvoutHandle << "[ " << endl;
    int ap_cycleNo = 0;
    while (1) {
        wait();
        const char* mComma = ap_cycleNo == 0 ? " " : ", " ;
        mHdltvinHandle << mComma << "{"  <<  " \"ap_rst\" :  \"" << ap_rst.read() << "\" ";
        mHdltvinHandle << " , " <<  " \"ap_start\" :  \"" << ap_start.read() << "\" ";
        mHdltvoutHandle << mComma << "{"  <<  " \"ap_done\" :  \"" << ap_done.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"ap_idle\" :  \"" << ap_idle.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"ap_ready\" :  \"" << ap_ready.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"input_r_address0\" :  \"" << input_r_address0.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"input_r_ce0\" :  \"" << input_r_ce0.read() << "\" ";
        mHdltvinHandle << " , " <<  " \"input_r_q0\" :  \"" << input_r_q0.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"output_r_address0\" :  \"" << output_r_address0.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"output_r_ce0\" :  \"" << output_r_ce0.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"output_r_we0\" :  \"" << output_r_we0.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"output_r_d0\" :  \"" << output_r_d0.read() << "\" ";
        mHdltvinHandle << "}" << std::endl;
        mHdltvoutHandle << "}" << std::endl;
        ap_cycleNo++;
    }
}

}

