// ==============================================================
// 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_dct_2d.h"
#include "AESL_pkg.h"

using namespace std;

namespace ap_rtl {

const sc_logic dct_dct_2d::ap_const_logic_1 = sc_dt::Log_1;
const sc_logic dct_dct_2d::ap_const_logic_0 = sc_dt::Log_0;
const sc_lv<8> dct_dct_2d::ap_ST_st1_fsm_0 = "1";
const sc_lv<8> dct_dct_2d::ap_ST_st2_fsm_1 = "10";
const sc_lv<8> dct_dct_2d::ap_ST_st3_fsm_2 = "100";
const sc_lv<8> dct_dct_2d::ap_ST_pp0_stg0_fsm_3 = "1000";
const sc_lv<8> dct_dct_2d::ap_ST_st6_fsm_4 = "10000";
const sc_lv<8> dct_dct_2d::ap_ST_st7_fsm_5 = "100000";
const sc_lv<8> dct_dct_2d::ap_ST_pp1_stg0_fsm_6 = "1000000";
const sc_lv<8> dct_dct_2d::ap_ST_st10_fsm_7 = "10000000";
const sc_lv<32> dct_dct_2d::ap_const_lv32_0 = "00000000000000000000000000000000";
const sc_lv<1> dct_dct_2d::ap_const_lv1_1 = "1";
const sc_lv<32> dct_dct_2d::ap_const_lv32_1 = "1";
const sc_lv<32> dct_dct_2d::ap_const_lv32_3 = "11";
const sc_lv<1> dct_dct_2d::ap_const_lv1_0 = "0";
const sc_lv<32> dct_dct_2d::ap_const_lv32_4 = "100";
const sc_lv<32> dct_dct_2d::ap_const_lv32_6 = "110";
const sc_lv<4> dct_dct_2d::ap_const_lv4_0 = "0000";
const sc_lv<32> dct_dct_2d::ap_const_lv32_2 = "10";
const sc_lv<7> dct_dct_2d::ap_const_lv7_0 = "0000000";
const sc_lv<32> dct_dct_2d::ap_const_lv32_5 = "101";
const sc_lv<4> dct_dct_2d::ap_const_lv4_8 = "1000";
const sc_lv<4> dct_dct_2d::ap_const_lv4_1 = "1";
const sc_lv<7> dct_dct_2d::ap_const_lv7_40 = "1000000";
const sc_lv<7> dct_dct_2d::ap_const_lv7_1 = "1";
const sc_lv<3> dct_dct_2d::ap_const_lv3_0 = "000";
const sc_lv<32> dct_dct_2d::ap_const_lv32_7 = "111";

dct_dct_2d::dct_dct_2d(sc_module_name name) : sc_module(name), mVcdFile(0) {
    row_outbuf_U = new dct_dct_2d_row_outbuf("row_outbuf_U");
    row_outbuf_U->clk(ap_clk);
    row_outbuf_U->reset(ap_rst);
    row_outbuf_U->address0(row_outbuf_address0);
    row_outbuf_U->ce0(row_outbuf_ce0);
    row_outbuf_U->we0(row_outbuf_we0);
    row_outbuf_U->d0(row_outbuf_d0);
    row_outbuf_U->q0(row_outbuf_q0);
    col_outbuf_U = new dct_dct_2d_row_outbuf("col_outbuf_U");
    col_outbuf_U->clk(ap_clk);
    col_outbuf_U->reset(ap_rst);
    col_outbuf_U->address0(col_outbuf_address0);
    col_outbuf_U->ce0(col_outbuf_ce0);
    col_outbuf_U->we0(col_outbuf_we0);
    col_outbuf_U->d0(col_outbuf_d0);
    col_outbuf_U->q0(col_outbuf_q0);
    col_inbuf_U = new dct_dct_2d_col_inbuf("col_inbuf_U");
    col_inbuf_U->clk(ap_clk);
    col_inbuf_U->reset(ap_rst);
    col_inbuf_U->address0(col_inbuf_address0);
    col_inbuf_U->ce0(col_inbuf_ce0);
    col_inbuf_U->we0(col_inbuf_we0);
    col_inbuf_U->d0(col_inbuf_d0);
    col_inbuf_U->q0(col_inbuf_q0);
    col_inbuf_U->address1(col_inbuf_address1);
    col_inbuf_U->ce1(col_inbuf_ce1);
    col_inbuf_U->q1(col_inbuf_q1);
    grp_dct_dct_1d_fu_223 = new dct_dct_1d("grp_dct_dct_1d_fu_223");
    grp_dct_dct_1d_fu_223->ap_clk(ap_clk);
    grp_dct_dct_1d_fu_223->ap_rst(ap_rst);
    grp_dct_dct_1d_fu_223->ap_start(grp_dct_dct_1d_fu_223_ap_start);
    grp_dct_dct_1d_fu_223->ap_done(grp_dct_dct_1d_fu_223_ap_done);
    grp_dct_dct_1d_fu_223->ap_idle(grp_dct_dct_1d_fu_223_ap_idle);
    grp_dct_dct_1d_fu_223->ap_ready(grp_dct_dct_1d_fu_223_ap_ready);
    grp_dct_dct_1d_fu_223->src_address0(grp_dct_dct_1d_fu_223_src_address0);
    grp_dct_dct_1d_fu_223->src_ce0(grp_dct_dct_1d_fu_223_src_ce0);
    grp_dct_dct_1d_fu_223->src_q0(grp_dct_dct_1d_fu_223_src_q0);
    grp_dct_dct_1d_fu_223->src_address1(grp_dct_dct_1d_fu_223_src_address1);
    grp_dct_dct_1d_fu_223->src_ce1(grp_dct_dct_1d_fu_223_src_ce1);
    grp_dct_dct_1d_fu_223->src_q1(grp_dct_dct_1d_fu_223_src_q1);
    grp_dct_dct_1d_fu_223->tmp_1(grp_dct_dct_1d_fu_223_tmp_1);
    grp_dct_dct_1d_fu_223->dst_address0(grp_dct_dct_1d_fu_223_dst_address0);
    grp_dct_dct_1d_fu_223->dst_ce0(grp_dct_dct_1d_fu_223_dst_ce0);
    grp_dct_dct_1d_fu_223->dst_we0(grp_dct_dct_1d_fu_223_dst_we0);
    grp_dct_dct_1d_fu_223->dst_d0(grp_dct_dct_1d_fu_223_dst_d0);
    grp_dct_dct_1d_fu_223->tmp_11(grp_dct_dct_1d_fu_223_tmp_11);

    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 << ( ap_sig_cseq_ST_st10_fsm_7 );

    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_st10_fsm_7 );

