- Timestamp:
- Jan 27, 2015, 5:58:07 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/reconfiguration/modules/dspin_router/caba/source/src/dspin_router.cpp
r886 r931 60 60 const size_t in_fifo_depth, 61 61 const size_t out_fifo_depth, 62 const bool broadcast_supported, 63 const bool reconfigurable ) 62 const bool broadcast_supported) 64 63 : soclib::caba::BaseModule(name), 65 64 … … 117 116 } 118 117 119 if ( reconfigurable ) p_blackhole_pos = new sc_core::sc_in<uint32_t>; 120 else p_blackhole_pos = NULL; 118 p_recovery_cfg = NULL; 121 119 } // end constructor 122 120 … … 124 122 tmpl(/**/)::~DspinRouter() 125 123 { 126 if ( p_ blackhole_pos != NULL ) delete p_blackhole_pos;124 if ( p_recovery_cfg != NULL ) delete p_recovery_cfg; 127 125 } 128 126 … … 137 135 138 136 /////////////////////////////////////////////////// 137 tmpl(void)::bind_recovery_port( sc_core::sc_signal<uint32_t> &s ) 138 { 139 if (p_recovery_cfg == NULL) { 140 p_recovery_cfg = new sc_core::sc_in<uint32_t>; 141 } 142 (*p_recovery_cfg)(s); 143 } 144 145 /////////////////////////////////////////////////// 146 tmpl(bool)::need_reroute( size_t xdest, size_t ydest, int bhpos ) 147 { 148 size_t xhole, yhole; 149 if (bhpos == BH_N) { 150 xhole = m_local_x; 151 yhole = m_local_y - 1; 152 } 153 else if (bhpos == BH_NW) { 154 xhole = m_local_x + 1; 155 yhole = m_local_y - 1; 156 } 157 else if (bhpos == BH_W) { 158 xhole = m_local_x + 1; 159 yhole = m_local_y; 160 } 161 else if (bhpos == BH_SW) { 162 xhole = m_local_x + 1; 163 yhole = m_local_y + 1; 164 } 165 else if (bhpos == BH_S) { 166 xhole = m_local_x; 167 yhole = m_local_y + 1; 168 } 169 else if (bhpos == BH_SE) { 170 xhole = m_local_x - 1; 171 yhole = m_local_y + 1; 172 } 173 else if (bhpos == BH_E) { 174 xhole = m_local_x - 1; 175 yhole = m_local_y; 176 } 177 else if (bhpos == BH_NE) { 178 xhole = m_local_x - 1; 179 yhole = m_local_y - 1; 180 } 181 else { 182 return false; 183 } 184 185 return ((xdest == xhole) && (ydest == yhole)); 186 } 187 188 /////////////////////////////////////////////////// 139 189 tmpl(int)::recovery_route( size_t xdest, size_t ydest ) 140 190 { 141 int bhpos = p_blackhole_pos->read(); 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 return recovery_direction; 198 } 199 142 200 if ( xdest > m_local_x ) { 143 201 if ( (bhpos == BH_NE) || (bhpos == BH_E) || (bhpos == BH_SE) || … … 249 307 size_t xdest = (size_t)(data >> m_x_shift) & m_x_mask; 250 308 size_t ydest = (size_t)(data >> m_y_shift) & m_y_mask; 251 if ( p_ blackhole_pos!= NULL )252 { 253 if ( p_blackhole_pos->read() != BH_NONE )309 if ( p_recovery_cfg != NULL ) 310 { 311 if ( (p_recovery_cfg->read() & 0xF) != BH_NONE ) 254 312 { 255 313 return recovery_route(xdest, ydest);
Note: See TracChangeset
for help on using the changeset viewer.