void hls_cropping_strm ( hls::stream< ap_int<8> > & src,  hls::stream< ap_int<16> > & dst) {

    fstream wrapc_switch_file_token;

    wrapc_switch_file_token.open(".hls_cosim_wrapc_switch.log");

    int AESL_i;

    if (wrapc_switch_file_token.good()) {

        static unsigned AESL_transaction_pc;

        string AESL_token;

        string AESL_num;

        static AESL_FILE_HANDLER aesl_fh;

        aesl_fh.read(WRAPC_STREAM_SIZE_IN_src_V_V, AESL_token); //[[transaction]]

        aesl_fh.read(WRAPC_STREAM_SIZE_IN_src_V_V, AESL_num); //transaction number

        if (atoi(AESL_num.c_str()) == AESL_transaction_pc ) {

            aesl_fh.read(WRAPC_STREAM_SIZE_IN_src_V_V, AESL_token); //pop_size

            int aesl_tmp_1 = atoi(AESL_token.c_str());

            for (int i = 0 ; i < aesl_tmp_1  ; i++) {

                src.read();

            }

            aesl_fh.read(WRAPC_STREAM_SIZE_IN_src_V_V, AESL_token); //[[/transaction]]

        }

        int aesl_tmp_4;

        int aesl_tmp_5 = 0;

        aesl_fh.read(WRAPC_STREAM_SIZE_OUT_dst_V_V, AESL_token); //[[transaction]]

        aesl_fh.read(WRAPC_STREAM_SIZE_OUT_dst_V_V, AESL_num); //transaction number

        if (atoi(AESL_num.c_str()) == AESL_transaction_pc ) {

            aesl_fh.read(WRAPC_STREAM_SIZE_OUT_dst_V_V, AESL_token); //pop_size

            aesl_tmp_4 = atoi(AESL_token.c_str());

            aesl_fh.read(WRAPC_STREAM_SIZE_OUT_dst_V_V, AESL_token); //[[/transaction]]

        }

        std::vector<ap_int<16> > aesl_tmp_3;

        aesl_fh.read(AUTOTB_TVOUT_PC_dst_V_V, AESL_token); //[[transaction]]

        if ( AESL_token != "[[transaction]]") {

           exit(1);

        }

        aesl_fh.read(AUTOTB_TVOUT_PC_dst_V_V, AESL_num); //transaction number

        if (atoi(AESL_num.c_str()) == AESL_transaction_pc ) {

            aesl_fh.read(AUTOTB_TVOUT_PC_dst_V_V, AESL_token); //data

            std::vector < sc_bv<16> > dst_V_V_pc_buffer;

            int i = 0;

            while (AESL_token != "[[/transaction]]") {

                bool no_x = false;

                bool err = false;

                while (!no_x) {

                size_t x_found = AESL_token.find('X');

                if (x_found != string::npos) {

                    if (!err) {

                        cerr << "@W [SIM-201] RTL produces unknown value 'X' on port 'dst_V_V', possible cause: There are uninitialized variables in the C design." << endl; 

                        err = true;

                    }

                    AESL_token.replace(x_found, 1, "0");

                } else {

                    no_x = true;

                }

                }

                no_x = false;

                while (!no_x) {

                size_t x_found = AESL_token.find('x', 2);

                if (x_found != string::npos) {

                    if (!err) {

                        cerr << "@W [SIM-201] RTL produces unknown value 'X' on port 'dst_V_V', possible cause: There are uninitialized variables in the C design." << endl; 

                        err = true;

                    }

                    AESL_token.replace(x_found, 1, "0");

                } else {

                    no_x = true;

                }

                }

                if (AESL_token != "") {

                    dst_V_V_pc_buffer.push_back( AESL_token.c_str() );

                    i++;

                }

                aesl_fh.read(AUTOTB_TVOUT_PC_dst_V_V, AESL_token); //data or [[/transaction]]

                if (AESL_token == "[[[/runtime]]]" || aesl_fh.eof(AUTOTB_TVOUT_PC_dst_V_V)) {

                   exit(1);

                }

            }

            if (i != aesl_tmp_4) {

               aesl_tmp_4 = i;

            }

            if (aesl_tmp_4 > 0 && aesl_tmp_3.size() < aesl_tmp_4) {

                int aesl_tmp_3_size = aesl_tmp_3.size();

                for (int tmp_aesl_tmp_3 = 0 ; tmp_aesl_tmp_3 < aesl_tmp_4 - aesl_tmp_3_size ; tmp_aesl_tmp_3 ++ ) {

                    ap_int<16> tmp;

                    aesl_tmp_3.push_back(tmp);

                }

            }

            if (i > 0) {

                sc_lv<16> *dst_V_V_lv0_0_0_1 = new sc_lv<16>[aesl_tmp_4 - aesl_tmp_5];

                AESL_i = 0; //subscript for rtl array

                for (int i_0 = 0; i_0 <= aesl_tmp_4 - aesl_tmp_5 - 1 ; i_0+= 1) {

                    if(&(aesl_tmp_3[0]) != 0) {

                       dst_V_V_lv0_0_0_1[0 + AESL_i].range(15, 0) = sc_bv<16>(dst_V_V_pc_buffer[0 + AESL_i].range(15, 0));

                    }

                    AESL_i++;

                }

                AESL_i = 0; //subscript for rtl array

                for (int i_0 = 0; i_0 <= aesl_tmp_4 - aesl_tmp_5 - 1 ; i_0+= 1) {

                    if(&(aesl_tmp_3[0]) != 0) {

                       aesl_tmp_3[i_0] = (dst_V_V_lv0_0_0_1[0 + AESL_i]).to_string(SC_BIN).c_str();

                    }

                    AESL_i++;

                }

                }

        }

        for (int i = 0; i < aesl_tmp_4; i++) {

            dst.write(aesl_tmp_3[i]);

        }

        AESL_transaction_pc ++ ;

    } else {

        static unsigned AESL_transaction;

        static AESL_FILE_HANDLER aesl_fh;

        char* tvin_src_V_V = new char[50];

        char* wrapc_stream_size_in_src_V_V = new char[50];

        char* tvout_dst_V_V = new char[50];

        char* tvin_dst_V_V = new char[50];

        aesl_fh.touch(AUTOTB_TVIN_dst_V_V);

        char* wrapc_stream_size_out_dst_V_V = new char[50];

        static INTER_TCL_FILE tcl_file(INTER_TCL);


        int leading_zero;

        std::vector<ap_int<8> > aesl_tmp_0;

        int aesl_tmp_1 = 0;

        while (!src.empty()) {

            aesl_tmp_0.push_back(src.read());

            aesl_tmp_1 ++;

        }

        std::vector<ap_int<16> > aesl_tmp_3;

        int aesl_tmp_4 = 0;

        while (!dst.empty()) {

            aesl_tmp_3.push_back(dst.read());

            aesl_tmp_4 ++;

        }

        for (int i = 0; i < aesl_tmp_1; i++) {

            src.write(aesl_tmp_0[i]);

        }

        AESL_ORIG_DUT_hls_cropping_strm(src,dst);

        int aesl_tmp_2 = src.size();

        int aesl_tmp_5 = aesl_tmp_4;

        while (!dst.empty()) {

            aesl_tmp_3.push_back(dst.read());

            aesl_tmp_4 ++;

        }

        sprintf(tvin_src_V_V, "[[transaction]] %d\n", AESL_transaction);

        aesl_fh.write(AUTOTB_TVIN_src_V_V, tvin_src_V_V);

        sc_bv<8> *src_V_V_tvin_wrapc_buffer = new sc_bv<8>[aesl_tmp_1 - aesl_tmp_2];

        AESL_i = 0; //subscript for rtl array

        for (int i_0 = 0; i_0 <= aesl_tmp_1 - aesl_tmp_2 - 1 ; i_0+= 1) {

        sc_lv<8> src_V_V_tmp_mem; 

            if(&(aesl_tmp_0[0]) != 0) {

            src_V_V_tmp_mem = (aesl_tmp_0[i_0]).to_string(2).c_str();

               src_V_V_tvin_wrapc_buffer[0 + AESL_i].range(7, 0) = src_V_V_tmp_mem.range(7, 0 ) ;

            }

            AESL_i++;

        }

        for (int i = 0; i < aesl_tmp_1 - aesl_tmp_2 ; i++) {

            sprintf(tvin_src_V_V, "%s\n", (src_V_V_tvin_wrapc_buffer[i]).to_string(SC_HEX).c_str());

            aesl_fh.write(AUTOTB_TVIN_src_V_V, tvin_src_V_V);

        }

        tcl_file.set_num(aesl_tmp_1 - aesl_tmp_2,&tcl_file.src_V_V_depth);

        sprintf(tvin_src_V_V, "[[/transaction]] \n");

        aesl_fh.write(AUTOTB_TVIN_src_V_V, tvin_src_V_V);

        delete [] src_V_V_tvin_wrapc_buffer;

        sprintf(wrapc_stream_size_in_src_V_V, "[[transaction]] %d\n", AESL_transaction);

        aesl_fh.write(WRAPC_STREAM_SIZE_IN_src_V_V, wrapc_stream_size_in_src_V_V);

        sprintf(wrapc_stream_size_in_src_V_V, "%d\n", aesl_tmp_1 - aesl_tmp_2);

        aesl_fh.write(WRAPC_STREAM_SIZE_IN_src_V_V, wrapc_stream_size_in_src_V_V);

        sprintf(wrapc_stream_size_in_src_V_V, "[[/transaction]] \n");

        aesl_fh.write(WRAPC_STREAM_SIZE_IN_src_V_V, wrapc_stream_size_in_src_V_V);

        sprintf(tvout_dst_V_V, "[[transaction]] %d\n", AESL_transaction);

        aesl_fh.write(AUTOTB_TVOUT_dst_V_V, tvout_dst_V_V);

        sc_bv<16> *dst_V_V_tvout_wrapc_buffer = new sc_bv<16>[aesl_tmp_4 - aesl_tmp_5];

        AESL_i = 0; //subscript for rtl array

        for (int i_0 = 0; i_0 <= aesl_tmp_4 - aesl_tmp_5 - 1 ; i_0+= 1) {

        sc_lv<16> dst_V_V_tmp_mem; 

            if(&(aesl_tmp_3[0]) != 0) {

            dst_V_V_tmp_mem = (aesl_tmp_3[i_0]).to_string(2).c_str();

               dst_V_V_tvout_wrapc_buffer[0 + AESL_i].range(15, 0) = dst_V_V_tmp_mem.range(15, 0 ) ;

            }

            AESL_i++;

        }

        for (int i = 0; i < aesl_tmp_4 - aesl_tmp_5 ; i++) {

            sprintf(tvout_dst_V_V, "%s\n", (dst_V_V_tvout_wrapc_buffer[i]).to_string(SC_HEX).c_str());

            aesl_fh.write(AUTOTB_TVOUT_dst_V_V, tvout_dst_V_V);

        }

        tcl_file.set_num(aesl_tmp_4 - aesl_tmp_5,&tcl_file.dst_V_V_depth);

        sprintf(tvout_dst_V_V, "[[/transaction]] \n");

        aesl_fh.write(AUTOTB_TVOUT_dst_V_V, tvout_dst_V_V);

        delete [] dst_V_V_tvout_wrapc_buffer;

        sprintf(wrapc_stream_size_out_dst_V_V, "[[transaction]] %d\n", AESL_transaction);

        aesl_fh.write(WRAPC_STREAM_SIZE_OUT_dst_V_V, wrapc_stream_size_out_dst_V_V);

        sprintf(wrapc_stream_size_out_dst_V_V, "%d\n", aesl_tmp_4 - aesl_tmp_5);

        aesl_fh.write(WRAPC_STREAM_SIZE_OUT_dst_V_V, wrapc_stream_size_out_dst_V_V);

        sprintf(wrapc_stream_size_out_dst_V_V, "[[/transaction]] \n");

        aesl_fh.write(WRAPC_STREAM_SIZE_OUT_dst_V_V, wrapc_stream_size_out_dst_V_V);

        for (int i = 0; i < aesl_tmp_4; i++) {

            dst.write(aesl_tmp_3[i]);

        }

        delete [] tvin_src_V_V;

        delete [] wrapc_stream_size_in_src_V_V;

        delete [] tvout_dst_V_V;

        delete [] tvin_dst_V_V;

        delete [] wrapc_stream_size_out_dst_V_V;

        AESL_transaction++;

        tcl_file.set_num(AESL_transaction , &tcl_file.trans_num);

    }
}
void pyrconstuct_top (
    std::complex<ap_fixed<16, 1, (ap_q_mode) 5, (ap_o_mode)3, 0> > imgIn[512],
    hls::stream<std::complex<ap_fixed<17, 6, (ap_q_mode) 0, (ap_o_mode)3, 0> > >& pyrFilOut,
    const int nL)
{
    fstream wrapc_switch_file_token;
    wrapc_switch_file_token.open(".hls_cosim_wrapc_switch.log");
    int AESL_i;
    if (wrapc_switch_file_token.good())
    {
        static unsigned AESL_transaction_pc = 0;
        string AESL_token;
        string AESL_num;
        static AESL_FILE_HANDLER aesl_fh;

        // define output stream variables: "pyrFilOut"
        std::vector<std::complex<ap_fixed<17, 6, (ap_q_mode) 0, (ap_o_mode)3, 0> > > aesl_tmp_0;
        int aesl_tmp_1;
        int aesl_tmp_2 = 0;

        // read output stream size: "pyrFilOut"
        aesl_fh.read(WRAPC_STREAM_SIZE_OUT_pyrFilOut_V, AESL_token); // [[transaction]]
        aesl_fh.read(WRAPC_STREAM_SIZE_OUT_pyrFilOut_V, AESL_num); // transaction number

        if (atoi(AESL_num.c_str()) == AESL_transaction_pc)
        {
            aesl_fh.read(WRAPC_STREAM_SIZE_OUT_pyrFilOut_V, AESL_token); // pop_size
            aesl_tmp_1 = atoi(AESL_token.c_str());
            aesl_fh.read(WRAPC_STREAM_SIZE_OUT_pyrFilOut_V, AESL_token); // [[/transaction]]
        }

        // output port post check: "pyrFilOut_V"
        aesl_fh.read(AUTOTB_TVOUT_PC_pyrFilOut_V, AESL_token); // [[transaction]]
        if (AESL_token != "[[transaction]]")
        {
            exit(1);
        }
        aesl_fh.read(AUTOTB_TVOUT_PC_pyrFilOut_V, AESL_num); // transaction number

        if (atoi(AESL_num.c_str()) == AESL_transaction_pc)
        {
            aesl_fh.read(AUTOTB_TVOUT_PC_pyrFilOut_V, AESL_token); // data

            std::vector<sc_bv<34> > pyrFilOut_V_pc_buffer;
            int i = 0;

            while (AESL_token != "[[/transaction]]")
            {
                bool no_x = false;
                bool err = false;

                // search and replace 'X' with "0" from the 1st char of token
                while (!no_x)
                {
                    size_t x_found = AESL_token.find('X');
                    if (x_found != string::npos)
                    {
                        if (!err)
                        {
                            cerr << "@W [SIM-201] RTL produces unknown value 'X' on port 'pyrFilOut_V', possible cause: There are uninitialized variables in the C design." << endl;
                            err = true;
                        }
                        AESL_token.replace(x_found, 1, "0");
                    }
                    else
                    {
                        no_x = true;
                    }
                }

                no_x = false;

                // search and replace 'x' with "0" from the 3rd char of token
                while (!no_x)
                {
                    size_t x_found = AESL_token.find('x', 2);

                    if (x_found != string::npos)
                    {
                        if (!err)
                        {
                            cerr << "@W [SIM-201] RTL produces unknown value 'X' on port 'pyrFilOut_V', possible cause: There are uninitialized variables in the C design." << endl;
                            err = true;
                        }
                        AESL_token.replace(x_found, 1, "0");
                    }
                    else
                    {
                        no_x = true;
                    }
                }

                // push token into output port buffer
                if (AESL_token != "")
                {
                    pyrFilOut_V_pc_buffer.push_back(AESL_token.c_str());
                    i++;
                }

                aesl_fh.read(AUTOTB_TVOUT_PC_pyrFilOut_V, AESL_token); // data or [[/transaction]]

                if (AESL_token == "[[[/runtime]]]" || aesl_fh.eof(AUTOTB_TVOUT_PC_pyrFilOut_V))
                {
                    exit(1);
                }
            }

            // correct the buffer size the current transaction
            if (i != aesl_tmp_1)
            {
                aesl_tmp_1 = i;
            }

            if (aesl_tmp_1 > 0 && aesl_tmp_0.size() < aesl_tmp_1)
            {
                int aesl_tmp_0_size = aesl_tmp_0.size();

                for (int tmp_aesl_tmp_0 = 0; tmp_aesl_tmp_0 < aesl_tmp_1 - aesl_tmp_0_size; tmp_aesl_tmp_0++)
                {
                    std::complex<ap_fixed<17, 6, (ap_q_mode) 0, (ap_o_mode)3, 0> > tmp;
                    aesl_tmp_0.push_back(tmp);
                }
            }

            // ***********************************
            if (i > 0)
            {
                // RTL Name: pyrFilOut_V
                {
                    // bitslice(16, 0)
                    // {
                    // celement: pyrFilOut.V._M_real.V(16, 0)
                    // {
                    sc_lv<17>* pyrFilOut_V__M_real_V_lv0_0_1519_1 = new sc_lv<17>[1520];
                    // }
                    // }
                    // bitslice(33, 17)
                    // {
                    // celement: pyrFilOut.V._M_imag.V(16, 0)
                    // {
                    sc_lv<17>* pyrFilOut_V__M_imag_V_lv0_0_1519_1 = new sc_lv<17>[1520];
                    // }
                    // }

                    // bitslice(16, 0)
                    {
                        int hls_map_index = 0;
                        // celement: pyrFilOut.V._M_real.V(16, 0)
                        {
                            // carray: (aesl_tmp_2) => (aesl_tmp_1 - 1) @ (1)
                            for (int i_0 = aesl_tmp_2; i_0 <= aesl_tmp_1 - 1; i_0 += 1)
                            {
                                if (&(aesl_tmp_0[0].real()) != NULL) // check the null address if the c port is array or others
                                {
                                    pyrFilOut_V__M_real_V_lv0_0_1519_1[hls_map_index++].range(16, 0) = sc_bv<17>(pyrFilOut_V_pc_buffer[hls_map_index].range(16, 0));
                                }
                            }
                        }
                    }
                    // bitslice(33, 17)
                    {
                        int hls_map_index = 0;
                        // celement: pyrFilOut.V._M_imag.V(16, 0)
                        {
                            // carray: (aesl_tmp_2) => (aesl_tmp_1 - 1) @ (1)
                            for (int i_0 = aesl_tmp_2; i_0 <= aesl_tmp_1 - 1; i_0 += 1)
                            {
                                if (&(aesl_tmp_0[0].imag()) != NULL) // check the null address if the c port is array or others
                                {
                                    pyrFilOut_V__M_imag_V_lv0_0_1519_1[hls_map_index++].range(16, 0) = sc_bv<17>(pyrFilOut_V_pc_buffer[hls_map_index].range(33, 17));
                                }
                            }
                        }
                    }

                    // bitslice(16, 0)
                    {
                        int hls_map_index = 0;
                        // celement: pyrFilOut.V._M_real.V(16, 0)
                        {
                            // carray: (aesl_tmp_2) => (aesl_tmp_1 - 1) @ (1)
                            for (int i_0 = aesl_tmp_2; i_0 <= aesl_tmp_1 - 1; i_0 += 1)
                            {
                                // sub                    : i_0
                                // ori_name               : aesl_tmp_0[i_0].real()
                                // sub_1st_elem           : 0
                                // ori_name_1st_elem      : aesl_tmp_0[0].real()
                                // output_left_conversion : (aesl_tmp_0[i_0].real()).range()
                                // output_type_conversion : (pyrFilOut_V__M_real_V_lv0_0_1519_1[hls_map_index++]).to_string(SC_BIN).c_str()
                                if (&(aesl_tmp_0[0].real()) != NULL) // check the null address if the c port is array or others
                                {
                                    (aesl_tmp_0[i_0].real()).range() = (pyrFilOut_V__M_real_V_lv0_0_1519_1[hls_map_index++]).to_string(SC_BIN).c_str();
                                }
                            }
                        }
                    }
                    // bitslice(33, 17)
                    {
                        int hls_map_index = 0;
                        // celement: pyrFilOut.V._M_imag.V(16, 0)
                        {
                            // carray: (aesl_tmp_2) => (aesl_tmp_1 - 1) @ (1)
                            for (int i_0 = aesl_tmp_2; i_0 <= aesl_tmp_1 - 1; i_0 += 1)
                            {
                                // sub                    : i_0
                                // ori_name               : aesl_tmp_0[i_0].imag()
                                // sub_1st_elem           : 0
                                // ori_name_1st_elem      : aesl_tmp_0[0].imag()
                                // output_left_conversion : (aesl_tmp_0[i_0].imag()).range()
                                // output_type_conversion : (pyrFilOut_V__M_imag_V_lv0_0_1519_1[hls_map_index++]).to_string(SC_BIN).c_str()
                                if (&(aesl_tmp_0[0].imag()) != NULL) // check the null address if the c port is array or others
                                {
                                    (aesl_tmp_0[i_0].imag()).range() = (pyrFilOut_V__M_imag_V_lv0_0_1519_1[hls_map_index++]).to_string(SC_BIN).c_str();
                                }
                            }
                        }
                    }
                }
            }
        }

        // push back output stream: "pyrFilOut"
        for (int i = 0; i < aesl_tmp_1; i++)
        {
            pyrFilOut.write(aesl_tmp_0[i]);
        }

        AESL_transaction_pc++;
    }
    else
    {
        static unsigned AESL_transaction;

        static AESL_FILE_HANDLER aesl_fh;

        // "imgIn_M_real_V"
        char* tvin_imgIn_M_real_V = new char[50];
        aesl_fh.touch(AUTOTB_TVIN_imgIn_M_real_V);

        // "imgIn_M_imag_V"
        char* tvin_imgIn_M_imag_V = new char[50];
        aesl_fh.touch(AUTOTB_TVIN_imgIn_M_imag_V);

        // "pyrFilOut_V"
        char* tvin_pyrFilOut_V = new char[50];
        aesl_fh.touch(AUTOTB_TVIN_pyrFilOut_V);
        char* tvout_pyrFilOut_V = new char[50];
        aesl_fh.touch(AUTOTB_TVOUT_pyrFilOut_V);
        char* wrapc_stream_size_out_pyrFilOut_V = new char[50];
        aesl_fh.touch(WRAPC_STREAM_SIZE_OUT_pyrFilOut_V);
        char* wrapc_stream_egress_status_pyrFilOut_V = new char[50];
        aesl_fh.touch(WRAPC_STREAM_EGRESS_STATUS_pyrFilOut_V);

        static INTER_TCL_FILE tcl_file(INTER_TCL);
        int leading_zero;

        // dump stream tvin: "pyrFilOut"
        std::vector<std::complex<ap_fixed<17, 6, (ap_q_mode) 0, (ap_o_mode)3, 0> > > aesl_tmp_0;
        int aesl_tmp_1 = 0;
        while (!pyrFilOut.empty())
        {
            aesl_tmp_0.push_back(pyrFilOut.read());
            aesl_tmp_1++;
        }

        // [[transaction]]
        sprintf(tvin_imgIn_M_real_V, "[[transaction]] %d\n", AESL_transaction);
        aesl_fh.write(AUTOTB_TVIN_imgIn_M_real_V, tvin_imgIn_M_real_V);

        sc_bv<16>* imgIn_M_real_V_tvin_wrapc_buffer = new sc_bv<16>[512];

        // RTL Name: imgIn_M_real_V
        {
            // bitslice(15, 0)
            {
                int hls_map_index = 0;
                // celement: imgIn._M_real.V(15, 0)
                {
                    // carray: (0) => (511) @ (1)
                    for (int i_0 = 0; i_0 <= 511; i_0 += 1)
                    {
                        // sub                   : i_0
                        // ori_name              : imgIn[i_0].real()
                        // sub_1st_elem          : 0
                        // ori_name_1st_elem     : imgIn[0].real()
                        // regulate_c_name       : imgIn__M_real_V
                        // input_type_conversion : (imgIn[i_0].real()).range().to_string(SC_BIN).c_str()
                        if (&(imgIn[0].real()) != NULL) // check the null address if the c port is array or others
                        {
                            sc_lv<16> imgIn__M_real_V_tmp_mem;
                            imgIn__M_real_V_tmp_mem = (imgIn[i_0].real()).range().to_string(SC_BIN).c_str();
                            imgIn_M_real_V_tvin_wrapc_buffer[hls_map_index++].range(15, 0) = imgIn__M_real_V_tmp_mem.range(15, 0);
                        }
                    }
                }
            }
        }

        // dump tv to file
        for (int i = 0; i < 512; i++)
        {
            sprintf(tvin_imgIn_M_real_V, "%s\n", (imgIn_M_real_V_tvin_wrapc_buffer[i]).to_string(SC_HEX).c_str());
            aesl_fh.write(AUTOTB_TVIN_imgIn_M_real_V, tvin_imgIn_M_real_V);
        }

        tcl_file.set_num(512, &tcl_file.imgIn_M_real_V_depth);
        sprintf(tvin_imgIn_M_real_V, "[[/transaction]] \n");
        aesl_fh.write(AUTOTB_TVIN_imgIn_M_real_V, tvin_imgIn_M_real_V);

        // release memory allocation
        delete [] imgIn_M_real_V_tvin_wrapc_buffer;

        // [[transaction]]
        sprintf(tvin_imgIn_M_imag_V, "[[transaction]] %d\n", AESL_transaction);
        aesl_fh.write(AUTOTB_TVIN_imgIn_M_imag_V, tvin_imgIn_M_imag_V);

        sc_bv<16>* imgIn_M_imag_V_tvin_wrapc_buffer = new sc_bv<16>[512];

        // RTL Name: imgIn_M_imag_V
        {
            // bitslice(15, 0)
            {
                int hls_map_index = 0;
                // celement: imgIn._M_imag.V(15, 0)
                {
                    // carray: (0) => (511) @ (1)
                    for (int i_0 = 0; i_0 <= 511; i_0 += 1)
                    {
                        // sub                   : i_0
                        // ori_name              : imgIn[i_0].imag()
                        // sub_1st_elem          : 0
                        // ori_name_1st_elem     : imgIn[0].imag()
                        // regulate_c_name       : imgIn__M_imag_V
                        // input_type_conversion : (imgIn[i_0].imag()).range().to_string(SC_BIN).c_str()
                        if (&(imgIn[0].imag()) != NULL) // check the null address if the c port is array or others
                        {
                            sc_lv<16> imgIn__M_imag_V_tmp_mem;
                            imgIn__M_imag_V_tmp_mem = (imgIn[i_0].imag()).range().to_string(SC_BIN).c_str();
                            imgIn_M_imag_V_tvin_wrapc_buffer[hls_map_index++].range(15, 0) = imgIn__M_imag_V_tmp_mem.range(15, 0);
                        }
                    }
                }
            }
        }

        // dump tv to file
        for (int i = 0; i < 512; i++)
        {
            sprintf(tvin_imgIn_M_imag_V, "%s\n", (imgIn_M_imag_V_tvin_wrapc_buffer[i]).to_string(SC_HEX).c_str());
            aesl_fh.write(AUTOTB_TVIN_imgIn_M_imag_V, tvin_imgIn_M_imag_V);
        }

        tcl_file.set_num(512, &tcl_file.imgIn_M_imag_V_depth);
        sprintf(tvin_imgIn_M_imag_V, "[[/transaction]] \n");
        aesl_fh.write(AUTOTB_TVIN_imgIn_M_imag_V, tvin_imgIn_M_imag_V);

        // release memory allocation
        delete [] imgIn_M_imag_V_tvin_wrapc_buffer;

        // push back input stream: "pyrFilOut"
        for (int i = 0; i < aesl_tmp_1; i++)
        {
            pyrFilOut.write(aesl_tmp_0[i]);
        }

// [call_c_dut] ---------->

        AESL_ORIG_DUT_pyrconstuct_top(imgIn, pyrFilOut, nL);

        // pop output stream: "pyrFilOut"
        int aesl_tmp_2 = aesl_tmp_1;
        aesl_tmp_1 = 0;
        aesl_tmp_0.clear();
        while (!pyrFilOut.empty())
        {
            aesl_tmp_0.push_back(pyrFilOut.read());
            aesl_tmp_1++;
        }

        // [[transaction]]
        sprintf(tvout_pyrFilOut_V, "[[transaction]] %d\n", AESL_transaction);
        aesl_fh.write(AUTOTB_TVOUT_pyrFilOut_V, tvout_pyrFilOut_V);

        sc_bv<34>* pyrFilOut_V_tvout_wrapc_buffer = new sc_bv<34>[1520];

        // RTL Name: pyrFilOut_V
        {
            // bitslice(16, 0)
            {
                int hls_map_index = 0;
                // celement: pyrFilOut.V._M_real.V(16, 0)
                {
                    // carray: (aesl_tmp_2) => (aesl_tmp_1 - 1) @ (1)
                    for (int i_0 = aesl_tmp_2; i_0 <= aesl_tmp_1 - 1; i_0 += 1)
                    {
                        // sub                   : i_0
                        // ori_name              : aesl_tmp_0[i_0].real()
                        // sub_1st_elem          : 0
                        // ori_name_1st_elem     : aesl_tmp_0[0].real()
                        // regulate_c_name       : pyrFilOut_V__M_real_V
                        // input_type_conversion : (aesl_tmp_0[i_0].real()).range().to_string(SC_BIN).c_str()
                        if (&(aesl_tmp_0[0].real()) != NULL) // check the null address if the c port is array or others
                        {
                            sc_lv<17> pyrFilOut_V__M_real_V_tmp_mem;
                            pyrFilOut_V__M_real_V_tmp_mem = (aesl_tmp_0[i_0].real()).range().to_string(SC_BIN).c_str();
                            pyrFilOut_V_tvout_wrapc_buffer[hls_map_index++].range(16, 0) = pyrFilOut_V__M_real_V_tmp_mem.range(16, 0);
                        }
                    }
                }
            }
            // bitslice(33, 17)
            {
                int hls_map_index = 0;
                // celement: pyrFilOut.V._M_imag.V(16, 0)
                {
                    // carray: (aesl_tmp_2) => (aesl_tmp_1 - 1) @ (1)
                    for (int i_0 = aesl_tmp_2; i_0 <= aesl_tmp_1 - 1; i_0 += 1)
                    {
                        // sub                   : i_0
                        // ori_name              : aesl_tmp_0[i_0].imag()
                        // sub_1st_elem          : 0
                        // ori_name_1st_elem     : aesl_tmp_0[0].imag()
                        // regulate_c_name       : pyrFilOut_V__M_imag_V
                        // input_type_conversion : (aesl_tmp_0[i_0].imag()).range().to_string(SC_BIN).c_str()
                        if (&(aesl_tmp_0[0].imag()) != NULL) // check the null address if the c port is array or others
                        {
                            sc_lv<17> pyrFilOut_V__M_imag_V_tmp_mem;
                            pyrFilOut_V__M_imag_V_tmp_mem = (aesl_tmp_0[i_0].imag()).range().to_string(SC_BIN).c_str();
                            pyrFilOut_V_tvout_wrapc_buffer[hls_map_index++].range(33, 17) = pyrFilOut_V__M_imag_V_tmp_mem.range(16, 0);
                        }
                    }
                }
            }
        }

        // dump tv to file
        for (int i = 0; i < aesl_tmp_1 - aesl_tmp_2; i++)
        {
            sprintf(tvout_pyrFilOut_V, "%s\n", (pyrFilOut_V_tvout_wrapc_buffer[i]).to_string(SC_HEX).c_str());
            aesl_fh.write(AUTOTB_TVOUT_pyrFilOut_V, tvout_pyrFilOut_V);
        }

        tcl_file.set_num(aesl_tmp_1 - aesl_tmp_2, &tcl_file.pyrFilOut_V_depth);
        sprintf(tvout_pyrFilOut_V, "[[/transaction]] \n");
        aesl_fh.write(AUTOTB_TVOUT_pyrFilOut_V, tvout_pyrFilOut_V);

        // release memory allocation
        delete [] pyrFilOut_V_tvout_wrapc_buffer;

        // dump stream size
        sprintf(wrapc_stream_size_out_pyrFilOut_V, "[[transaction]] %d\n", AESL_transaction);
        aesl_fh.write(WRAPC_STREAM_SIZE_OUT_pyrFilOut_V, wrapc_stream_size_out_pyrFilOut_V);
        sprintf(wrapc_stream_size_out_pyrFilOut_V, "%d\n", aesl_tmp_1 - aesl_tmp_2);
        aesl_fh.write(WRAPC_STREAM_SIZE_OUT_pyrFilOut_V, wrapc_stream_size_out_pyrFilOut_V);
        sprintf(wrapc_stream_size_out_pyrFilOut_V, "[[/transaction]] \n");
        aesl_fh.write(WRAPC_STREAM_SIZE_OUT_pyrFilOut_V, wrapc_stream_size_out_pyrFilOut_V);

        // push back output stream: "pyrFilOut"
        for (int i = 0; i < aesl_tmp_1; i++)
        {
            pyrFilOut.write(aesl_tmp_0[i]);
        }

        // release memory allocation: "imgIn_M_real_V"
        delete [] tvin_imgIn_M_real_V;
        // release memory allocation: "imgIn_M_imag_V"
        delete [] tvin_imgIn_M_imag_V;
        // release memory allocation: "pyrFilOut_V"
        delete [] tvout_pyrFilOut_V;
        delete [] tvin_pyrFilOut_V;
        delete [] wrapc_stream_size_out_pyrFilOut_V;

        AESL_transaction++;

        tcl_file.set_num(AESL_transaction , &tcl_file.trans_num);
    }
}