    SC_METHOD(thread_ap_sig_bdd_105);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_116);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_209);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_228);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_26);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_452);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_66);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_bdd_77);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_cseq_ST_pp0_stg0_fsm_3);
    sensitive << ( ap_sig_bdd_77 );

    SC_METHOD(thread_ap_sig_cseq_ST_pp1_stg0_fsm_6);
    sensitive << ( ap_sig_bdd_116 );

    SC_METHOD(thread_ap_sig_cseq_ST_st10_fsm_7);
    sensitive << ( ap_sig_bdd_452 );

    SC_METHOD(thread_ap_sig_cseq_ST_st1_fsm_0);
    sensitive << ( ap_sig_bdd_26 );

    SC_METHOD(thread_ap_sig_cseq_ST_st2_fsm_1);
    sensitive << ( ap_sig_bdd_66 );

    SC_METHOD(thread_ap_sig_cseq_ST_st3_fsm_2);
    sensitive << ( ap_sig_bdd_209 );

    SC_METHOD(thread_ap_sig_cseq_ST_st6_fsm_4);
    sensitive << ( ap_sig_bdd_105 );

    SC_METHOD(thread_ap_sig_cseq_ST_st7_fsm_5);
    sensitive << ( ap_sig_bdd_228 );

    SC_METHOD(thread_col_inbuf_address0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_3 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );
    sensitive << ( grp_dct_dct_1d_fu_223_src_address0 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );
    sensitive << ( tmp_8_fu_357_p1 );

    SC_METHOD(thread_col_inbuf_address1);
    sensitive << ( grp_dct_dct_1d_fu_223_src_address1 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );

    SC_METHOD(thread_col_inbuf_ce0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_3 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );
    sensitive << ( grp_dct_dct_1d_fu_223_src_ce0 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );

    SC_METHOD(thread_col_inbuf_ce1);
    sensitive << ( grp_dct_dct_1d_fu_223_src_ce1 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );

    SC_METHOD(thread_col_inbuf_d0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_3 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );
    sensitive << ( row_outbuf_q0 );

    SC_METHOD(thread_col_inbuf_we0);
    sensitive << ( exitcond_flatten_reg_481 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_3 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );

    SC_METHOD(thread_col_outbuf_address0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_6 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );
    sensitive << ( grp_dct_dct_1d_fu_223_dst_address0 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );
    sensitive << ( tmp_1_fu_436_p1 );

    SC_METHOD(thread_col_outbuf_ce0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_6 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );
    sensitive << ( grp_dct_dct_1d_fu_223_dst_ce0 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );

    SC_METHOD(thread_col_outbuf_d0);
    sensitive << ( grp_dct_dct_1d_fu_223_dst_d0 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );

    SC_METHOD(thread_col_outbuf_we0);
    sensitive << ( grp_dct_dct_1d_fu_223_dst_we0 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );

    SC_METHOD(thread_exitcond1_fu_386_p2);
    sensitive << ( i_3_reg_212 );
    sensitive << ( exitcond_flatten2_fu_374_p2 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_6 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );

    SC_METHOD(thread_exitcond2_fu_362_p2);
    sensitive << ( ap_sig_cseq_ST_st6_fsm_4 );
    sensitive << ( i_2_reg_178 );

    SC_METHOD(thread_exitcond5_fu_252_p2);
    sensitive << ( ap_sig_cseq_ST_st2_fsm_1 );
    sensitive << ( i_reg_133 );

    SC_METHOD(thread_exitcond_flatten2_fu_374_p2);
    sensitive << ( indvar_flatten2_reg_190 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_6 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );

    SC_METHOD(thread_exitcond_flatten_fu_264_p2);
    sensitive << ( indvar_flatten_reg_145 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_3 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );

    SC_METHOD(thread_exitcond_fu_276_p2);
    sensitive << ( i_1_reg_167 );
    sensitive << ( exitcond_flatten_fu_264_p2 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_3 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );

    SC_METHOD(thread_grp_dct_dct_1d_fu_223_ap_start);
    sensitive << ( grp_dct_dct_1d_fu_223_ap_start_ap_start_reg );

    SC_METHOD(thread_grp_dct_dct_1d_fu_223_src_q0);
    sensitive << ( in_block_q0 );
    sensitive << ( col_inbuf_q0 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );

    SC_METHOD(thread_grp_dct_dct_1d_fu_223_src_q1);
    sensitive << ( in_block_q1 );
    sensitive << ( col_inbuf_q1 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );

    SC_METHOD(thread_grp_dct_dct_1d_fu_223_tmp_1);
    sensitive << ( i_reg_133 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );
    sensitive << ( i_2_reg_178 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );

    SC_METHOD(thread_grp_dct_dct_1d_fu_223_tmp_11);
    sensitive << ( i_reg_133 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );
    sensitive << ( i_2_reg_178 );
    sensitive << ( ap_sig_cseq_ST_st7_fsm_5 );

    SC_METHOD(thread_i_1_mid2_fu_282_p3);
    sensitive << ( i_1_reg_167 );
    sensitive << ( exitcond_fu_276_p2 );

    SC_METHOD(thread_i_3_mid2_fu_392_p3);
    sensitive << ( i_3_reg_212 );
    sensitive << ( exitcond1_fu_386_p2 );

    SC_METHOD(thread_i_4_fu_258_p2);
    sensitive << ( i_reg_133 );

    SC_METHOD(thread_i_5_fu_368_p2);
    sensitive << ( i_2_reg_178 );

    SC_METHOD(thread_i_6_fu_331_p2);
    sensitive << ( i_1_mid2_fu_282_p3 );

    SC_METHOD(thread_i_7_fu_441_p2);
    sensitive << ( i_3_mid2_fu_392_p3 );

    SC_METHOD(thread_in_block_address0);
    sensitive << ( grp_dct_dct_1d_fu_223_src_address0 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );

    SC_METHOD(thread_in_block_address1);
    sensitive << ( grp_dct_dct_1d_fu_223_src_address1 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );

    SC_METHOD(thread_in_block_ce0);
    sensitive << ( grp_dct_dct_1d_fu_223_src_ce0 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );

    SC_METHOD(thread_in_block_ce1);
    sensitive << ( grp_dct_dct_1d_fu_223_src_ce1 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );

    SC_METHOD(thread_indvar_flatten_next2_fu_380_p2);
    sensitive << ( indvar_flatten2_reg_190 );

    SC_METHOD(thread_indvar_flatten_next_fu_270_p2);
    sensitive << ( indvar_flatten_reg_145 );

    SC_METHOD(thread_j_1_mid2_fu_406_p3);
    sensitive << ( j_1_phi_fu_205_p4 );
    sensitive << ( exitcond1_fu_386_p2 );
    sensitive << ( j_2_fu_400_p2 );

    SC_METHOD(thread_j_1_phi_fu_205_p4);
    sensitive << ( j_1_reg_201 );
    sensitive << ( exitcond_flatten2_reg_520 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_6 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );
    sensitive << ( j_1_mid2_reg_534 );

    SC_METHOD(thread_j_2_fu_400_p2);
    sensitive << ( j_1_phi_fu_205_p4 );

    SC_METHOD(thread_j_mid2_fu_296_p3);
    sensitive << ( j_phi_fu_160_p4 );
    sensitive << ( exitcond_fu_276_p2 );
    sensitive << ( j_s_fu_290_p2 );

    SC_METHOD(thread_j_phi_fu_160_p4);
    sensitive << ( j_reg_156 );
    sensitive << ( exitcond_flatten_reg_481 );
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_3 );
    sensitive << ( ap_reg_ppiten_pp0_it1 );
    sensitive << ( j_mid2_reg_495 );

    SC_METHOD(thread_j_s_fu_290_p2);
    sensitive << ( j_phi_fu_160_p4 );

    SC_METHOD(thread_out_block_address0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_6 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );
    sensitive << ( tmp_3_fu_467_p1 );

    SC_METHOD(thread_out_block_ce0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_6 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );

    SC_METHOD(thread_out_block_d0);
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_6 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );
    sensitive << ( col_outbuf_q0 );

    SC_METHOD(thread_out_block_we0);
    sensitive << ( exitcond_flatten2_reg_520 );
    sensitive << ( ap_sig_cseq_ST_pp1_stg0_fsm_6 );
    sensitive << ( ap_reg_ppiten_pp1_it1 );

    SC_METHOD(thread_p_addr3_cast_fu_457_p1);
    sensitive << ( tmp_2_fu_450_p3 );

    SC_METHOD(thread_p_addr4_fu_461_p2);
    sensitive << ( tmp_4_trn_cast_fu_447_p1 );
    sensitive << ( p_addr3_cast_fu_457_p1 );

    SC_METHOD(thread_p_addr5_fu_320_p2);
    sensitive << ( tmp_trn_cast_fu_304_p1 );
    sensitive << ( p_addr_cast_fu_316_p1 );

    SC_METHOD(thread_p_addr6_cast_fu_347_p1);
    sensitive << ( tmp_7_fu_340_p3 );

    SC_METHOD(thread_p_addr7_fu_351_p2);
    sensitive << ( tmp_2_trn_cast_fu_337_p1 );
    sensitive << ( p_addr6_cast_fu_347_p1 );

    SC_METHOD(thread_p_addr8_cast_fu_426_p1);
    sensitive << ( tmp_s_fu_418_p3 );

    SC_METHOD(thread_p_addr9_fu_430_p2);
    sensitive << ( tmp_3_trn_cast_fu_414_p1 );
    sensitive << ( p_addr8_cast_fu_426_p1 );

    SC_METHOD(thread_p_addr_cast_fu_316_p1);
    sensitive << ( tmp_fu_308_p3 );

    SC_METHOD(thread_row_outbuf_address0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_3 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );
    sensitive << ( grp_dct_dct_1d_fu_223_dst_address0 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );
    sensitive << ( tmp_6_fu_326_p1 );

    SC_METHOD(thread_row_outbuf_ce0);
    sensitive << ( ap_sig_cseq_ST_pp0_stg0_fsm_3 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );
    sensitive << ( grp_dct_dct_1d_fu_223_dst_ce0 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );

    SC_METHOD(thread_row_outbuf_d0);
    sensitive << ( grp_dct_dct_1d_fu_223_dst_d0 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );

    SC_METHOD(thread_row_outbuf_we0);
    sensitive << ( grp_dct_dct_1d_fu_223_dst_we0 );
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );

    SC_METHOD(thread_tmp_1_fu_436_p1);
    sensitive << ( p_addr9_fu_430_p2 );

    SC_METHOD(thread_tmp_2_fu_450_p3);
    sensitive << ( j_1_mid2_reg_534 );

    SC_METHOD(thread_tmp_2_trn_cast_fu_337_p1);
    sensitive << ( i_1_mid2_reg_490 );

    SC_METHOD(thread_tmp_3_fu_467_p1);
    sensitive << ( p_addr4_fu_461_p2 );

    SC_METHOD(thread_tmp_3_trn_cast_fu_414_p1);
    sensitive << ( j_1_mid2_fu_406_p3 );

    SC_METHOD(thread_tmp_4_trn_cast_fu_447_p1);
    sensitive << ( i_3_mid2_reg_529 );

    SC_METHOD(thread_tmp_6_fu_326_p1);
    sensitive << ( p_addr5_fu_320_p2 );

    SC_METHOD(thread_tmp_7_fu_340_p3);
    sensitive << ( j_mid2_reg_495 );

    SC_METHOD(thread_tmp_8_fu_357_p1);
    sensitive << ( p_addr7_fu_351_p2 );

    SC_METHOD(thread_tmp_fu_308_p3);
    sensitive << ( i_1_mid2_fu_282_p3 );

    SC_METHOD(thread_tmp_s_fu_418_p3);
    sensitive << ( i_3_mid2_fu_392_p3 );

    SC_METHOD(thread_tmp_trn_cast_fu_304_p1);
    sensitive << ( j_mid2_fu_296_p3 );

    SC_METHOD(thread_ap_NS_fsm);
    sensitive << ( ap_start );
    sensitive << ( ap_CS_fsm );
    sensitive << ( exitcond5_fu_252_p2 );
    sensitive << ( exitcond_flatten_fu_264_p2 );
    sensitive << ( ap_reg_ppiten_pp0_it0 );
    sensitive << ( exitcond2_fu_362_p2 );
    sensitive << ( exitcond_flatten2_fu_374_p2 );
    sensitive << ( ap_reg_ppiten_pp1_it0 );
    sensitive << ( grp_dct_dct_1d_fu_223_ap_done );

    ap_CS_fsm = "00000001";
    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_1d_fu_223_ap_start_ap_start_reg = SC_LOGIC_0;
    static int apTFileNum = 0;
    stringstream apTFilenSS;
    apTFilenSS << "dct_dct_2d_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, in_block_address0, "(port)in_block_address0");
    sc_trace(mVcdFile, in_block_ce0, "(port)in_block_ce0");
    sc_trace(mVcdFile, in_block_q0, "(port)in_block_q0");
    sc_trace(mVcdFile, in_block_address1, "(port)in_block_address1");
    sc_trace(mVcdFile, in_block_ce1, "(port)in_block_ce1");
    sc_trace(mVcdFile, in_block_q1, "(port)in_block_q1");
    sc_trace(mVcdFile, out_block_address0, "(port)out_block_address0");
    sc_trace(mVcdFile, out_block_ce0, "(port)out_block_ce0");
    sc_trace(mVcdFile, out_block_we0, "(port)out_block_we0");
    sc_trace(mVcdFile, out_block_d0, "(port)out_block_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_26, "ap_sig_bdd_26");
    sc_trace(mVcdFile, indvar_flatten_reg_145, "indvar_flatten_reg_145");
    sc_trace(mVcdFile, j_reg_156, "j_reg_156");
    sc_trace(mVcdFile, i_1_reg_167, "i_1_reg_167");
    sc_trace(mVcdFile, indvar_flatten2_reg_190, "indvar_flatten2_reg_190");
    sc_trace(mVcdFile, j_1_reg_201, "j_1_reg_201");
    sc_trace(mVcdFile, i_3_reg_212, "i_3_reg_212");
    sc_trace(mVcdFile, exitcond5_fu_252_p2, "exitcond5_fu_252_p2");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st2_fsm_1, "ap_sig_cseq_ST_st2_fsm_1");
    sc_trace(mVcdFile, ap_sig_bdd_66, "ap_sig_bdd_66");
    sc_trace(mVcdFile, i_4_fu_258_p2, "i_4_fu_258_p2");
    sc_trace(mVcdFile, i_4_reg_476, "i_4_reg_476");
    sc_trace(mVcdFile, exitcond_flatten_fu_264_p2, "exitcond_flatten_fu_264_p2");
    sc_trace(mVcdFile, exitcond_flatten_reg_481, "exitcond_flatten_reg_481");
    sc_trace(mVcdFile, ap_sig_cseq_ST_pp0_stg0_fsm_3, "ap_sig_cseq_ST_pp0_stg0_fsm_3");
    sc_trace(mVcdFile, ap_sig_bdd_77, "ap_sig_bdd_77");
    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_270_p2, "indvar_flatten_next_fu_270_p2");
    sc_trace(mVcdFile, i_1_mid2_fu_282_p3, "i_1_mid2_fu_282_p3");
    sc_trace(mVcdFile, i_1_mid2_reg_490, "i_1_mid2_reg_490");
    sc_trace(mVcdFile, j_mid2_fu_296_p3, "j_mid2_fu_296_p3");
    sc_trace(mVcdFile, j_mid2_reg_495, "j_mid2_reg_495");
    sc_trace(mVcdFile, i_6_fu_331_p2, "i_6_fu_331_p2");
    sc_trace(mVcdFile, exitcond2_fu_362_p2, "exitcond2_fu_362_p2");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st6_fsm_4, "ap_sig_cseq_ST_st6_fsm_4");
    sc_trace(mVcdFile, ap_sig_bdd_105, "ap_sig_bdd_105");
    sc_trace(mVcdFile, i_5_fu_368_p2, "i_5_fu_368_p2");
    sc_trace(mVcdFile, i_5_reg_515, "i_5_reg_515");
    sc_trace(mVcdFile, exitcond_flatten2_fu_374_p2, "exitcond_flatten2_fu_374_p2");
    sc_trace(mVcdFile, exitcond_flatten2_reg_520, "exitcond_flatten2_reg_520");
    sc_trace(mVcdFile, ap_sig_cseq_ST_pp1_stg0_fsm_6, "ap_sig_cseq_ST_pp1_stg0_fsm_6");
    sc_trace(mVcdFile, ap_sig_bdd_116, "ap_sig_bdd_116");
    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_next2_fu_380_p2, "indvar_flatten_next2_fu_380_p2");
    sc_trace(mVcdFile, i_3_mid2_fu_392_p3, "i_3_mid2_fu_392_p3");
    sc_trace(mVcdFile, i_3_mid2_reg_529, "i_3_mid2_reg_529");
    sc_trace(mVcdFile, j_1_mid2_fu_406_p3, "j_1_mid2_fu_406_p3");
    sc_trace(mVcdFile, j_1_mid2_reg_534, "j_1_mid2_reg_534");
    sc_trace(mVcdFile, i_7_fu_441_p2, "i_7_fu_441_p2");
    sc_trace(mVcdFile, row_outbuf_address0, "row_outbuf_address0");
    sc_trace(mVcdFile, row_outbuf_ce0, "row_outbuf_ce0");
    sc_trace(mVcdFile, row_outbuf_we0, "row_outbuf_we0");
    sc_trace(mVcdFile, row_outbuf_d0, "row_outbuf_d0");
    sc_trace(mVcdFile, row_outbuf_q0, "row_outbuf_q0");
    sc_trace(mVcdFile, col_outbuf_address0, "col_outbuf_address0");
    sc_trace(mVcdFile, col_outbuf_ce0, "col_outbuf_ce0");
    sc_trace(mVcdFile, col_outbuf_we0, "col_outbuf_we0");
    sc_trace(mVcdFile, col_outbuf_d0, "col_outbuf_d0");
    sc_trace(mVcdFile, col_outbuf_q0, "col_outbuf_q0");
    sc_trace(mVcdFile, col_inbuf_address0, "col_inbuf_address0");
    sc_trace(mVcdFile, col_inbuf_ce0, "col_inbuf_ce0");
    sc_trace(mVcdFile, col_inbuf_we0, "col_inbuf_we0");
    sc_trace(mVcdFile, col_inbuf_d0, "col_inbuf_d0");
    sc_trace(mVcdFile, col_inbuf_q0, "col_inbuf_q0");
    sc_trace(mVcdFile, col_inbuf_address1, "col_inbuf_address1");
    sc_trace(mVcdFile, col_inbuf_ce1, "col_inbuf_ce1");
    sc_trace(mVcdFile, col_inbuf_q1, "col_inbuf_q1");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_ap_start, "grp_dct_dct_1d_fu_223_ap_start");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_ap_done, "grp_dct_dct_1d_fu_223_ap_done");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_ap_idle, "grp_dct_dct_1d_fu_223_ap_idle");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_ap_ready, "grp_dct_dct_1d_fu_223_ap_ready");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_src_address0, "grp_dct_dct_1d_fu_223_src_address0");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_src_ce0, "grp_dct_dct_1d_fu_223_src_ce0");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_src_q0, "grp_dct_dct_1d_fu_223_src_q0");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_src_address1, "grp_dct_dct_1d_fu_223_src_address1");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_src_ce1, "grp_dct_dct_1d_fu_223_src_ce1");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_src_q1, "grp_dct_dct_1d_fu_223_src_q1");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_tmp_1, "grp_dct_dct_1d_fu_223_tmp_1");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_dst_address0, "grp_dct_dct_1d_fu_223_dst_address0");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_dst_ce0, "grp_dct_dct_1d_fu_223_dst_ce0");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_dst_we0, "grp_dct_dct_1d_fu_223_dst_we0");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_dst_d0, "grp_dct_dct_1d_fu_223_dst_d0");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_tmp_11, "grp_dct_dct_1d_fu_223_tmp_11");
    sc_trace(mVcdFile, i_reg_133, "i_reg_133");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st3_fsm_2, "ap_sig_cseq_ST_st3_fsm_2");
    sc_trace(mVcdFile, ap_sig_bdd_209, "ap_sig_bdd_209");
    sc_trace(mVcdFile, j_phi_fu_160_p4, "j_phi_fu_160_p4");
    sc_trace(mVcdFile, i_2_reg_178, "i_2_reg_178");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st7_fsm_5, "ap_sig_cseq_ST_st7_fsm_5");
    sc_trace(mVcdFile, ap_sig_bdd_228, "ap_sig_bdd_228");
    sc_trace(mVcdFile, j_1_phi_fu_205_p4, "j_1_phi_fu_205_p4");
    sc_trace(mVcdFile, grp_dct_dct_1d_fu_223_ap_start_ap_start_reg, "grp_dct_dct_1d_fu_223_ap_start_ap_start_reg");
    sc_trace(mVcdFile, tmp_6_fu_326_p1, "tmp_6_fu_326_p1");
    sc_trace(mVcdFile, tmp_8_fu_357_p1, "tmp_8_fu_357_p1");
    sc_trace(mVcdFile, tmp_1_fu_436_p1, "tmp_1_fu_436_p1");
    sc_trace(mVcdFile, tmp_3_fu_467_p1, "tmp_3_fu_467_p1");
    sc_trace(mVcdFile, exitcond_fu_276_p2, "exitcond_fu_276_p2");
    sc_trace(mVcdFile, j_s_fu_290_p2, "j_s_fu_290_p2");
    sc_trace(mVcdFile, tmp_fu_308_p3, "tmp_fu_308_p3");
    sc_trace(mVcdFile, tmp_trn_cast_fu_304_p1, "tmp_trn_cast_fu_304_p1");
    sc_trace(mVcdFile, p_addr_cast_fu_316_p1, "p_addr_cast_fu_316_p1");
    sc_trace(mVcdFile, p_addr5_fu_320_p2, "p_addr5_fu_320_p2");
    sc_trace(mVcdFile, tmp_7_fu_340_p3, "tmp_7_fu_340_p3");
    sc_trace(mVcdFile, tmp_2_trn_cast_fu_337_p1, "tmp_2_trn_cast_fu_337_p1");
    sc_trace(mVcdFile, p_addr6_cast_fu_347_p1, "p_addr6_cast_fu_347_p1");
    sc_trace(mVcdFile, p_addr7_fu_351_p2, "p_addr7_fu_351_p2");
    sc_trace(mVcdFile, exitcond1_fu_386_p2, "exitcond1_fu_386_p2");
    sc_trace(mVcdFile, j_2_fu_400_p2, "j_2_fu_400_p2");
    sc_trace(mVcdFile, tmp_s_fu_418_p3, "tmp_s_fu_418_p3");
    sc_trace(mVcdFile, tmp_3_trn_cast_fu_414_p1, "tmp_3_trn_cast_fu_414_p1");
    sc_trace(mVcdFile, p_addr8_cast_fu_426_p1, "p_addr8_cast_fu_426_p1");
    sc_trace(mVcdFile, p_addr9_fu_430_p2, "p_addr9_fu_430_p2");
    sc_trace(mVcdFile, tmp_2_fu_450_p3, "tmp_2_fu_450_p3");
    sc_trace(mVcdFile, tmp_4_trn_cast_fu_447_p1, "tmp_4_trn_cast_fu_447_p1");
    sc_trace(mVcdFile, p_addr3_cast_fu_457_p1, "p_addr3_cast_fu_457_p1");
    sc_trace(mVcdFile, p_addr4_fu_461_p2, "p_addr4_fu_461_p2");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st10_fsm_7, "ap_sig_cseq_ST_st10_fsm_7");
    sc_trace(mVcdFile, ap_sig_bdd_452, "ap_sig_bdd_452");
    sc_trace(mVcdFile, ap_NS_fsm, "ap_NS_fsm");
