Ignore:
Timestamp:
Sep 14, 2015, 9:42:16 AM (9 years ago)
Author:
cfuguet
Message:

reconf: dspin_router

  • improve the code readability of the dspin_router model.
  • update the unitary tests of the dspin_router to support the local gateway hardware barrier, and the memory cache scratchpad mode.
Location:
branches/reconfiguration/modules/dspin_router/caba/test/recovery_bcast_evaluation
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/reconfiguration/modules/dspin_router/caba/test/recovery_bcast_evaluation/dspin_broadcast_generator/caba/source/src/dspin_broadcast_generator.cpp

    r1009 r1016  
    11/* -*- c++ -*-
    22 * SOCLIB_LGPL_HEADER_BEGIN
    3  * 
     3 *
    44 * This file is part of SoCLib, GNU LGPLv2.1.
    5  * 
     5 *
    66 * SoCLib is free software; you can redistribute it and/or modify it
    77 * under the terms of the GNU Lesser General Public License as published
    88 * by the Free Software Foundation; version 2.1 of the License.
    9  * 
     9 *
    1010 * SoCLib is distributed in the hope that it will be useful, but
    1111 * WITHOUT ANY WARRANTY; without even the implied warranty of
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1313 * Lesser General Public License for more details.
    14  * 
     14 *
    1515 * You should have received a copy of the GNU Lesser General Public
    1616 * License along with SoCLib; if not, write to the Free Software
    1717 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    1818 * 02110-1301 USA
    19  * 
     19 *
    2020 * SOCLIB_LGPL_HEADER_END
    2121 *
    22  * Authors  : alain.greiner@lip6.fr 
     22 * Authors  : alain.greiner@lip6.fr
    2323 * Date     : july 2010
    2424 * Copyright: UPMC - LIP6
     
    4444                                     const size_t   x_size,
    4545                                     const size_t   y_size,
    46                                      const size_t   srcid,      // srcid for random 
     46                                     const size_t   srcid,      // srcid for random
    4747                                     const size_t   load,       // requested load * 1000
    4848                                     const size_t   fifo_depth) // Fifo depth
    4949           : BaseModule(name),
    50            
     50
    5151           p_clk( "clk" ),
    5252           p_resetn( "resetn" ),
     
    5858
    5959           r_send_fsm( "r_send_fsm" ),
    60            r_send_length( "r_send_length" ), 
     60           r_send_length( "r_send_length" ),
    6161           r_send_dest( "r_send_dest" ),
    6262           r_send_date( "r_send_date" ),
     
    6969
    7070           r_max_fill_status( "r_max_fill_status" ),
    71            
     71
    7272           r_date_fifo( "r_date_fifo", fifo_depth ),
    7373
     
    127127
    128128    /////////////////////////// CMD FSM
    129     switch( r_send_fsm.read() ) 
     129    switch( r_send_fsm.read() )
    130130    {
    131131        case SEND_IDLE:
     
    141141        break;
    142142        case SEND_BROADCAST:
    143             if( p_out.read.read() ) 
     143            if( p_out.read.read() )
    144144            {
    145145                r_send_length = r_send_length.read() - 1;
     
    164164            if (latency > r_receive_bc_max_latency.read())
    165165                r_receive_bc_max_latency = latency;
    166            
     166
    167167            r_receive_fsm = RECEIVE_IDLE;
    168168        }
     
    178178    if (r_date_fifo.filled_status() > r_max_fill_status.read())
    179179        r_max_fill_status.write(r_date_fifo.filled_status());
    180    
     180
    181181} // end transition
    182182
     
    210210    p_out.eop   = eop;
    211211    p_out.write = write;
    212    
     212
    213213    p_in.read = true;
    214214
     
    221221    const char* rsp_str[] = { "IDLE", "RECEIVE_BROADCAST" };
    222222
    223     std::cout << "DSPIN_GENERATOR " << name() 
    224               << " : send_fsm = " << cmd_str[r_send_fsm.read()] 
    225               << " / recv_fsm = " << rsp_str[r_receive_fsm.read()] 
     223    std::cout << "DSPIN_GENERATOR " << name()
     224              << " : send_fsm = " << cmd_str[r_send_fsm.read()]
     225              << " / recv_fsm = " << rsp_str[r_receive_fsm.read()]
    226226              << " / fifo_content = " << r_date_fifo.filled_status() << std::endl;
    227227} // end print_trace
     
    253253// indent-tabs-mode: nil
    254254// End:
     255
     256// vim: ts=4 : sts=4 : sw=4 : et
  • branches/reconfiguration/modules/dspin_router/caba/test/recovery_bcast_evaluation/soclib.conf

    r1009 r1016  
    11# append compilation flags
    22cflags = config.default.toolchain.cflags
    3 #cflags.extend(['-ggdb'])
     3# cflags.extend(['-ggdb'])
     4# cflags.extend(['-DUNICAST'])
    45config.default.toolchain.set("cflags", cflags)
    5 
    66
    77# append modules' description file paths
  • branches/reconfiguration/modules/dspin_router/caba/test/recovery_bcast_evaluation/synthetic_dspin_network/caba/metadata/synthetic_dspin_network.sd

    r1009 r1016  
    1818           Uses('caba:dspin_broadcast_generator',
    1919                cmd_width=DSPIN_FLIT_WIDTH,
     20                rsp_width=DSPIN_FLIT_WIDTH),
     21           Uses('caba:dspin_packet_generator',
     22                cmd_width=DSPIN_FLIT_WIDTH,
    2023                rsp_width=DSPIN_FLIT_WIDTH)
    2124       ],
  • branches/reconfiguration/modules/dspin_router/caba/test/recovery_bcast_evaluation/synthetic_dspin_network/caba/source/include/synthetic_dspin_network.h

    r1009 r1016  
    22 *
    33 * SOCLIB_LGPL_HEADER_BEGIN
    4  * 
     4 *
    55 * This file is part of SoCLib, GNU LGPLv2.1.
    6  * 
     6 *
    77 * SoCLib is free software; you can redistribute it and/or modify it
    88 * under the terms of the GNU Lesser General Public License as published
    99 * by the Free Software Foundation; version 2.1 of the License.
    10  * 
     10 *
    1111 * SoCLib is distributed in the hope that it will be useful, but
    1212 * WITHOUT ANY WARRANTY; without even the implied warranty of
    1313 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1414 * Lesser General Public License for more details.
    15  * 
     15 *
    1616 * You should have received a copy of the GNU Lesser General Public
    1717 * License along with SoCLib; if not, write to the Free Software
    1818 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    1919 * 02110-1301 USA
    20  * 
     20 *
    2121 * SOCLIB_LGPL_HEADER_END
    2222 *
    23  * Authors  : Cesar Armando Fuguet Tortolero 
     23 * Authors  : Cesar Armando Fuguet Tortolero
    2424 * Date     : jul 2015
    2525 * Copyright: UPMC - LIP6
     
    3232#include "caba_base_module.h"
    3333#include "dspin_router.h"
     34
     35#if UNICAST
     36#include "dspin_packet_generator.h"
     37#else
    3438#include "dspin_broadcast_generator.h"
     39#endif
    3540
    3641namespace soclib {
     
    4752    static const int DSPIN_GENERATOR_FIFO_DEPTH = 50;
    4853
     54#if UNICAST
     55    typedef DspinPacketGenerator<DSPIN_WIDTH, DSPIN_WIDTH>
     56    DspinNetworkGenerator;
     57#else
    4958    typedef DspinBroadcastGenerator<DSPIN_WIDTH, DSPIN_WIDTH>
    5059    DspinNetworkGenerator;
     60#endif
     61
    5162    typedef DspinRouter<DSPIN_WIDTH>
    5263    DspinNetworkRouter;
     
    5465    DspinNetworkSignal;
    5566
    56      
     67
    5768public:
    5869
     
    7182    void print_stats(const size_t x, const size_t y);
    7283
    73      
     84
    7485private:
    7586
    7687    const size_t m_x_size;
    7788    const size_t m_y_size;
    78      
     89
    7990    DspinNetworkGenerator **dspinGenerator;
    8091    DspinNetworkRouter **dspinRouter;
     
    8394    DspinNetworkSignal ***sH;
    8495    DspinNetworkSignal ***sV;
    85      
     96
    8697    sc_core::sc_signal<uint32_t>** sConfigRouter;
    8798};                  // end class SyntheticDspinNetwork
  • branches/reconfiguration/modules/dspin_router/caba/test/recovery_bcast_evaluation/synthetic_dspin_network/caba/source/src/synthetic_dspin_network.cpp

    r1009 r1016  
    22 *
    33 * SOCLIB_LGPL_HEADER_BEGIN
    4  * 
     4 *
    55 * This file is part of SoCLib, GNU LGPLv2.1.
    6  * 
     6 *
    77 * SoCLib is free software; you can redistribute it and/or modify it
    88 * under the terms of the GNU Lesser General Public License as published
    99 * by the Free Software Foundation; version 2.1 of the License.
    10  * 
     10 *
    1111 * SoCLib is distributed in the hope that it will be useful, but
    1212 * WITHOUT ANY WARRANTY; without even the implied warranty of
    1313 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1414 * Lesser General Public License for more details.
    15  * 
     15 *
    1616 * You should have received a copy of the GNU Lesser General Public
    1717 * License along with SoCLib; if not, write to the Free Software
    1818 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    1919 * 02110-1301 USA
    20  * 
     20 *
    2121 * SOCLIB_LGPL_HEADER_END
    2222 *
    23  * Authors  : Cesar Armando Fuguet Tortolero 
     23 * Authors  : Cesar Armando Fuguet Tortolero
    2424 * Date     : jul 2015
    2525 * Copyright: UPMC - LIP6
     
    3434namespace caba {
    3535using namespace soclib::common;
    36    
     36
    3737
    3838SyntheticDspinNetwork::SyntheticDspinNetwork(sc_module_name name,
     
    5858            const int SRCID = (x << Y_WIDTH) | y;
    5959            generator_name << "generator[" << x << "][" << y << "]";
     60#if UNICAST
     61            const size_t PACKET_LENGTH = 8;
     62            new(&dspinGenerator[x][y])
     63                DspinNetworkGenerator(generator_name.str().c_str(),
     64                                      (size_t)SRCID,
     65                                      PACKET_LENGTH,
     66                                      load,
     67                                      (size_t)DSPIN_GENERATOR_FIFO_DEPTH,
     68                                      0 );
     69#else
    6070            new(&dspinGenerator[x][y])
    6171                DspinNetworkGenerator(generator_name.str().c_str(),
     
    6575                                      load,
    6676                                      DSPIN_GENERATOR_FIFO_DEPTH);
    67          
    68         }
    69     }
    70      
     77#endif
     78
     79        }
     80    }
     81
    7182    // DSPIN router instantiation
    7283    dspinRouter = (DspinNetworkRouter**)
     
    7485
    7586    for (size_t x = 0; x < m_x_size; ++x) {
    76         dspinRouter[x] = (DspinNetworkRouter*)
     87        dspinRouter[x] = (DspinNetworkRouter*)
    7788            malloc(sizeof(DspinNetworkRouter) * m_y_size);
    7889
     
    102113                                                   m_x_size, m_y_size);
    103114
    104      
     115
    105116    // netlist
    106117    for (size_t x = 0; x < m_x_size; ++x) {
     
    133144    for (size_t x = 0; x < m_x_size; ++x) {
    134145        for (size_t y = 0; y < m_y_size; ++y) {
     146#if UNICAST
     147            dspinGenerator[x][y].~DspinPacketGenerator();
     148#else
    135149            dspinGenerator[x][y].~DspinBroadcastGenerator();
     150#endif
    136151            dspinRouter[x][y].~DspinRouter();
    137152        }
     
    151166
    152167
    153 static inline uint32_t configRouter(int bypass_mode,
    154                                     int reallocation_dir,
     168static inline uint32_t configRouter(int reallocation_dir,
     169                                    int recovery_mode,
    155170                                    int blackhole_pos)
    156171{
    157     return (bypass_mode << 7) | (reallocation_dir << 4) | blackhole_pos;
     172    return ((reallocation_dir & 0x7) << 5) |
     173           ((recovery_mode & 0x1)    << 4) |
     174           (blackhole_pos & 0xF);
    158175}
    159176
     
    164181    for (size_t x = 0; x < m_x_size; ++x) {
    165182        for (size_t y = 0; y < m_y_size; ++y) {
    166             const uint32_t CONFIG_NONE = configRouter(0, REQ_NOP, BH_NONE);
     183            const uint32_t CONFIG_NONE = configRouter(0, 0, NORMAL);
    167184            sConfigRouter[x][y].write(CONFIG_NONE);
    168185        }
    169186    }
    170      
     187
    171188
    172189    // initialize mesh's boundary signals
     
    184201    }
    185202}                   // end reset()
    186    
     203
    187204
    188205void SyntheticDspinNetwork::set_faulty_router(const size_t faulty_x,
     
    199216    // reconfigure the faulty router's contour
    200217    if (faulty_y < (m_y_size - 1)) {
    201         const uint32_t CONFIG_N = configRouter(1, REQ_SOUTH, BH_N);
     218        const uint32_t CONFIG_N = configRouter(REQ_SOUTH, 1, N_OF_X);
    202219        sConfigRouter[faulty_x][faulty_y + 1].write(CONFIG_N);
    203220
    204221        if (faulty_x > 0) {
    205             const uint32_t CONFIG_NW = configRouter(1, REQ_EAST, BH_NW);
     222            const uint32_t CONFIG_NW = configRouter(REQ_EAST, 1, NW_OF_X);
    206223            sConfigRouter[faulty_x - 1][faulty_y + 1].write(CONFIG_NW);
    207224        }
    208225        if (faulty_x < (m_x_size - 1)) {
    209             const uint32_t CONFIG_NE = configRouter(1, REQ_WEST, BH_NE);
     226            const uint32_t CONFIG_NE = configRouter(REQ_WEST, 1, NE_OF_X);
    210227            sConfigRouter[faulty_x + 1][faulty_y + 1].write(CONFIG_NE);
    211228        }
     
    213230
    214231    if (faulty_y > 0) {
    215         const uint32_t CONFIG_S = configRouter(1, REQ_NORTH, BH_S);
     232        const uint32_t CONFIG_S = configRouter(REQ_NORTH, 1, S_OF_X);
    216233        sConfigRouter[faulty_x][faulty_y - 1].write(CONFIG_S);
    217234
    218235        if (faulty_x > 0) {
    219             const uint32_t CONFIG_SW = configRouter(1, REQ_EAST, BH_SW);
     236            const uint32_t CONFIG_SW = configRouter(REQ_EAST, 1, SW_OF_X);
    220237            sConfigRouter[faulty_x - 1][faulty_y - 1].write(CONFIG_SW);
    221238        }
    222239        if (faulty_x < (m_x_size - 1)) {
    223             const uint32_t CONFIG_SE = configRouter(1, REQ_WEST, BH_SE);
     240            const uint32_t CONFIG_SE = configRouter(REQ_WEST, 1, SE_OF_X);
    224241            sConfigRouter[faulty_x + 1][faulty_y - 1].write(CONFIG_SE);
    225242        }
     
    227244
    228245    if (faulty_x > 0) {
    229         const uint32_t CONFIG_W = configRouter(1, REQ_EAST, BH_W);
     246        const uint32_t CONFIG_W = configRouter(REQ_EAST, 1, W_OF_X);
    230247        sConfigRouter[faulty_x - 1][faulty_y].write(CONFIG_W);
    231248    }
    232249
    233250    if (faulty_x < (m_x_size - 1)) {
    234         const uint32_t CONFIG_E = configRouter(1, REQ_WEST, BH_E);
     251        const uint32_t CONFIG_E = configRouter(REQ_WEST, 1, E_OF_X);
    235252        sConfigRouter[faulty_x + 1][faulty_y].write(CONFIG_E);
    236253    }
     
    245262    dspinGenerator[x][y].print_stats();
    246263}
    247    
     264
    248265
    249266}                   // end namespace caba
     
    256273// indent-tabs-mode: nil
    257274// End:
     275
     276// vim: ts=4 : sts=4 : sw=4 : et
  • branches/reconfiguration/modules/dspin_router/caba/test/recovery_bcast_evaluation/top.cpp

    r1009 r1016  
    7373            continue;
    7474        }
    75    
     75
    7676        std::cout << "   Arguments are (key, value) couples." << std::endl;
    7777        std::cout << "   The order is not important." << std::endl;
    7878        std::cout << "   Accepted arguments are :" << std::endl << std::endl;
    79         std::cout << "     -L dspin generators' accepted load * 1000" << std::endl;
     79        std::cout << "     -L generators' accepted load * 1000" << std::endl;
    8080        std::cout << "     -X number of clusters per row" << std::endl;
    8181        std::cout << "     -Y number of clusters per column" << std::endl;
    8282        std::cout << "     -N simulation's cycles" << std::endl;
    8383        std::cout << "     -F deactivate a router" << std::endl;
     84
     85        exit(1);
    8486    }
    8587}                        // end parse_args()
     
    137139        // deactivate a router in the center of the mesh and create its
    138140        // recovery cycle-free contour
    139         syntheticDspinNetwork.set_faulty_router(args.x_size / 2, args.y_size / 2);
     141        syntheticDspinNetwork.set_faulty_router(args.x_size / 2,
     142                                                args.y_size / 2);
    140143    }
    141144
     
    154157    }
    155158
    156  
     159
    157160    return 0;
    158161}                   // end sc_main()
     
    164167// indent-tabs-mode: nil
    165168// End:
     169
     170// vim: ts=4 : sts=4 : sw=4 : et
Note: See TracChangeset for help on using the changeset viewer.