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

#include "clock_top.h"
#include "AESL_pkg.h"

using namespace std;

namespace ap_rtl {

const sc_logic clock_top::ap_const_logic_1 = sc_dt::Log_1;
const sc_logic clock_top::ap_const_logic_0 = sc_dt::Log_0;
const sc_lv<18> clock_top::ap_ST_st1_fsm_0 = "1";
const sc_lv<18> clock_top::ap_ST_st2_fsm_1 = "10";
const sc_lv<18> clock_top::ap_ST_st3_fsm_2 = "100";
const sc_lv<18> clock_top::ap_ST_st4_fsm_3 = "1000";
const sc_lv<18> clock_top::ap_ST_st5_fsm_4 = "10000";
const sc_lv<18> clock_top::ap_ST_st6_fsm_5 = "100000";
const sc_lv<18> clock_top::ap_ST_st7_fsm_6 = "1000000";
const sc_lv<18> clock_top::ap_ST_st8_fsm_7 = "10000000";
const sc_lv<18> clock_top::ap_ST_st9_fsm_8 = "100000000";
const sc_lv<18> clock_top::ap_ST_st10_fsm_9 = "1000000000";
const sc_lv<18> clock_top::ap_ST_st11_fsm_10 = "10000000000";
const sc_lv<18> clock_top::ap_ST_st12_fsm_11 = "100000000000";
const sc_lv<18> clock_top::ap_ST_st13_fsm_12 = "1000000000000";
const sc_lv<18> clock_top::ap_ST_st14_fsm_13 = "10000000000000";
const sc_lv<18> clock_top::ap_ST_st15_fsm_14 = "100000000000000";
const sc_lv<18> clock_top::ap_ST_st16_fsm_15 = "1000000000000000";
const sc_lv<18> clock_top::ap_ST_st17_fsm_16 = "10000000000000000";
const sc_lv<18> clock_top::ap_ST_st18_fsm_17 = "100000000000000000";
const sc_lv<32> clock_top::ap_const_lv32_0 = "00000000000000000000000000000000";
const sc_lv<1> clock_top::ap_const_lv1_1 = "1";
const sc_lv<1> clock_top::ap_const_lv1_0 = "0";
const sc_lv<32> clock_top::ap_const_lv32_2 = "10";
const sc_lv<32> clock_top::ap_const_lv32_4 = "100";
const sc_lv<32> clock_top::ap_const_lv32_6 = "110";
const sc_lv<32> clock_top::ap_const_lv32_A = "1010";
const sc_lv<32> clock_top::ap_const_lv32_C = "1100";
const sc_lv<32> clock_top::ap_const_lv32_10 = "10000";
const sc_lv<6> clock_top::ap_const_lv6_0 = "000000";
const sc_lv<32> clock_top::ap_const_lv32_1 = "1";
const sc_lv<32> clock_top::ap_const_lv32_3 = "11";
const sc_lv<32> clock_top::ap_const_lv32_5 = "101";
const sc_lv<32> clock_top::ap_const_lv32_8 = "1000";
const sc_lv<32> clock_top::ap_const_lv32_E = "1110";
const sc_lv<7> clock_top::ap_const_lv7_10 = "10000";
const sc_lv<7> clock_top::ap_const_lv7_11 = "10001";
const sc_lv<32> clock_top::ap_const_lv32_7 = "111";
const sc_lv<7> clock_top::ap_const_lv7_12 = "10010";
const sc_lv<32> clock_top::ap_const_lv32_9 = "1001";
const sc_lv<7> clock_top::ap_const_lv7_13 = "10011";
const sc_lv<32> clock_top::ap_const_lv32_B = "1011";
const sc_lv<7> clock_top::ap_const_lv7_14 = "10100";
const sc_lv<32> clock_top::ap_const_lv32_D = "1101";
const sc_lv<7> clock_top::ap_const_lv7_15 = "10101";
const sc_lv<32> clock_top::ap_const_lv32_F = "1111";
const sc_lv<7> clock_top::ap_const_lv7_16 = "10110";
const sc_lv<32> clock_top::ap_const_lv32_11 = "10001";
const sc_lv<8> clock_top::ap_const_lv8_20 = "100000";
const sc_lv<8> clock_top::ap_const_lv8_3A = "111010";
const sc_lv<8> clock_top::ap_const_lv8_2E = "101110";
const sc_lv<8> clock_top::ap_const_lv8_30 = "110000";
const sc_lv<6> clock_top::ap_const_lv6_20 = "100000";
const sc_lv<6> clock_top::ap_const_lv6_1 = "1";
const sc_lv<8> clock_top::ap_const_lv8_1 = "1";
const sc_lv<8> clock_top::ap_const_lv8_39 = "111001";
const sc_lv<8> clock_top::ap_const_lv8_35 = "110101";
const sc_lv<6> clock_top::ap_const_lv6_30 = "110000";

clock_top::clock_top(sc_module_name name) : sc_module(name), mVcdFile(0) {
    grp_clock_top_wait_tmr_fu_131 = new clock_top_wait_tmr("grp_clock_top_wait_tmr_fu_131");
    grp_clock_top_wait_tmr_fu_131->ap_clk(ap_clk);
    grp_clock_top_wait_tmr_fu_131->ap_rst(ap_rst);
    grp_clock_top_wait_tmr_fu_131->ap_start(grp_clock_top_wait_tmr_fu_131_ap_start);
    grp_clock_top_wait_tmr_fu_131->ap_done(grp_clock_top_wait_tmr_fu_131_ap_done);
    grp_clock_top_wait_tmr_fu_131->ap_idle(grp_clock_top_wait_tmr_fu_131_ap_idle);
    grp_clock_top_wait_tmr_fu_131->ap_ready(grp_clock_top_wait_tmr_fu_131_ap_ready);
    grp_clock_top_wait_tmr_fu_131->dummy_tmr_out_i(dummy_tmr_out_0_data_reg);
    grp_clock_top_wait_tmr_fu_131->dummy_tmr_out_o(grp_clock_top_wait_tmr_fu_131_dummy_tmr_out_o);
    grp_clock_top_wait_tmr_fu_131->dummy_tmr_out_o_ap_vld(grp_clock_top_wait_tmr_fu_131_dummy_tmr_out_o_ap_vld);
    grp_clock_top_write_mem_fu_137 = new clock_top_write_mem("grp_clock_top_write_mem_fu_137");
    grp_clock_top_write_mem_fu_137->ap_clk(ap_clk);
    grp_clock_top_write_mem_fu_137->ap_rst(ap_rst);
    grp_clock_top_write_mem_fu_137->ap_start(grp_clock_top_write_mem_fu_137_ap_start);
    grp_clock_top_write_mem_fu_137->ap_done(grp_clock_top_write_mem_fu_137_ap_done);
    grp_clock_top_write_mem_fu_137->ap_idle(grp_clock_top_write_mem_fu_137_ap_idle);
    grp_clock_top_write_mem_fu_137->ap_ready(grp_clock_top_write_mem_fu_137_ap_ready);
    grp_clock_top_write_mem_fu_137->addr(grp_clock_top_write_mem_fu_137_addr);
    grp_clock_top_write_mem_fu_137->data(grp_clock_top_write_mem_fu_137_data);
    grp_clock_top_write_mem_fu_137->mem_addr(grp_clock_top_write_mem_fu_137_mem_addr);
    grp_clock_top_write_mem_fu_137->mem_addr_ap_vld(grp_clock_top_write_mem_fu_137_mem_addr_ap_vld);
    grp_clock_top_write_mem_fu_137->mem_dout(grp_clock_top_write_mem_fu_137_mem_dout);
    grp_clock_top_write_mem_fu_137->mem_dout_ap_vld(grp_clock_top_write_mem_fu_137_mem_dout_ap_vld);
    grp_clock_top_write_mem_fu_137->mem_wreq(grp_clock_top_write_mem_fu_137_mem_wreq);
    grp_clock_top_write_mem_fu_137->mem_wreq_ap_vld(grp_clock_top_write_mem_fu_137_mem_wreq_ap_vld);
    grp_clock_top_write_mem_fu_137->mem_ack(mem_ack);

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

    SC_METHOD(thread_ap_done);

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

    SC_METHOD(thread_ap_ready);

    SC_METHOD(thread_ap_sig_251);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_265);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_274);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_283);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_292);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_301);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_33);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_335);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_342);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_354);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_367);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_377);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_388);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_396);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_404);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_412);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_420);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_428);
    sensitive << ( ap_CS_fsm );

    SC_METHOD(thread_ap_sig_cseq_ST_st10_fsm_9);
    sensitive << ( ap_sig_396 );

    SC_METHOD(thread_ap_sig_cseq_ST_st11_fsm_10);
    sensitive << ( ap_sig_283 );

    SC_METHOD(thread_ap_sig_cseq_ST_st12_fsm_11);
    sensitive << ( ap_sig_404 );

    SC_METHOD(thread_ap_sig_cseq_ST_st13_fsm_12);
    sensitive << ( ap_sig_292 );

    SC_METHOD(thread_ap_sig_cseq_ST_st14_fsm_13);
    sensitive << ( ap_sig_412 );

    SC_METHOD(thread_ap_sig_cseq_ST_st15_fsm_14);
    sensitive << ( ap_sig_377 );

    SC_METHOD(thread_ap_sig_cseq_ST_st16_fsm_15);
    sensitive << ( ap_sig_420 );

    SC_METHOD(thread_ap_sig_cseq_ST_st17_fsm_16);
    sensitive << ( ap_sig_301 );

    SC_METHOD(thread_ap_sig_cseq_ST_st18_fsm_17);
    sensitive << ( ap_sig_428 );

    SC_METHOD(thread_ap_sig_cseq_ST_st1_fsm_0);
    sensitive << ( ap_sig_33 );

    SC_METHOD(thread_ap_sig_cseq_ST_st2_fsm_1);
    sensitive << ( ap_sig_335 );

    SC_METHOD(thread_ap_sig_cseq_ST_st3_fsm_2);
    sensitive << ( ap_sig_251 );

    SC_METHOD(thread_ap_sig_cseq_ST_st4_fsm_3);
    sensitive << ( ap_sig_342 );

    SC_METHOD(thread_ap_sig_cseq_ST_st5_fsm_4);
    sensitive << ( ap_sig_265 );

    SC_METHOD(thread_ap_sig_cseq_ST_st6_fsm_5);
    sensitive << ( ap_sig_354 );

    SC_METHOD(thread_ap_sig_cseq_ST_st7_fsm_6);
    sensitive << ( ap_sig_274 );

    SC_METHOD(thread_ap_sig_cseq_ST_st8_fsm_7);
    sensitive << ( ap_sig_388 );

    SC_METHOD(thread_ap_sig_cseq_ST_st9_fsm_8);
    sensitive << ( ap_sig_367 );

    SC_METHOD(thread_dummy_tmr_out_0_ack_out);

    SC_METHOD(thread_dummy_tmr_out_1_vld_in);
    sensitive << ( grp_clock_top_wait_tmr_fu_131_dummy_tmr_out_o_ap_vld );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );

    SC_METHOD(thread_dummy_tmr_out_o);
    sensitive << ( dummy_tmr_out_1_data_reg );

    SC_METHOD(thread_exitcond_fu_181_p2);
    sensitive << ( ap_sig_cseq_ST_st3_fsm_2 );
    sensitive << ( pos_reg_120 );

    SC_METHOD(thread_grp_clock_top_wait_tmr_fu_131_ap_start);
    sensitive << ( ap_reg_grp_clock_top_wait_tmr_fu_131_ap_start );

    SC_METHOD(thread_grp_clock_top_write_mem_fu_137_addr);
    sensitive << ( pos_cast1_cast_reg_327 );
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );
    sensitive << ( ap_sig_cseq_ST_st10_fsm_9 );
    sensitive << ( ap_sig_cseq_ST_st12_fsm_11 );
    sensitive << ( ap_sig_cseq_ST_st14_fsm_13 );
    sensitive << ( ap_sig_cseq_ST_st16_fsm_15 );
    sensitive << ( ap_sig_cseq_ST_st18_fsm_17 );

    SC_METHOD(thread_grp_clock_top_write_mem_fu_137_ap_start);
    sensitive << ( ap_reg_grp_clock_top_write_mem_fu_137_ap_start );

    SC_METHOD(thread_grp_clock_top_write_mem_fu_137_data);
    sensitive << ( min_load_reg_367 );
    sensitive << ( min1_load_reg_373 );
    sensitive << ( sec10_1_load_reg_379 );
    sensitive << ( sec1_load_reg_385 );
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );
    sensitive << ( ap_sig_cseq_ST_st10_fsm_9 );
    sensitive << ( ap_sig_cseq_ST_st12_fsm_11 );
    sensitive << ( ap_sig_cseq_ST_st14_fsm_13 );
    sensitive << ( ap_sig_cseq_ST_st16_fsm_15 );
    sensitive << ( ap_sig_cseq_ST_st18_fsm_17 );
    sensitive << ( msec_fu_70 );

    SC_METHOD(thread_mem_addr_1_vld_in);
    sensitive << ( grp_clock_top_write_mem_fu_137_mem_addr_ap_vld );
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );
    sensitive << ( ap_sig_cseq_ST_st10_fsm_9 );
    sensitive << ( ap_sig_cseq_ST_st12_fsm_11 );
    sensitive << ( ap_sig_cseq_ST_st14_fsm_13 );
    sensitive << ( ap_sig_cseq_ST_st16_fsm_15 );
    sensitive << ( ap_sig_cseq_ST_st18_fsm_17 );

    SC_METHOD(thread_mem_addr_o);
    sensitive << ( mem_addr_1_data_reg );

    SC_METHOD(thread_mem_dout_1_vld_in);
    sensitive << ( grp_clock_top_write_mem_fu_137_mem_dout_ap_vld );
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );
    sensitive << ( ap_sig_cseq_ST_st10_fsm_9 );
    sensitive << ( ap_sig_cseq_ST_st12_fsm_11 );
    sensitive << ( ap_sig_cseq_ST_st14_fsm_13 );
    sensitive << ( ap_sig_cseq_ST_st16_fsm_15 );
    sensitive << ( ap_sig_cseq_ST_st18_fsm_17 );

    SC_METHOD(thread_mem_dout_o);
    sensitive << ( mem_dout_1_data_reg );

    SC_METHOD(thread_mem_wreq_1_vld_in);
    sensitive << ( grp_clock_top_write_mem_fu_137_mem_wreq_ap_vld );
    sensitive << ( ap_sig_cseq_ST_st4_fsm_3 );
    sensitive << ( ap_sig_cseq_ST_st6_fsm_5 );
    sensitive << ( ap_sig_cseq_ST_st8_fsm_7 );
    sensitive << ( ap_sig_cseq_ST_st10_fsm_9 );
    sensitive << ( ap_sig_cseq_ST_st12_fsm_11 );
    sensitive << ( ap_sig_cseq_ST_st14_fsm_13 );
    sensitive << ( ap_sig_cseq_ST_st16_fsm_15 );
    sensitive << ( ap_sig_cseq_ST_st18_fsm_17 );

    SC_METHOD(thread_mem_wreq_o);
    sensitive << ( mem_wreq_1_data_reg );

    SC_METHOD(thread_min10_fu_287_p2);
    sensitive << ( min_load_reg_367 );

    SC_METHOD(thread_min1_1_fu_271_p2);
    sensitive << ( min1_load_reg_373 );

    SC_METHOD(thread_msec_1_fu_223_p2);
    sensitive << ( msec_fu_70 );

    SC_METHOD(thread_p_cast_fu_310_p1);
    sensitive << ( p_s_fu_302_p3 );

    SC_METHOD(thread_p_s_fu_302_p3);
    sensitive << ( tmp_2_fu_296_p2 );
    sensitive << ( tmp_fu_292_p1 );

    SC_METHOD(thread_pos_1_fu_187_p2);
    sensitive << ( pos_reg_120 );

    SC_METHOD(thread_pos_cast1_cast_fu_193_p1);
    sensitive << ( pos_reg_120 );

    SC_METHOD(thread_sec10_fu_255_p2);
    sensitive << ( sec10_1_load_reg_379 );

    SC_METHOD(thread_sec1_1_fu_239_p2);
    sensitive << ( sec1_load_reg_385 );

    SC_METHOD(thread_tmp_1_fu_276_p2);
    sensitive << ( grp_clock_top_write_mem_fu_137_ap_done );
    sensitive << ( ap_sig_cseq_ST_st18_fsm_17 );
    sensitive << ( tmp_7_fu_228_p2 );
    sensitive << ( tmp_9_fu_244_p2 );
    sensitive << ( tmp_s_fu_260_p2 );
    sensitive << ( min1_1_fu_271_p2 );

    SC_METHOD(thread_tmp_2_fu_296_p2);
    sensitive << ( grp_clock_top_write_mem_fu_137_ap_done );
    sensitive << ( ap_sig_cseq_ST_st18_fsm_17 );
    sensitive << ( tmp_7_fu_228_p2 );
    sensitive << ( tmp_9_fu_244_p2 );
    sensitive << ( tmp_s_fu_260_p2 );
    sensitive << ( tmp_1_fu_276_p2 );
    sensitive << ( min10_fu_287_p2 );

    SC_METHOD(thread_tmp_7_fu_228_p2);
    sensitive << ( grp_clock_top_write_mem_fu_137_ap_done );
    sensitive << ( ap_sig_cseq_ST_st18_fsm_17 );
    sensitive << ( msec_1_fu_223_p2 );

    SC_METHOD(thread_tmp_9_fu_244_p2);
    sensitive << ( grp_clock_top_write_mem_fu_137_ap_done );
    sensitive << ( ap_sig_cseq_ST_st18_fsm_17 );
    sensitive << ( tmp_7_fu_228_p2 );
    sensitive << ( sec1_1_fu_239_p2 );

    SC_METHOD(thread_tmp_fu_292_p1);
    sensitive << ( min10_fu_287_p2 );

    SC_METHOD(thread_tmp_s_fu_260_p2);
    sensitive << ( grp_clock_top_write_mem_fu_137_ap_done );
    sensitive << ( ap_sig_cseq_ST_st18_fsm_17 );
    sensitive << ( tmp_7_fu_228_p2 );
    sensitive << ( tmp_9_fu_244_p2 );
    sensitive << ( sec10_fu_255_p2 );

    SC_METHOD(thread_ap_NS_fsm);
    sensitive << ( ap_start );
    sensitive << ( ap_CS_fsm );
    sensitive << ( exitcond_fu_181_p2 );
    sensitive << ( grp_clock_top_wait_tmr_fu_131_ap_done );
    sensitive << ( grp_clock_top_write_mem_fu_137_ap_done );

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

    ap_CS_fsm = "000000000000000001";
    dummy_tmr_out_0_data_reg = "0";
    dummy_tmr_out_0_vld_reg = SC_LOGIC_0;
    dummy_tmr_out_1_data_reg = "0";
    dummy_tmr_out_1_vld_reg = SC_LOGIC_0;
    mem_addr_1_data_reg = "00000000";
    mem_addr_1_vld_reg = SC_LOGIC_0;
    mem_dout_1_data_reg = "00000000";
    mem_dout_1_vld_reg = SC_LOGIC_0;
    mem_wreq_1_data_reg = "0";
    mem_wreq_1_vld_reg = SC_LOGIC_0;
    ap_reg_grp_clock_top_wait_tmr_fu_131_ap_start = SC_LOGIC_0;
    ap_reg_grp_clock_top_write_mem_fu_137_ap_start = SC_LOGIC_0;
    static int apTFileNum = 0;
    stringstream apTFilenSS;
    apTFilenSS << "clock_top_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, dummy_tmr_out_i, "(port)dummy_tmr_out_i");
    sc_trace(mVcdFile, dummy_tmr_out_o, "(port)dummy_tmr_out_o");
    sc_trace(mVcdFile, mem_addr_i, "(port)mem_addr_i");
    sc_trace(mVcdFile, mem_addr_o, "(port)mem_addr_o");
    sc_trace(mVcdFile, mem_dout_i, "(port)mem_dout_i");
    sc_trace(mVcdFile, mem_dout_o, "(port)mem_dout_o");
    sc_trace(mVcdFile, mem_wreq_i, "(port)mem_wreq_i");
    sc_trace(mVcdFile, mem_wreq_o, "(port)mem_wreq_o");
    sc_trace(mVcdFile, mem_ack, "(port)mem_ack");