#endif

    }
}

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

    delete row_outbuf_U;
    delete col_outbuf_U;
    delete col_inbuf_U;
    delete grp_dct_dct_1d_fu_223;
}

void dct_dct_2d::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_3.read()) && 
             !esl_seteq<1,1,1>(exitcond_flatten_fu_264_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_st2_fsm_1.read()) && 
                    !esl_seteq<1,1,1>(exitcond5_fu_252_p2.read(), ap_const_lv1_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_3.read()) && 
             esl_seteq<1,1,1>(exitcond_flatten_fu_264_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_st2_fsm_1.read()) && 
                     !esl_seteq<1,1,1>(exitcond5_fu_252_p2.read(), ap_const_lv1_0)) || 
                    (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
                     !esl_seteq<1,1,1>(exitcond_flatten_fu_264_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_6.read()) && 
             !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten2_fu_374_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_st6_fsm_4.read()) && 
                    !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond2_fu_362_p2.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_6.read()) && 
             esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten2_fu_374_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_st6_fsm_4.read()) && 
                     !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond2_fu_362_p2.read())) || 
                    (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.read()) && 
                     !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten2_fu_374_p2.read())))) {
            ap_reg_ppiten_pp1_it1 = ap_const_logic_0;
        }
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        grp_dct_dct_1d_fu_223_ap_start_ap_start_reg = 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>(exitcond5_fu_252_p2.read(), ap_const_lv1_0)) || 
             (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_4.read()) && 
              esl_seteq<1,1,1>(ap_const_lv1_0, exitcond2_fu_362_p2.read())))) {
            grp_dct_dct_1d_fu_223_ap_start_ap_start_reg = ap_const_logic_1;
        } else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_dct_dct_1d_fu_223_ap_ready.read())) {
            grp_dct_dct_1d_fu_223_ap_start_ap_start_reg = ap_const_logic_0;
        }
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st2_fsm_1.read()) && 
         !esl_seteq<1,1,1>(exitcond5_fu_252_p2.read(), ap_const_lv1_0))) {
        i_1_reg_167 = ap_const_lv4_0;
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
                esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && 
                esl_seteq<1,1,1>(exitcond_flatten_fu_264_p2.read(), ap_const_lv1_0))) {
        i_1_reg_167 = i_6_fu_331_p2.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && 
         !esl_seteq<1,1,1>(exitcond_flatten_fu_264_p2.read(), ap_const_lv1_0))) {
        i_2_reg_178 = ap_const_lv4_0;
    } else if ((!esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_1d_fu_223_ap_done.read()) && 
                esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read()))) {
        i_2_reg_178 = i_5_reg_515.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_4.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond2_fu_362_p2.read()))) {
        i_3_reg_212 = ap_const_lv4_0;
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.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_flatten2_fu_374_p2.read()))) {
        i_3_reg_212 = i_7_fu_441_p2.read();
    }
    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_0, grp_dct_dct_1d_fu_223_ap_done.read()))) {
        i_reg_133 = i_4_reg_476.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))) {
        i_reg_133 = ap_const_lv4_0;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_4.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond2_fu_362_p2.read()))) {
        indvar_flatten2_reg_190 = ap_const_lv7_0;
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.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_flatten2_fu_374_p2.read()))) {
        indvar_flatten2_reg_190 = indvar_flatten_next2_fu_380_p2.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st2_fsm_1.read()) && 
         !esl_seteq<1,1,1>(exitcond5_fu_252_p2.read(), ap_const_lv1_0))) {
        indvar_flatten_reg_145 = ap_const_lv7_0;
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
                esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && 
                esl_seteq<1,1,1>(exitcond_flatten_fu_264_p2.read(), ap_const_lv1_0))) {
        indvar_flatten_reg_145 = indvar_flatten_next_fu_270_p2.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_4.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond2_fu_362_p2.read()))) {
        j_1_reg_201 = ap_const_lv4_0;
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.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_flatten2_reg_520.read()))) {
        j_1_reg_201 = j_1_mid2_reg_534.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st2_fsm_1.read()) && 
         !esl_seteq<1,1,1>(exitcond5_fu_252_p2.read(), ap_const_lv1_0))) {
        j_reg_156 = ap_const_lv4_0;
    } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
                esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()) && 
                esl_seteq<1,1,1>(exitcond_flatten_reg_481.read(), ap_const_lv1_0))) {
        j_reg_156 = j_mid2_reg_495.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.read())) {
        exitcond_flatten2_reg_520 = exitcond_flatten2_fu_374_p2.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read())) {
        exitcond_flatten_reg_481 = exitcond_flatten_fu_264_p2.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && esl_seteq<1,1,1>(exitcond_flatten_fu_264_p2.read(), ap_const_lv1_0))) {
        i_1_mid2_reg_490 = i_1_mid2_fu_282_p3.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_flatten2_fu_374_p2.read()))) {
        i_3_mid2_reg_529 = i_3_mid2_fu_392_p3.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st2_fsm_1.read())) {
        i_4_reg_476 = i_4_fu_258_p2.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_4.read())) {
        i_5_reg_515 = i_5_fu_368_p2.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.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_flatten2_fu_374_p2.read()))) {
        j_1_mid2_reg_534 = j_1_mid2_fu_406_p3.read();
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && esl_seteq<1,1,1>(exitcond_flatten_fu_264_p2.read(), ap_const_lv1_0))) {
        j_mid2_reg_495 = j_mid2_fu_296_p3.read();
    }
}

