Changeset 392 for trunk/modules/vci_block_device_tsar/caba/source/src
- Timestamp:
- May 28, 2013, 12:35:01 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_block_device_tsar/caba/source/src/vci_block_device_tsar.cpp
r381 r392 44 44 if(p_resetn.read() == false) 45 45 { 46 r_initiator_fsm = M_IDLE;47 r_target_fsm = T_IDLE;48 r_irq_enable = true;49 r_go = false;46 r_initiator_fsm = M_IDLE; 47 r_target_fsm = T_IDLE; 48 r_irq_enable = true; 49 r_go = false; 50 50 return; 51 51 } … … 67 67 sc_dt::sc_uint<vci_param::N> address = p_vci_target.address.read(); 68 68 bool read = (p_vci_target.cmd.read() == vci_param::CMD_READ); 69 uint32_t cell = (uint32_t)((address & 0x 1F)>>2);69 uint32_t cell = (uint32_t)((address & 0x3F)>>2); 70 70 71 71 if ( !read && !m_segment.contains(address) ) r_target_fsm = T_WRITE_ERROR; … … 75 75 else if( !read && (cell == BLOCK_DEVICE_BUFFER) ) r_target_fsm = T_WRITE_BUFFER; 76 76 else if( read && (cell == BLOCK_DEVICE_BUFFER) ) r_target_fsm = T_READ_BUFFER; 77 else if( !read && (cell == BLOCK_DEVICE_BUFFER_EXT) ) r_target_fsm = T_WRITE_BUFFER_EXT; 78 else if( read && (cell == BLOCK_DEVICE_BUFFER_EXT) ) r_target_fsm = T_READ_BUFFER_EXT; 77 79 else if( !read && (cell == BLOCK_DEVICE_COUNT) ) r_target_fsm = T_WRITE_COUNT; 78 80 else if( read && (cell == BLOCK_DEVICE_COUNT) ) r_target_fsm = T_READ_COUNT; … … 91 93 case T_WRITE_BUFFER: 92 94 { 93 if ( r_initiator_fsm == M_IDLE ) r_buf_address = (uint32_t)p_vci_target.wdata.read(); 94 if ( p_vci_target.rspack.read() ) r_target_fsm = T_IDLE; 95 if ( (r_initiator_fsm.read() == M_IDLE) and p_vci_target.rspack.read() ) 96 { 97 r_buf_address = (uint64_t)p_vci_target.wdata.read(); 98 r_target_fsm = T_IDLE; 99 } 100 break; 101 } 102 //////////////////////// 103 case T_WRITE_BUFFER_EXT: 104 { 105 if ( (r_initiator_fsm.read() == M_IDLE) and p_vci_target.rspack.read() ) 106 { 107 r_buf_address = r_buf_address.read() + 108 (((uint64_t)p_vci_target.wdata.read())<<32); 109 r_target_fsm = T_IDLE; 110 } 95 111 break; 96 112 } … … 98 114 case T_WRITE_COUNT: 99 115 { 100 if ( r_initiator_fsm == M_IDLE ) r_nblocks = (uint32_t)p_vci_target.wdata.read(); 101 if ( p_vci_target.rspack.read() ) r_target_fsm = T_IDLE; 116 if ( (r_initiator_fsm.read() == M_IDLE) and p_vci_target.rspack.read() ) 117 { 118 r_nblocks = (uint32_t)p_vci_target.wdata.read(); 119 r_target_fsm = T_IDLE; 120 } 102 121 break; 103 122 } … … 105 124 case T_WRITE_LBA: 106 125 { 107 if ( r_initiator_fsm == M_IDLE ) r_lba = (uint32_t)p_vci_target.wdata.read(); 108 if ( p_vci_target.rspack.read() ) r_target_fsm = T_IDLE; 126 if ( (r_initiator_fsm.read() == M_IDLE) and p_vci_target.rspack.read() ) 127 { 128 r_lba = (uint32_t)p_vci_target.wdata.read(); 129 r_target_fsm = T_IDLE; 130 } 109 131 break; 110 132 } … … 112 134 case T_WRITE_OP: 113 135 { 114 if ( r_initiator_fsm == M_IDLE ) 115 { 116 if ( (uint32_t)p_vci_target.wdata.read() == BLOCK_DEVICE_READ ) 136 if ( p_vci_target.rspack.read() ) 137 { 138 if ( ((uint32_t)p_vci_target.wdata.read() == BLOCK_DEVICE_READ) and 139 (r_initiator_fsm.read() == M_IDLE) ) 117 140 { 118 141 r_read = true; 119 r_go = true; 120 } 121 else if ( (uint32_t)p_vci_target.wdata.read() == BLOCK_DEVICE_WRITE) 142 r_go = true; 143 } 144 else if ( ((uint32_t)p_vci_target.wdata.read() == BLOCK_DEVICE_WRITE) and 145 (r_initiator_fsm.read() == M_IDLE) ) 122 146 { 123 147 r_read = false; 124 r_go = true; 125 } 126 } 127 if ( p_vci_target.rspack.read() ) r_target_fsm = T_IDLE; 148 r_go = true; 149 } 150 else 151 { 152 r_go = false; 153 } 154 r_target_fsm = T_IDLE; 155 } 128 156 break; 129 157 } … … 131 159 case T_WRITE_IRQEN: 132 160 { 133 r_irq_enable = (p_vci_target.wdata.read() != 0); 134 if ( p_vci_target.rspack.read() ) r_target_fsm = T_IDLE; 161 if ( p_vci_target.rspack.read() ) 162 { 163 r_target_fsm = T_IDLE; 164 r_irq_enable = (p_vci_target.wdata.read() != 0); 165 } 135 166 break; 136 167 } 137 168 /////////////////// 138 169 case T_READ_BUFFER: 170 case T_READ_BUFFER_EXT: 139 171 case T_READ_COUNT: 140 172 case T_READ_LBA: … … 190 222 191 223 // compute r_burst_offset (zero when buffer aligned) 192 r_burst_offset = ( r_buf_address.read()>>2) % m_flits_per_burst;224 r_burst_offset = (uint32_t)((r_buf_address.read()>>2) % m_flits_per_burst); 193 225 194 226 // start tranfer … … 338 370 if ( p_vci_initiator.reop.read() ) // last flit of the burst 339 371 { 340 r_flit_count = 0;372 r_flit_count = 0; 341 373 r_buf_address = r_buf_address.read() + (r_burst_nflits.read()<<2); 342 374 343 if( (p_vci_initiator.rerror.read()&0x1) != 0 )375 if( (p_vci_initiator.rerror.read()&0x1) != 0 ) 344 376 { 345 377 r_initiator_fsm = M_WRITE_ERROR; … … 431 463 p_vci_target.rspval = true; 432 464 p_vci_target.rdata = (uint32_t)r_buf_address.read(); 465 p_vci_target.rerror = VCI_READ_OK; 466 break; 467 case T_READ_BUFFER_EXT: 468 p_vci_target.cmdack = false; 469 p_vci_target.rspval = true; 470 p_vci_target.rdata = (uint32_t)(r_buf_address.read()>>32); 433 471 p_vci_target.rerror = VCI_READ_OK; 434 472 break; … … 649 687 }; 650 688 const char* target_str[] = { 651 "IDLE 689 "IDLE", 652 690 "WRITE_BUFFER", 653 "READ_BUFFER ", 654 "WRITE_COUNT ", 655 "READ_COUNT ", 656 "WRITE_LBA ", 657 "READ_LBA ", 658 "WRITE_OP ", 659 "READ_STATUS ", 660 "WRITE_IRQEN ", 661 "READ_IRQEN ", 662 "READ_SIZE ", 663 "READ_BLOCK ", 664 "READ_ERROR ", 691 "READ_BUFFER", 692 "WRITE_BUFFER_EXT", 693 "READ_BUFFER_EXT", 694 "WRITE_COUNT", 695 "READ_COUNT", 696 "WRITE_LBA", 697 "READ_LBA", 698 "WRITE_OP", 699 "READ_STATUS", 700 "WRITE_IRQEN", 701 "READ_IRQEN", 702 "READ_SIZE", 703 "READ_BLOCK", 704 "READ_ERROR", 665 705 "WRITE_ERROR ", 666 706 }; … … 668 708 std::cout << "BDEV_TGT : " << target_str[r_target_fsm.read()] 669 709 << " BDEV_INI : " << initiator_str[r_initiator_fsm.read()] 670 << " block = " << r_block_count.read() 710 << " buf = " << std::hex << r_buf_address.read() 711 << " block = " << std::dec << r_block_count.read() 671 712 << " burst = " << r_burst_count.read() 672 713 << " flit = " << r_flit_count.read() <<std::endl;
Note: See TracChangeset
for help on using the changeset viewer.