Ignore:
Timestamp:
Nov 10, 2014, 12:16:07 PM (9 years ago)
Author:
cfuguet
Message:

reconf: introducing recovery_route function in the dspin_router

  • For now, this function defines a recovery routing function for single-faulty router topologies as defined by Zhen Zhang work.
  • TODO: support segment migration.
  • TODO: support multi-faulty router topologies.
Location:
branches/reconfiguration/modules/dspin_router/caba/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h

    r854 r873  
    8484    };
    8585
     86    // Black-Hole position
     87    enum
     88    {
     89        BH_NONE,
     90        BH_N,
     91        BH_NE,
     92        BH_E,
     93        BH_SE,
     94        BH_S,
     95        BH_SW,
     96        BH_W,
     97        BH_NW
     98    };
     99
    86100    protected:
    87101    SC_HAS_PROCESS(DspinRouter);
     
    137151    bool                        m_broadcast_supported;
    138152    int                         m_disable_mask;
     153    int                         m_blackhole_pos;
    139154
    140155    // methods
    141156    void    transition();
    142157    void    genMoore();
    143     int     xfirst_route( sc_uint<flit_width> data );
     158    int     xfirst_route( size_t xdest, size_t ydest );
     159    int     recovery_route( size_t xdest, size_t ydest );
     160    int     route( sc_uint<flit_width> data );
    144161    int     broadcast_route( int iter, int source, sc_uint<flit_width> data );
    145162    bool    is_broadcast( sc_uint<flit_width> data );
     
    147164    public:
    148165
    149     void    set_disable_mask( int mask );
    150     void    print_trace();
     166    void set_disable_mask( int mask )
     167    {
     168        m_disable_mask = mask;
     169    }
     170
     171    void set_blackhole_pos( int pos )
     172    {
     173        m_blackhole_pos = pos;
     174    }
     175
     176    void print_trace();
    151177};
    152178
  • branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp

    r854 r873  
    117117
    118118    ///////////////////////////////////////////////////
    119     tmpl(int)::xfirst_route( sc_uint<flit_width> data )
    120     {
    121         size_t xdest = (size_t)(data >> m_x_shift) & m_x_mask;
    122         size_t ydest = (size_t)(data >> m_y_shift) & m_y_mask;
     119    tmpl(int)::xfirst_route( size_t xdest, size_t ydest )
     120    {
    123121        return (xdest < m_local_x ? REQ_WEST :
    124122               (xdest > m_local_x ? REQ_EAST :
    125123               (ydest < m_local_y ? REQ_SOUTH :
    126124               (ydest > m_local_y ? REQ_NORTH : REQ_LOCAL))));
     125    }
     126
     127    ///////////////////////////////////////////////////
     128    tmpl(int)::recovery_route( size_t xdest, size_t ydest )
     129    {
     130        int bhpos = m_blackhole_pos;
     131        if ( xdest > m_local_x ) {
     132            if ( (bhpos == BH_NE) || (bhpos == BH_E) || (bhpos == BH_SE) ||
     133                 (bhpos == BH_S) ) {
     134                return REQ_EAST;
     135            }
     136            else if ( bhpos == BH_N ) {
     137                if ( (m_local_y == 1) || (m_local_x == 0) || (ydest >= m_local_y) ||
     138                     (xdest > (m_local_x + 1)) ) {
     139                    return REQ_EAST;
     140                }
     141                else {
     142                    return REQ_WEST;
     143                }
     144            }
     145            else if ( bhpos == BH_NW ) {
     146                if ( (m_local_y == 1) || (ydest >= m_local_y) ||
     147                     (xdest > (m_local_x + 2)) ) {
     148                    return REQ_EAST;
     149                }
     150                else {
     151                    return REQ_SOUTH;
     152                }
     153            }
     154            else if ( bhpos == BH_W ) {
     155                if ( (m_local_y == 0) || (ydest > m_local_y)) {
     156                    return REQ_NORTH;
     157                }
     158                else {
     159                    return REQ_SOUTH;
     160                }
     161            }
     162            else if ( bhpos == BH_SW ) {
     163                if ( (ydest <= m_local_y) || (xdest > (m_local_x + 1)) ) {
     164                    return REQ_EAST;
     165                }
     166                else {
     167                    return REQ_NORTH;
     168                }
     169            }
     170            std::cout << "error: unexpected condition in function "
     171                      << __FILE__ << ":" << __func__ << " +" << __LINE__
     172                      << std::endl;
     173            exit(1);
     174        }                    // end if (xdest > m_local_x)
     175        else if ( xdest < m_local_x ) {
     176            if ( (bhpos == BH_N) || (bhpos == BH_NW) || (bhpos == BH_W) ||
     177                 (bhpos == BH_SW) || (bhpos == BH_S) ) {
     178                return REQ_WEST;
     179            }
     180            else if ( bhpos == BH_NE ) {
     181                if ( (xdest < (m_local_x - 1)) || (ydest >= m_local_y) ) {
     182                    return REQ_WEST;
     183                }
     184                else {
     185                    return REQ_SOUTH;
     186                }
     187            }
     188            else if ( bhpos == BH_SE ) {
     189                if ( (m_local_x == 1) && (ydest > (m_local_y + 1)) ) {
     190                    return REQ_NORTH;
     191                }
     192                else {
     193                    return REQ_WEST;
     194                }
     195            }
     196            else if ( bhpos == BH_E ) {
     197                if ( (m_local_y == 0) ||
     198                    ((m_local_x == 1) && (ydest > m_local_y)) ) {
     199                    return REQ_NORTH;
     200                }
     201                else {
     202                    return REQ_SOUTH;
     203                }
     204            }
     205            std::cout << "error: unexpected condition in function "
     206                      << __FILE__ << ":" << __func__ << " +" << __LINE__
     207                      << std::endl;
     208            exit(1);
     209        }                    // end if (xdest < m_local_x)
     210        else if ( ydest > m_local_y ) {
     211            if ( bhpos != BH_S ) {
     212                return REQ_NORTH;
     213            }
     214            else if ( m_local_x != 0 ) {
     215                return REQ_WEST;
     216            }
     217            else {
     218                return REQ_EAST;
     219            }
     220        }                    // end if (ydest > m_local_y)
     221        else if ( ydest < m_local_y ) {
     222            if ( bhpos != BH_N ) {
     223                return REQ_SOUTH;
     224            }
     225            else if ( m_local_x != 0) {
     226                return REQ_WEST;
     227            }
     228            else {
     229                return REQ_EAST;
     230            }
     231        }                    // end if (ydest < m_local_y)
     232        return REQ_LOCAL;
     233    }
     234
     235    ///////////////////////////////////////////////////
     236    tmpl(int)::route( sc_uint<flit_width> data )
     237    {
     238        size_t xdest = (size_t)(data >> m_x_shift) & m_x_mask;
     239        size_t ydest = (size_t)(data >> m_y_shift) & m_y_mask;
     240        if ( m_blackhole_pos == BH_NONE ) {
     241            return xfirst_route(xdest, ydest);
     242        }
     243        else {
     244            return recovery_route(xdest, ydest);
     245        }
    127246    }
    128247
     
    182301    }
    183302
    184     /////////////////////////////////////////////////////////
    185     tmpl(void)::set_disable_mask( int mask )
    186     {
    187         m_disable_mask = mask;
    188     }
    189 
    190303    /////////////////////////
    191304    tmpl(void)::print_trace()
     
    265378                r_fifo_out[i].init();
    266379            }
     380
     381            set_blackhole_pos(BH_NONE);
    267382            return;
    268383        }
     
    327442                        else                                  // unicast
    328443                        {
    329                             req_in[i]       = xfirst_route(r_fifo_in[i].read().data);
     444                            req_in[i]       = route(r_fifo_in[i].read().data);
    330445                            r_index_in[i]   = req_in[i];
    331446                            r_fsm_in[i]     = INFSM_REQ;
Note: See TracChangeset for help on using the changeset viewer.