void dct_dct_2d::thread_ap_done() {
    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())) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st10_fsm_7.read()))) {
        ap_done = ap_const_logic_1;
    } else {
        ap_done = ap_const_logic_0;
    }
}

void dct_dct_2d::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_dct_2d::thread_ap_ready() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st10_fsm_7.read())) {
        ap_ready = ap_const_logic_1;
    } else {
        ap_ready = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_ap_sig_bdd_105() {
    ap_sig_bdd_105 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(4, 4));
}

void dct_dct_2d::thread_ap_sig_bdd_116() {
    ap_sig_bdd_116 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(6, 6));
}

void dct_dct_2d::thread_ap_sig_bdd_209() {
    ap_sig_bdd_209 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(2, 2));
}

void dct_dct_2d::thread_ap_sig_bdd_228() {
    ap_sig_bdd_228 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(5, 5));
}

void dct_dct_2d::thread_ap_sig_bdd_26() {
    ap_sig_bdd_26 = esl_seteq<1,1,1>(ap_CS_fsm.read().range(0, 0), ap_const_lv1_1);
}

void dct_dct_2d::thread_ap_sig_bdd_452() {
    ap_sig_bdd_452 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(7, 7));
}

void dct_dct_2d::thread_ap_sig_bdd_66() {
    ap_sig_bdd_66 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(1, 1));
}