#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_33, "ap_sig_33");
    sc_trace(mVcdFile, dummy_tmr_out_0_data_reg, "dummy_tmr_out_0_data_reg");
    sc_trace(mVcdFile, dummy_tmr_out_0_vld_reg, "dummy_tmr_out_0_vld_reg");
    sc_trace(mVcdFile, dummy_tmr_out_0_ack_out, "dummy_tmr_out_0_ack_out");
    sc_trace(mVcdFile, dummy_tmr_out_1_data_reg, "dummy_tmr_out_1_data_reg");
    sc_trace(mVcdFile, dummy_tmr_out_1_vld_reg, "dummy_tmr_out_1_vld_reg");
    sc_trace(mVcdFile, dummy_tmr_out_1_vld_in, "dummy_tmr_out_1_vld_in");
    sc_trace(mVcdFile, mem_addr_1_data_reg, "mem_addr_1_data_reg");
    sc_trace(mVcdFile, mem_addr_1_vld_reg, "mem_addr_1_vld_reg");
    sc_trace(mVcdFile, mem_addr_1_vld_in, "mem_addr_1_vld_in");
    sc_trace(mVcdFile, mem_dout_1_data_reg, "mem_dout_1_data_reg");
    sc_trace(mVcdFile, mem_dout_1_vld_reg, "mem_dout_1_vld_reg");
    sc_trace(mVcdFile, mem_dout_1_vld_in, "mem_dout_1_vld_in");
    sc_trace(mVcdFile, mem_wreq_1_data_reg, "mem_wreq_1_data_reg");
    sc_trace(mVcdFile, mem_wreq_1_vld_reg, "mem_wreq_1_vld_reg");
    sc_trace(mVcdFile, mem_wreq_1_vld_in, "mem_wreq_1_vld_in");
    sc_trace(mVcdFile, pos_1_fu_187_p2, "pos_1_fu_187_p2");
    sc_trace(mVcdFile, pos_1_reg_322, "pos_1_reg_322");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st3_fsm_2, "ap_sig_cseq_ST_st3_fsm_2");
    sc_trace(mVcdFile, ap_sig_251, "ap_sig_251");
    sc_trace(mVcdFile, pos_cast1_cast_fu_193_p1, "pos_cast1_cast_fu_193_p1");
    sc_trace(mVcdFile, pos_cast1_cast_reg_327, "pos_cast1_cast_reg_327");
    sc_trace(mVcdFile, exitcond_fu_181_p2, "exitcond_fu_181_p2");
    sc_trace(mVcdFile, min_load_reg_367, "min_load_reg_367");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st5_fsm_4, "ap_sig_cseq_ST_st5_fsm_4");
    sc_trace(mVcdFile, ap_sig_265, "ap_sig_265");
    sc_trace(mVcdFile, min1_load_reg_373, "min1_load_reg_373");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st7_fsm_6, "ap_sig_cseq_ST_st7_fsm_6");
    sc_trace(mVcdFile, ap_sig_274, "ap_sig_274");
    sc_trace(mVcdFile, sec10_1_load_reg_379, "sec10_1_load_reg_379");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st11_fsm_10, "ap_sig_cseq_ST_st11_fsm_10");
    sc_trace(mVcdFile, ap_sig_283, "ap_sig_283");
    sc_trace(mVcdFile, sec1_load_reg_385, "sec1_load_reg_385");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st13_fsm_12, "ap_sig_cseq_ST_st13_fsm_12");
    sc_trace(mVcdFile, ap_sig_292, "ap_sig_292");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st17_fsm_16, "ap_sig_cseq_ST_st17_fsm_16");
    sc_trace(mVcdFile, ap_sig_301, "ap_sig_301");
    sc_trace(mVcdFile, grp_clock_top_wait_tmr_fu_131_ap_start, "grp_clock_top_wait_tmr_fu_131_ap_start");
    sc_trace(mVcdFile, grp_clock_top_wait_tmr_fu_131_ap_done, "grp_clock_top_wait_tmr_fu_131_ap_done");
    sc_trace(mVcdFile, grp_clock_top_wait_tmr_fu_131_ap_idle, "grp_clock_top_wait_tmr_fu_131_ap_idle");
    sc_trace(mVcdFile, grp_clock_top_wait_tmr_fu_131_ap_ready, "grp_clock_top_wait_tmr_fu_131_ap_ready");
    sc_trace(mVcdFile, grp_clock_top_wait_tmr_fu_131_dummy_tmr_out_o, "grp_clock_top_wait_tmr_fu_131_dummy_tmr_out_o");
    sc_trace(mVcdFile, grp_clock_top_wait_tmr_fu_131_dummy_tmr_out_o_ap_vld, "grp_clock_top_wait_tmr_fu_131_dummy_tmr_out_o_ap_vld");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_ap_start, "grp_clock_top_write_mem_fu_137_ap_start");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_ap_done, "grp_clock_top_write_mem_fu_137_ap_done");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_ap_idle, "grp_clock_top_write_mem_fu_137_ap_idle");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_ap_ready, "grp_clock_top_write_mem_fu_137_ap_ready");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_addr, "grp_clock_top_write_mem_fu_137_addr");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_data, "grp_clock_top_write_mem_fu_137_data");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_mem_addr, "grp_clock_top_write_mem_fu_137_mem_addr");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_mem_addr_ap_vld, "grp_clock_top_write_mem_fu_137_mem_addr_ap_vld");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_mem_dout, "grp_clock_top_write_mem_fu_137_mem_dout");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_mem_dout_ap_vld, "grp_clock_top_write_mem_fu_137_mem_dout_ap_vld");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_mem_wreq, "grp_clock_top_write_mem_fu_137_mem_wreq");
    sc_trace(mVcdFile, grp_clock_top_write_mem_fu_137_mem_wreq_ap_vld, "grp_clock_top_write_mem_fu_137_mem_wreq_ap_vld");
    sc_trace(mVcdFile, pos_reg_120, "pos_reg_120");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st2_fsm_1, "ap_sig_cseq_ST_st2_fsm_1");
    sc_trace(mVcdFile, ap_sig_335, "ap_sig_335");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st4_fsm_3, "ap_sig_cseq_ST_st4_fsm_3");
    sc_trace(mVcdFile, ap_sig_342, "ap_sig_342");
    sc_trace(mVcdFile, ap_reg_grp_clock_top_wait_tmr_fu_131_ap_start, "ap_reg_grp_clock_top_wait_tmr_fu_131_ap_start");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st6_fsm_5, "ap_sig_cseq_ST_st6_fsm_5");
    sc_trace(mVcdFile, ap_sig_354, "ap_sig_354");
    sc_trace(mVcdFile, ap_reg_grp_clock_top_write_mem_fu_137_ap_start, "ap_reg_grp_clock_top_write_mem_fu_137_ap_start");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st9_fsm_8, "ap_sig_cseq_ST_st9_fsm_8");
    sc_trace(mVcdFile, ap_sig_367, "ap_sig_367");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st15_fsm_14, "ap_sig_cseq_ST_st15_fsm_14");
    sc_trace(mVcdFile, ap_sig_377, "ap_sig_377");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st8_fsm_7, "ap_sig_cseq_ST_st8_fsm_7");
    sc_trace(mVcdFile, ap_sig_388, "ap_sig_388");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st10_fsm_9, "ap_sig_cseq_ST_st10_fsm_9");
    sc_trace(mVcdFile, ap_sig_396, "ap_sig_396");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st12_fsm_11, "ap_sig_cseq_ST_st12_fsm_11");
    sc_trace(mVcdFile, ap_sig_404, "ap_sig_404");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st14_fsm_13, "ap_sig_cseq_ST_st14_fsm_13");
    sc_trace(mVcdFile, ap_sig_412, "ap_sig_412");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st16_fsm_15, "ap_sig_cseq_ST_st16_fsm_15");
    sc_trace(mVcdFile, ap_sig_420, "ap_sig_420");
    sc_trace(mVcdFile, ap_sig_cseq_ST_st18_fsm_17, "ap_sig_cseq_ST_st18_fsm_17");
    sc_trace(mVcdFile, ap_sig_428, "ap_sig_428");
    sc_trace(mVcdFile, msec_fu_70, "msec_fu_70");
    sc_trace(mVcdFile, msec_1_fu_223_p2, "msec_1_fu_223_p2");
    sc_trace(mVcdFile, tmp_7_fu_228_p2, "tmp_7_fu_228_p2");
    sc_trace(mVcdFile, tmp_9_fu_244_p2, "tmp_9_fu_244_p2");
    sc_trace(mVcdFile, tmp_s_fu_260_p2, "tmp_s_fu_260_p2");
    sc_trace(mVcdFile, tmp_1_fu_276_p2, "tmp_1_fu_276_p2");
    sc_trace(mVcdFile, min_fu_74, "min_fu_74");
    sc_trace(mVcdFile, p_cast_fu_310_p1, "p_cast_fu_310_p1");
    sc_trace(mVcdFile, min1_fu_78, "min1_fu_78");
    sc_trace(mVcdFile, min1_1_fu_271_p2, "min1_1_fu_271_p2");
    sc_trace(mVcdFile, sec10_1_fu_82, "sec10_1_fu_82");
    sc_trace(mVcdFile, sec10_fu_255_p2, "sec10_fu_255_p2");
    sc_trace(mVcdFile, sec1_fu_86, "sec1_fu_86");
    sc_trace(mVcdFile, sec1_1_fu_239_p2, "sec1_1_fu_239_p2");
    sc_trace(mVcdFile, min10_fu_287_p2, "min10_fu_287_p2");
    sc_trace(mVcdFile, tmp_2_fu_296_p2, "tmp_2_fu_296_p2");
    sc_trace(mVcdFile, tmp_fu_292_p1, "tmp_fu_292_p1");
    sc_trace(mVcdFile, p_s_fu_302_p3, "p_s_fu_302_p3");
    sc_trace(mVcdFile, ap_NS_fsm, "ap_NS_fsm");
