- Timestamp:
- Jan 20, 2011, 5:37:52 PM (14 years ago)
- Location:
- trunk/modules/vci_synthetic_initator/caba/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_synthetic_initator/caba/sources/include/vci_synthetic_initiator.h
r128 r131 4 4 * Copyright : UPMC / LIP6 5 5 * Authors : Christophe Choichillon 6 * Version : 2. 06 * Version : 2.1 7 7 * 8 8 * SOCLIB_LGPL_HEADER_BEGIN … … 26 26 * SOCLIB_LGPL_HEADER_END 27 27 * 28 * Versions : 29 * - 1.0 Sending only one request at a time 30 * - 2.0 Sending multiple transactions and broadcast responses 31 * identified with pktid (deprecated) 32 * - 2.1 Broadcast responses identified with the value 0 of trdid 33 * 28 34 * Maintainers: christophe.choichillon@lip6.fr 29 35 */ … … 32 38 #define SOCLIB_CABA_SYNTHETIC_INITIATOR_H 33 39 40 #include <cassert> 34 41 #include <systemc> 35 42 #include <inttypes.h> … … 62 69 VCI_SINGLE_SEND, 63 70 VCI_BC_SEND, 71 VCI_SINGLE_REGISTER 64 72 }; 65 73 … … 140 148 141 149 // Broadcast FSM 142 sc_signal<bool> r_bc_fsm; // FSM state143 sc_signal<uint64_t> r_bc_date; // broadcast transaction requested date150 //sc_signal<bool> r_bc_fsm; // FSM state 151 //sc_signal<uint64_t> r_bc_date; // broadcast transaction requested date 144 152 sc_signal<uint32_t> r_bc_nrsp; // Expected number of responses for a broadcast command 145 153 -
trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp
r129 r131 5 5 * Copyright : UPMC / LIP6 6 6 * Authors : Christophe Choichillon 7 * Version : 2. 07 * Version : 2.1 8 8 * 9 9 * SOCLIB_LGPL_HEADER_BEGIN … … 81 81 m_ymin(ymin), 82 82 m_ymax(ymax), 83 r_date_fifo("r_date_fifo", depth), 84 r_type_fifo("r_type_fifo", depth), 85 r_cmd_fsm; ("r_count"), 86 r_bc_rsp_fsm("r_bc_rsp_fsm"), 87 r_index("r_index"), 88 r_broadcast_req("r_broadcast_req"), 89 r_broadcast_rsp("r_broadcast_rsp"), 90 r_bc_nrsp("r_bc_nrsp") 91 //r_req_id("r_req_id") 83 r_date_fifo("r_date_fifo", m_depth), 84 r_bc_fifo("r_bc_fifo", m_depth), 85 r_cmd_fsm("r_cmd_fsm"), 86 r_cmd_address("r_cmd_address"), 87 r_cmd_trdid("r_cmd_trdid"), 88 r_cmd_count("r_cmd_count"), 89 r_cmd_seed("r_cmd_seed"), 90 //r_bc_fsm("r_bc_fsm"), 91 //r_bc_date("r_bc_date"), 92 r_bc_nrsp("r_bc_nrsp"), 93 r_cpt_cycles("r_cpt_cycles"), 94 r_cpt_period("r_cpt_period"), 95 r_nb_single("r_nb_single"), 96 r_latency_single("r_latency_single"), 97 r_nb_bc("r_nb_bc"), 98 r_latency_bc("r_latency_bc") 92 99 { 93 100 94 r_req_id = new sc_signal<uint64_t>*[tab_size]; 95 for(int i = 0; i < tab_size ; i++){ 96 r_req_id[i] = new sc_signal<uint64_t>[2]; 97 } 101 r_pending_fsm = new sc_signal<bool>[m_tab_size]; 102 r_pending_date = new sc_signal<uint64_t>[m_tab_size]; 98 103 99 104 SC_METHOD(transition); … … 112 117 ///////////////////////////////// 113 118 { 114 for(int i = 0; i < tab_size ; i++){ 115 delete r_req_id[i]; 116 } 117 delete r_req_id; 119 delete r_pending_fsm; 120 delete r_pending_date; 118 121 } 119 122 … … 146 149 147 150 std::cout << "Vci_Synthetic_Initiator " << name() 148 << " : " << std::dec << m_cpt_cycles<< " cycles "151 << " : " << std::dec << r_cpt_cycles.read() << " cycles " 149 152 << " : state_cmd_fsm = " << state_cmd_str[r_cmd_fsm] 150 << " : state_rsp_fsm = " << state_bc_rsp_str[r_ bc_rsp_fsm]153 << " : state_rsp_fsm = " << state_bc_rsp_str[r_pending_fsm[0].read()] 151 154 << " Adresse to send : " << std::hex << r_cmd_address.read() 152 155 << " Number of broadcast to receive : " << std::dec << r_bc_nrsp.read() 153 << " Number of packets sent : " << std::dec << r_nb_single.read() << " " << r_ id_to_send.read() << std::endl;156 << " Number of packets sent : " << std::dec << r_nb_single.read() << " " << r_cmd_trdid.read() << std::endl; 154 157 for(int i = 0; i < (1<<vci_param::T) ; i++){ 155 std::cout << "ID : " << i << " " << (uint64_t)(r_ req_id[i][0].read()) << " " << (uint64_t)(r_req_id[i][1].read()) << std::endl;158 std::cout << "ID : " << i << " " << (uint64_t)(r_pending_date[i].read()) << std::endl; 156 159 } 157 160 } … … 161 164 ////////////////////////////////// 162 165 { 163 std::cout << name() << " : "<< std::dec << m_cpt_cycles << " cycles, " << r_nb_single.read() << " packets sent" << std::endl; 164 std::cout << ((double)r_latency1.read()/(double)r_nb_single.read()) << " | " << ((double)r_latency2.read()/(double)r_nb_single.read()) << std::endl; 166 std::cout << name() << " : "<< std::dec << r_cpt_cycles.read() << " cycles, " << r_nb_single.read() << " packets sent" << std::endl; 165 167 if(m_bc_period) 166 168 std::cout << ((double)r_latency_bc.read()/(double)r_nb_bc.read()) << std::endl; … … 182 184 // Initializing FSMs 183 185 r_cmd_fsm = VCI_IDLE; 184 r_bc_fsm = BC_RSP_IDLE;186 //r_bc_fsm = false; 185 187 for(size_t i=0 ; i<m_tab_size ; i++) r_pending_fsm[i] = false; 186 188 … … 216 218 if (r_date_fifo.rok()) 217 219 { 218 if ( r_bc_fifo ()= true ) // its a broadcast request220 if ( r_bc_fifo.read() == true ) // its a broadcast request 219 221 { 220 if ( r_ bc_fsm.read()= false ) // no current broadcast222 if ( r_pending_fsm[0].read() == false ) // no current broadcast 221 223 { 222 r_cmd_fsm = VCI_BC_SEND ;223 224 r_cmd_fsm = VCI_BC_SEND ; 225 r_cmd_address = 0x3 | (0x7c1f << vci_param::N-20) ; 224 226 } 225 227 } … … 227 229 { 228 230 int id = -1; 229 for(int i = 0; i < tab_size; i++){231 for(int i = 1; i < m_tab_size; i++){ // ID 0 reserved for broadcast transactions 230 232 if(r_pending_fsm[i].read() == false) 231 233 { … … 254 256 if ( p_vci.cmdack.read()) 255 257 { 256 r_c ount = r_count.read() + 1;258 r_cmd_count = r_cmd_count.read() + 1; 257 259 if (r_cmd_count.read() == m_length-1) 258 260 { … … 265 267 case VCI_SINGLE_REGISTER: 266 268 { 267 r_pending_date[r_cmd_trdid.read()] = (uint64_t)( m_date_fifo.read());269 r_pending_date[r_cmd_trdid.read()] = (uint64_t)(r_date_fifo.read()); 268 270 r_pending_fsm[r_cmd_trdid.read()] = true; 269 271 fifo_get = true; … … 274 276 if (p_vci.cmdack.read()) 275 277 { 276 r_bc_fsm = true;278 //r_bc_fsm = true; 277 279 r_bc_nrsp = (m_xmax - m_xmin) * (m_ymax - m_ymin) ; 278 r_bc_date = (uint64_t)(m_date_fifo.read()); 280 //r_bc_date = (uint64_t)(r_date_fifo.read()); 281 r_pending_fsm[0] = true; 282 r_pending_date[0] = (uint64_t)(r_date_fifo.read()); 279 283 fifo_get = true; 280 284 r_cmd_fsm = VCI_IDLE; … … 287 291 // BC_FSM 288 292 ///////////////////// 289 if ( r_bc_fsm.read() && p_vci.rspval.read() ) 290 { 291 if ( p_vci.rpktid.read() == 1 ) r_bc_nrsp = r_bc_nrsp.read() - 1; 292 if (r_bc_nrsp == 1) 293 { 294 r_bc_fsm = false; 295 r_latency_bc = r_latency_bc.read() + (r_cpt_cycle.read() - r_bc_date.read()); 296 } 297 } 293 //if ( r_pending_fsm[0].read() && p_vci.rspval.read() ) 294 //{ 295 // if ( p_vci.rtrdid.read() == 0 ) r_bc_nrsp = r_bc_nrsp.read() - 1; 296 // if (r_bc_nrsp.read() == 1) 297 // { 298 // //r_bc_fsm = false; 299 // r_pending_fsm[0] = false ; 300 // r_latency_bc = r_latency_bc.read() + (r_cpt_cycles.read() - r_pending_date[0].read()); 301 // } 302 //} 298 303 299 304 /////////////////// 300 305 // PENDING FSMs 301 306 ////////////////// 302 if(p_vci.rspval.read()) i307 if(p_vci.rspval.read()) 303 308 { 304 if((int)(p_vci.pktid.read()) == 0) // not a broadcast 309 if(p_vci.rtrdid.read() == 0) // not a broadcast 310 { 311 assert( ( r_pending_fsm[0].read() == true ) && 312 "illegal broadcast response received"); 313 r_bc_nrsp = r_bc_nrsp.read() - 1 ; 314 if(r_bc_nrsp.read() == 1) 315 { 316 r_pending_fsm[0] = false; 317 r_latency_bc = r_latency_bc.read() + (r_cpt_cycles.read() - r_pending_date[0].read()); 318 } 319 } 320 else 305 321 { 306 322 assert( ( r_pending_fsm[(int)p_vci.rtrdid.read()] == true ) && 307 "illegal single response received") 323 "illegal single response received"); 308 324 r_pending_fsm[p_vci.rtrdid.read()] = false; 309 325 r_latency_single = r_latency_single.read() + … … 332 348 } 333 349 334 if ( m_bc_period && (r_cpt_period.read() > m_bc_period) && r_dat a_fifo.wok() )335 m_cpt_period = 0;350 if ( m_bc_period && (r_cpt_period.read() > m_bc_period) && r_date_fifo.wok() ) 351 r_cpt_period = 0; 336 352 else 337 m_cpt_period = m_cpt_period.read() + 1;353 r_cpt_period = r_cpt_period.read() + 1; 338 354 339 355 //////////////////////// 340 356 // update fifos 341 357 //////////////////////// 342 if ( date_fifo_put){343 if ( date_fifo_get){358 if (fifo_put){ 359 if (fifo_get){ 344 360 r_date_fifo.put_and_get(r_cpt_cycles.read()); 345 361 r_bc_fifo.put_and_get(fifo_bc); 346 362 } else { 347 r_date_fifo.simple_put( m_cpt_cycles);363 r_date_fifo.simple_put(r_cpt_cycles.read()); 348 364 r_bc_fifo.simple_put(fifo_bc); 349 365 } 350 366 } else { 351 if ( date_fifo_get){367 if (fifo_get){ 352 368 r_date_fifo.simple_get(); 353 369 r_bc_fifo.simple_get(); … … 374 390 p_vci.be = 0xF; 375 391 p_vci.srcid = m_srcid; 376 p_vci.pktid = 0;377 392 p_vci.cons = false; 378 393 p_vci.wrap = false; … … 393 408 p_vci.wdata = 0; 394 409 p_vci.trdid = 0; 410 p_vci.pktid = 0; 395 411 p_vci.eop = false; 396 412 break; … … 400 416 { 401 417 p_vci.cmdval = true; 402 p_vci.address = (addr_t)(r_cmd_address.read() + (r_c ount.read()*4));418 p_vci.address = (addr_t)(r_cmd_address.read() + (r_cmd_count.read()*4)); 403 419 p_vci.plen = m_length*4; 404 420 p_vci.wdata = 0; 405 p_vci.trdid = r_id_to_send.read(); 406 if (r_count.read() == m_length - 1 ) { 421 p_vci.trdid = r_cmd_trdid.read(); 422 p_vci.pktid = 0; 423 if (r_cmd_count.read() == m_length - 1 ) { 407 424 p_vci.eop = true; 408 425 } else { … … 418 435 p_vci.plen = 4; 419 436 p_vci.wdata = 0; 420 p_vci.pktid = 1;421 437 p_vci.trdid = 0; 438 p_vci.pktid = 0; 422 439 p_vci.eop = true; 423 440 break; 424 441 } 442 ////////////////// 443 case VCI_SINGLE_REGISTER: 444 { 445 p_vci.cmdval = false; 446 p_vci.address = 0; 447 p_vci.plen = 0; 448 p_vci.wdata = 0; 449 p_vci.trdid = 0; 450 p_vci.pktid = 0; 451 p_vci.eop = false; 452 break; 453 } 425 454 } // end switch vci_cmd_fsm 426 455
Note: See TracChangeset
for help on using the changeset viewer.