Changeset 1001 for branches/reconfiguration/modules/vci_local_crossbar/caba
- Timestamp:
- Jun 16, 2015, 9:24:36 PM (10 years ago)
- Location:
- branches/reconfiguration/modules/vci_local_crossbar/caba/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/reconfiguration/modules/vci_local_crossbar/caba/source/include/vci_local_crossbar.h
r932 r1001 56 56 sc_in<bool> p_resetn; 57 57 58 sc_in<uint32_t> *p_barrier_enable; 59 58 60 VciInitiator<vci_param> *p_to_target; 59 61 VciTarget<vci_param> *p_to_initiator; … … 92 94 const size_t nb_attached_initiators, 93 95 const size_t nb_attached_targets, 94 const size_t default_target_id ); 96 const size_t default_target_id, 97 const bool hardware_barrier = false ); 95 98 ~VciLocalCrossbar(); 96 99 }; -
branches/reconfiguration/modules/vci_local_crossbar/caba/source/src/vci_local_crossbar.cpp
r933 r1001 78 78 const void* m_lt; // locality table if cmd / id_locality table if rsp 79 79 const bool m_is_cmd; // cmd crossbar when true 80 bool m_barrier; // barrier in the global interface is enabled 80 81 81 82 sc_signal<bool>* r_allocated; // for each output port: allocation state … … 97 98 m_rt( rt ), 98 99 m_lt( lt ), 99 m_is_cmd( is_cmd ) 100 m_is_cmd( is_cmd ), 101 m_barrier( false ) 100 102 { 101 103 r_allocated = new sc_signal<bool>[out_size]; … … 104 106 r_bc_count = new sc_signal<size_t>[in_size]; 105 107 } // end constructor 108 109 ////////////////////////////////// 110 void setBarrier(const bool &value) 111 { 112 m_barrier = value; 113 } 106 114 107 115 //////////// … … 147 155 } 148 156 } 157 std::cout << " / barrier enable = " << m_barrier; 149 158 } // end print_trace() 150 159 … … 190 199 for( size_t in = 0 ; in < m_in_size ; in++ ) 191 200 { 192 if ( input_port[in]->getVal() ) 201 /* drop global-to-local packets when the barrier is enabled */ 202 bool write = input_port[in]->getVal(); 203 if ( in == (m_in_size - 1) ) 204 write = write && !m_barrier; 205 206 if ( write ) 193 207 { 194 208 if ( r_bc_state[in].read() ) // pending broadcast … … 237 251 { 238 252 size_t in = (_in + r_origin[out] + 1) % m_in_size; 239 if ( input_port[in]->getVal() ) 253 254 /* drop global-to-local packets when the barrier is enabled */ 255 bool write = input_port[in]->getVal(); 256 if ( in == (m_in_size - 1) ) 257 write = write && !m_barrier; 258 259 if ( write ) 240 260 { 241 261 pkt_t tmp; … … 285 305 pkt_t tmp; 286 306 tmp.readFrom(*input_port[in]); 307 308 // if the hardware barrier is activated, drop all 309 // local-to-global packets. This is done by consuming every 310 // incoming packet (send the acknowledgement to the input port) 311 // and resetting the cmdval signal to the upper network level. 312 bool read = output_port[out]->getAck(); 313 if (out == (m_out_size - 1)) { 314 read = read || m_barrier; 315 tmp.set_val(tmp.val() && !m_barrier); 316 } 317 318 ack[in] = read; 287 319 tmp.writeTo(*output_port[out]); 288 ack[in] = output_port[out]->getAck(); 320 289 321 if ( r_bc_state[in].read() ) // its a broacast 290 322 { … … 299 331 } 300 332 } 333 // Drop all global-to-local packets when the hardware barrier is enabled 334 ack[m_in_size - 1] = ack[m_in_size - 1] || m_barrier; 301 335 302 336 // Send acknowledges on input ports … … 313 347 std::cout << "LOCAL_CROSSBAR " << name() << " / "; 314 348 m_cmd_crossbar->print_trace(); 315 m_rsp_crossbar->print_trace(); 349 std::cout << " / "; 350 m_rsp_crossbar->print_trace(); 316 351 std::cout << std::endl; 317 352 } … … 327 362 } 328 363 364 if (p_barrier_enable != NULL) 365 { 366 const bool enable = (p_barrier_enable->read() != 0xFFFFFFFF); 367 m_cmd_crossbar->setBarrier(enable); 368 m_rsp_crossbar->setBarrier(enable); 369 } 329 370 m_cmd_crossbar->transition( m_ports_to_initiator, m_ports_to_target ); 330 371 m_rsp_crossbar->transition( m_ports_to_target, m_ports_to_initiator ); … … 344 385 const size_t nb_attached_initiators, 345 386 const size_t nb_attached_targets, 346 const size_t default_target_id ) 387 const size_t default_target_id, 388 const bool hardware_barrier ) 347 389 : BaseModule(name), 348 390 p_clk("clk"), … … 409 451 m_ports_to_target[i] = &p_to_target[i]; 410 452 m_ports_to_target[nb_attached_targets] = &p_initiator_to_up; 453 454 if (hardware_barrier) 455 p_barrier_enable = new sc_in<uint32_t>("p_barrier_enable"); 456 else 457 p_barrier_enable = NULL; 411 458 } 412 459
Note: See TracChangeset
for help on using the changeset viewer.