#endif

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

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

    mHdltvinHandle << "] " << endl;
    mHdltvoutHandle << "] " << endl;
    mHdltvinHandle.close();
    mHdltvoutHandle.close();
    delete grp_clock_top_wait_tmr_fu_131;
    delete grp_clock_top_write_mem_fu_137;
}

void clock_top::thread_ap_clk_no_reset_() {
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_CS_fsm = ap_ST_st1_fsm_0;
    } else {
        ap_CS_fsm = ap_NS_fsm.read();
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_reg_grp_clock_top_wait_tmr_fu_131_ap_start = ap_const_logic_0;
    } else {
        if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_4.read())) {
            ap_reg_grp_clock_top_wait_tmr_fu_131_ap_start = ap_const_logic_1;
        } else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_clock_top_wait_tmr_fu_131_ap_ready.read())) {
            ap_reg_grp_clock_top_wait_tmr_fu_131_ap_start = ap_const_logic_0;
        }
    }
    if ( ap_rst.read() == ap_const_logic_1) {
        ap_reg_grp_clock_top_write_mem_fu_137_ap_start = ap_const_logic_0;
    } else {
        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_lv1_0, exitcond_fu_181_p2.read())) || 
             esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_4.read()) || 
             esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_6.read()) || 
             esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st11_fsm_10.read()) || 
             esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st13_fsm_12.read()) || 
             esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st17_fsm_16.read()) || 
             esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st9_fsm_8.read()) || 
             esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st15_fsm_14.read()))) {
            ap_reg_grp_clock_top_write_mem_fu_137_ap_start = ap_const_logic_1;
        } else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_clock_top_write_mem_fu_137_ap_ready.read())) {
            ap_reg_grp_clock_top_write_mem_fu_137_ap_start = ap_const_logic_0;
        }
    }
    if ((!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_fu_276_p2.read()))) {
        min1_fu_78 = min1_1_fu_271_p2.read();
    } else 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_lv1_0, exitcond_fu_181_p2.read())) || 
                (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
                 esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_fu_276_p2.read())))) {
        min1_fu_78 = ap_const_lv8_30;
    }
    if ((!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_fu_276_p2.read()))) {
        min_fu_74 = p_cast_fu_310_p1.read();
    } else 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_lv1_0, exitcond_fu_181_p2.read()))) {
        min_fu_74 = ap_const_lv8_30;
    }
    if ((!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()))) {
        msec_fu_70 = msec_1_fu_223_p2.read();
    } else 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_lv1_0, exitcond_fu_181_p2.read())) || 
                (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
                 esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
                 esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read())) || 
                (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
                 esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
                 esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read())) || 
                (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
                 esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read()) && 
                 esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_fu_276_p2.read())) || 
                (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
                 esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_fu_276_p2.read())))) {
        msec_fu_70 = ap_const_lv8_30;
    }
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read()) && 
         !esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()))) {
        pos_reg_120 = pos_1_reg_322.read();
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st2_fsm_1.read())) {
        pos_reg_120 = ap_const_lv6_0;
    }
    if ((!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read()))) {
        sec10_1_fu_82 = sec10_fu_255_p2.read();
    } else 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_lv1_0, exitcond_fu_181_p2.read())) || 
                (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
                 esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read())))) {
        sec10_1_fu_82 = ap_const_lv8_30;
    }
    if ((!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
         !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
         esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()))) {
        sec1_fu_86 = sec1_1_fu_239_p2.read();
    } else 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_lv1_0, exitcond_fu_181_p2.read())) || 
                (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
                 esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
                 esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read())) || 
                (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
                 esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read()) && 
                 esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_fu_276_p2.read())) || 
                (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) && 
                 esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_7_fu_228_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_9_fu_244_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_s_fu_260_p2.read()) && 
                 !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_fu_276_p2.read())))) {
        sec1_fu_86 = ap_const_lv8_30;
    }
    if (((!(esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) && 
  esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) && 
  esl_seteq<1,1,1>(ap_const_logic_0, dummy_tmr_out_0_vld_reg.read())) || (!(esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) && 
  esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) && 
  esl_seteq<1,1,1>(ap_const_logic_1, dummy_tmr_out_0_vld_reg.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_1, dummy_tmr_out_0_ack_out.read())))) {
        dummy_tmr_out_0_data_reg = dummy_tmr_out_i.read();
    }
    if (((!(esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) && 
  esl_seteq<1,1,1>(ap_const_logic_1, dummy_tmr_out_1_vld_in.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_0, dummy_tmr_out_1_vld_reg.read())) || (!(esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) && 
  esl_seteq<1,1,1>(ap_const_logic_1, dummy_tmr_out_1_vld_in.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_1, dummy_tmr_out_1_vld_reg.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1)))) {
        dummy_tmr_out_1_data_reg = grp_clock_top_wait_tmr_fu_131_dummy_tmr_out_o.read();
    }
    if (((!(esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) && 
  esl_seteq<1,1,1>(ap_const_logic_1, mem_addr_1_vld_in.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_0, mem_addr_1_vld_reg.read())) || (!(esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) && 
  esl_seteq<1,1,1>(ap_const_logic_1, mem_addr_1_vld_in.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_1, mem_addr_1_vld_reg.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1)))) {
        mem_addr_1_data_reg = grp_clock_top_write_mem_fu_137_mem_addr.read();
    }
    if (((!(esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) && 
  esl_seteq<1,1,1>(ap_const_logic_1, mem_dout_1_vld_in.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_0, mem_dout_1_vld_reg.read())) || (!(esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) && 
  esl_seteq<1,1,1>(ap_const_logic_1, mem_dout_1_vld_in.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_1, mem_dout_1_vld_reg.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1)))) {
        mem_dout_1_data_reg = grp_clock_top_write_mem_fu_137_mem_dout.read();
    }
    if (((!(esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) && 
  esl_seteq<1,1,1>(ap_const_logic_1, mem_wreq_1_vld_in.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_0, mem_wreq_1_vld_reg.read())) || (!(esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st1_fsm_0.read())) && 
  esl_seteq<1,1,1>(ap_const_logic_1, mem_wreq_1_vld_in.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_1, mem_wreq_1_vld_reg.read()) && 
  esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1)))) {
        mem_wreq_1_data_reg = grp_clock_top_write_mem_fu_137_mem_wreq.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st7_fsm_6.read())) {
        min1_load_reg_373 = min1_fu_78.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st5_fsm_4.read())) {
        min_load_reg_367 = min_fu_74.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st3_fsm_2.read())) {
        pos_1_reg_322 = pos_1_fu_187_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_lv1_0, exitcond_fu_181_p2.read()))) {
        pos_cast1_cast_reg_327 = pos_cast1_cast_fu_193_p1.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st11_fsm_10.read())) {
        sec10_1_load_reg_379 = sec10_1_fu_82.read();
    }
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st13_fsm_12.read())) {
        sec1_load_reg_385 = sec1_fu_86.read();
    }
}