void dct_dct_2d::thread_ap_sig_bdd_77() {
    ap_sig_bdd_77 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(3, 3));
}

void dct_dct_2d::thread_ap_sig_cseq_ST_pp0_stg0_fsm_3() {
    if (ap_sig_bdd_77.read()) {
        ap_sig_cseq_ST_pp0_stg0_fsm_3 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_pp0_stg0_fsm_3 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_ap_sig_cseq_ST_pp1_stg0_fsm_6() {
    if (ap_sig_bdd_116.read()) {
        ap_sig_cseq_ST_pp1_stg0_fsm_6 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_pp1_stg0_fsm_6 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_ap_sig_cseq_ST_st10_fsm_7() {
    if (ap_sig_bdd_452.read()) {
        ap_sig_cseq_ST_st10_fsm_7 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st10_fsm_7 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_ap_sig_cseq_ST_st1_fsm_0() {
    if (ap_sig_bdd_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 dct_dct_2d::thread_ap_sig_cseq_ST_st2_fsm_1() {
    if (ap_sig_bdd_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 dct_dct_2d::thread_ap_sig_cseq_ST_st3_fsm_2() {
    if (ap_sig_bdd_209.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 dct_dct_2d::thread_ap_sig_cseq_ST_st6_fsm_4() {
    if (ap_sig_bdd_105.read()) {
        ap_sig_cseq_ST_st6_fsm_4 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st6_fsm_4 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_ap_sig_cseq_ST_st7_fsm_5() {
    if (ap_sig_bdd_228.read()) {
        ap_sig_cseq_ST_st7_fsm_5 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st7_fsm_5 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_col_inbuf_address0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()))) {
        col_inbuf_address0 =  (sc_lv<6>) (tmp_8_fu_357_p1.read());
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read())) {
        col_inbuf_address0 = grp_dct_dct_1d_fu_223_src_address0.read();
    } else {
        col_inbuf_address0 = "XXXXXX";
    }
}

void dct_dct_2d::thread_col_inbuf_address1() {
    col_inbuf_address1 = grp_dct_dct_1d_fu_223_src_address1.read();
}

void dct_dct_2d::thread_col_inbuf_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()))) {
        col_inbuf_ce0 = ap_const_logic_1;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read())) {
        col_inbuf_ce0 = grp_dct_dct_1d_fu_223_src_ce0.read();
    } else {
        col_inbuf_ce0 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_col_inbuf_ce1() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read())) {
        col_inbuf_ce1 = grp_dct_dct_1d_fu_223_src_ce1.read();
    } else {
        col_inbuf_ce1 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_col_inbuf_d0() {
    col_inbuf_d0 = row_outbuf_q0.read();
}

void dct_dct_2d::thread_col_inbuf_we0() {
    if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
          esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()) && 
          esl_seteq<1,1,1>(exitcond_flatten_reg_481.read(), ap_const_lv1_0)))) {
        col_inbuf_we0 = ap_const_logic_1;
    } else {
        col_inbuf_we0 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_col_outbuf_address0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()))) {
        col_outbuf_address0 =  (sc_lv<6>) (tmp_1_fu_436_p1.read());
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read())) {
        col_outbuf_address0 = grp_dct_dct_1d_fu_223_dst_address0.read();
    } else {
        col_outbuf_address0 = "XXXXXX";
    }
}

