Changeset 1016


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
Files:
14 edited

Legend:

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

    r1010 r1016  
    2929    ///////////////////////////////////////////////////////////////////////////
    3030    // Implementation Note :
    31     // The xfirst_route(), broadcast_route() and is_broadcast() functions
    32     // defined below are used to decode the DSPIN first flit format:
     31    // DSPIN first flit format:
    3332    // - In case of a non-broadcast packet :
    3433    //  |   X     |   Y     |---------------------------------------|BC |
     
    3635    //
    3736    //  - In case of a broacast
    38     //  |  XMIN   |  XMAX   |  YMIN   |  YMAX   |-------------------|BC |
    39     //  |   5     |   5     |   5     |   5     | flit_width - 22   | 1 |
     37    //  |  XMIN   |  XMAX   |  YMIN   |  YMAX   |----------------|SP|BC |
     38    //  |   5     |   5     |   5     |   5     | flit_width - 21| 1| 1 |
    4039    ///////////////////////////////////////////////////////////////////////////
    4140
     
    147146    void    genMoore();
    148147
    149     int     xfirst_route( size_t xdest, size_t ydest );
     148    int     route( sc_uint<flit_width> data );
    150149    int     recovery_route( size_t xdest, size_t ydest );
    151     int     route( sc_uint<flit_width> data );
     150    int     broadcast_route( int iter, int source, sc_uint<flit_width> data );
     151    int     reallocation_route();
    152152
    153     int     broadcast_route( int iter, int source, sc_uint<flit_width> data );
    154153    bool    is_broadcast( sc_uint<flit_width> data );
    155     sc_uint<flit_width> compute_broadcast_header( int source );
     154    internal_flit_t compute_broadcast_header( int source );
    156155
    157     bool    is_destination_blackhole( size_t xdest, size_t ydest, int bhpos );
     156    bool    is_reconfigurable();
     157    bool    is_recovery_routing_enabled();
     158    bool    is_reallocation_enabled();
     159    bool    is_destination_blackhole( size_t xdest, size_t ydest );
    158160    int     blackhole_position();
    159 
    160     inline bool is_network_recovery_enable()
    161     {
    162         return (((p_recovery_cfg->read() >> 7) & 0x1) != 0);
    163     }
    164 
    165     inline int migration_route()
    166     {
    167         return ((p_recovery_cfg->read() >> 4) & 0x7);
    168     }
    169 
    170     inline bool is_reconfigurable()
    171     {
    172         return (p_recovery_cfg != NULL);
    173     }
    174161
    175162    public:
  • branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp

    r1006 r1016  
    2626  *
    2727  */
    28 
    29     ///////////////////////////////////////////////////////////////////////////
    30     // Implementation Note :
    31     // The xfirst_route(), broadcast_route() and is_broadcast() functions
    32     // defined below are used to decode the DSPIN first flit format:
    33     // - In case of a non-broadcast packet :
    34     //  |   X     |   Y     |---------------------------------------|BC |
    35     //  | x_width | y_width |  flit_width - (x_width + y_width + 2) | 0 |
    36     //
    37     //  - In case of a broacast
    38     //  |  XMIN   |  XMAX   |  YMIN   |  YMAX   |----------------|SP|BC |
    39     //  |   5     |   5     |   5     |   5     | flit_width - 21| 1| 1 |
    40     ///////////////////////////////////////////////////////////////////////////
    41 
    4228#include "../include/dspin_router.h"
    4329#include "dspin_router_config.h"
     30
     31#include <cassert>
    4432
    4533namespace soclib { namespace caba {
     
    132120    tmpl(int)::blackhole_position()
    133121    {
    134         if ( is_reconfigurable() ) {
    135             return p_recovery_cfg->read() & 0xF;
    136         }
    137         return BH_NONE;
     122        assert( is_reconfigurable() );
     123        return p_recovery_cfg->read() & 0xF;
    138124    }
    139125
     
    141127    tmpl(void)::bind_recovery_port(sc_signal<uint32_t> &s)
    142128    {
    143         if (!is_reconfigurable()) {
     129        if ( not is_reconfigurable() ) {
    144130            std::cerr << "Error in " << name()
    145131                      << ": router configuration not supported." << std::endl
     
    150136    }
    151137
     138    tmpl(bool)::is_recovery_routing_enabled()
     139    {
     140        assert( is_reconfigurable() );
     141        return (((p_recovery_cfg->read() >> 4) & 0x1) != 0);
     142    }
     143
     144    tmpl(bool)::is_reallocation_enabled()
     145    {
     146        assert( is_reconfigurable() );
     147        return (blackhole_position() != NORMAL);
     148    }
     149
     150    tmpl(int)::reallocation_route()
     151    {
     152        assert( is_reconfigurable() );
     153        return ((p_recovery_cfg->read() >> 5) & 0x7);
     154    }
     155
     156    tmpl(bool)::is_reconfigurable()
     157    {
     158        return (p_recovery_cfg != NULL);
     159    }
     160
    152161    ///////////////////////////////////////////////////
    153     tmpl(int)::xfirst_route( size_t xdest, size_t ydest )
    154     {
    155         return (xdest < m_local_x ? REQ_WEST :
    156                (xdest > m_local_x ? REQ_EAST :
    157                (ydest < m_local_y ? REQ_SOUTH :
    158                (ydest > m_local_y ? REQ_NORTH : REQ_LOCAL))));
     162    tmpl(bool)::is_destination_blackhole( size_t xdest, size_t ydest )
     163    {
     164        assert ( is_reconfigurable() );
     165
     166        const int bhpos = blackhole_position();
     167
     168        const bool is_n = (bhpos == N_OF_X);
     169        const bool is_s = (bhpos == S_OF_X);
     170        const bool is_w = (bhpos == W_OF_X);
     171        const bool is_e = (bhpos == E_OF_X);
     172        const bool is_nw = (bhpos == NW_OF_X);
     173        const bool is_ne = (bhpos == NE_OF_X);
     174        const bool is_sw = (bhpos == SW_OF_X);
     175        const bool is_se = (bhpos == SE_OF_X);
     176
     177        if ( bhpos == NORMAL ) return false;
     178
     179        size_t xhole;
     180        if      (is_nw || is_w  || is_sw) xhole = m_local_x + 1;
     181        else if (is_ne || is_se || is_e ) xhole = m_local_x - 1;
     182        else                              xhole = m_local_x;
     183
     184        size_t yhole;
     185        if      (is_sw || is_s  || is_se) yhole = m_local_y + 1;
     186        else if (is_nw || is_n  || is_ne) yhole = m_local_y - 1;
     187        else                              yhole = m_local_y;
     188
     189        return ((xdest == xhole) && (ydest == yhole));
    159190    }
    160191
    161192    ///////////////////////////////////////////////////
    162     tmpl(bool)::is_destination_blackhole( size_t xdest, size_t ydest, int bhpos )
    163     {
    164         size_t xhole, yhole;
    165         switch (bhpos) {
    166             case BH_N:
    167                 xhole = m_local_x;
    168                 yhole = m_local_y - 1;
    169                 break;
    170             case BH_NW:
    171                 xhole = m_local_x + 1;
    172                 yhole = m_local_y - 1;
    173                 break;
    174             case BH_W:
    175                 xhole = m_local_x + 1;
    176                 yhole = m_local_y;
    177                 break;
    178             case BH_SW:
    179                 xhole = m_local_x + 1;
    180                 yhole = m_local_y + 1;
    181                 break;
    182             case BH_S:
    183                 xhole = m_local_x;
    184                 yhole = m_local_y + 1;
    185                 break;
    186             case BH_SE:
    187                 xhole = m_local_x - 1;
    188                 yhole = m_local_y + 1;
    189                 break;
    190             case BH_E:
    191                 xhole = m_local_x - 1;
    192                 yhole = m_local_y;
    193                 break;
    194             case BH_NE:
    195                 xhole = m_local_x - 1;
    196                 yhole = m_local_y - 1;
    197                 break;
    198             default:
    199                 return false;
    200         }
    201 
    202         return ((xdest == xhole) && (ydest == yhole));
    203     }
    204 
    205     ///////////////////////////////////////////////////
    206     tmpl(int)::recovery_route( size_t xdest, size_t ydest )
    207     {
    208         int bhpos = blackhole_position();
    209 
    210         if ( xdest > m_local_x ) {
    211             if ( (bhpos == BH_NE) || (bhpos == BH_E) || (bhpos == BH_SE) ||
    212                  (bhpos == BH_S) ) {
     193    tmpl(int)::recovery_route( size_t dx, size_t dy )
     194    {
     195        // use normal routing (X-first) when the recovery routing is disabled
     196        int bhpos = NORMAL;
     197        bool normal = true;
     198        if (is_reconfigurable()) {
     199            assert(not is_reallocation_enabled() or
     200                   not is_destination_blackhole(dx, dy));
     201
     202            bhpos  = blackhole_position();
     203
     204            normal = (bhpos == NORMAL) or
     205                     (not is_recovery_routing_enabled() and
     206                      not is_destination_blackhole(dx, dy));
     207        }
     208
     209        const bool is_n  = not normal and (bhpos == N_OF_X);
     210        const bool is_s  = not normal and (bhpos == S_OF_X);
     211        const bool is_w  = not normal and (bhpos == W_OF_X);
     212        const bool is_e  = not normal and (bhpos == E_OF_X);
     213        const bool is_nw = not normal and (bhpos == NW_OF_X);
     214        const bool is_ne = not normal and (bhpos == NE_OF_X);
     215        const bool is_sw = not normal and (bhpos == SW_OF_X);
     216        const bool is_se = not normal and (bhpos == SE_OF_X);
     217
     218        const size_t lx = m_local_x;
     219        const size_t ly = m_local_y;
     220
     221        if ( dx > lx ) {
     222            if ( is_ne || is_e || is_se || is_s || normal )
    213223                return REQ_EAST;
    214             }
    215             else if ( bhpos == BH_N ) {
    216                 if ( (m_local_y == 1) || (m_local_x == 0) || (ydest >= m_local_y) ||
    217                      (xdest > (m_local_x + 1)) ) {
     224
     225            else if ( is_n ) {
     226                if ( (ly == 1) || (lx == 0) || (dy >= ly) || (dx > (lx + 1)) )
    218227                    return REQ_EAST;
    219                 }
    220                 else {
     228                else
    221229                    return REQ_WEST;
    222                 }
    223             }
    224             else if ( bhpos == BH_NW ) {
    225                 if ( (m_local_y == 1) || (ydest >= m_local_y) ||
    226                      (xdest > (m_local_x + 2)) ) {
     230            }
     231            else if ( is_nw ) {
     232                if ( (ly == 1) || (dy >= ly) || (dx > (lx + 2)) )
    227233                    return REQ_EAST;
    228                 }
    229                 else {
     234                else
    230235                    return REQ_SOUTH;
    231                 }
    232             }
    233             else if ( bhpos == BH_W ) {
    234                 if ( (m_local_y == 0) || (ydest > m_local_y)) {
     236            }
     237            else if ( is_w ) {
     238                if ( (ly == 0) || (dy > ly))
    235239                    return REQ_NORTH;
    236                 }
    237                 else {
     240                else
    238241                    return REQ_SOUTH;
    239                 }
    240             }
    241             else if ( bhpos == BH_SW ) {
    242                 if ( (ydest <= m_local_y) || (xdest > (m_local_x + 1)) ) {
     242            }
     243            else if ( is_sw ) {
     244                if ( (dy <= ly) || (dx > (lx + 1)) )
    243245                    return REQ_EAST;
    244                 }
    245                 else {
     246                else
    246247                    return REQ_NORTH;
    247                 }
    248248            }
    249249            std::cout << "error: unexpected condition in function "
     
    251251                      << std::endl;
    252252            exit(1);
    253         }                    // end if (xdest > m_local_x)
    254         else if ( xdest < m_local_x ) {
    255             if ( (bhpos == BH_N) || (bhpos == BH_NW) || (bhpos == BH_W) ||
    256                  (bhpos == BH_SW) || (bhpos == BH_S) ) {
     253        }                    // end if (dx > lx)
     254        else if ( dx < lx ) {
     255            if ( is_n || is_nw || is_w || is_sw || is_s || normal )
    257256                return REQ_WEST;
    258             }
    259             else if ( bhpos == BH_NE ) {
    260                 if ( (xdest < (m_local_x - 1)) || (ydest >= m_local_y) ) {
     257
     258            else if ( is_ne ) {
     259                if ( (dx < (lx - 1)) || (dy >= ly) )
    261260                    return REQ_WEST;
    262                 }
    263                 else {
     261                else
    264262                    return REQ_SOUTH;
    265                 }
    266             }
    267             else if ( bhpos == BH_SE ) {
    268                 if ( (m_local_x == 1) && (ydest > (m_local_y + 1)) ) {
     263            }
     264            else if ( is_se ) {
     265                if ( (lx == 1) && (dy > (ly + 1)) )
    269266                    return REQ_NORTH;
    270                 }
    271                 else {
     267                else
    272268                    return REQ_WEST;
    273                 }
    274             }
    275             else if ( bhpos == BH_E ) {
    276                 if ( (m_local_y == 0) ||
    277                     ((m_local_x == 1) && (ydest > m_local_y)) ) {
     269            }
     270            else if ( is_e ) {
     271                if ( (ly == 0) || ((lx == 1) && (dy > ly)) )
    278272                    return REQ_NORTH;
    279                 }
    280                 else {
     273                else
    281274                    return REQ_SOUTH;
    282                 }
    283275            }
    284276            std::cout << "error: unexpected condition in function "
     
    286278                      << std::endl;
    287279            exit(1);
    288         }                    // end if (xdest < m_local_x)
    289         else if ( ydest > m_local_y ) {
    290             if ( bhpos != BH_S ) {
    291                 return REQ_NORTH;
    292             }
    293             else if ( m_local_x != 0 ) {
    294                 return REQ_WEST;
    295             }
    296             else {
    297                 return REQ_EAST;
    298             }
    299         }                    // end if (ydest > m_local_y)
    300         else if ( ydest < m_local_y ) {
    301             if ( bhpos != BH_N ) {
    302                 return REQ_SOUTH;
    303             }
    304             else if ( m_local_x != 0) {
    305                 return REQ_WEST;
    306             }
    307             else {
    308                 return REQ_EAST;
    309             }
    310         }                    // end if (ydest < m_local_y)
     280        }                    // end if (dx < lx)
     281        else if ( dy > ly ) {
     282            if      ( ! is_s  ) return REQ_NORTH;
     283            else if ( lx != 0 ) return REQ_WEST;
     284            else                return REQ_EAST;
     285        }
     286        else if ( dy < ly ) {
     287            if      ( ! is_n )  return REQ_SOUTH;
     288            else if ( lx != 0)  return REQ_WEST;
     289            else                return REQ_EAST;
     290        }
    311291        return REQ_LOCAL;
    312292    }
     
    315295    tmpl(int)::route( sc_uint<flit_width> data )
    316296    {
    317         size_t xdest = (size_t)(data >> m_x_shift) & m_x_mask;
    318         size_t ydest = (size_t)(data >> m_y_shift) & m_y_mask;
    319         if ( blackhole_position() != BH_NONE )
    320         {
    321             // reroute the request if its destination is the blackhole (this
    322             // is to implement the segment recovery mechanism)
    323             if ( is_destination_blackhole(xdest, ydest, blackhole_position()) )
     297        const size_t dx = (size_t)(data >> m_x_shift) & m_x_mask;
     298        const size_t dy = (size_t)(data >> m_y_shift) & m_y_mask;
     299
     300        if ( is_reconfigurable() ) {
     301            // reroute requests whose destination is the blackhole (this is to
     302            // implement the segment reallocation mechanism)
     303            if ( is_reallocation_enabled() and is_destination_blackhole(dx, dy))
    324304            {
    325                 int dir = migration_route();
    326 
    327 #if SOCLIB_MODULE_DEBUG
    328                 std::cout << "<" << name() << "> migration: "
    329                           << "route request to DIR = " << dir << std::endl;
    330 #endif
    331                 return dir;
    332             }
    333 
    334             if (is_network_recovery_enable())
    335             {
    336                 int dir = recovery_route(xdest, ydest);
    337 
    338 #if SOCLIB_MODULE_DEBUG
    339                 std::cout << "<" << name() << "> network recovery: "
    340                           << "route request to DIR = " << dir << std::endl;
    341 #endif
    342                 return dir;
    343             }
    344         }
    345         return xfirst_route(xdest, ydest);
     305                return reallocation_route();
     306            }
     307        }
     308
     309        // use the recovery routing
     310        return recovery_route(dx, dy);
    346311    }
    347312
     
    349314    tmpl(int)::broadcast_route(int step, int source, sc_uint<flit_width> data)
    350315    {
    351         const size_t lx   = m_local_x;
    352         const size_t ly   = m_local_y;
     316        const size_t lx = m_local_x;
     317        const size_t ly = m_local_y;
    353318        const size_t xmin = (data >> (flit_width - 5 )) & 0x1F;
    354319        const size_t xmax = (data >> (flit_width - 10)) & 0x1F;
    355320        const size_t ymin = (data >> (flit_width - 15)) & 0x1F;
    356321        const size_t ymax = (data >> (flit_width - 20)) & 0x1F;
    357         const int    bh   = blackhole_position();
    358 
    359         int  sel = REQ_NOP;
    360         bool special = ((data & 0x2) != 0);
    361 
     322
     323        int bhpos = NORMAL;
     324        bool recovery = false;
     325        if (is_reconfigurable()) {
     326            bhpos    = blackhole_position();
     327            recovery = is_recovery_routing_enabled();
     328        }
     329
     330        const bool is_n  = recovery and (bhpos == N_OF_X);
     331        const bool is_s  = recovery and (bhpos == S_OF_X);
     332        const bool is_w  = recovery and (bhpos == W_OF_X);
     333        const bool is_e  = recovery and (bhpos == E_OF_X);
     334        const bool is_nw = recovery and (bhpos == NW_OF_X);
     335        const bool is_ne = recovery and (bhpos == NE_OF_X);
     336        const bool is_sw = recovery and (bhpos == SW_OF_X);
     337        const bool is_se = recovery and (bhpos == SE_OF_X);
     338
     339        const bool special = ((data & 0x2) != 0) and recovery;
     340
     341        int sel = REQ_NOP;
    362342        switch(source) {
    363343        case REQ_LOCAL :
     
    365345            else if ( step == 2 ) sel = REQ_SOUTH;
    366346            else if ( step == 3 ) {
    367                 if ( (bh == BH_N) && (lx != 0) && (ly != 1) ) {
     347                if ( is_n && (lx != 0) && (ly != 1) )
    368348                    sel = REQ_NOP;
    369                     break;
    370                 }
    371                 sel = REQ_EAST;
     349                else
     350                    sel = REQ_EAST;
    372351            }
    373352            else if ( step == 4 ) {
    374                 if ( (bh == BH_NE) && (lx != 1) && (ly != 1) ) {
     353                if ( is_ne && (lx != 1) && (ly != 1) )
    375354                    sel = REQ_NOP;
    376                     break;
    377                 }
    378                 sel = REQ_WEST;
     355                else
     356                    sel = REQ_WEST;
    379357            }
    380358        break;
     
    383361            else if ( step == 2 ) sel = REQ_LOCAL;
    384362            else if ( step == 3 ) {
    385                 if ( bh == BH_SW ) {
     363                if ( is_sw )
    386364                    sel = REQ_EAST;
    387                     break;
    388                 }
    389                 sel = REQ_NOP;
     365                else
     366                    sel = REQ_NOP;
    390367            }
    391368            else if ( step == 4 ) {
    392                 if ( (bh == BH_SE) && (!special || (lx == 1))) {
     369                if ( is_se && (!special || (lx == 1)))
    393370                    sel = REQ_WEST;
    394                     break;
    395                 }
    396                 sel = REQ_NOP;
     371                else
     372                    sel = REQ_NOP;
    397373            }
    398374        break;
     
    401377            else if ( step == 2 ) sel = REQ_LOCAL;
    402378            else if ( step == 3 ) {
    403                 if ( bh == BH_NW ) {
     379                if ( is_nw )
    404380                    sel = REQ_EAST;
    405                     break;
    406                 }
    407                 if ( (bh == BH_NE) && ((lx == 1) || (ly == 1)) ) {
     381                else if ( is_ne && ((lx == 1) || (ly == 1)) )
    408382                    sel = REQ_WEST;
    409                     break;
    410                 }
    411                 sel = REQ_NOP;
     383                else
     384                    sel = REQ_NOP;
    412385            }
    413386            else if ( step == 4 ) sel = REQ_NOP;
     
    415388        case REQ_EAST :
    416389            if ( step == 1 ) {
    417                 if ( (bh == BH_NE) && (lx != 1) && (ly != 1) ) {
     390                if ( is_ne && (lx != 1) && (ly != 1) )
    418391                    sel = REQ_NOP;
    419                     break;
    420                 }
    421                 sel = REQ_WEST;
     392                else
     393                    sel = REQ_WEST;
    422394            }
    423395            else if ( step == 2 ) sel = REQ_NORTH;
     
    427399        case REQ_WEST :
    428400            if ( step == 1 ) {
    429                 if ( (bh == BH_N) && (ly != 1) ) {
     401                if ( is_n && (ly != 1) )
    430402                    sel = REQ_NOP;
    431                     break;
    432                 }
    433                 if ( (bh == BH_S) && special ) {
     403                else if ( is_s && special )
    434404                    sel = REQ_NOP;
    435                     break;
    436                 }
    437                 sel = REQ_EAST;
     405                else
     406                    sel = REQ_EAST;
    438407            }
    439408            else if ( step == 2 ) sel = REQ_NORTH;
     
    443412        }
    444413
    445         if      ( (sel == REQ_NORTH) && !(ly < ymax) ) sel = REQ_NOP;
    446         else if ( (sel == REQ_SOUTH) && !(ly > ymin) ) sel = REQ_NOP;
    447         else if ( (sel == REQ_EAST ) && !(lx < xmax) ) sel = REQ_NOP;
    448         else if ( (sel == REQ_WEST ) && !(lx > xmin) ) sel = REQ_NOP;
    449 
    450 #if 0
    451         /* This code can be used if we want to inhibit requests to the
    452          * blackhole. However, it is not strictly necessary because the
    453          * blackhole will consume the request and will do nothing with it */
    454 
    455         if      ( (sel == REQ_NORTH) && (bh == BH_S) ) sel = REQ_NOP;
    456         else if ( (sel == REQ_SOUTH) && (bh == BH_N) ) sel = REQ_NOP;
    457         else if ( (sel == REQ_EAST ) && (bh == BH_W) ) sel = REQ_NOP;
    458         else if ( (sel == REQ_WEST ) && (bh == BH_E) ) sel = REQ_NOP;
    459 #endif
     414        // inhibit requests to the blackhole or beyond the mesh boundaries.
     415        if      ( (sel == REQ_NORTH) && (!(ly < ymax) || is_s)) sel = REQ_NOP;
     416        else if ( (sel == REQ_SOUTH) && (!(ly > ymin) || is_n)) sel = REQ_NOP;
     417        else if ( (sel == REQ_EAST ) && (!(lx < xmax) || is_w)) sel = REQ_NOP;
     418        else if ( (sel == REQ_WEST ) && (!(lx > xmin) || is_e)) sel = REQ_NOP;
    460419
    461420        return sel;
     
    469428
    470429    /////////////////////////////////////////////////////////
    471     tmpl(sc_uint<flit_width>)::compute_broadcast_header(int source)
    472     {
    473         const int bh = blackhole_position();
    474         sc_uint<flit_width> header = r_fifo_in[source].read().data;
    475         sc_uint<flit_width> special = 0x2;
     430    tmpl(typename DspinRouter<flit_width>::internal_flit_t)::
     431    compute_broadcast_header(int source)
     432    {
     433        const int bhpos = blackhole_position();
     434
     435        const int is_nw = (bhpos == NW_OF_X);
     436        const int is_ne = (bhpos == NE_OF_X);
     437
     438        internal_flit_t header;
     439        header.eop = false;
     440        header.data = r_fifo_in[source].read().data;
     441
     442        const int SPECIAL = 0x2;
    476443        switch (source) {
    477444            case REQ_NORTH:
    478                 if ( (bh == BH_NW) || (bh == BH_NE) ) {
    479                     header |= special;
    480                 }
     445                if ( is_nw || is_ne ) header.data |= SPECIAL;
    481446                break;
    482447
     
    484449             * network with the special bit set. This can arrive if an initiator
    485450             * or a local interconnect uses the broadcast header reserved bits
    486              * internally and don't reset them */
     451             * internally */
    487452            case REQ_LOCAL:
    488                 header &= ~special;
     453                header.data &= ~SPECIAL;
    489454                break;
    490455        }
     
    521486        const char* bh_str[] =
    522487        {
    523             "BH_NONE",
    524             "BH_N",
    525             "BH_NE",
    526             "BH_E",
    527             "BH_SE",
    528             "BH_S",
    529             "BH_SW",
    530             "BH_W",
    531             "BH_NW"
     488            "N_OF_X",
     489            "NE_OF_X",
     490            "E_OF_X",
     491            "SE_OF_X",
     492            "S_OF_X",
     493            "SW_OF_X",
     494            "W_OF_X",
     495            "NW_OF_X"
    532496        };
    533497
    534498        std::cout << "DSPIN_ROUTER " << name();
    535         std::cout << " / bh = " << bh_str[blackhole_position()];
     499
     500        if ( is_reconfigurable() ) {
     501            std::cout << " / bh = " << bh_str[blackhole_position()];
     502            if (is_recovery_routing_enabled())
     503                std::cout << " / recovery_routing ";
     504            if (is_reallocation_enabled())
     505                std::cout << " / reallocation dir = "
     506                          << port_name[reallocation_route()];
     507        }
     508
    536509
    537510        for( size_t i = 0 ; i < 5 ; i++)  // loop on input ports
     
    640613                            {
    641614                                std::cout << "ERROR in DSPIN_ROUTER " << name()
    642                                           << " : broadcast packet must be 2 flits" << std::endl;
     615                                          << " : broadcast packet must be 2 flits"
     616                                          << std::endl;
    643617                                exit(1);
    644618                            }
    645619
    646                             internal_flit_t header;
    647                             header.eop  = false;
    648                             header.data = compute_broadcast_header(i);
     620                            const internal_flit_t& header = compute_broadcast_header(i);
    649621
    650622                            fifo_in_read[i] = true;
     
    652624                            r_buf_in[i]     = header;
    653625                            r_index_in[i]   = req_in[i];
    654                             if( req_in[i] == REQ_NOP ) r_fsm_in[i] = INFSM_REQ_SECOND;
    655                             else                       r_fsm_in[i] = INFSM_REQ_FIRST;
     626                            if ( req_in[i] == REQ_NOP ) r_fsm_in[i] = INFSM_REQ_SECOND;
     627                            else                        r_fsm_in[i] = INFSM_REQ_FIRST;
    656628                        }
    657629                        else                                  // unicast
  • 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
  • branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/Makefile

    r934 r1016  
    7070
    7171mkconfig $(SIMULATOR) $(CONF): $(PLATFORM)/scripts/onerun.py
    72         ./$< -o $(CONFDIR) -p $(PLATFORM) -x3 -y3 -n1 -c
     72        ./$< -o $(CONFDIR) -p $(PLATFORM) -x3 -y3 -n1 -f -c
    7373
    7474$(BUILD_DIR):
  • branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/main.c

    r947 r1016  
    2525    /* configure the routers around the blackhole (1, 1) to define a cycle-free
    2626     * contour */
    27     const int PATH_RECOVERY = 1;
     27    const int RECOVERY = 1;
    2828    uint32_t val;
    2929
    3030    printf("router(0, 2): configuring as NW\n");
    31     assert(xcu_get_register(0, 2, XICU_CFG_REG, 0) == BH_NONE);
    32     val = (PATH_RECOVERY << 7) | (REQ_SOUTH << 4) | BH_NW;
     31    val = (REQ_SOUTH << 5) | (RECOVERY << 4) | NW_OF_X;
    3332    xcu_set_register(0, 2, XICU_CFG_REG, 0, val);     /* configure NW */
    3433
    3534    printf("router(0, 1): configuring as W\n");
    36     assert(xcu_get_register(0, 1, XICU_CFG_REG, 0) == BH_NONE);
    37     val = (PATH_RECOVERY << 7) | (REQ_LOCAL << 4) | BH_W;
     35    val = (REQ_LOCAL << 5) | (RECOVERY << 4) | W_OF_X;
    3836    xcu_set_register(0, 1, XICU_CFG_REG, 0, val);     /* configure W */
    3937
    4038    printf("router(0, 0): configuring as SW\n");
    41     assert(xcu_get_register(0, 0, XICU_CFG_REG, 0) == BH_NONE);
    42     val = (PATH_RECOVERY << 7) | (REQ_NORTH << 4) | BH_SW;
     39    val = (REQ_NORTH << 5) | (RECOVERY << 4) | SW_OF_X;
    4340    xcu_set_register(0, 0, XICU_CFG_REG, 0, val);     /* configure SW */
    4441
    4542    printf("router(1, 2): configuring as N\n");
    46     assert(xcu_get_register(1, 2, XICU_CFG_REG, 0) == BH_NONE);
    47     val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_N;
     43    val = (REQ_WEST << 5) | (RECOVERY << 4) | N_OF_X;
    4844    xcu_set_register(1, 2, XICU_CFG_REG, 0, val);     /* configure N */
    4945
    5046    printf("router(2, 2): configuring as NE\n");
    51     assert(xcu_get_register(2, 2, XICU_CFG_REG, 0) == BH_NONE);
    52     val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_NE;
     47    val = (REQ_WEST << 5) | (RECOVERY << 4) | NE_OF_X;
    5348    xcu_set_register(2, 2, XICU_CFG_REG, 0, val);     /* configure NE */
    5449
    5550    printf("router(2, 1): configuring as E\n");
    56     assert(xcu_get_register(2, 1, XICU_CFG_REG, 0) == BH_NONE);
    57     val = (PATH_RECOVERY << 7) | (REQ_SOUTH << 4) | BH_E;
     51    val = (REQ_SOUTH << 5) | (RECOVERY << 4) | E_OF_X;
    5852    xcu_set_register(2, 1, XICU_CFG_REG, 0, val);     /* configure E */
    5953
    6054    printf("router(2, 0): configuring as SE\n");
    61     assert(xcu_get_register(2, 0, XICU_CFG_REG, 0) == BH_NONE);
    62     val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_SE;
     55    val = (REQ_WEST << 5) | (RECOVERY << 4) | SE_OF_X;
    6356    xcu_set_register(2, 0, XICU_CFG_REG, 0, val);     /* configure SE */
    6457
    6558    printf("router(1, 0): configuring as S\n");
    66     assert(xcu_get_register(1, 0, XICU_CFG_REG, 0) == BH_NONE);
    67     val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_S;
     59    val = (REQ_WEST << 5) | (RECOVERY << 4) | S_OF_X;
    6860    xcu_set_register(1, 0, XICU_CFG_REG, 0, val);     /* configure S */
    6961
    70     assert((xcu_get_register(0, 2, XICU_CFG_REG, 0) & 0xF) == BH_NW);
    71     assert((xcu_get_register(0, 1, XICU_CFG_REG, 0) & 0xF) == BH_W);
    72     assert((xcu_get_register(0, 0, XICU_CFG_REG, 0) & 0xF) == BH_SW);
    73     assert((xcu_get_register(1, 2, XICU_CFG_REG, 0) & 0xF) == BH_N);
    74     assert((xcu_get_register(2, 2, XICU_CFG_REG, 0) & 0xF) == BH_NE);
    75     assert((xcu_get_register(2, 1, XICU_CFG_REG, 0) & 0xF) == BH_E);
    76     assert((xcu_get_register(2, 0, XICU_CFG_REG, 0) & 0xF) == BH_SE);
    77     assert((xcu_get_register(1, 0, XICU_CFG_REG, 0) & 0xF) == BH_S);
     62    assert((xcu_get_register(0, 2, XICU_CFG_REG, 0) & 0xF) == NW_OF_X);
     63    assert((xcu_get_register(0, 1, XICU_CFG_REG, 0) & 0xF) == W_OF_X);
     64    assert((xcu_get_register(0, 0, XICU_CFG_REG, 0) & 0xF) == SW_OF_X);
     65    assert((xcu_get_register(1, 2, XICU_CFG_REG, 0) & 0xF) == N_OF_X);
     66    assert((xcu_get_register(2, 2, XICU_CFG_REG, 0) & 0xF) == NE_OF_X);
     67    assert((xcu_get_register(2, 1, XICU_CFG_REG, 0) & 0xF) == E_OF_X);
     68    assert((xcu_get_register(2, 0, XICU_CFG_REG, 0) & 0xF) == SE_OF_X);
     69    assert((xcu_get_register(1, 0, XICU_CFG_REG, 0) & 0xF) == S_OF_X);
    7870
    7971    /* Test the recovered segment that has been migrated to the EAST cluster */
  • branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/reset.S

    r934 r1016  
    2121#define Y_MASK ((1<<Y_WIDTH)-1)
    2222
     23#define XCU_REG(func, idx) ((((func)<<5)|(idx)) << 2)
     24#define XCU_CFG_REG 17
     25#define XCU_BARRIER 5
     26
     27#define MEMC_REG(func,idx) (((func<<7)|idx) << 2)
     28#define MEMC_CONFIG 0
     29#define MEMC_SCRATCHPAD 4
     30
    2331reset:
    2432    .set noreorder
     
    3341
    3442    /*
    35      * All processors compute:
    36      *   cid = (x * Y_SIZE) + y
    37      *   pid = (cid * NB_PROCS_MAX) + lpid
     43     * Get processor ID
    3844     */
    3945    mfc0   k0,  CP0_PROCID
    40     andi   k0,  k0,  0xFFF             /* k0 <= proc_xyl                 */
     46    andi   k0,  k0,  0xFFF             /* k0 <= proc_xyl                     */
    4147
    42     /* Only the processor 0 continues the execution                      */
     48    /*
     49     * Release local gateway hardware barrier
     50     */
     51    la     k1,     SEG_XCU_BASE        /* k1 <= ICU base address             */
     52    li     t0,     XCU_REG(XCU_CFG_REG, XCU_BARRIER)
     53    or     k1,     k1,     t0          /* k1 <= &XICU[CFG_REG][BARRIER]      */
     54    li     t0,     0xFFFFFFFF
     55    sw     t0,     0(k1)
     56
     57    /*
     58     * Disable the scratchpad mode on the local memory cache
     59     */
     60    la     k1,     SEG_MMC_BASE        /* k1 <= MMC base address             */
     61    li     t0,     MEMC_REG(MEMC_CONFIG, MEMC_SCRATCHPAD)
     62    or     k1,     k1,     t0          /* k1 <= &MEMC[CONFIG][SCRATCHPAD]    */
     63    sw     zero,   0(k1)
     64
     65    /* Only the processor 0 continues the execution                          */
    4366    beqz   k0,  1f
    4467    nop
     
    47701:  /* processor 0 initializes stack pointer (16K) */
    4871    la     sp,  _stack
    49     addiu  sp,  sp,  (1<<14)           /* sp <= _stack + 16K             */
     72    addiu  sp,  sp,  (1<<14)           /* sp <= _stack + 16K                 */
    5073
    5174    /* jumps to main in kernel mode */
  • branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/test.sh

    r942 r1016  
    1313PLATFORM=../../../../../platforms/tsar_generic_iob
    1414SIMULATOR=$PLATFORM/simul.x
    15 $SIMULATOR -DSOFT $SOFT -DISK /dev/null -FAULTY_ROUTER 0 1 1 > output/log 2>&1
     15$SIMULATOR -DSOFT $SOFT \
     16           -DISK /dev/null \
     17           -FAULTY_ROUTER 0 1 1 \
     18           -NCYCLES 20000 > output/log 2>&1
     19#          -PROCID 0 \
     20#          -MEMCID 0x1 \
     21#          -DEBUG 3000 \
     22
    1623soclib-cleanup-terms &> /dev/null
    1724mv term0 output/term
    1825grep -q "success" output/term
    1926if [ $? == 0 ];
    20         then echo $(basename $PWD) ": Success";
    21         else echo $(basename $PWD) ": Failure";
     27    then echo $(basename $PWD) ": Success";
     28    else echo $(basename $PWD) ": Failure";
    2229fi;
  • branches/reconfiguration/modules/dspin_router/caba/test/synthetic_test/top.cpp

    r998 r1016  
    4444}
    4545
    46 static inline uint32_t configRouter(int bypass_mode,
    47                                     int reallocation_dir,
     46static inline uint32_t configRouter(int reallocation_dir,
     47                                    int recovery_mode,
    4848                                    int blackhole_pos)
    4949{
    50     return (bypass_mode << 7) | (reallocation_dir << 4) | blackhole_pos;
     50    return ((reallocation_dir & 0x7) << 5) |
     51           ((recovery_mode    & 0x1) << 4) |
     52           (blackhole_pos     & 0xF);
    5153}
    5254
     
    295297
    296298    /* initialize the configuration signals */
    297     sConfigNONE.write(configRouter(0, REQ_NOP, BH_NONE));
    298     sConfigN.write(configRouter(1, REQ_SOUTH, BH_N));
    299     sConfigNE.write(configRouter(1, REQ_WEST, BH_NE));
    300     sConfigE.write(configRouter(1, REQ_WEST, BH_E));
    301     sConfigSE.write(configRouter(1, REQ_WEST, BH_SE));
    302     sConfigS.write(configRouter(1, REQ_NORTH, BH_S));
    303     sConfigSW.write(configRouter(1, REQ_EAST, BH_SW));
    304     sConfigW.write(configRouter(1, REQ_EAST, BH_W));
    305     sConfigNW.write(configRouter(1, REQ_EAST, BH_NW));
     299    sConfigNONE.write(configRouter(0, 0, NORMAL));
     300
     301    // requests to the deactivated segment are dropped
     302    sConfigN.write(configRouter(REQ_SOUTH, 1, N_OF_X));
     303    sConfigNE.write(configRouter(REQ_WEST, 1, NE_OF_X));
     304    sConfigE.write(configRouter(REQ_WEST, 1, E_OF_X));
     305    sConfigSE.write(configRouter(REQ_WEST, 1, SE_OF_X));
     306    sConfigS.write(configRouter(REQ_NORTH, 1, S_OF_X));
     307    sConfigSW.write(configRouter(REQ_EAST, 1, SW_OF_X));
     308    sConfigW.write(configRouter(REQ_EAST, 1, W_OF_X));
     309    sConfigNW.write(configRouter(REQ_EAST, 1, NW_OF_X));
    306310
    307311    /* initialize mesh boundary signals */
  • branches/reconfiguration/modules/dspin_router/include/soclib/dspin_router_config.h

    r934 r1016  
    3030enum
    3131{
    32     REQ_NORTH   = 0,
    33     REQ_SOUTH   = 1,
    34     REQ_EAST    = 2,
    35     REQ_WEST    = 3,
    36     REQ_LOCAL   = 4,
    37     REQ_NOP     = 5,
     32    REQ_NORTH = 0,
     33    REQ_SOUTH = 1,
     34    REQ_EAST = 2,
     35    REQ_WEST = 3,
     36    REQ_LOCAL = 4,
     37    REQ_NOP = 5,
    3838};
    3939
     
    4141enum
    4242{
    43     BH_NONE = 0,
    44     BH_N = 1,
    45     BH_NE = 2,
    46     BH_E = 3,
    47     BH_SE = 4,
    48     BH_S = 5,
    49     BH_SW = 6,
    50     BH_W = 7,
    51     BH_NW = 8
     43    NORMAL = 0,
     44    N_OF_X = 1,
     45    NE_OF_X = 2,
     46    E_OF_X = 3,
     47    SE_OF_X = 4,
     48    S_OF_X = 5,
     49    SW_OF_X = 6,
     50    W_OF_X = 7,
     51    NW_OF_X = 8
    5252};
    5353
Note: See TracChangeset for help on using the changeset viewer.