void clock_top::thread_ap_done() {
    ap_done = ap_const_logic_0;
}

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

void clock_top::thread_ap_ready() {
    ap_ready = ap_const_logic_0;
}

void clock_top::thread_ap_sig_251() {
    ap_sig_251 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(2, 2));
}

void clock_top::thread_ap_sig_265() {
    ap_sig_265 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(4, 4));
}

void clock_top::thread_ap_sig_274() {
    ap_sig_274 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(6, 6));
}

void clock_top::thread_ap_sig_283() {
    ap_sig_283 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(10, 10));
}

void clock_top::thread_ap_sig_292() {
    ap_sig_292 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(12, 12));
}

void clock_top::thread_ap_sig_301() {
    ap_sig_301 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(16, 16));
}

void clock_top::thread_ap_sig_33() {
    ap_sig_33 = esl_seteq<1,1,1>(ap_CS_fsm.read().range(0, 0), ap_const_lv1_1);
}

void clock_top::thread_ap_sig_335() {
    ap_sig_335 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(1, 1));
}

void clock_top::thread_ap_sig_342() {
    ap_sig_342 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(3, 3));
}

void clock_top::thread_ap_sig_354() {
    ap_sig_354 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(5, 5));
}

void clock_top::thread_ap_sig_367() {
    ap_sig_367 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(8, 8));
}

