Changeset 947 for branches/reconfiguration/modules
- Timestamp:
- Feb 15, 2015, 8:44:35 PM (10 years ago)
- Location:
- branches/reconfiguration/modules/dspin_router/caba
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/reconfiguration/modules/dspin_router/caba/source/include/dspin_router.h
r934 r947 141 141 142 142 // fault-recovery methods 143 bool need_reroute( size_t xdest, size_t ydest, int bhpos );143 bool is_destination_blackhole( size_t xdest, size_t ydest, int bhpos ); 144 144 int recovery_route( size_t xdest, size_t ydest ); 145 145 … … 149 149 { 150 150 m_disable_mask = mask; 151 } 152 153 inline bool is_network_recovery_enable() 154 { 155 return (((p_recovery_cfg->read() >> 7) & 0x1) != 0); 156 } 157 158 inline int migration_route() 159 { 160 return ((p_recovery_cfg->read() >> 4) & 0x7); 161 } 162 163 inline int blackhole_position() 164 { 165 return (p_recovery_cfg->read() & 0xF); 151 166 } 152 167 -
branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp
r934 r947 138 138 { 139 139 if (p_recovery_cfg == NULL) { 140 p_recovery_cfg = new sc_core::sc_in<uint32_t> ;140 p_recovery_cfg = new sc_core::sc_in<uint32_t> ("p_recovery_cfg"); 141 141 } 142 142 (*p_recovery_cfg)(s); … … 144 144 145 145 /////////////////////////////////////////////////// 146 tmpl(bool):: need_reroute( size_t xdest, size_t ydest, int bhpos )146 tmpl(bool)::is_destination_blackhole( size_t xdest, size_t ydest, int bhpos ) 147 147 { 148 148 size_t xhole, yhole; … … 189 189 tmpl(int)::recovery_route( size_t xdest, size_t ydest ) 190 190 { 191 int bhpos = p_recovery_cfg->read() & 0xF; 192 193 // reroute the request if its destination is the blackhole (this is to 194 // implement the segment recovery mechanism) 195 if (need_reroute(xdest, ydest, bhpos)) { 196 int recovery_direction = (p_recovery_cfg->read() >> 4) & 0xF; 197 198 #if SOCLIB_MODULE_DEBUG 199 std::cout << "<" << name() << "> reroute request to DIR = " 200 << recovery_direction << std::endl; 201 #endif 202 203 return recovery_direction; 204 } 191 int bhpos = blackhole_position(); 205 192 206 193 if ( xdest > m_local_x ) { … … 315 302 if ( p_recovery_cfg != NULL ) 316 303 { 317 if ( (p_recovery_cfg->read() & 0xF) != BH_NONE ) 318 { 319 return recovery_route(xdest, ydest); 304 if (blackhole_position() != BH_NONE ) 305 { 306 // reroute the request if its destination is the blackhole (this 307 // is to implement the segment recovery mechanism) 308 if (is_destination_blackhole(xdest, ydest, blackhole_position())) 309 { 310 int dir = migration_route(); 311 312 #if SOCLIB_MODULE_DEBUG 313 std::cout << "<" << name() << "> migration: " 314 << "route request to DIR = " << dir << std::endl; 315 #endif 316 return dir; 317 } 318 319 if (is_network_recovery_enable()) 320 { 321 int dir = recovery_route(xdest, ydest); 322 323 #if SOCLIB_MODULE_DEBUG 324 std::cout << "<" << name() << "> network recovery: " 325 << "route request to DIR = " << dir << std::endl; 326 #endif 327 return dir; 328 } 320 329 } 321 330 } -
branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/main.c
r942 r947 25 25 /* configure the routers around the blackhole (1, 1) to define a cycle-free 26 26 * contour */ 27 const int PATH_RECOVERY = 1; 27 28 uint32_t val; 28 29 29 30 printf("router(0, 2): configuring as NW\n"); 30 31 assert(xcu_get_register(0, 2, XICU_CFG_REG, 0) == BH_NONE); 31 val = ( REQ_SOUTH << 4) | BH_NW;32 val = (PATH_RECOVERY << 7) | (REQ_SOUTH << 4) | BH_NW; 32 33 xcu_set_register(0, 2, XICU_CFG_REG, 0, val); /* configure NW */ 33 34 34 35 printf("router(0, 1): configuring as W\n"); 35 36 assert(xcu_get_register(0, 1, XICU_CFG_REG, 0) == BH_NONE); 36 val = ( REQ_LOCAL << 4) | BH_W;37 val = (PATH_RECOVERY << 7) | (REQ_LOCAL << 4) | BH_W; 37 38 xcu_set_register(0, 1, XICU_CFG_REG, 0, val); /* configure W */ 38 39 39 40 printf("router(0, 0): configuring as SW\n"); 40 41 assert(xcu_get_register(0, 0, XICU_CFG_REG, 0) == BH_NONE); 41 val = ( REQ_NORTH << 4) | BH_SW;42 val = (PATH_RECOVERY << 7) | (REQ_NORTH << 4) | BH_SW; 42 43 xcu_set_register(0, 0, XICU_CFG_REG, 0, val); /* configure SW */ 43 44 44 45 printf("router(1, 2): configuring as N\n"); 45 46 assert(xcu_get_register(1, 2, XICU_CFG_REG, 0) == BH_NONE); 46 val = ( REQ_WEST << 4) | BH_N;47 val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_N; 47 48 xcu_set_register(1, 2, XICU_CFG_REG, 0, val); /* configure N */ 48 49 49 50 printf("router(2, 2): configuring as NE\n"); 50 51 assert(xcu_get_register(2, 2, XICU_CFG_REG, 0) == BH_NONE); 51 val = ( REQ_WEST << 4) | BH_NE;52 val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_NE; 52 53 xcu_set_register(2, 2, XICU_CFG_REG, 0, val); /* configure NE */ 53 54 54 55 printf("router(2, 1): configuring as E\n"); 55 56 assert(xcu_get_register(2, 1, XICU_CFG_REG, 0) == BH_NONE); 56 val = ( REQ_SOUTH << 4) | BH_E;57 val = (PATH_RECOVERY << 7) | (REQ_SOUTH << 4) | BH_E; 57 58 xcu_set_register(2, 1, XICU_CFG_REG, 0, val); /* configure E */ 58 59 59 60 printf("router(2, 0): configuring as SE\n"); 60 61 assert(xcu_get_register(2, 0, XICU_CFG_REG, 0) == BH_NONE); 61 val = ( REQ_WEST << 4) | BH_SE;62 val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_SE; 62 63 xcu_set_register(2, 0, XICU_CFG_REG, 0, val); /* configure SE */ 63 64 64 65 printf("router(1, 0): configuring as S\n"); 65 66 assert(xcu_get_register(1, 0, XICU_CFG_REG, 0) == BH_NONE); 66 val = ( REQ_WEST << 4) | BH_S;67 val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_S; 67 68 xcu_set_register(1, 0, XICU_CFG_REG, 0, val); /* configure S */ 68 69
Note: See TracChangeset
for help on using the changeset viewer.