Changeset 77 for trunk/modules/vci_synthetic_initator/caba/sources/src
- Timestamp:
- Aug 27, 2010, 3:48:56 PM (14 years ago)
- Location:
- trunk/modules/vci_synthetic_initator
- Files:
-
- 1 deleted
- 2 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initator.cpp
r75 r77 1 /* -*- c++ -*- 2 * File : vci_traffic_generator.cpp 3 * Date : 26/08/2010 4 * Copyright : UPMC / LIP6 5 * Authors : Christophe Choichillon 6 * 7 * SOCLIB_LGPL_HEADER_BEGIN 8 * 9 * This file is part of SoCLib, GNU LGPLv2.1. 10 * 11 * SoCLib is free software; you can redistribute it and/or modify it 12 * under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; version 2.1 of the License. 14 * 15 * SoCLib is distributed in the hope that it will be useful, but 16 * WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with SoCLib; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 * 02110-1301 USA 24 * 25 * SOCLIB_LGPL_HEADER_END 26 * 27 * Maintainers: christophe.choichillon@lip6.fr 28 */ 29 30 #include "../include/vci_traffic_generator.h" 31 32 33 34 namespace soclib { namespace caba { 35 36 37 #define tmpl(x) template<typename vci_param> x VciTrafficGenerator<vci_param> 38 39 40 //////////////////////////////// 41 // Constructor 42 //////////////////////////////// 43 44 tmpl(/**/)::VciTrafficGenerator( 45 sc_module_name name, 46 const soclib::common::MappingTable &mtp, 47 const soclib::common::MappingTable &mtc, 48 const soclib::common::MappingTable &mtx, 49 const soclib::common::IntTab &vci_ixr_index, 50 const soclib::common::IntTab &vci_ini_index, 51 const soclib::common::IntTab &vci_tgt_index, 52 size_t nways, 53 size_t nsets, 54 size_t nwords) 55 56 : soclib::caba::BaseModule(name), 57 58 p_clk("clk"), 59 p_resetn("resetn"), 60 p_vci("vci_ini"), 61 62 m_srcid_ini( mtc.indexForId(vci_ini_index) ), 63 // FIFOs 64 m_cmd_read_addr_fifo("m_cmd_read_addr_fifo", 4), 65 66 r_tgt_cmd_fsm("r_tgt_cmd_fsm"), 67 { 68 assert(IS_POW_OF_2(nsets)); 69 assert(IS_POW_OF_2(nwords)); 70 assert(IS_POW_OF_2(nways)); 71 assert(nsets); 72 assert(nwords); 73 assert(nways); 74 assert(nsets <= 1024); 75 assert(nwords <= 32); 76 assert(nways <= 32); 77 78 // Get the segments associated to the MemCache 79 //std::list<soclib::common::Segment> segList(mtp.getSegmentList(vci_tgt_index)); 80 std::list<soclib::common::Segment>::iterator seg; 81 /* 82 for(seg = segList.begin(); seg != segList.end() ; seg++) { 83 if( seg->size() > 8 ) m_mem_segment = *seg; 84 else m_reg_segment = *seg; 85 nseg++; 86 } 87 */ 88 89 for(seg = m_seglist.begin(); seg != m_seglist.end() ; seg++) { 90 if( seg->size() > 8 ) nseg++; 91 } 92 //assert( (nseg == 2) && (m_reg_segment.size() == 8) ); 93 94 m_seg = new soclib::common::Segment*[nseg]; 95 size_t i = 0; 96 for ( seg = m_seglist.begin() ; seg != m_seglist.end() ; seg++ ) { 97 if ( seg->size() > 8 ) 98 { 99 m_seg[i] = &(*seg); 100 i++; 101 } 102 else 103 { 104 m_reg_segment = *seg; 105 } 106 } 107 108 assert( (m_reg_segment.size() == 8) ); 109 110 // Memory cache allocation & initialisation 111 m_cache_data = new data_t**[nways]; 112 for ( size_t i=0 ; i<nways ; ++i ) { 113 m_cache_data[i] = new data_t*[nsets]; 114 } 115 for ( size_t i=0; i<nways; ++i ) { 116 for ( size_t j=0; j<nsets; ++j ) { 117 m_cache_data[i][j] = new data_t[nwords]; 118 for ( size_t k=0; k<nwords; k++){ 119 m_cache_data[i][j][k]=0; 120 } 121 } 122 } 123 124 // Allocation for IXR_RSP FSM 125 r_ixr_rsp_to_xram_rsp_rok = new sc_signal<bool>[TRANSACTION_TAB_LINES]; 126 127 // Allocation for XRAM_RSP FSM 128 r_xram_rsp_victim_data = new sc_signal<data_t>[nwords]; 129 r_xram_rsp_to_tgt_rsp_data = new sc_signal<data_t>[nwords]; 130 r_xram_rsp_to_tgt_rsp_val = new sc_signal<bool>[nwords]; 131 r_xram_rsp_to_xram_cmd_data = new sc_signal<data_t>[nwords]; 132 133 // Allocation for READ FSM 134 r_read_data = new sc_signal<data_t>[nwords]; 135 r_read_to_tgt_rsp_data = new sc_signal<data_t>[nwords]; 136 r_read_to_tgt_rsp_val = new sc_signal<bool>[nwords]; 137 138 // Allocation for WRITE FSM 139 r_write_data = new sc_signal<data_t>[nwords]; 140 r_write_be = new sc_signal<be_t>[nwords]; 141 r_write_to_init_cmd_data = new sc_signal<data_t>[nwords]; 142 r_write_to_init_cmd_we = new sc_signal<bool>[nwords]; 143 144 // Simulation 145 146 SC_METHOD(transition); 147 dont_initialize(); 148 sensitive << p_clk.pos(); 149 150 SC_METHOD(genMoore); 151 dont_initialize(); 152 sensitive << p_clk.neg(); 153 154 } // end constructor 155 156 ///////////////////////////////////////// 157 // This function prints the statistics 158 ///////////////////////////////////////// 159 160 tmpl(void)::print_stats() 161 { 162 std::cout << "----------------------------------" << std::dec << std::endl; 163 std::cout << "MEM_CACHE " << m_srcid_ini << " / Time = " << m_cpt_cycles << std::endl 164 << "- READ RATE = " << (float)m_cpt_read/m_cpt_cycles << std::endl 165 << "- READ MISS RATE = " << (float)m_cpt_read_miss/m_cpt_read << std::endl 166 << "- WRITE RATE = " << (float)m_cpt_write/m_cpt_cycles << std::endl 167 << "- WRITE MISS RATE = " << (float)m_cpt_write_miss/m_cpt_write << std::endl 168 << "- WRITE BURST LENGTH = " << (float)m_cpt_write_cells/m_cpt_write << std::endl 169 << "- UPDATE RATE = " << (float)m_cpt_update/m_cpt_cycles << std::endl 170 << "- UPDATE ARITY = " << (float)m_cpt_update_mult/m_cpt_update << std::endl 171 << "- INVAL RATE = " << (float)m_cpt_inval/m_cpt_cycles << std::endl 172 << "- INVAL ARITY = " << (float)m_cpt_inval_mult/m_cpt_inval << std::endl 173 << "- SAVE DIRTY RATE = " << (float)m_cpt_write_dirty/m_cpt_cycles << std::endl 174 << "- CLEANUP RATE = " << (float)m_cpt_cleanup/m_cpt_cycles << std::endl 175 << "- LL RATE = " << (float)m_cpt_ll/m_cpt_cycles << std::endl 176 << "- SC RATE = " << (float)m_cpt_sc/m_cpt_cycles << std::endl; 177 } 178 179 ///////////////////////////////// 180 tmpl(/**/)::~VciTrafficGenerator() 181 ///////////////////////////////// 182 { 183 for(size_t i=0; i<m_ways ; i++){ 184 for(size_t j=0; j<m_sets ; j++){ 185 delete [] m_cache_data[i][j]; 186 } 187 } 188 for(size_t i=0; i<m_ways ; i++){ 189 delete [] m_cache_data[i]; 190 } 191 delete [] m_cache_data; 192 delete [] m_coherence_table; 193 194 delete [] r_ixr_rsp_to_xram_rsp_rok; 195 196 delete [] r_xram_rsp_victim_data; 197 delete [] r_xram_rsp_to_tgt_rsp_data; 198 delete [] r_xram_rsp_to_tgt_rsp_val; 199 delete [] r_xram_rsp_to_xram_cmd_data; 200 201 delete [] r_read_data; 202 delete [] r_read_to_tgt_rsp_data; 203 delete [] r_read_to_tgt_rsp_val; 204 205 delete [] r_write_data; 206 delete [] r_write_be; 207 delete [] r_write_to_init_cmd_data; 208 } 209 210 ////////////////////////////////// 211 tmpl(void)::transition() 212 ////////////////////////////////// 213 { 214 using soclib::common::uint32_log2; 215 // RESET 216 if ( ! p_resetn.read() ) { 217 218 // Initializing FSMs 219 r_tgt_cmd_fsm = TGT_CMD_IDLE; 220 r_tgt_rsp_fsm = TGT_RSP_READ_IDLE; 221 r_init_cmd_fsm = INIT_CMD_INVAL_IDLE; 222 r_init_rsp_fsm = INIT_RSP_IDLE; 223 r_read_fsm = READ_IDLE; 224 r_write_fsm = WRITE_IDLE; 225 r_llsc_fsm = LLSC_IDLE; 226 r_cleanup_fsm = CLEANUP_IDLE; 227 r_alloc_dir_fsm = ALLOC_DIR_READ; 228 r_alloc_trt_fsm = ALLOC_TRT_READ; 229 r_alloc_upt_fsm = ALLOC_UPT_WRITE; 230 r_ixr_rsp_fsm = IXR_RSP_IDLE; 231 r_xram_rsp_fsm = XRAM_RSP_IDLE; 232 r_xram_cmd_fsm = XRAM_CMD_READ_IDLE; 233 234 // Initializing Tables 235 m_cache_directory.init(); 236 m_atomic_tab.init(); 237 m_transaction_tab.init(); 238 239 // initializing FIFOs and communication Buffers 240 241 m_cmd_read_addr_fifo.init(); 242 m_cmd_read_word_fifo.init(); 243 m_cmd_read_srcid_fifo.init(); 244 m_cmd_read_trdid_fifo.init(); 245 m_cmd_read_pktid_fifo.init(); 246 247 m_cmd_write_addr_fifo.init(); 248 m_cmd_write_eop_fifo.init(); 249 m_cmd_write_srcid_fifo.init(); 250 m_cmd_write_trdid_fifo.init(); 251 m_cmd_write_pktid_fifo.init(); 252 m_cmd_write_data_fifo.init(); 253 254 m_cmd_llsc_addr_fifo.init(); 255 m_cmd_llsc_srcid_fifo.init(); 256 m_cmd_llsc_trdid_fifo.init(); 257 m_cmd_llsc_pktid_fifo.init(); 258 m_cmd_llsc_wdata_fifo.init(); 259 m_cmd_llsc_sc_fifo.init(); 260 261 m_cmd_cleanup_srcid_fifo.init(); 262 m_cmd_cleanup_trdid_fifo.init(); 263 m_cmd_cleanup_pktid_fifo.init(); 264 m_cmd_cleanup_nline_fifo.init(); 265 266 r_read_to_tgt_rsp_req = false; 267 r_read_to_xram_cmd_req = false; 268 269 r_write_to_tgt_rsp_req = false; 270 r_write_to_xram_cmd_req = false; 271 r_write_to_init_cmd_req = false; 272 273 r_init_rsp_to_tgt_rsp_req = false; 274 275 r_cleanup_to_tgt_rsp_req = false; 276 277 r_llsc_to_tgt_rsp_req = false; 278 r_llsc_to_xram_cmd_req = false; 279 280 for(size_t i=0; i<TRANSACTION_TAB_LINES ; i++){ 281 r_ixr_rsp_to_xram_rsp_rok[i]= false; 282 } 283 284 r_xram_rsp_to_tgt_rsp_req = false; 285 r_xram_rsp_to_init_cmd_req = false; 286 r_xram_rsp_to_xram_cmd_req = false; 287 r_xram_rsp_trt_index = 0; 288 289 r_xram_cmd_cpt = 0; 290 291 // Activity counters 292 m_cpt_cycles = 0; 293 m_cpt_read = 0; 294 m_cpt_read_miss = 0; 295 m_cpt_write = 0; 296 m_cpt_write_miss = 0; 297 m_cpt_write_cells = 0; 298 m_cpt_write_dirty = 0; 299 m_cpt_update = 0; 300 m_cpt_update_mult = 0; 301 m_cpt_inval = 0; 302 m_cpt_inval_mult = 0; 303 m_cpt_cleanup = 0; 304 m_cpt_ll = 0; 305 m_cpt_sc = 0; 306 307 return; 308 } 309 310 bool cmd_read_fifo_put = false; 311 bool cmd_read_fifo_get = false; 312 313 bool cmd_write_fifo_put = false; 314 bool cmd_write_fifo_get = false; 315 316 bool cmd_llsc_fifo_put = false; 317 bool cmd_llsc_fifo_get = false; 318 319 bool cmd_cleanup_fifo_put = false; 320 bool cmd_cleanup_fifo_get = false; 321 322 323 324 switch ( r_tgt_cmd_fsm.read() ) { 325 326 ////////////////// 327 case TGT_CMD_IDLE: 328 { 329 if ( p_vci_tgt.cmdval ) { 330 assert( (p_vci_tgt.srcid.read() < m_initiators) 331 && "error in VCI_MEM_CACHE : The received SRCID is larger than 31"); 332 333 bool reached = false; 334 for ( size_t index = 0 ; index < nseg && !reached ; index++) 335 { 336 if ( m_seg[index]->contains(p_vci_tgt.address.read()) ) { 337 reached = true; 338 r_index = index; 339 } 340 } 341 342 if ( !reached ) 343 { 344 std::cout << "Out of segment access in VCI_MEM_CACHE" << std::endl; 345 std::cout << "Faulty address = " << p_vci_tgt.address.read() << std::endl; 346 std::cout << "Faulty initiator = " << p_vci_tgt.srcid.read() << std::endl; 347 exit(0); 348 } 349 else if ( p_vci_tgt.cmd.read() == vci_param::CMD_READ ) 350 { 351 r_tgt_cmd_fsm = TGT_CMD_READ; 352 } 353 else if (( p_vci_tgt.cmd.read() == vci_param::CMD_WRITE ) && ( p_vci_tgt.trdid.read() == 0x0 ) ) 354 { 355 r_tgt_cmd_fsm = TGT_CMD_WRITE; 356 } 357 else if ((p_vci_tgt.cmd.read() == vci_param::CMD_LOCKED_READ) || 358 (p_vci_tgt.cmd.read() == vci_param::CMD_STORE_COND) ) 359 { 360 r_tgt_cmd_fsm = TGT_CMD_ATOMIC; 361 } 362 else if (( p_vci_tgt.cmd.read() == vci_param::CMD_WRITE ) && ( p_vci_tgt.trdid.read() == 0x1 )) 363 { 364 r_tgt_cmd_fsm = TGT_CMD_CLEANUP; 365 } 366 } 367 break; 368 } 369 ////////////////// 370 case TGT_CMD_READ: 371 { 372 assert(((p_vci_tgt.plen.read() == 4) || (p_vci_tgt.plen.read() == m_words*4)) 373 && "All read request to the MemCache must have PLEN = 4 or PLEN = 4*nwords"); 374 375 if ( p_vci_tgt.cmdval && m_cmd_read_addr_fifo.wok() ) { 376 cmd_read_fifo_put = true; 377 if ( p_vci_tgt.eop ) r_tgt_cmd_fsm = TGT_CMD_IDLE; 378 else r_tgt_cmd_fsm = TGT_CMD_READ_EOP; 379 } 380 break; 381 } 382 ////////////////////// 383 case TGT_CMD_READ_EOP: 384 { 385 if ( p_vci_tgt.cmdval && p_vci_tgt.eop ){ 386 r_tgt_cmd_fsm = TGT_CMD_IDLE; 387 } 388 break; 389 } 390 /////////////////// 391 case TGT_CMD_WRITE: 392 { 393 if ( p_vci_tgt.cmdval && m_cmd_write_addr_fifo.wok() ) { 394 cmd_write_fifo_put = true; 395 if( p_vci_tgt.eop ) r_tgt_cmd_fsm = TGT_CMD_IDLE; 396 } 397 break; 398 } 399 //////////////////// 400 case TGT_CMD_ATOMIC: 401 { 402 assert(p_vci_tgt.eop && "Memory Cache Error: LL or SC command with length > 1 "); 403 404 if ( p_vci_tgt.cmdval && m_cmd_llsc_addr_fifo.wok() ) { 405 cmd_llsc_fifo_put = true; 406 r_tgt_cmd_fsm = TGT_CMD_IDLE; 407 } 408 break; 409 } 410 ///////////////////// 411 case TGT_CMD_CLEANUP: 412 { 413 assert(p_vci_tgt.eop && "Memory Cache Error: CLEANUP request with length > 1 "); 414 415 if ( p_vci_tgt.cmdval && m_cmd_cleanup_nline_fifo.wok() ) { 416 cmd_cleanup_fifo_put = true; 417 r_tgt_cmd_fsm = TGT_CMD_IDLE; 418 } 419 break; 420 } 421 } // end switch tgt_cmd_fsm 422 423 424 if ( cmd_cleanup_fifo_put ) { 425 if ( cmd_cleanup_fifo_get ) { 426 m_cmd_cleanup_srcid_fifo.put_and_get(p_vci_tgt.srcid.read()); 427 m_cmd_cleanup_trdid_fifo.put_and_get(p_vci_tgt.trdid.read()); 428 m_cmd_cleanup_pktid_fifo.put_and_get(p_vci_tgt.pktid.read()); 429 m_cmd_cleanup_nline_fifo.put_and_get(p_vci_tgt.wdata.read()); 430 } else { 431 m_cmd_cleanup_srcid_fifo.simple_put(p_vci_tgt.srcid.read()); 432 m_cmd_cleanup_trdid_fifo.simple_put(p_vci_tgt.trdid.read()); 433 m_cmd_cleanup_pktid_fifo.simple_put(p_vci_tgt.pktid.read()); 434 m_cmd_cleanup_nline_fifo.simple_put(p_vci_tgt.wdata.read()); 435 } 436 } else { 437 if ( cmd_cleanup_fifo_get ) { 438 m_cmd_cleanup_srcid_fifo.simple_get(); 439 m_cmd_cleanup_trdid_fifo.simple_get(); 440 m_cmd_cleanup_pktid_fifo.simple_get(); 441 m_cmd_cleanup_nline_fifo.simple_get(); 442 } 443 } 444 445 m_cpt_cycles++; 446 447 } // end transition() 448 449 ///////////////////////////// 450 tmpl(void)::genMoore() 451 ///////////////////////////// 452 { 453 //////////////////////////////////////////////////////////// 454 // Command signals on the p_vci_ixr port 455 //////////////////////////////////////////////////////////// 456 457 458 p_vci_ixr.be = 0xF; 459 p_vci_ixr.pktid = 0; 460 p_vci_ixr.srcid = m_srcid_ixr; 461 p_vci_ixr.cons = false; 462 p_vci_ixr.wrap = false; 463 p_vci_ixr.contig = true; 464 p_vci_ixr.clen = 0; 465 p_vci_ixr.cfixed = false; 466 467 if ( r_xram_cmd_fsm.read() == XRAM_CMD_READ_NLINE ) { 468 p_vci_ixr.cmd = vci_param::CMD_READ; 469 p_vci_ixr.cmdval = true; 470 p_vci_ixr.address = (r_read_to_xram_cmd_nline.read()*m_words*4); 471 p_vci_ixr.plen = m_words*4; 472 p_vci_ixr.wdata = 0x00000000; 473 p_vci_ixr.trdid = r_read_to_xram_cmd_trdid.read(); 474 p_vci_ixr.eop = true; 475 } 476 else if ( r_xram_cmd_fsm.read() == XRAM_CMD_LLSC_NLINE ) { 477 p_vci_ixr.cmd = vci_param::CMD_READ; 478 p_vci_ixr.cmdval = true; 479 p_vci_ixr.address = (r_llsc_to_xram_cmd_nline.read()*m_words*4); 480 p_vci_ixr.plen = m_words*4; 481 p_vci_ixr.wdata = 0x00000000; 482 p_vci_ixr.trdid = r_llsc_to_xram_cmd_trdid.read(); 483 p_vci_ixr.eop = true; 484 } 485 else if ( r_xram_cmd_fsm.read() == XRAM_CMD_WRITE_NLINE ) { 486 p_vci_ixr.cmd = vci_param::CMD_READ; 487 p_vci_ixr.cmdval = true; 488 p_vci_ixr.address = (r_write_to_xram_cmd_nline.read()*m_words*4); 489 p_vci_ixr.plen = m_words*4; 490 p_vci_ixr.wdata = 0x00000000; 491 p_vci_ixr.trdid = r_write_to_xram_cmd_trdid.read(); 492 p_vci_ixr.eop = true; 493 } 494 else if ( r_xram_cmd_fsm.read() == XRAM_CMD_XRAM_DATA ) { 495 p_vci_ixr.cmd = vci_param::CMD_WRITE; 496 p_vci_ixr.cmdval = true; 497 p_vci_ixr.address = ((r_xram_rsp_to_xram_cmd_nline.read()*m_words+r_xram_cmd_cpt.read())*4); 498 p_vci_ixr.plen = m_words*4; 499 p_vci_ixr.wdata = r_xram_rsp_to_xram_cmd_data[r_xram_cmd_cpt.read()].read(); 500 p_vci_ixr.trdid = r_xram_rsp_to_xram_cmd_trdid.read(); 501 p_vci_ixr.eop = (r_xram_cmd_cpt == (m_words-1)); 502 } else { 503 p_vci_ixr.cmdval = false; 504 p_vci_ixr.address = 0; 505 p_vci_ixr.plen = 0; 506 p_vci_ixr.wdata = 0; 507 p_vci_ixr.trdid = 0; 508 p_vci_ixr.eop = false; 509 } 510 511 //////////////////////////////////////////////////// 512 // Response signals on the p_vci_ixr port 513 //////////////////////////////////////////////////// 514 515 if ( ((r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP) && 516 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) || 517 (r_ixr_rsp_fsm.read() == IXR_RSP_ACK) ) p_vci_ixr.rspack = true; 518 else p_vci_ixr.rspack = false; 519 520 //////////////////////////////////////////////////// 521 // Command signals on the p_vci_tgt port 522 //////////////////////////////////////////////////// 523 524 switch ((tgt_cmd_fsm_state_e)r_tgt_cmd_fsm.read()) { 525 case TGT_CMD_IDLE: 526 p_vci_tgt.cmdack = false; 527 break; 528 case TGT_CMD_READ: 529 p_vci_tgt.cmdack = m_cmd_read_addr_fifo.wok(); 530 break; 531 case TGT_CMD_READ_EOP: 532 p_vci_tgt.cmdack = true; 533 break; 534 case TGT_CMD_WRITE: 535 p_vci_tgt.cmdack = m_cmd_write_addr_fifo.wok(); 536 break; 537 case TGT_CMD_ATOMIC: 538 p_vci_tgt.cmdack = m_cmd_llsc_addr_fifo.wok(); 539 break; 540 case TGT_CMD_CLEANUP: 541 p_vci_tgt.cmdack = m_cmd_cleanup_nline_fifo.wok(); 542 break; 543 default: 544 p_vci_tgt.cmdack = false; 545 break; 546 } 547 548 //////////////////////////////////////////////////// 549 // Response signals on the p_vci_tgt port 550 //////////////////////////////////////////////////// 551 switch ( r_tgt_rsp_fsm.read() ) { 552 553 case TGT_RSP_READ_IDLE: 554 case TGT_RSP_WRITE_IDLE: 555 case TGT_RSP_LLSC_IDLE: 556 case TGT_RSP_CLEANUP_IDLE: 557 case TGT_RSP_XRAM_IDLE: 558 case TGT_RSP_INIT_IDLE: 559 case TGT_RSP_READ_TEST: 560 case TGT_RSP_XRAM_TEST: 561 562 p_vci_tgt.rspval = false; 563 p_vci_tgt.rsrcid = 0; 564 p_vci_tgt.rdata = 0; 565 p_vci_tgt.rpktid = 0; 566 p_vci_tgt.rtrdid = 0; 567 p_vci_tgt.rerror = 0; 568 p_vci_tgt.reop = false; 569 break; 570 case TGT_RSP_READ_LINE: 571 p_vci_tgt.rspval = true; 572 p_vci_tgt.rdata = r_read_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read(); 573 p_vci_tgt.rsrcid = r_read_to_tgt_rsp_srcid.read(); 574 p_vci_tgt.rtrdid = r_read_to_tgt_rsp_trdid.read(); 575 p_vci_tgt.rpktid = r_read_to_tgt_rsp_pktid.read(); 576 p_vci_tgt.rerror = 0; 577 p_vci_tgt.reop = (r_tgt_rsp_cpt.read()==(m_words-1)); 578 break; 579 case TGT_RSP_READ_WORD: 580 p_vci_tgt.rspval = true; 581 p_vci_tgt.rdata = r_read_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read(); 582 p_vci_tgt.rsrcid = r_read_to_tgt_rsp_srcid.read(); 583 p_vci_tgt.rtrdid = r_read_to_tgt_rsp_trdid.read(); 584 p_vci_tgt.rpktid = r_read_to_tgt_rsp_pktid.read(); 585 p_vci_tgt.rerror = 0; 586 p_vci_tgt.reop = true; 587 break; 588 case TGT_RSP_WRITE: 589 p_vci_tgt.rspval = true; 590 p_vci_tgt.rdata = 0; 591 p_vci_tgt.rsrcid = r_write_to_tgt_rsp_srcid.read(); 592 p_vci_tgt.rtrdid = r_write_to_tgt_rsp_trdid.read(); 593 p_vci_tgt.rpktid = r_write_to_tgt_rsp_pktid.read(); 594 p_vci_tgt.rerror = 0; 595 p_vci_tgt.reop = true; 596 break; 597 case TGT_RSP_CLEANUP: 598 p_vci_tgt.rspval = true; 599 p_vci_tgt.rdata = 0; 600 p_vci_tgt.rsrcid = r_cleanup_to_tgt_rsp_srcid.read(); 601 p_vci_tgt.rtrdid = r_cleanup_to_tgt_rsp_trdid.read(); 602 p_vci_tgt.rpktid = r_cleanup_to_tgt_rsp_pktid.read(); 603 p_vci_tgt.rerror = 0; 604 p_vci_tgt.reop = true; 605 break; 606 case TGT_RSP_LLSC: 607 p_vci_tgt.rspval = true; 608 p_vci_tgt.rdata = r_llsc_to_tgt_rsp_data.read(); 609 p_vci_tgt.rsrcid = r_llsc_to_tgt_rsp_srcid.read(); 610 p_vci_tgt.rtrdid = r_llsc_to_tgt_rsp_trdid.read(); 611 p_vci_tgt.rpktid = r_llsc_to_tgt_rsp_pktid.read(); 612 p_vci_tgt.rerror = 0; 613 p_vci_tgt.reop = true; 614 break; 615 case TGT_RSP_XRAM_LINE: 616 p_vci_tgt.rspval = true; 617 p_vci_tgt.rdata = r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read(); 618 p_vci_tgt.rsrcid = r_xram_rsp_to_tgt_rsp_srcid.read(); 619 p_vci_tgt.rtrdid = r_xram_rsp_to_tgt_rsp_trdid.read(); 620 p_vci_tgt.rpktid = r_xram_rsp_to_tgt_rsp_pktid.read(); 621 p_vci_tgt.rerror = 0; 622 p_vci_tgt.reop = (r_tgt_rsp_cpt.read()==(m_words-1)); 623 break; 624 case TGT_RSP_XRAM_WORD: 625 p_vci_tgt.rspval = true; 626 p_vci_tgt.rdata = r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read(); 627 p_vci_tgt.rsrcid = r_xram_rsp_to_tgt_rsp_srcid.read(); 628 p_vci_tgt.rtrdid = r_xram_rsp_to_tgt_rsp_trdid.read(); 629 p_vci_tgt.rpktid = r_xram_rsp_to_tgt_rsp_pktid.read(); 630 p_vci_tgt.rerror = 0; 631 p_vci_tgt.reop = true; 632 break; 633 case TGT_RSP_INIT: 634 p_vci_tgt.rspval = true; 635 p_vci_tgt.rdata = 0; 636 p_vci_tgt.rsrcid = r_init_rsp_to_tgt_rsp_srcid.read(); 637 p_vci_tgt.rtrdid = r_init_rsp_to_tgt_rsp_trdid.read(); 638 p_vci_tgt.rpktid = r_init_rsp_to_tgt_rsp_pktid.read(); 639 p_vci_tgt.rerror = 0; 640 p_vci_tgt.reop = true; 641 break; 642 } // end switch r_tgt_rsp_fsm 643 644 /////////////////////////////////////////////////// 645 // Command signals on the p_vci_ini port 646 /////////////////////////////////////////////////// 647 648 p_vci_ini.cmd = vci_param::CMD_WRITE; 649 p_vci_ini.srcid = m_srcid_ini; 650 p_vci_ini.pktid = 0; 651 p_vci_ini.cons = true; 652 p_vci_ini.wrap = false; 653 p_vci_ini.contig = false; 654 p_vci_ini.clen = 0; 655 p_vci_ini.cfixed = false; 656 657 switch ( r_init_cmd_fsm.read() ) { 658 659 case INIT_CMD_UPDT_IDLE: 660 case INIT_CMD_INVAL_IDLE: 661 case INIT_CMD_UPDT_SEL: 662 case INIT_CMD_INVAL_SEL: 663 p_vci_ini.cmdval = false; 664 p_vci_ini.address = 0; 665 p_vci_ini.wdata = 0; 666 p_vci_ini.be = 0; 667 p_vci_ini.plen = 0; 668 p_vci_ini.trdid = 0; 669 p_vci_ini.eop = false; 670 break; 671 case INIT_CMD_INVAL_NLINE: 672 p_vci_ini.cmdval = true; 673 p_vci_ini.address = m_coherence_table[r_init_cmd_target.read()]; 674 p_vci_ini.wdata = r_xram_rsp_to_init_cmd_nline.read(); 675 p_vci_ini.be = 0xF; 676 p_vci_ini.plen = 4; 677 p_vci_ini.trdid = r_xram_rsp_to_init_cmd_trdid.read(); 678 p_vci_ini.eop = true; 679 break; 680 case INIT_CMD_UPDT_NLINE: 681 p_vci_ini.cmdval = true; 682 p_vci_ini.address = m_coherence_table[r_init_cmd_target.read()] + 4; 683 p_vci_ini.wdata = r_write_to_init_cmd_nline.read(); 684 p_vci_ini.be = 0xF; 685 p_vci_ini.plen = 4 * (r_write_to_init_cmd_count.read() + 2); 686 p_vci_ini.trdid = r_write_to_init_cmd_trdid.read(); 687 p_vci_ini.eop = false; 688 break; 689 case INIT_CMD_UPDT_INDEX: 690 p_vci_ini.cmdval = true; 691 p_vci_ini.address = m_coherence_table[r_init_cmd_target.read()] + 4; 692 p_vci_ini.wdata = r_write_to_init_cmd_index.read(); 693 p_vci_ini.be = 0xF; 694 p_vci_ini.plen = 4 * (r_write_to_init_cmd_count.read() + 2); 695 p_vci_ini.trdid = r_write_to_init_cmd_trdid.read(); 696 p_vci_ini.eop = false; 697 break; 698 case INIT_CMD_UPDT_DATA: 699 p_vci_ini.cmdval = true; 700 p_vci_ini.address = m_coherence_table[r_init_cmd_target.read()] + 4; 701 p_vci_ini.wdata = r_write_to_init_cmd_data[r_init_cmd_cpt.read() + 702 r_write_to_init_cmd_index.read()].read(); 703 if(r_write_to_init_cmd_we[r_init_cmd_cpt.read() + 704 r_write_to_init_cmd_index.read()].read()) 705 p_vci_ini.be = 0xF; 706 else p_vci_ini.be = 0x0; 707 p_vci_ini.plen = 4 * (r_write_to_init_cmd_count.read() + 2); 708 p_vci_ini.trdid = r_write_to_init_cmd_trdid.read(); 709 p_vci_ini.eop = ( r_init_cmd_cpt.read() == (r_write_to_init_cmd_count.read()-1) ); 710 break; 711 } // end switch r_init_cmd_fsm 712 713 ////////////////////////////////////////////////////// 714 // Response signals on the p_vci_ini port 715 ////////////////////////////////////////////////////// 716 717 if ( r_init_rsp_fsm.read() == INIT_RSP_IDLE ) p_vci_ini.rspack = true; 718 else p_vci_ini.rspack = false; 719 720 } // end genMoore() 721 722 }} // end name space
Note: See TracChangeset
for help on using the changeset viewer.