void clock_top::thread_ap_sig_377() {
    ap_sig_377 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(14, 14));
}

void clock_top::thread_ap_sig_388() {
    ap_sig_388 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(7, 7));
}

void clock_top::thread_ap_sig_396() {
    ap_sig_396 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(9, 9));
}

void clock_top::thread_ap_sig_404() {
    ap_sig_404 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(11, 11));
}

void clock_top::thread_ap_sig_412() {
    ap_sig_412 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(13, 13));
}

void clock_top::thread_ap_sig_420() {
    ap_sig_420 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(15, 15));
}

void clock_top::thread_ap_sig_428() {
    ap_sig_428 = esl_seteq<1,1,1>(ap_const_lv1_1, ap_CS_fsm.read().range(17, 17));
}

void clock_top::thread_ap_sig_cseq_ST_st10_fsm_9() {
    if (ap_sig_396.read()) {
        ap_sig_cseq_ST_st10_fsm_9 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st10_fsm_9 = ap_const_logic_0;
    }
}

void clock_top::thread_ap_sig_cseq_ST_st11_fsm_10() {
    if (ap_sig_283.read()) {
        ap_sig_cseq_ST_st11_fsm_10 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st11_fsm_10 = ap_const_logic_0;
    }
}

void clock_top::thread_ap_sig_cseq_ST_st12_fsm_11() {
    if (ap_sig_404.read()) {
        ap_sig_cseq_ST_st12_fsm_11 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st12_fsm_11 = ap_const_logic_0;
    }
}