void dct_dct_2d::thread_col_outbuf_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()))) {
        col_outbuf_ce0 = ap_const_logic_1;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read())) {
        col_outbuf_ce0 = grp_dct_dct_1d_fu_223_dst_ce0.read();
    } else {
        col_outbuf_ce0 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_col_outbuf_d0() {
    col_outbuf_d0 = grp_dct_dct_1d_fu_223_dst_d0.read();
}

void dct_dct_2d::thread_col_outbuf_we0() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read())) {
        col_outbuf_we0 = grp_dct_dct_1d_fu_223_dst_we0.read();
    } else {
        col_outbuf_we0 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_exitcond1_fu_386_p2() {
    exitcond1_fu_386_p2 = (!i_3_reg_212.read().is_01() || !ap_const_lv4_8.is_01())? sc_lv<1>(): sc_lv<1>(i_3_reg_212.read() == ap_const_lv4_8);
}

void dct_dct_2d::thread_exitcond2_fu_362_p2() {
    exitcond2_fu_362_p2 = (!i_2_reg_178.read().is_01() || !ap_const_lv4_8.is_01())? sc_lv<1>(): sc_lv<1>(i_2_reg_178.read() == ap_const_lv4_8);
}

void dct_dct_2d::thread_exitcond5_fu_252_p2() {
    exitcond5_fu_252_p2 = (!i_reg_133.read().is_01() || !ap_const_lv4_8.is_01())? sc_lv<1>(): sc_lv<1>(i_reg_133.read() == ap_const_lv4_8);
}

void dct_dct_2d::thread_exitcond_flatten2_fu_374_p2() {
    exitcond_flatten2_fu_374_p2 = (!indvar_flatten2_reg_190.read().is_01() || !ap_const_lv7_40.is_01())? sc_lv<1>(): sc_lv<1>(indvar_flatten2_reg_190.read() == ap_const_lv7_40);
}

void dct_dct_2d::thread_exitcond_flatten_fu_264_p2() {
    exitcond_flatten_fu_264_p2 = (!indvar_flatten_reg_145.read().is_01() || !ap_const_lv7_40.is_01())? sc_lv<1>(): sc_lv<1>(indvar_flatten_reg_145.read() == ap_const_lv7_40);
}

void dct_dct_2d::thread_exitcond_fu_276_p2() {
    exitcond_fu_276_p2 = (!i_1_reg_167.read().is_01() || !ap_const_lv4_8.is_01())? sc_lv<1>(): sc_lv<1>(i_1_reg_167.read() == ap_const_lv4_8);
}

void dct_dct_2d::thread_grp_dct_dct_1d_fu_223_ap_start() {
    grp_dct_dct_1d_fu_223_ap_start = grp_dct_dct_1d_fu_223_ap_start_ap_start_reg.read();
}

void dct_dct_2d::thread_grp_dct_dct_1d_fu_223_src_q0() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read())) {
        grp_dct_dct_1d_fu_223_src_q0 = col_inbuf_q0.read();
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read())) {
        grp_dct_dct_1d_fu_223_src_q0 = in_block_q0.read();
    } else {
        grp_dct_dct_1d_fu_223_src_q0 =  (sc_lv<16>) ("XXXXXXXXXXXXXXXX");
    }
}

void dct_dct_2d::thread_grp_dct_dct_1d_fu_223_src_q1() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read())) {
        grp_dct_dct_1d_fu_223_src_q1 = col_inbuf_q1.read();
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read())) {
        grp_dct_dct_1d_fu_223_src_q1 = in_block_q1.read();
    } else {
        grp_dct_dct_1d_fu_223_src_q1 =  (sc_lv<16>) ("XXXXXXXXXXXXXXXX");
    }
}

