Changeset 580 for trunk/modules/vci_block_device_tsar/caba/source/src
- Timestamp:
- Nov 23, 2013, 6:19:53 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_block_device_tsar/caba/source/src/vci_block_device_tsar.cpp
r522 r580 32 32 #include "vci_block_device_tsar.h" 33 33 34 #define DEBUG_BDEV 0 35 34 36 namespace soclib { namespace caba { 35 37 … … 65 67 r_trdid = p_vci_target.trdid.read(); 66 68 r_pktid = p_vci_target.pktid.read(); 67 r_tdata = p_vci_target.wdata.read();68 69 sc_dt::sc_uint<vci_param::N> address = p_vci_target.address.read(); 69 70 … … 96 97 else if( read && (cell == BLOCK_DEVICE_SIZE) ) r_target_fsm = T_READ_SIZE; 97 98 else if( read && (cell == BLOCK_DEVICE_BLOCK_SIZE) ) r_target_fsm = T_READ_BLOCK; 99 100 // get write data value for both 32 bits and 64 bits data width 101 if( (vci_param::B == 8) and (p_vci_target.be.read() == 0xF0) ) 102 r_tdata = (uint32_t)(p_vci_target.wdata.read()>>32); 103 else 104 r_tdata = p_vci_target.wdata.read(); 98 105 } 99 106 break; … … 102 109 case T_WRITE_BUFFER: 103 110 { 104 if (p_vci_target.rspack.read() ) { 105 #ifdef SOCLIB_MODULE_DEBUG 106 std::cout << "vci_bd WRITE_BUFFER " << r_tdata.read() 107 << " status " << r_initiator_fsm.read() << std::endl; 111 if (p_vci_target.rspack.read() ) 112 { 113 if (r_initiator_fsm.read() == M_IDLE) 114 { 115 116 #if DEBUG_BDEV 117 std::cout << " <BDEV_TGT WRITE_BUFFER> value = " << r_tdata.read() << std::endl; 108 118 #endif 109 if (r_initiator_fsm.read() == M_IDLE)110 {111 119 r_buf_address = (uint64_t)r_tdata.read(); 112 120 r_target_fsm = T_IDLE; 113 }121 } 114 122 } 115 123 break; … … 118 126 case T_WRITE_BUFFER_EXT: 119 127 { 120 if (p_vci_target.rspack.read() ) { 121 #ifdef SOCLIB_MODULE_DEBUG 122 std::cout << "vci_bd WRITE_BUFFER_EXT " << r_tdata.read() 123 << " status " << r_initiator_fsm.read() << std::endl; 128 if (p_vci_target.rspack.read() ) 129 { 130 if (r_initiator_fsm.read() == M_IDLE) 131 { 132 133 #if DEBUG_BDEV 134 std::cout << " <BDEV_TGT WRITE_BUFFER_EXT> value = " << r_tdata.read() << std::endl; 124 135 #endif 125 if (r_initiator_fsm.read() == M_IDLE) 126 { 127 r_buf_address = r_buf_address.read() + 128 (((uint64_t)r_tdata.read())<<32); 136 r_buf_address = r_buf_address.read() + (((uint64_t)r_tdata.read())<<32); 129 137 r_target_fsm = T_IDLE; 130 138 } 131 139 } 132 140 break; … … 135 143 case T_WRITE_COUNT: 136 144 { 137 if (p_vci_target.rspack.read() ) { 138 #ifdef SOCLIB_MODULE_DEBUG 139 std::cout << "vci_bd WRITE_COUNT " << r_tdata.read() << 140 " status " << r_initiator_fsm.read() << std::endl; 145 if (p_vci_target.rspack.read() ) 146 { 147 if (r_initiator_fsm.read() == M_IDLE) 148 { 149 150 #if DEBUG_BDEV 151 std::cout << " <BDEV_TGT WRITE_COUNT> value = " << r_tdata.read() << std::endl; 141 152 #endif 142 if (r_initiator_fsm.read() == M_IDLE)143 {144 153 r_nblocks = (uint32_t)r_tdata.read(); 145 154 r_target_fsm = T_IDLE; 146 155 } 147 156 } 148 157 break; 149 158 } … … 151 160 case T_WRITE_LBA: 152 161 { 153 if (p_vci_target.rspack.read() ) { 154 #ifdef SOCLIB_MODULE_DEBUG 155 std::cout << "vci_bd WRITE_LBA " << r_tdata.read() << 156 " status " << r_initiator_fsm.read() << std::endl; 162 if (p_vci_target.rspack.read() ) 163 { 164 if (r_initiator_fsm.read() == M_IDLE) 165 { 166 167 #if DEBUG_BDEV 168 std::cout << " <BDEV_TGT WRITE_LBA> value = " << r_tdata.read() << std::endl; 157 169 #endif 158 if (r_initiator_fsm.read() == M_IDLE) {159 170 r_lba = (uint32_t)r_tdata.read(); 160 171 r_target_fsm = T_IDLE; 161 172 } 162 173 } 163 174 break; 164 175 } … … 168 179 if ( p_vci_target.rspack.read() ) 169 180 { 170 #ifdef SOCLIB_MODULE_DEBUG171 std::cout << "vci_bd WRITE_OP " << r_tdata.read() <<172 " status " << r_initiator_fsm.read();173 #endif174 181 if ( ((uint32_t)r_tdata.read() == BLOCK_DEVICE_READ) and 175 182 (r_initiator_fsm.read() == M_IDLE) ) 176 183 { 184 185 #if DEBUG_BDEV 186 std::cout << " <BDEV_TGT WRITE_LBA> value = READ" << std::endl; 187 #endif 177 188 r_read = true; 178 189 r_go = true; 179 #ifdef SOCLIB_MODULE_DEBUG180 std::cout << " READ";181 #endif182 190 } 183 191 else if ( ((uint32_t)r_tdata.read() == BLOCK_DEVICE_WRITE) and 184 192 (r_initiator_fsm.read() == M_IDLE) ) 185 193 { 194 195 #if DEBUG_BDEV 196 std::cout << " <BDEV_TGT WRITE_LBA> value = WRITE" << std::endl; 197 #endif 186 198 r_read = false; 187 199 r_go = true; 188 #ifdef SOCLIB_MODULE_DEBUG 189 std::cout << " WRITE"; 200 } 201 else 202 { 203 204 #if DEBUG_BDEV 205 std::cout << " <BDEV_TGT WRITE_LBA> value = SOFT RESET" << std::endl; 190 206 #endif 191 }192 else193 {194 207 r_go = false; 195 208 } 196 209 r_target_fsm = T_IDLE; 197 #ifdef SOCLIB_MODULE_DEBUG198 std::cout << std::endl;199 #endif200 210 } 201 211 break; … … 206 216 if ( p_vci_target.rspack.read() ) 207 217 { 208 #ifdef SOCLIB_MODULE_DEBUG 209 std::cout << "vci_bd WRITE_IRQEN " << r_tdata.read() 210 << " status " << r_initiator_fsm.read() << std::endl;218 219 #if DEBUG_BDEV 220 std::cout << " <BDEV_TGT WRITE_IRQEN> value = " << r_tdata.read() << std::endl; 211 221 #endif 212 222 r_target_fsm = T_IDLE; … … 289 299 { 290 300 r_initiator_fsm = M_READ_ERROR; 291 #ifdef SOCLIB_MODULE_DEBUG292 std::cout << "vci_bd M_READ_ERROR" << std::endl;293 #endif294 301 } 295 302 else 296 303 { 297 304 r_burst_count = 0; 298 r_words_count 305 r_words_count = 0; 299 306 r_initiator_fsm = M_READ_BURST; 300 307 } … … 389 396 { 390 397 r_initiator_fsm = M_READ_ERROR; 391 #ifdef SOCLIB_MODULE_DEBUG392 std::cout << "vci_bd M_READ_ERROR" << std::endl;393 #endif394 398 } 395 399 else if ( (not aligned and (r_burst_count.read() == m_bursts_per_block)) or … … 399 403 { 400 404 r_initiator_fsm = M_READ_SUCCESS; 401 #ifdef SOCLIB_MODULE_DEBUG402 std::cout << "vci_bd M_READ_SUCCESS" << std::endl;403 #endif404 405 } 405 406 else // last burst not last block … … 480 481 { 481 482 r_initiator_fsm = M_WRITE_ERROR; 482 #ifdef SOCLIB_MODULE_DEBUG483 std::cout << "vci_bd M_WRITE_ERROR" << std::endl;484 #endif485 483 } 486 484 else if ( (not aligned and (r_burst_count.read() == m_bursts_per_block)) or … … 512 510 { 513 511 r_initiator_fsm = M_WRITE_ERROR; 514 #ifdef SOCLIB_MODULE_DEBUG515 std::cout << "vci_bd M_WRITE_ERROR" << std::endl;516 #endif517 512 } 518 513 else if ( r_block_count.read() == r_nblocks.read() - 1 ) 519 514 { 520 515 r_initiator_fsm = M_WRITE_SUCCESS; 521 #ifdef SOCLIB_MODULE_DEBUG522 std::cout << "vci_bd M_WRITE_SUCCESS" << std::endl;523 #endif524 516 } 525 517 else … … 693 685 (r_initiator_fsm == M_READ_ERROR) || 694 686 (r_initiator_fsm == M_WRITE_ERROR) ) && 695 r_irq_enable.read() ) { 696 #ifdef SOCLIB_MODULE_DEBUG 697 std::cout << "vci_bd send IRQ" << std::endl; 687 r_irq_enable.read() ) 688 { 689 690 #if DEBUG_BDEV 691 std::cout << " <BDEV_INI send IRQ>" << std::endl; 698 692 #endif 699 693 p_irq = true; 700 } else p_irq = false; 694 } 695 else 696 { 697 p_irq = false; 698 } 701 699 } // end GenMoore() 702 700 … … 817 815 } // end constructor 818 816 817 ///////////////////////////////// 819 818 tmpl(/**/)::~VciBlockDeviceTsar() 820 819 { … … 828 827 const char* initiator_str[] = 829 828 { 830 "I DLE",831 832 " READ_BLOCK",833 " READ_BURST",834 " READ_CMD",835 " READ_RSP",836 " READ_SUCCESS",837 " READ_ERROR",838 839 " WRITE_BURST",840 " WRITE_CMD",841 " WRITE_RSP",842 " WRITE_BLOCK",843 " WRITE_SUCCESS",844 " WRITE_ERROR",829 "INI_IDLE", 830 831 "INI_READ_BLOCK", 832 "INI_READ_BURST", 833 "INI_READ_CMD", 834 "INI_READ_RSP", 835 "INI_READ_SUCCESS", 836 "INI_READ_ERROR", 837 838 "INI_WRITE_BURST", 839 "INI_WRITE_CMD", 840 "INI_WRITE_RSP", 841 "INI_WRITE_BLOCK", 842 "INI_WRITE_SUCCESS", 843 "INI_WRITE_ERROR", 845 844 }; 846 845 const char* target_str[] = 847 846 { 848 " IDLE",849 " WRITE_BUFFER",850 " READ_BUFFER",851 " WRITE_BUFFER_EXT",852 " READ_BUFFER_EXT",853 " WRITE_COUNT",854 " READ_COUNT",855 " WRITE_LBA",856 " READ_LBA",857 " WRITE_OP",858 " READ_STATUS",859 " WRITE_IRQEN",860 " READ_IRQEN",861 " READ_SIZE",862 " READ_BLOCK",863 " READ_ERROR",864 " WRITE_ERROR ",847 "TGT_IDLE", 848 "TGT_WRITE_BUFFER", 849 "TGT_READ_BUFFER", 850 "TGT_WRITE_BUFFER_EXT", 851 "TGT_READ_BUFFER_EXT", 852 "TGT_WRITE_COUNT", 853 "TGT_READ_COUNT", 854 "TGT_WRITE_LBA", 855 "TGT_READ_LBA", 856 "TGT_WRITE_OP", 857 "TGT_READ_STATUS", 858 "TGT_WRITE_IRQEN", 859 "TGT_READ_IRQEN", 860 "TGT_READ_SIZE", 861 "TGT_READ_BLOCK", 862 "TGT_READ_ERROR", 863 "TGT_WRITE_ERROR ", 865 864 }; 866 865 867 std::cout << "BDEV_TGT : " << target_str[r_target_fsm.read()] 868 << " BDEV_INI : " << initiator_str[r_initiator_fsm.read()] 869 << " buf = " << std::hex << r_buf_address.read() 870 << " block = " << std::dec << r_block_count.read() 871 << " burst = " << r_burst_count.read() 872 << " word = " << r_words_count.read() <<std::endl; 866 std::cout << "BDEV " << name() 867 << " : " << target_str[r_target_fsm.read()] 868 << " / " << initiator_str[r_initiator_fsm.read()] 869 << " / buf = " << std::hex << r_buf_address.read() 870 << " / lba = " << std::hex << r_lba.read() 871 << " / block_count = " << std::dec << r_block_count.read() 872 << " / burst_count = " << r_burst_count.read() 873 << " / word_count = " << r_words_count.read() <<std::endl; 873 874 } 874 875
Note: See TracChangeset
for help on using the changeset viewer.