void clock_top::thread_ap_sig_cseq_ST_st13_fsm_12() {
    if (ap_sig_292.read()) {
        ap_sig_cseq_ST_st13_fsm_12 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st13_fsm_12 = ap_const_logic_0;
    }
}

void clock_top::thread_ap_sig_cseq_ST_st14_fsm_13() {
    if (ap_sig_412.read()) {
        ap_sig_cseq_ST_st14_fsm_13 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st14_fsm_13 = ap_const_logic_0;
    }
}

void clock_top::thread_ap_sig_cseq_ST_st15_fsm_14() {
    if (ap_sig_377.read()) {
        ap_sig_cseq_ST_st15_fsm_14 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st15_fsm_14 = ap_const_logic_0;
    }
}

void clock_top::thread_ap_sig_cseq_ST_st16_fsm_15() {
    if (ap_sig_420.read()) {
        ap_sig_cseq_ST_st16_fsm_15 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st16_fsm_15 = ap_const_logic_0;
    }
}

void clock_top::thread_ap_sig_cseq_ST_st17_fsm_16() {
    if (ap_sig_301.read()) {
        ap_sig_cseq_ST_st17_fsm_16 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st17_fsm_16 = ap_const_logic_0;
    }
}

void clock_top::thread_ap_sig_cseq_ST_st18_fsm_17() {
    if (ap_sig_428.read()) {
        ap_sig_cseq_ST_st18_fsm_17 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st18_fsm_17 = ap_const_logic_0;
    }
}