void dct_dct_2d::thread_grp_dct_dct_1d_fu_223_tmp_1() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read())) {
        grp_dct_dct_1d_fu_223_tmp_1 = i_2_reg_178.read();
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read())) {
        grp_dct_dct_1d_fu_223_tmp_1 = i_reg_133.read();
    } else {
        grp_dct_dct_1d_fu_223_tmp_1 =  (sc_lv<4>) ("XXXX");
    }
}

void dct_dct_2d::thread_grp_dct_dct_1d_fu_223_tmp_11() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_5.read())) {
        grp_dct_dct_1d_fu_223_tmp_11 = i_2_reg_178.read();
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read())) {
        grp_dct_dct_1d_fu_223_tmp_11 = i_reg_133.read();
    } else {
        grp_dct_dct_1d_fu_223_tmp_11 =  (sc_lv<4>) ("XXXX");
    }
}

void dct_dct_2d::thread_i_1_mid2_fu_282_p3() {
    i_1_mid2_fu_282_p3 = (!exitcond_fu_276_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond_fu_276_p2.read()[0].to_bool())? ap_const_lv4_0: i_1_reg_167.read());
}

void dct_dct_2d::thread_i_3_mid2_fu_392_p3() {
    i_3_mid2_fu_392_p3 = (!exitcond1_fu_386_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond1_fu_386_p2.read()[0].to_bool())? ap_const_lv4_0: i_3_reg_212.read());
}

void dct_dct_2d::thread_i_4_fu_258_p2() {
    i_4_fu_258_p2 = (!i_reg_133.read().is_01() || !ap_const_lv4_1.is_01())? sc_lv<4>(): (sc_biguint<4>(i_reg_133.read()) + sc_biguint<4>(ap_const_lv4_1));
}

void dct_dct_2d::thread_i_5_fu_368_p2() {
    i_5_fu_368_p2 = (!i_2_reg_178.read().is_01() || !ap_const_lv4_1.is_01())? sc_lv<4>(): (sc_biguint<4>(i_2_reg_178.read()) + sc_biguint<4>(ap_const_lv4_1));
}

void dct_dct_2d::thread_i_6_fu_331_p2() {
    i_6_fu_331_p2 = (!i_1_mid2_fu_282_p3.read().is_01() || !ap_const_lv4_1.is_01())? sc_lv<4>(): (sc_biguint<4>(i_1_mid2_fu_282_p3.read()) + sc_biguint<4>(ap_const_lv4_1));
}

void dct_dct_2d::thread_i_7_fu_441_p2() {
    i_7_fu_441_p2 = (!i_3_mid2_fu_392_p3.read().is_01() || !ap_const_lv4_1.is_01())? sc_lv<4>(): (sc_biguint<4>(i_3_mid2_fu_392_p3.read()) + sc_biguint<4>(ap_const_lv4_1));
}

void dct_dct_2d::thread_in_block_address0() {
    in_block_address0 = grp_dct_dct_1d_fu_223_src_address0.read();
}

void dct_dct_2d::thread_in_block_address1() {
    in_block_address1 = grp_dct_dct_1d_fu_223_src_address1.read();
}

void dct_dct_2d::thread_in_block_ce0() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read())) {
        in_block_ce0 = grp_dct_dct_1d_fu_223_src_ce0.read();
    } else {
        in_block_ce0 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_in_block_ce1() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read())) {
        in_block_ce1 = grp_dct_dct_1d_fu_223_src_ce1.read();
    } else {
        in_block_ce1 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_indvar_flatten_next2_fu_380_p2() {
    indvar_flatten_next2_fu_380_p2 = (!indvar_flatten2_reg_190.read().is_01() || !ap_const_lv7_1.is_01())? sc_lv<7>(): (sc_biguint<7>(indvar_flatten2_reg_190.read()) + sc_biguint<7>(ap_const_lv7_1));
}

void dct_dct_2d::thread_indvar_flatten_next_fu_270_p2() {
    indvar_flatten_next_fu_270_p2 = (!indvar_flatten_reg_145.read().is_01() || !ap_const_lv7_1.is_01())? sc_lv<7>(): (sc_biguint<7>(indvar_flatten_reg_145.read()) + sc_biguint<7>(ap_const_lv7_1));
}

void dct_dct_2d::thread_j_1_mid2_fu_406_p3() {
    j_1_mid2_fu_406_p3 = (!exitcond1_fu_386_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond1_fu_386_p2.read()[0].to_bool())? j_2_fu_400_p2.read(): j_1_phi_fu_205_p4.read());
}

void dct_dct_2d::thread_j_1_phi_fu_205_p4() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.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_flatten2_reg_520.read()))) {
        j_1_phi_fu_205_p4 = j_1_mid2_reg_534.read();
    } else {
        j_1_phi_fu_205_p4 = j_1_reg_201.read();
    }
}

void dct_dct_2d::thread_j_2_fu_400_p2() {
    j_2_fu_400_p2 = (!j_1_phi_fu_205_p4.read().is_01() || !ap_const_lv4_1.is_01())? sc_lv<4>(): (sc_biguint<4>(j_1_phi_fu_205_p4.read()) + sc_biguint<4>(ap_const_lv4_1));
}

void dct_dct_2d::thread_j_mid2_fu_296_p3() {
    j_mid2_fu_296_p3 = (!exitcond_fu_276_p2.read()[0].is_01())? sc_lv<4>(): ((exitcond_fu_276_p2.read()[0].to_bool())? j_s_fu_290_p2.read(): j_phi_fu_160_p4.read());
}

void dct_dct_2d::thread_j_phi_fu_160_p4() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it1.read()) && 
         esl_seteq<1,1,1>(exitcond_flatten_reg_481.read(), ap_const_lv1_0))) {
        j_phi_fu_160_p4 = j_mid2_reg_495.read();
    } else {
        j_phi_fu_160_p4 = j_reg_156.read();
    }
}

void dct_dct_2d::thread_j_s_fu_290_p2() {
    j_s_fu_290_p2 = (!j_phi_fu_160_p4.read().is_01() || !ap_const_lv4_1.is_01())? sc_lv<4>(): (sc_biguint<4>(j_phi_fu_160_p4.read()) + sc_biguint<4>(ap_const_lv4_1));
}

void dct_dct_2d::thread_out_block_address0() {
    out_block_address0 =  (sc_lv<6>) (tmp_3_fu_467_p1.read());
}