void clock_top::thread_ap_sig_cseq_ST_st1_fsm_0() {
    if (ap_sig_33.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 clock_top::thread_ap_sig_cseq_ST_st2_fsm_1() {
    if (ap_sig_335.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 clock_top::thread_ap_sig_cseq_ST_st3_fsm_2() {
    if (ap_sig_251.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 clock_top::thread_ap_sig_cseq_ST_st4_fsm_3() {
    if (ap_sig_342.read()) {
        ap_sig_cseq_ST_st4_fsm_3 = ap_const_logic_1;
    } else {
        ap_sig_cseq_ST_st4_fsm_3 = ap_const_logic_0;
    }
}

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

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

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

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

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

void clock_top::thread_dummy_tmr_out_0_ack_out() {
    dummy_tmr_out_0_ack_out = ap_const_logic_0;
}

void clock_top::thread_dummy_tmr_out_1_vld_in() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read())) {
        dummy_tmr_out_1_vld_in = grp_clock_top_wait_tmr_fu_131_dummy_tmr_out_o_ap_vld.read();
    } else {
        dummy_tmr_out_1_vld_in = ap_const_logic_0;
    }
}

void clock_top::thread_dummy_tmr_out_o() {
    dummy_tmr_out_o = dummy_tmr_out_1_data_reg.read();
}

void clock_top::thread_exitcond_fu_181_p2() {
    exitcond_fu_181_p2 = (!pos_reg_120.read().is_01() || !ap_const_lv6_20.is_01())? sc_lv<1>(): sc_lv<1>(pos_reg_120.read() == ap_const_lv6_20);
}

void clock_top::thread_grp_clock_top_wait_tmr_fu_131_ap_start() {
    grp_clock_top_wait_tmr_fu_131_ap_start = ap_reg_grp_clock_top_wait_tmr_fu_131_ap_start.read();
}

void clock_top::thread_grp_clock_top_write_mem_fu_137_addr() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read())) {
        grp_clock_top_write_mem_fu_137_addr = ap_const_lv7_16;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st16_fsm_15.read())) {
        grp_clock_top_write_mem_fu_137_addr = ap_const_lv7_15;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st14_fsm_13.read())) {
        grp_clock_top_write_mem_fu_137_addr = ap_const_lv7_14;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st12_fsm_11.read())) {
        grp_clock_top_write_mem_fu_137_addr = ap_const_lv7_13;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st10_fsm_9.read())) {
        grp_clock_top_write_mem_fu_137_addr = ap_const_lv7_12;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_7.read())) {
        grp_clock_top_write_mem_fu_137_addr = ap_const_lv7_11;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read())) {
        grp_clock_top_write_mem_fu_137_addr = ap_const_lv7_10;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read())) {
        grp_clock_top_write_mem_fu_137_addr = pos_cast1_cast_reg_327.read();
    } else {
        grp_clock_top_write_mem_fu_137_addr = "XXXXXXX";
    }
}

void clock_top::thread_grp_clock_top_write_mem_fu_137_ap_start() {
    grp_clock_top_write_mem_fu_137_ap_start = ap_reg_grp_clock_top_write_mem_fu_137_ap_start.read();
}

void clock_top::thread_grp_clock_top_write_mem_fu_137_data() {
    if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read())) {
        grp_clock_top_write_mem_fu_137_data = msec_fu_70.read();
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st16_fsm_15.read())) {
        grp_clock_top_write_mem_fu_137_data = ap_const_lv8_2E;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st14_fsm_13.read())) {
        grp_clock_top_write_mem_fu_137_data = sec1_load_reg_385.read();
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st12_fsm_11.read())) {
        grp_clock_top_write_mem_fu_137_data = sec10_1_load_reg_379.read();
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st10_fsm_9.read())) {
        grp_clock_top_write_mem_fu_137_data = ap_const_lv8_3A;
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_7.read())) {
        grp_clock_top_write_mem_fu_137_data = min1_load_reg_373.read();
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read())) {
        grp_clock_top_write_mem_fu_137_data = min_load_reg_367.read();
    } else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read())) {
        grp_clock_top_write_mem_fu_137_data = ap_const_lv8_20;
    } else {
        grp_clock_top_write_mem_fu_137_data =  (sc_lv<8>) ("XXXXXXXX");
    }
}

void clock_top::thread_mem_addr_1_vld_in() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_7.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st10_fsm_9.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st12_fsm_11.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st14_fsm_13.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st16_fsm_15.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()))) {
        mem_addr_1_vld_in = grp_clock_top_write_mem_fu_137_mem_addr_ap_vld.read();
    } else {
        mem_addr_1_vld_in = ap_const_logic_0;
    }
}

void clock_top::thread_mem_addr_o() {
    mem_addr_o = mem_addr_1_data_reg.read();
}

void clock_top::thread_mem_dout_1_vld_in() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_7.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st10_fsm_9.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st12_fsm_11.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st14_fsm_13.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st16_fsm_15.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()))) {
        mem_dout_1_vld_in = grp_clock_top_write_mem_fu_137_mem_dout_ap_vld.read();
    } else {
        mem_dout_1_vld_in = ap_const_logic_0;
    }
}

void clock_top::thread_mem_dout_o() {
    mem_dout_o = mem_dout_1_data_reg.read();
}

void clock_top::thread_mem_wreq_1_vld_in() {
    if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st4_fsm_3.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st6_fsm_5.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st8_fsm_7.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st10_fsm_9.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st12_fsm_11.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st14_fsm_13.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st16_fsm_15.read()) || 
         esl_seteq<1,1,1>(ap_const_logic_1, ap_sig_cseq_ST_st18_fsm_17.read()))) {
        mem_wreq_1_vld_in = grp_clock_top_write_mem_fu_137_mem_wreq_ap_vld.read();
    } else {
        mem_wreq_1_vld_in = ap_const_logic_0;
    }
}

void clock_top::thread_mem_wreq_o() {
    mem_wreq_o = mem_wreq_1_data_reg.read();
}

void clock_top::thread_min10_fu_287_p2() {
    min10_fu_287_p2 = (!ap_const_lv8_1.is_01() || !min_load_reg_367.read().is_01())? sc_lv<8>(): (sc_biguint<8>(ap_const_lv8_1) + sc_biguint<8>(min_load_reg_367.read()));
}

void clock_top::thread_min1_1_fu_271_p2() {
    min1_1_fu_271_p2 = (!min1_load_reg_373.read().is_01() || !ap_const_lv8_1.is_01())? sc_lv<8>(): (sc_biguint<8>(min1_load_reg_373.read()) + sc_biguint<8>(ap_const_lv8_1));
}

void clock_top::thread_msec_1_fu_223_p2() {
    msec_1_fu_223_p2 = (!msec_fu_70.read().is_01() || !ap_const_lv8_1.is_01())? sc_lv<8>(): (sc_biguint<8>(msec_fu_70.read()) + sc_biguint<8>(ap_const_lv8_1));
}

void clock_top::thread_p_cast_fu_310_p1() {
    p_cast_fu_310_p1 = esl_zext<8,6>(p_s_fu_302_p3.read());
}

void clock_top::thread_p_s_fu_302_p3() {
    p_s_fu_302_p3 = (!tmp_2_fu_296_p2.read()[0].is_01())? sc_lv<6>(): ((tmp_2_fu_296_p2.read()[0].to_bool())? ap_const_lv6_30: tmp_fu_292_p1.read());
}

void clock_top::thread_pos_1_fu_187_p2() {
    pos_1_fu_187_p2 = (!pos_reg_120.read().is_01() || !ap_const_lv6_1.is_01())? sc_lv<6>(): (sc_biguint<6>(pos_reg_120.read()) + sc_biguint<6>(ap_const_lv6_1));
}

void clock_top::thread_pos_cast1_cast_fu_193_p1() {
    pos_cast1_cast_fu_193_p1 = esl_zext<7,6>(pos_reg_120.read());
}

void clock_top::thread_sec10_fu_255_p2() {
    sec10_fu_255_p2 = (!sec10_1_load_reg_379.read().is_01() || !ap_const_lv8_1.is_01())? sc_lv<8>(): (sc_biguint<8>(sec10_1_load_reg_379.read()) + sc_biguint<8>(ap_const_lv8_1));
}

void clock_top::thread_sec1_1_fu_239_p2() {
    sec1_1_fu_239_p2 = (!sec1_load_reg_385.read().is_01() || !ap_const_lv8_1.is_01())? sc_lv<8>(): (sc_biguint<8>(sec1_load_reg_385.read()) + sc_biguint<8>(ap_const_lv8_1));
}

void clock_top::thread_tmp_1_fu_276_p2() {
    tmp_1_fu_276_p2 = (!min1_1_fu_271_p2.read().is_01() || !ap_const_lv8_39.is_01())? sc_lv<1>(): (sc_biguint<8>(min1_1_fu_271_p2.read()) > sc_biguint<8>(ap_const_lv8_39));
}

void clock_top::thread_tmp_2_fu_296_p2() {
    tmp_2_fu_296_p2 = (!min10_fu_287_p2.read().is_01() || !ap_const_lv8_35.is_01())? sc_lv<1>(): (sc_biguint<8>(min10_fu_287_p2.read()) > sc_biguint<8>(ap_const_lv8_35));
}

void clock_top::thread_tmp_7_fu_228_p2() {
    tmp_7_fu_228_p2 = (!msec_1_fu_223_p2.read().is_01() || !ap_const_lv8_39.is_01())? sc_lv<1>(): (sc_biguint<8>(msec_1_fu_223_p2.read()) > sc_biguint<8>(ap_const_lv8_39));
}

void clock_top::thread_tmp_9_fu_244_p2() {
    tmp_9_fu_244_p2 = (!sec1_1_fu_239_p2.read().is_01() || !ap_const_lv8_39.is_01())? sc_lv<1>(): (sc_biguint<8>(sec1_1_fu_239_p2.read()) > sc_biguint<8>(ap_const_lv8_39));
}

void clock_top::thread_tmp_fu_292_p1() {
    tmp_fu_292_p1 = min10_fu_287_p2.read().range(6-1, 0);
}

void clock_top::thread_tmp_s_fu_260_p2() {
    tmp_s_fu_260_p2 = (!sec10_fu_255_p2.read().is_01() || !ap_const_lv8_35.is_01())? sc_lv<1>(): (sc_biguint<8>(sec10_fu_255_p2.read()) > sc_biguint<8>(ap_const_lv8_35));
}

void clock_top::thread_ap_NS_fsm() {
    switch (ap_CS_fsm.read().to_uint64()) {
        case 1 : 
            if (!esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0)) {
                ap_NS_fsm = ap_ST_st2_fsm_1;
            } else {
                ap_NS_fsm = ap_ST_st1_fsm_0;
            }
            break;
        case 2 : 
            ap_NS_fsm = ap_ST_st3_fsm_2;
            break;
        case 4 : 
            if (!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_fu_181_p2.read())) {
                ap_NS_fsm = ap_ST_st5_fsm_4;
            } else {
                ap_NS_fsm = ap_ST_st4_fsm_3;
            }
            break;
        case 8 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read())) {
                ap_NS_fsm = ap_ST_st3_fsm_2;
            } else {
                ap_NS_fsm = ap_ST_st4_fsm_3;
            }
            break;
        case 16 : 
            ap_NS_fsm = ap_ST_st6_fsm_5;
            break;
        case 32 : 
            if (!(esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read()) || esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_wait_tmr_fu_131_ap_done.read()))) {
                ap_NS_fsm = ap_ST_st7_fsm_6;
            } else {
                ap_NS_fsm = ap_ST_st6_fsm_5;
            }
            break;
        case 64 : 
            ap_NS_fsm = ap_ST_st8_fsm_7;
            break;
        case 128 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read())) {
                ap_NS_fsm = ap_ST_st9_fsm_8;
            } else {
                ap_NS_fsm = ap_ST_st8_fsm_7;
            }
            break;
        case 256 : 
            ap_NS_fsm = ap_ST_st10_fsm_9;
            break;
        case 512 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read())) {
                ap_NS_fsm = ap_ST_st11_fsm_10;
            } else {
                ap_NS_fsm = ap_ST_st10_fsm_9;
            }
            break;
        case 1024 : 
            ap_NS_fsm = ap_ST_st12_fsm_11;
            break;
        case 2048 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read())) {
                ap_NS_fsm = ap_ST_st13_fsm_12;
            } else {
                ap_NS_fsm = ap_ST_st12_fsm_11;
            }
            break;
        case 4096 : 
            ap_NS_fsm = ap_ST_st14_fsm_13;
            break;
        case 8192 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read())) {
                ap_NS_fsm = ap_ST_st15_fsm_14;
            } else {
                ap_NS_fsm = ap_ST_st14_fsm_13;
            }
            break;
        case 16384 : 
            ap_NS_fsm = ap_ST_st16_fsm_15;
            break;
        case 32768 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read())) {
                ap_NS_fsm = ap_ST_st17_fsm_16;
            } else {
                ap_NS_fsm = ap_ST_st16_fsm_15;
            }
            break;
        case 65536 : 
            ap_NS_fsm = ap_ST_st18_fsm_17;
            break;
        case 131072 : 
            if (!esl_seteq<1,1,1>(ap_const_logic_0, grp_clock_top_write_mem_fu_137_ap_done.read())) {
                ap_NS_fsm = ap_ST_st5_fsm_4;
            } else {
                ap_NS_fsm = ap_ST_st18_fsm_17;
            }
            break;
        default : 
            ap_NS_fsm =  (sc_lv<18>) ("XXXXXXXXXXXXXXXXXX");
            break;
    }
}

void clock_top::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() << "\" ";
        mHdltvinHandle << " , " <<  " \"dummy_tmr_out_i\" :  \"" << dummy_tmr_out_i.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"dummy_tmr_out_o\" :  \"" << dummy_tmr_out_o.read() << "\" ";
        mHdltvinHandle << " , " <<  " \"mem_addr_i\" :  \"" << mem_addr_i.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"mem_addr_o\" :  \"" << mem_addr_o.read() << "\" ";
        mHdltvinHandle << " , " <<  " \"mem_dout_i\" :  \"" << mem_dout_i.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"mem_dout_o\" :  \"" << mem_dout_o.read() << "\" ";
        mHdltvinHandle << " , " <<  " \"mem_wreq_i\" :  \"" << mem_wreq_i.read() << "\" ";
        mHdltvoutHandle << " , " <<  " \"mem_wreq_o\" :  \"" << mem_wreq_o.read() << "\" ";
        mHdltvinHandle << " , " <<  " \"mem_ack\" :  \"" << mem_ack.read() << "\" ";
        mHdltvinHandle << "}" << std::endl;
        mHdltvoutHandle << "}" << std::endl;
        ap_cycleNo++;
    }
}

}