void dct_dct_2d::thread_out_block_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()))) {
        out_block_ce0 = ap_const_logic_1;
    } else {
        out_block_ce0 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_out_block_d0() {
    out_block_d0 = col_outbuf_q0.read();
}

void dct_dct_2d::thread_out_block_we0() {
    if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp1_stg0_fsm_6.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_flatten2_reg_520.read())))) {
        out_block_we0 = ap_const_logic_1;
    } else {
        out_block_we0 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_p_addr3_cast_fu_457_p1() {
    p_addr3_cast_fu_457_p1 = esl_zext<8,7>(tmp_2_fu_450_p3.read());
}

void dct_dct_2d::thread_p_addr4_fu_461_p2() {
    p_addr4_fu_461_p2 = (!tmp_4_trn_cast_fu_447_p1.read().is_01() || !p_addr3_cast_fu_457_p1.read().is_01())? sc_lv<8>(): (sc_biguint<8>(tmp_4_trn_cast_fu_447_p1.read()) + sc_biguint<8>(p_addr3_cast_fu_457_p1.read()));
}

void dct_dct_2d::thread_p_addr5_fu_320_p2() {
    p_addr5_fu_320_p2 = (!tmp_trn_cast_fu_304_p1.read().is_01() || !p_addr_cast_fu_316_p1.read().is_01())? sc_lv<8>(): (sc_biguint<8>(tmp_trn_cast_fu_304_p1.read()) + sc_biguint<8>(p_addr_cast_fu_316_p1.read()));
}

void dct_dct_2d::thread_p_addr6_cast_fu_347_p1() {
    p_addr6_cast_fu_347_p1 = esl_zext<8,7>(tmp_7_fu_340_p3.read());
}

void dct_dct_2d::thread_p_addr7_fu_351_p2() {
    p_addr7_fu_351_p2 = (!tmp_2_trn_cast_fu_337_p1.read().is_01() || !p_addr6_cast_fu_347_p1.read().is_01())? sc_lv<8>(): (sc_biguint<8>(tmp_2_trn_cast_fu_337_p1.read()) + sc_biguint<8>(p_addr6_cast_fu_347_p1.read()));
}

void dct_dct_2d::thread_p_addr8_cast_fu_426_p1() {
    p_addr8_cast_fu_426_p1 = esl_zext<8,7>(tmp_s_fu_418_p3.read());
}

void dct_dct_2d::thread_p_addr9_fu_430_p2() {
    p_addr9_fu_430_p2 = (!tmp_3_trn_cast_fu_414_p1.read().is_01() || !p_addr8_cast_fu_426_p1.read().is_01())? sc_lv<8>(): (sc_biguint<8>(tmp_3_trn_cast_fu_414_p1.read()) + sc_biguint<8>(p_addr8_cast_fu_426_p1.read()));
}

void dct_dct_2d::thread_p_addr_cast_fu_316_p1() {
    p_addr_cast_fu_316_p1 = esl_zext<8,7>(tmp_fu_308_p3.read());
}

void dct_dct_2d::thread_row_outbuf_address0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()))) {
        row_outbuf_address0 =  (sc_lv<6>) (tmp_6_fu_326_p1.read());
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read())) {
        row_outbuf_address0 = grp_dct_dct_1d_fu_223_dst_address0.read();
    } else {
        row_outbuf_address0 = "XXXXXX";
    }
}

void dct_dct_2d::thread_row_outbuf_ce0() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_pp0_stg0_fsm_3.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()))) {
        row_outbuf_ce0 = ap_const_logic_1;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read())) {
        row_outbuf_ce0 = grp_dct_dct_1d_fu_223_dst_ce0.read();
    } else {
        row_outbuf_ce0 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_row_outbuf_d0() {
    row_outbuf_d0 = grp_dct_dct_1d_fu_223_dst_d0.read();
}

void dct_dct_2d::thread_row_outbuf_we0() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read())) {
        row_outbuf_we0 = grp_dct_dct_1d_fu_223_dst_we0.read();
    } else {
        row_outbuf_we0 = ap_const_logic_0;
    }
}

void dct_dct_2d::thread_tmp_1_fu_436_p1() {
    tmp_1_fu_436_p1 = esl_zext<64,8>(p_addr9_fu_430_p2.read());
}

void dct_dct_2d::thread_tmp_2_fu_450_p3() {
    tmp_2_fu_450_p3 = esl_concat<4,3>(j_1_mid2_reg_534.read(), ap_const_lv3_0);
}

void dct_dct_2d::thread_tmp_2_trn_cast_fu_337_p1() {
    tmp_2_trn_cast_fu_337_p1 = esl_zext<8,4>(i_1_mid2_reg_490.read());
}

void dct_dct_2d::thread_tmp_3_fu_467_p1() {
    tmp_3_fu_467_p1 = esl_zext<64,8>(p_addr4_fu_461_p2.read());
}

void dct_dct_2d::thread_tmp_3_trn_cast_fu_414_p1() {
    tmp_3_trn_cast_fu_414_p1 = esl_zext<8,4>(j_1_mid2_fu_406_p3.read());
}

void dct_dct_2d::thread_tmp_4_trn_cast_fu_447_p1() {
    tmp_4_trn_cast_fu_447_p1 = esl_zext<8,4>(i_3_mid2_reg_529.read());
}

void dct_dct_2d::thread_tmp_6_fu_326_p1() {
    tmp_6_fu_326_p1 = esl_zext<64,8>(p_addr5_fu_320_p2.read());
}

void dct_dct_2d::thread_tmp_7_fu_340_p3() {
    tmp_7_fu_340_p3 = esl_concat<4,3>(j_mid2_reg_495.read(), ap_const_lv3_0);
}

void dct_dct_2d::thread_tmp_8_fu_357_p1() {
    tmp_8_fu_357_p1 = esl_zext<64,8>(p_addr7_fu_351_p2.read());
}

void dct_dct_2d::thread_tmp_fu_308_p3() {
    tmp_fu_308_p3 = esl_concat<4,3>(i_1_mid2_fu_282_p3.read(), ap_const_lv3_0);
}

void dct_dct_2d::thread_tmp_s_fu_418_p3() {
    tmp_s_fu_418_p3 = esl_concat<4,3>(i_3_mid2_fu_392_p3.read(), ap_const_lv3_0);
}

void dct_dct_2d::thread_tmp_trn_cast_fu_304_p1() {
    tmp_trn_cast_fu_304_p1 = esl_zext<8,4>(j_mid2_fu_296_p3.read());
}

void dct_dct_2d::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 : 
            if (!esl_seteq<1,1,1>(exitcond5_fu_252_p2.read(), ap_const_lv1_0)) {
                ap_NS_fsm = ap_ST_pp0_stg0_fsm_3;
            } else {
                ap_NS_fsm = ap_ST_st3_fsm_2;
            }
            break;
        case 4 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_1d_fu_223_ap_done.read())) {
                ap_NS_fsm = ap_ST_st2_fsm_1;
            } else {
                ap_NS_fsm = ap_ST_st3_fsm_2;
            }
            break;
        case 8 : 
            if (!(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp0_it0.read()) && !esl_seteq<1,1,1>(exitcond_flatten_fu_264_p2.read(), ap_const_lv1_0))) {
                ap_NS_fsm = ap_ST_pp0_stg0_fsm_3;
            } else {
                ap_NS_fsm = ap_ST_st6_fsm_4;
            }
            break;
        case 16 : 
            if (!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond2_fu_362_p2.read())) {
                ap_NS_fsm = ap_ST_pp1_stg0_fsm_6;
            } else {
                ap_NS_fsm = ap_ST_st7_fsm_5;
            }
            break;
        case 32 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_dct_dct_1d_fu_223_ap_done.read())) {
                ap_NS_fsm = ap_ST_st6_fsm_4;
            } else {
                ap_NS_fsm = ap_ST_st7_fsm_5;
            }
            break;
        case 64 : 
            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_flatten2_fu_374_p2.read()))) {
                ap_NS_fsm = ap_ST_pp1_stg0_fsm_6;
            } else {
                ap_NS_fsm = ap_ST_st10_fsm_7;
            }
            break;
        case 128 : 
            ap_NS_fsm = ap_ST_st1_fsm_0;
            break;
        default : 
            ap_NS_fsm =  (sc_lv<8>) ("XXXXXXXX");
            break;
    }
}

}

