[151] | 1 | /* -*- c++ -*- |
---|
| 2 | * |
---|
| 3 | * SOCLIB_LGPL_HEADER_BEGIN |
---|
| 4 | * |
---|
| 5 | * This file is part of SoCLib, GNU LGPLv2.1. |
---|
| 6 | * |
---|
| 7 | * SoCLib is free software; you can redistribute it and/or modify it |
---|
| 8 | * under the terms of the GNU Lesser General Public License as published |
---|
| 9 | * by the Free Software Foundation; version 2.1 of the License. |
---|
| 10 | * |
---|
| 11 | * SoCLib is distributed in the hope that it will be useful, but |
---|
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 14 | * Lesser General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU Lesser General Public |
---|
| 17 | * License along with SoCLib; if not, write to the Free Software |
---|
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
---|
| 19 | * 02110-1301 USA |
---|
| 20 | * |
---|
| 21 | * SOCLIB_LGPL_HEADER_END |
---|
| 22 | * |
---|
| 23 | * Copyright (c) UPMC, Lip6, Asim |
---|
| 24 | * alain.greiner@lip6.fr april 2011 |
---|
| 25 | * |
---|
| 26 | * Maintainers: alain |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #include <stdint.h> |
---|
| 30 | #include <iostream> |
---|
| 31 | #include <fcntl.h> |
---|
[374] | 32 | #include "vci_block_device_tsar.h" |
---|
[599] | 33 | #include "block_device_tsar.h" |
---|
[151] | 34 | |
---|
[580] | 35 | #define DEBUG_BDEV 0 |
---|
| 36 | |
---|
[151] | 37 | namespace soclib { namespace caba { |
---|
| 38 | |
---|
[374] | 39 | #define tmpl(t) template<typename vci_param> t VciBlockDeviceTsar<vci_param> |
---|
[151] | 40 | |
---|
| 41 | using namespace soclib::caba; |
---|
| 42 | using namespace soclib::common; |
---|
| 43 | |
---|
| 44 | //////////////////////// |
---|
| 45 | tmpl(void)::transition() |
---|
| 46 | { |
---|
| 47 | if(p_resetn.read() == false) |
---|
| 48 | { |
---|
[392] | 49 | r_initiator_fsm = M_IDLE; |
---|
| 50 | r_target_fsm = T_IDLE; |
---|
| 51 | r_irq_enable = true; |
---|
| 52 | r_go = false; |
---|
[260] | 53 | return; |
---|
[151] | 54 | } |
---|
| 55 | |
---|
| 56 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 57 | // The Target FSM controls the following registers: |
---|
| 58 | // r_target_fsm, r_irq_enable, r_nblocks, r_buf adress, r_lba, r_go, r_read |
---|
| 59 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 60 | |
---|
| 61 | switch(r_target_fsm) { |
---|
[260] | 62 | //////////// |
---|
[151] | 63 | case T_IDLE: |
---|
| 64 | { |
---|
| 65 | if ( p_vci_target.cmdval.read() ) |
---|
| 66 | { |
---|
| 67 | r_srcid = p_vci_target.srcid.read(); |
---|
| 68 | r_trdid = p_vci_target.trdid.read(); |
---|
| 69 | r_pktid = p_vci_target.pktid.read(); |
---|
[260] | 70 | sc_dt::sc_uint<vci_param::N> address = p_vci_target.address.read(); |
---|
[408] | 71 | |
---|
| 72 | bool found = false; |
---|
| 73 | std::list<soclib::common::Segment>::iterator seg; |
---|
| 74 | for ( seg = m_seglist.begin() ; seg != m_seglist.end() ; seg++ ) |
---|
| 75 | { |
---|
| 76 | if ( seg->contains(address) ) found = true; |
---|
| 77 | } |
---|
| 78 | |
---|
[151] | 79 | bool read = (p_vci_target.cmd.read() == vci_param::CMD_READ); |
---|
[392] | 80 | uint32_t cell = (uint32_t)((address & 0x3F)>>2); |
---|
[151] | 81 | |
---|
[408] | 82 | if ( !read && not found ) r_target_fsm = T_WRITE_ERROR; |
---|
| 83 | else if( read && not found ) r_target_fsm = T_READ_ERROR; |
---|
| 84 | else if( !read && not p_vci_target.eop.read() ) r_target_fsm = T_WRITE_ERROR; |
---|
| 85 | else if( read && not p_vci_target.eop.read() ) r_target_fsm = T_READ_ERROR; |
---|
[260] | 86 | else if( !read && (cell == BLOCK_DEVICE_BUFFER) ) r_target_fsm = T_WRITE_BUFFER; |
---|
| 87 | else if( read && (cell == BLOCK_DEVICE_BUFFER) ) r_target_fsm = T_READ_BUFFER; |
---|
[392] | 88 | else if( !read && (cell == BLOCK_DEVICE_BUFFER_EXT) ) r_target_fsm = T_WRITE_BUFFER_EXT; |
---|
| 89 | else if( read && (cell == BLOCK_DEVICE_BUFFER_EXT) ) r_target_fsm = T_READ_BUFFER_EXT; |
---|
[260] | 90 | else if( !read && (cell == BLOCK_DEVICE_COUNT) ) r_target_fsm = T_WRITE_COUNT; |
---|
| 91 | else if( read && (cell == BLOCK_DEVICE_COUNT) ) r_target_fsm = T_READ_COUNT; |
---|
| 92 | else if( !read && (cell == BLOCK_DEVICE_LBA) ) r_target_fsm = T_WRITE_LBA; |
---|
| 93 | else if( read && (cell == BLOCK_DEVICE_LBA) ) r_target_fsm = T_READ_LBA; |
---|
| 94 | else if( !read && (cell == BLOCK_DEVICE_OP) ) r_target_fsm = T_WRITE_OP; |
---|
| 95 | else if( read && (cell == BLOCK_DEVICE_STATUS) ) r_target_fsm = T_READ_STATUS; |
---|
| 96 | else if( !read && (cell == BLOCK_DEVICE_IRQ_ENABLE) ) r_target_fsm = T_WRITE_IRQEN; |
---|
| 97 | else if( read && (cell == BLOCK_DEVICE_IRQ_ENABLE) ) r_target_fsm = T_READ_IRQEN; |
---|
| 98 | else if( read && (cell == BLOCK_DEVICE_SIZE) ) r_target_fsm = T_READ_SIZE; |
---|
| 99 | else if( read && (cell == BLOCK_DEVICE_BLOCK_SIZE) ) r_target_fsm = T_READ_BLOCK; |
---|
[580] | 100 | |
---|
| 101 | // get write data value for both 32 bits and 64 bits data width |
---|
| 102 | if( (vci_param::B == 8) and (p_vci_target.be.read() == 0xF0) ) |
---|
| 103 | r_tdata = (uint32_t)(p_vci_target.wdata.read()>>32); |
---|
| 104 | else |
---|
| 105 | r_tdata = p_vci_target.wdata.read(); |
---|
[151] | 106 | } |
---|
| 107 | break; |
---|
| 108 | } |
---|
[260] | 109 | //////////////////// |
---|
[151] | 110 | case T_WRITE_BUFFER: |
---|
| 111 | { |
---|
[580] | 112 | if (p_vci_target.rspack.read() ) |
---|
| 113 | { |
---|
[522] | 114 | if (r_initiator_fsm.read() == M_IDLE) |
---|
| 115 | { |
---|
[580] | 116 | |
---|
| 117 | #if DEBUG_BDEV |
---|
| 118 | std::cout << " <BDEV_TGT WRITE_BUFFER> value = " << r_tdata.read() << std::endl; |
---|
| 119 | #endif |
---|
[522] | 120 | r_buf_address = (uint64_t)r_tdata.read(); |
---|
| 121 | r_target_fsm = T_IDLE; |
---|
[580] | 122 | } |
---|
[392] | 123 | } |
---|
[151] | 124 | break; |
---|
| 125 | } |
---|
[392] | 126 | //////////////////////// |
---|
| 127 | case T_WRITE_BUFFER_EXT: |
---|
| 128 | { |
---|
[580] | 129 | if (p_vci_target.rspack.read() ) |
---|
| 130 | { |
---|
[522] | 131 | if (r_initiator_fsm.read() == M_IDLE) |
---|
| 132 | { |
---|
[580] | 133 | |
---|
| 134 | #if DEBUG_BDEV |
---|
| 135 | std::cout << " <BDEV_TGT WRITE_BUFFER_EXT> value = " << r_tdata.read() << std::endl; |
---|
| 136 | #endif |
---|
| 137 | r_buf_address = r_buf_address.read() + (((uint64_t)r_tdata.read())<<32); |
---|
[522] | 138 | r_target_fsm = T_IDLE; |
---|
[580] | 139 | } |
---|
[392] | 140 | } |
---|
| 141 | break; |
---|
| 142 | } |
---|
[260] | 143 | /////////////////// |
---|
[151] | 144 | case T_WRITE_COUNT: |
---|
| 145 | { |
---|
[580] | 146 | if (p_vci_target.rspack.read() ) |
---|
| 147 | { |
---|
[522] | 148 | if (r_initiator_fsm.read() == M_IDLE) |
---|
| 149 | { |
---|
[580] | 150 | |
---|
| 151 | #if DEBUG_BDEV |
---|
| 152 | std::cout << " <BDEV_TGT WRITE_COUNT> value = " << r_tdata.read() << std::endl; |
---|
| 153 | #endif |
---|
[522] | 154 | r_nblocks = (uint32_t)r_tdata.read(); |
---|
| 155 | r_target_fsm = T_IDLE; |
---|
| 156 | } |
---|
[580] | 157 | } |
---|
[151] | 158 | break; |
---|
| 159 | } |
---|
[260] | 160 | ///////////////// |
---|
[151] | 161 | case T_WRITE_LBA: |
---|
| 162 | { |
---|
[580] | 163 | if (p_vci_target.rspack.read() ) |
---|
| 164 | { |
---|
| 165 | if (r_initiator_fsm.read() == M_IDLE) |
---|
| 166 | { |
---|
| 167 | |
---|
| 168 | #if DEBUG_BDEV |
---|
| 169 | std::cout << " <BDEV_TGT WRITE_LBA> value = " << r_tdata.read() << std::endl; |
---|
[522] | 170 | #endif |
---|
| 171 | r_lba = (uint32_t)r_tdata.read(); |
---|
| 172 | r_target_fsm = T_IDLE; |
---|
| 173 | } |
---|
[580] | 174 | } |
---|
[151] | 175 | break; |
---|
| 176 | } |
---|
[260] | 177 | //////////////// |
---|
[151] | 178 | case T_WRITE_OP: |
---|
| 179 | { |
---|
[392] | 180 | if ( p_vci_target.rspack.read() ) |
---|
[151] | 181 | { |
---|
[522] | 182 | if ( ((uint32_t)r_tdata.read() == BLOCK_DEVICE_READ) and |
---|
[392] | 183 | (r_initiator_fsm.read() == M_IDLE) ) |
---|
[151] | 184 | { |
---|
[580] | 185 | |
---|
| 186 | #if DEBUG_BDEV |
---|
| 187 | std::cout << " <BDEV_TGT WRITE_LBA> value = READ" << std::endl; |
---|
| 188 | #endif |
---|
[151] | 189 | r_read = true; |
---|
[392] | 190 | r_go = true; |
---|
[151] | 191 | } |
---|
[522] | 192 | else if ( ((uint32_t)r_tdata.read() == BLOCK_DEVICE_WRITE) and |
---|
[392] | 193 | (r_initiator_fsm.read() == M_IDLE) ) |
---|
[151] | 194 | { |
---|
[580] | 195 | |
---|
| 196 | #if DEBUG_BDEV |
---|
| 197 | std::cout << " <BDEV_TGT WRITE_LBA> value = WRITE" << std::endl; |
---|
| 198 | #endif |
---|
[151] | 199 | r_read = false; |
---|
[392] | 200 | r_go = true; |
---|
[151] | 201 | } |
---|
[392] | 202 | else |
---|
| 203 | { |
---|
[580] | 204 | |
---|
| 205 | #if DEBUG_BDEV |
---|
| 206 | std::cout << " <BDEV_TGT WRITE_LBA> value = SOFT RESET" << std::endl; |
---|
| 207 | #endif |
---|
[392] | 208 | r_go = false; |
---|
| 209 | } |
---|
| 210 | r_target_fsm = T_IDLE; |
---|
[151] | 211 | } |
---|
| 212 | break; |
---|
| 213 | } |
---|
[260] | 214 | /////////////////// |
---|
[151] | 215 | case T_WRITE_IRQEN: |
---|
| 216 | { |
---|
[392] | 217 | if ( p_vci_target.rspack.read() ) |
---|
| 218 | { |
---|
[580] | 219 | |
---|
| 220 | #if DEBUG_BDEV |
---|
| 221 | std::cout << " <BDEV_TGT WRITE_IRQEN> value = " << r_tdata.read() << std::endl; |
---|
[522] | 222 | #endif |
---|
[392] | 223 | r_target_fsm = T_IDLE; |
---|
[522] | 224 | r_irq_enable = (r_tdata.read() != 0); |
---|
[392] | 225 | } |
---|
[151] | 226 | break; |
---|
| 227 | } |
---|
[260] | 228 | /////////////////// |
---|
[151] | 229 | case T_READ_BUFFER: |
---|
[392] | 230 | case T_READ_BUFFER_EXT: |
---|
[151] | 231 | case T_READ_COUNT: |
---|
| 232 | case T_READ_LBA: |
---|
| 233 | case T_READ_IRQEN: |
---|
| 234 | case T_READ_SIZE: |
---|
| 235 | case T_READ_BLOCK: |
---|
| 236 | case T_READ_ERROR: |
---|
| 237 | case T_WRITE_ERROR: |
---|
| 238 | { |
---|
| 239 | if ( p_vci_target.rspack.read() ) r_target_fsm = T_IDLE; |
---|
| 240 | break; |
---|
| 241 | } |
---|
[260] | 242 | /////////////////// |
---|
[151] | 243 | case T_READ_STATUS: |
---|
| 244 | { |
---|
| 245 | if ( p_vci_target.rspack.read() ) |
---|
| 246 | { |
---|
| 247 | r_target_fsm = T_IDLE; |
---|
| 248 | if( (r_initiator_fsm == M_READ_SUCCESS ) || |
---|
| 249 | (r_initiator_fsm == M_READ_ERROR ) || |
---|
| 250 | (r_initiator_fsm == M_WRITE_SUCCESS) || |
---|
| 251 | (r_initiator_fsm == M_WRITE_ERROR ) ) r_go = false; |
---|
| 252 | } |
---|
| 253 | break; |
---|
| 254 | } |
---|
| 255 | } // end switch target fsm |
---|
| 256 | |
---|
[260] | 257 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 258 | // The initiator FSM executes a loop, transfering one block per iteration. |
---|
| 259 | // Each block is split in bursts, and the number of bursts depends |
---|
| 260 | // on the memory buffer alignment on a burst boundary: |
---|
[400] | 261 | // - If buffer aligned, all burst have the same length (m_words_per burst) |
---|
[260] | 262 | // and the number of bursts is (m_bursts_per_block). |
---|
| 263 | // - If buffer not aligned, the number of bursts is (m_bursts_per_block + 1) |
---|
[400] | 264 | // and first and last burst are shorter, because all words in a burst |
---|
[260] | 265 | // must be contained in a single cache line. |
---|
[400] | 266 | // first burst => nwords = m_words_per_burst - offset |
---|
| 267 | // last burst => nwords = offset |
---|
| 268 | // other burst => nwords = m_words_per_burst |
---|
[260] | 269 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 270 | |
---|
| 271 | switch( r_initiator_fsm.read() ) { |
---|
| 272 | //////////// |
---|
| 273 | case M_IDLE: // check buffer alignment to compute the number of bursts |
---|
[151] | 274 | { |
---|
[260] | 275 | if ( r_go.read() ) |
---|
[151] | 276 | { |
---|
[260] | 277 | r_index = 0; |
---|
[151] | 278 | r_block_count = 0; |
---|
| 279 | r_burst_count = 0; |
---|
[433] | 280 | r_words_count = 0; |
---|
[151] | 281 | r_latency_count = m_latency; |
---|
| 282 | |
---|
[260] | 283 | // compute r_burst_offset (zero when buffer aligned) |
---|
[400] | 284 | r_burst_offset = (uint32_t)((r_buf_address.read()>>2) % m_words_per_burst); |
---|
[260] | 285 | |
---|
| 286 | // start tranfer |
---|
| 287 | if ( r_read.read() ) r_initiator_fsm = M_READ_BLOCK; |
---|
| 288 | else r_initiator_fsm = M_WRITE_BURST; |
---|
[151] | 289 | } |
---|
| 290 | break; |
---|
[260] | 291 | } |
---|
| 292 | ////////////////// |
---|
[228] | 293 | case M_READ_BLOCK: // read one block from disk after waiting m_latency cycles |
---|
[151] | 294 | { |
---|
[260] | 295 | if ( r_latency_count.read() == 0 ) |
---|
[151] | 296 | { |
---|
| 297 | r_latency_count = m_latency; |
---|
[400] | 298 | ::lseek(m_fd, (r_lba + r_block_count)*m_words_per_block*4, SEEK_SET); |
---|
| 299 | if( ::read(m_fd, r_local_buffer, m_words_per_block*4) < 0 ) |
---|
[151] | 300 | { |
---|
[260] | 301 | r_initiator_fsm = M_READ_ERROR; |
---|
[151] | 302 | } |
---|
| 303 | else |
---|
| 304 | { |
---|
[260] | 305 | r_burst_count = 0; |
---|
[580] | 306 | r_words_count = 0; |
---|
[260] | 307 | r_initiator_fsm = M_READ_BURST; |
---|
[151] | 308 | } |
---|
| 309 | } |
---|
| 310 | else |
---|
| 311 | { |
---|
[260] | 312 | r_latency_count = r_latency_count.read() - 1; |
---|
[151] | 313 | } |
---|
| 314 | break; |
---|
| 315 | } |
---|
[260] | 316 | ////////////////// |
---|
[400] | 317 | case M_READ_BURST: // Compute the number of words and the number of flits in the burst |
---|
| 318 | // The number of flits can be smaller than the number of words |
---|
| 319 | // in case of 8 bytes flits... |
---|
[151] | 320 | { |
---|
[400] | 321 | uint32_t nwords; |
---|
[260] | 322 | uint32_t offset = r_burst_offset.read(); |
---|
| 323 | |
---|
| 324 | if ( offset ) // buffer not aligned |
---|
| 325 | { |
---|
[400] | 326 | if ( r_burst_count.read() == 0 ) nwords = m_words_per_burst - offset; |
---|
| 327 | else if ( r_burst_count.read() == m_bursts_per_block ) nwords = offset; |
---|
| 328 | else nwords = m_words_per_burst; |
---|
[260] | 329 | } |
---|
| 330 | else // buffer aligned |
---|
| 331 | { |
---|
[400] | 332 | nwords = m_words_per_burst; |
---|
[260] | 333 | } |
---|
[400] | 334 | |
---|
| 335 | r_burst_nwords = nwords; |
---|
| 336 | r_initiator_fsm = M_READ_CMD; |
---|
[260] | 337 | break; |
---|
| 338 | } |
---|
| 339 | //////////////// |
---|
| 340 | case M_READ_CMD: // Send a multi-flits VCI WRITE command |
---|
| 341 | { |
---|
[151] | 342 | if ( p_vci_initiator.cmdack.read() ) |
---|
| 343 | { |
---|
[400] | 344 | uint32_t nwords = r_burst_nwords.read() - r_words_count.read(); |
---|
| 345 | |
---|
| 346 | if ( vci_param::B == 4 ) // one word per flit |
---|
[151] | 347 | { |
---|
[400] | 348 | if ( nwords <= 1 ) // last flit |
---|
| 349 | { |
---|
| 350 | r_initiator_fsm = M_READ_RSP; |
---|
| 351 | r_words_count = 0; |
---|
| 352 | } |
---|
| 353 | else // not the last flit |
---|
| 354 | { |
---|
| 355 | r_words_count = r_words_count.read() + 1; |
---|
| 356 | } |
---|
| 357 | |
---|
| 358 | // compute next word address and next local buffer index |
---|
| 359 | r_buf_address = r_buf_address.read() + 4; |
---|
| 360 | r_index = r_index.read() + 1; |
---|
[151] | 361 | } |
---|
[400] | 362 | else // 2 words per flit |
---|
[151] | 363 | { |
---|
[400] | 364 | if ( nwords <= 2 ) // last flit |
---|
| 365 | { |
---|
| 366 | r_initiator_fsm = M_READ_RSP; |
---|
| 367 | r_words_count = 0; |
---|
| 368 | } |
---|
| 369 | else // not the last flit |
---|
| 370 | { |
---|
| 371 | r_words_count = r_words_count.read() + 2; |
---|
| 372 | } |
---|
| 373 | |
---|
| 374 | // compute next word address and next local buffer index |
---|
| 375 | if ( nwords == 1 ) |
---|
| 376 | { |
---|
| 377 | r_buf_address = r_buf_address.read() + 4; |
---|
| 378 | r_index = r_index.read() + 1; |
---|
| 379 | } |
---|
| 380 | else |
---|
| 381 | { |
---|
| 382 | r_buf_address = r_buf_address.read() + 8; |
---|
| 383 | r_index = r_index.read() + 2; |
---|
| 384 | } |
---|
[151] | 385 | } |
---|
| 386 | } |
---|
| 387 | break; |
---|
| 388 | } |
---|
[260] | 389 | //////////////// |
---|
| 390 | case M_READ_RSP: // Wait a single flit VCI WRITE response |
---|
[151] | 391 | { |
---|
| 392 | if ( p_vci_initiator.rspval.read() ) |
---|
| 393 | { |
---|
[260] | 394 | bool aligned = (r_burst_offset.read() == 0); |
---|
| 395 | |
---|
| 396 | if ( (p_vci_initiator.rerror.read()&0x1) != 0 ) |
---|
[151] | 397 | { |
---|
[260] | 398 | r_initiator_fsm = M_READ_ERROR; |
---|
[151] | 399 | } |
---|
[260] | 400 | else if ( (not aligned and (r_burst_count.read() == m_bursts_per_block)) or |
---|
| 401 | (aligned and (r_burst_count.read() == (m_bursts_per_block-1))) ) |
---|
[151] | 402 | { |
---|
[260] | 403 | if ( r_block_count.read() == (r_nblocks.read()-1) ) // last burst of last block |
---|
| 404 | { |
---|
| 405 | r_initiator_fsm = M_READ_SUCCESS; |
---|
| 406 | } |
---|
| 407 | else // last burst not last block |
---|
| 408 | { |
---|
| 409 | r_index = 0; |
---|
| 410 | r_burst_count = 0; |
---|
| 411 | r_block_count = r_block_count.read() + 1; |
---|
| 412 | r_initiator_fsm = M_READ_BLOCK; |
---|
| 413 | } |
---|
[151] | 414 | } |
---|
[260] | 415 | else // not the last burst |
---|
| 416 | { |
---|
| 417 | r_burst_count = r_burst_count.read() + 1; |
---|
| 418 | r_initiator_fsm = M_READ_BURST; |
---|
| 419 | } |
---|
[151] | 420 | } |
---|
| 421 | break; |
---|
| 422 | } |
---|
[260] | 423 | /////////////////// |
---|
[151] | 424 | case M_READ_SUCCESS: |
---|
[260] | 425 | case M_READ_ERROR: |
---|
[151] | 426 | { |
---|
| 427 | if( !r_go ) r_initiator_fsm = M_IDLE; |
---|
| 428 | break; |
---|
| 429 | } |
---|
[260] | 430 | /////////////////// |
---|
[400] | 431 | case M_WRITE_BURST: // Compute the number of words in the burst |
---|
[151] | 432 | { |
---|
[400] | 433 | uint32_t nwords; |
---|
[260] | 434 | uint32_t offset = r_burst_offset.read(); |
---|
| 435 | |
---|
| 436 | if ( offset ) // buffer not aligned |
---|
| 437 | { |
---|
[400] | 438 | if ( r_burst_count.read() == 0 ) nwords = m_words_per_burst - offset; |
---|
| 439 | else if ( r_burst_count.read() == m_bursts_per_block ) nwords = offset; |
---|
| 440 | else nwords = m_words_per_burst; |
---|
[260] | 441 | } |
---|
| 442 | else // buffer aligned |
---|
| 443 | { |
---|
[400] | 444 | nwords = m_words_per_burst; |
---|
[260] | 445 | } |
---|
[400] | 446 | |
---|
| 447 | r_burst_nwords = nwords; |
---|
[260] | 448 | r_initiator_fsm = M_WRITE_CMD; |
---|
[151] | 449 | break; |
---|
| 450 | } |
---|
[260] | 451 | ///////////////// |
---|
[151] | 452 | case M_WRITE_CMD: // This is actually a single flit VCI READ command |
---|
| 453 | { |
---|
[228] | 454 | if ( p_vci_initiator.cmdack.read() ) r_initiator_fsm = M_WRITE_RSP; |
---|
[151] | 455 | break; |
---|
| 456 | } |
---|
[260] | 457 | ///////////////// |
---|
[400] | 458 | case M_WRITE_RSP: // This is actually a multi-words VCI READ response |
---|
[151] | 459 | { |
---|
| 460 | if ( p_vci_initiator.rspval.read() ) |
---|
| 461 | { |
---|
[400] | 462 | bool aligned = (r_burst_offset.read() == 0); |
---|
[260] | 463 | |
---|
[400] | 464 | if ( (vci_param::B == 8) and (r_burst_nwords.read() > 1) ) |
---|
| 465 | { |
---|
| 466 | r_local_buffer[r_index.read()] = (uint32_t)p_vci_initiator.rdata.read(); |
---|
| 467 | r_local_buffer[r_index.read()+1] = (uint32_t)(p_vci_initiator.rdata.read()>>32); |
---|
| 468 | r_index = r_index.read() + 2; |
---|
| 469 | } |
---|
| 470 | else |
---|
| 471 | { |
---|
| 472 | r_local_buffer[r_index.read()] = (uint32_t)p_vci_initiator.rdata.read(); |
---|
| 473 | r_index = r_index.read() + 1; |
---|
| 474 | } |
---|
| 475 | |
---|
[260] | 476 | if ( p_vci_initiator.reop.read() ) // last flit of the burst |
---|
[151] | 477 | { |
---|
[400] | 478 | r_words_count = 0; |
---|
| 479 | r_buf_address = r_buf_address.read() + (r_burst_nwords.read()<<2); |
---|
[260] | 480 | |
---|
[392] | 481 | if( (p_vci_initiator.rerror.read()&0x1) != 0 ) |
---|
[260] | 482 | { |
---|
| 483 | r_initiator_fsm = M_WRITE_ERROR; |
---|
| 484 | } |
---|
| 485 | else if ( (not aligned and (r_burst_count.read() == m_bursts_per_block)) or |
---|
[400] | 486 | (aligned and (r_burst_count.read() == (m_bursts_per_block-1))) ) // last burst |
---|
[260] | 487 | { |
---|
| 488 | r_initiator_fsm = M_WRITE_BLOCK; |
---|
| 489 | } |
---|
| 490 | else // not the last burst |
---|
| 491 | { |
---|
| 492 | r_burst_count = r_burst_count.read() + 1; |
---|
| 493 | r_initiator_fsm = M_WRITE_BURST; |
---|
| 494 | } |
---|
[151] | 495 | } |
---|
| 496 | else |
---|
| 497 | { |
---|
[400] | 498 | r_words_count = r_words_count.read() + 1; |
---|
[151] | 499 | } |
---|
| 500 | } |
---|
| 501 | break; |
---|
| 502 | } |
---|
[260] | 503 | /////////////////// |
---|
[151] | 504 | case M_WRITE_BLOCK: // write a block to disk after waiting m_latency cycles |
---|
| 505 | { |
---|
| 506 | if ( r_latency_count == 0 ) |
---|
| 507 | { |
---|
| 508 | r_latency_count = m_latency; |
---|
[581] | 509 | ::lseek(m_fd, (r_lba + r_block_count)*m_words_per_block*4, SEEK_SET); |
---|
| 510 | if( ::write(m_fd, r_local_buffer, m_words_per_block*4) < 0 ) |
---|
[151] | 511 | { |
---|
| 512 | r_initiator_fsm = M_WRITE_ERROR; |
---|
| 513 | } |
---|
[272] | 514 | else if ( r_block_count.read() == r_nblocks.read() - 1 ) |
---|
[151] | 515 | { |
---|
| 516 | r_initiator_fsm = M_WRITE_SUCCESS; |
---|
| 517 | } |
---|
| 518 | else |
---|
| 519 | { |
---|
[272] | 520 | r_burst_count = 0; |
---|
[400] | 521 | r_index = 0; |
---|
[272] | 522 | r_block_count = r_block_count.read() + 1; |
---|
[400] | 523 | r_initiator_fsm = M_WRITE_BURST; |
---|
[151] | 524 | } |
---|
| 525 | } |
---|
| 526 | else |
---|
| 527 | { |
---|
| 528 | r_latency_count = r_latency_count - 1; |
---|
| 529 | } |
---|
| 530 | break; |
---|
| 531 | } |
---|
[260] | 532 | ///////////////////// |
---|
[151] | 533 | case M_WRITE_SUCCESS: |
---|
| 534 | case M_WRITE_ERROR: |
---|
| 535 | { |
---|
| 536 | if( !r_go ) r_initiator_fsm = M_IDLE; |
---|
| 537 | break; |
---|
| 538 | } |
---|
| 539 | } // end switch r_initiator_fsm |
---|
| 540 | } // end transition |
---|
| 541 | |
---|
| 542 | ////////////////////// |
---|
| 543 | tmpl(void)::genMoore() |
---|
| 544 | { |
---|
| 545 | // p_vci_target port |
---|
[164] | 546 | p_vci_target.rsrcid = (sc_dt::sc_uint<vci_param::S>)r_srcid.read(); |
---|
| 547 | p_vci_target.rtrdid = (sc_dt::sc_uint<vci_param::T>)r_trdid.read(); |
---|
| 548 | p_vci_target.rpktid = (sc_dt::sc_uint<vci_param::P>)r_pktid.read(); |
---|
[151] | 549 | p_vci_target.reop = true; |
---|
| 550 | |
---|
| 551 | switch(r_target_fsm) { |
---|
| 552 | case T_IDLE: |
---|
| 553 | p_vci_target.cmdack = true; |
---|
[260] | 554 | p_vci_target.rspval = false; |
---|
[514] | 555 | p_vci_target.rdata = 0; |
---|
[151] | 556 | break; |
---|
| 557 | case T_READ_STATUS: |
---|
| 558 | p_vci_target.cmdack = false; |
---|
[260] | 559 | p_vci_target.rspval = true; |
---|
| 560 | if (r_initiator_fsm == M_IDLE) p_vci_target.rdata = BLOCK_DEVICE_IDLE; |
---|
| 561 | else if(r_initiator_fsm == M_READ_SUCCESS) p_vci_target.rdata = BLOCK_DEVICE_READ_SUCCESS; |
---|
| 562 | else if(r_initiator_fsm == M_WRITE_SUCCESS) p_vci_target.rdata = BLOCK_DEVICE_WRITE_SUCCESS; |
---|
[151] | 563 | else if(r_initiator_fsm == M_READ_ERROR) p_vci_target.rdata = BLOCK_DEVICE_READ_ERROR; |
---|
| 564 | else if(r_initiator_fsm == M_WRITE_ERROR) p_vci_target.rdata = BLOCK_DEVICE_WRITE_ERROR; |
---|
| 565 | else p_vci_target.rdata = BLOCK_DEVICE_BUSY; |
---|
| 566 | p_vci_target.rerror = VCI_READ_OK; |
---|
| 567 | break; |
---|
| 568 | case T_READ_BUFFER: |
---|
| 569 | p_vci_target.cmdack = false; |
---|
[260] | 570 | p_vci_target.rspval = true; |
---|
| 571 | p_vci_target.rdata = (uint32_t)r_buf_address.read(); |
---|
[151] | 572 | p_vci_target.rerror = VCI_READ_OK; |
---|
| 573 | break; |
---|
[392] | 574 | case T_READ_BUFFER_EXT: |
---|
| 575 | p_vci_target.cmdack = false; |
---|
| 576 | p_vci_target.rspval = true; |
---|
| 577 | p_vci_target.rdata = (uint32_t)(r_buf_address.read()>>32); |
---|
| 578 | p_vci_target.rerror = VCI_READ_OK; |
---|
| 579 | break; |
---|
[151] | 580 | case T_READ_COUNT: |
---|
| 581 | p_vci_target.cmdack = false; |
---|
[260] | 582 | p_vci_target.rspval = true; |
---|
[400] | 583 | p_vci_target.rdata = r_nblocks.read(); |
---|
[151] | 584 | p_vci_target.rerror = VCI_READ_OK; |
---|
| 585 | break; |
---|
| 586 | case T_READ_LBA: |
---|
| 587 | p_vci_target.cmdack = false; |
---|
[260] | 588 | p_vci_target.rspval = true; |
---|
[400] | 589 | p_vci_target.rdata = r_lba.read(); |
---|
[151] | 590 | p_vci_target.rerror = VCI_READ_OK; |
---|
| 591 | break; |
---|
| 592 | case T_READ_IRQEN: |
---|
| 593 | p_vci_target.cmdack = false; |
---|
[260] | 594 | p_vci_target.rspval = true; |
---|
[400] | 595 | p_vci_target.rdata = r_irq_enable.read(); |
---|
[151] | 596 | p_vci_target.rerror = VCI_READ_OK; |
---|
| 597 | break; |
---|
| 598 | case T_READ_SIZE: |
---|
| 599 | p_vci_target.cmdack = false; |
---|
[260] | 600 | p_vci_target.rspval = true; |
---|
[400] | 601 | p_vci_target.rdata = m_device_size; |
---|
[151] | 602 | p_vci_target.rerror = VCI_READ_OK; |
---|
| 603 | break; |
---|
| 604 | case T_READ_BLOCK: |
---|
| 605 | p_vci_target.cmdack = false; |
---|
[260] | 606 | p_vci_target.rspval = true; |
---|
[451] | 607 | p_vci_target.rdata = m_words_per_block*4; |
---|
[151] | 608 | p_vci_target.rerror = VCI_READ_OK; |
---|
| 609 | break; |
---|
| 610 | case T_READ_ERROR: |
---|
| 611 | p_vci_target.cmdack = false; |
---|
[260] | 612 | p_vci_target.rspval = true; |
---|
[400] | 613 | p_vci_target.rdata = 0; |
---|
[151] | 614 | p_vci_target.rerror = VCI_READ_ERROR; |
---|
| 615 | break; |
---|
| 616 | case T_WRITE_ERROR: |
---|
| 617 | p_vci_target.cmdack = false; |
---|
[260] | 618 | p_vci_target.rspval = true; |
---|
[400] | 619 | p_vci_target.rdata = 0; |
---|
[151] | 620 | p_vci_target.rerror = VCI_WRITE_ERROR; |
---|
| 621 | break; |
---|
| 622 | default: |
---|
| 623 | p_vci_target.cmdack = false; |
---|
| 624 | p_vci_target.rspval = true; |
---|
[400] | 625 | p_vci_target.rdata = 0; |
---|
[151] | 626 | p_vci_target.rerror = VCI_WRITE_OK; |
---|
| 627 | break; |
---|
| 628 | } // end switch target fsm |
---|
| 629 | |
---|
| 630 | // p_vci_initiator port |
---|
[164] | 631 | p_vci_initiator.srcid = (sc_dt::sc_uint<vci_param::S>)m_srcid; |
---|
[151] | 632 | p_vci_initiator.trdid = 0; |
---|
| 633 | p_vci_initiator.contig = true; |
---|
| 634 | p_vci_initiator.cons = false; |
---|
| 635 | p_vci_initiator.wrap = false; |
---|
| 636 | p_vci_initiator.cfixed = false; |
---|
| 637 | p_vci_initiator.clen = 0; |
---|
| 638 | |
---|
| 639 | switch (r_initiator_fsm) { |
---|
[401] | 640 | case M_WRITE_CMD: // It is actually a single flit VCI read command |
---|
[151] | 641 | p_vci_initiator.rspack = false; |
---|
| 642 | p_vci_initiator.cmdval = true; |
---|
[260] | 643 | p_vci_initiator.address = (sc_dt::sc_uint<vci_param::N>)r_buf_address.read(); |
---|
[151] | 644 | p_vci_initiator.cmd = vci_param::CMD_READ; |
---|
[401] | 645 | p_vci_initiator.pktid = TYPE_READ_DATA_UNC; |
---|
[151] | 646 | p_vci_initiator.wdata = 0; |
---|
[401] | 647 | p_vci_initiator.be = 0; |
---|
[400] | 648 | p_vci_initiator.plen = (sc_dt::sc_uint<vci_param::K>)(r_burst_nwords.read()<<2); |
---|
[151] | 649 | p_vci_initiator.eop = true; |
---|
| 650 | break; |
---|
[400] | 651 | case M_READ_CMD: // It is actually a multi-words VCI WRITE command |
---|
[151] | 652 | p_vci_initiator.rspack = false; |
---|
| 653 | p_vci_initiator.cmdval = true; |
---|
[260] | 654 | p_vci_initiator.address = (sc_dt::sc_uint<vci_param::N>)r_buf_address.read(); |
---|
[151] | 655 | p_vci_initiator.cmd = vci_param::CMD_WRITE; |
---|
[284] | 656 | p_vci_initiator.pktid = TYPE_WRITE; |
---|
[400] | 657 | p_vci_initiator.plen = (sc_dt::sc_uint<vci_param::K>)(r_burst_nwords.read()<<2); |
---|
[401] | 658 | if ( (vci_param::B == 8) and ((r_burst_nwords.read() - r_words_count.read()) > 1) ) |
---|
| 659 | { |
---|
[424] | 660 | p_vci_initiator.wdata = ((uint64_t)r_local_buffer[r_index.read() ]) + |
---|
| 661 | (((uint64_t)r_local_buffer[r_index.read()+1]) << 32); |
---|
[401] | 662 | p_vci_initiator.be = 0xFF; |
---|
[433] | 663 | p_vci_initiator.eop = ( (r_burst_nwords.read() - r_words_count.read()) <= 2 ); |
---|
[401] | 664 | } |
---|
| 665 | else |
---|
| 666 | { |
---|
| 667 | p_vci_initiator.wdata = r_local_buffer[r_index.read()]; |
---|
| 668 | p_vci_initiator.be = 0xF; |
---|
[433] | 669 | p_vci_initiator.eop = ( r_words_count.read() == (r_burst_nwords.read() - 1) ); |
---|
[401] | 670 | } |
---|
[151] | 671 | break; |
---|
| 672 | case M_READ_RSP: |
---|
| 673 | case M_WRITE_RSP: |
---|
| 674 | p_vci_initiator.rspack = true; |
---|
| 675 | p_vci_initiator.cmdval = false; |
---|
[260] | 676 | break; |
---|
[151] | 677 | default: |
---|
[260] | 678 | p_vci_initiator.rspack = false; |
---|
| 679 | p_vci_initiator.cmdval = false; |
---|
| 680 | break; |
---|
[151] | 681 | } |
---|
| 682 | |
---|
| 683 | // IRQ signal |
---|
[433] | 684 | if ( ((r_initiator_fsm == M_READ_SUCCESS) || |
---|
| 685 | (r_initiator_fsm == M_WRITE_SUCCESS) || |
---|
| 686 | (r_initiator_fsm == M_READ_ERROR) || |
---|
| 687 | (r_initiator_fsm == M_WRITE_ERROR) ) && |
---|
[580] | 688 | r_irq_enable.read() ) |
---|
| 689 | { |
---|
| 690 | |
---|
| 691 | #if DEBUG_BDEV |
---|
| 692 | std::cout << " <BDEV_INI send IRQ>" << std::endl; |
---|
[522] | 693 | #endif |
---|
| 694 | p_irq = true; |
---|
[580] | 695 | } |
---|
| 696 | else |
---|
| 697 | { |
---|
| 698 | p_irq = false; |
---|
| 699 | } |
---|
[151] | 700 | } // end GenMoore() |
---|
| 701 | |
---|
| 702 | ////////////////////////////////////////////////////////////////////////////// |
---|
[374] | 703 | tmpl(/**/)::VciBlockDeviceTsar( sc_core::sc_module_name name, |
---|
[400] | 704 | const soclib::common::MappingTable &mt, |
---|
| 705 | const soclib::common::IntTab &srcid, |
---|
| 706 | const soclib::common::IntTab &tgtid, |
---|
| 707 | const std::string &filename, |
---|
| 708 | const uint32_t block_size, |
---|
| 709 | const uint32_t burst_size, |
---|
| 710 | const uint32_t latency) |
---|
[151] | 711 | |
---|
| 712 | : caba::BaseModule(name), |
---|
[408] | 713 | m_seglist(mt.getSegmentList(tgtid)), |
---|
[151] | 714 | m_srcid(mt.indexForId(srcid)), |
---|
[400] | 715 | m_words_per_block(block_size/4), |
---|
| 716 | m_words_per_burst(burst_size/4), |
---|
[151] | 717 | m_bursts_per_block(block_size/burst_size), |
---|
| 718 | m_latency(latency), |
---|
| 719 | p_clk("p_clk"), |
---|
| 720 | p_resetn("p_resetn"), |
---|
| 721 | p_vci_initiator("p_vci_initiator"), |
---|
| 722 | p_vci_target("p_vci_target"), |
---|
| 723 | p_irq("p_irq") |
---|
| 724 | { |
---|
[433] | 725 | std::cout << " - Building VciBlockDeviceTsar " << name << std::endl; |
---|
| 726 | |
---|
[151] | 727 | SC_METHOD(transition); |
---|
[381] | 728 | dont_initialize(); |
---|
| 729 | sensitive << p_clk.pos(); |
---|
[151] | 730 | |
---|
| 731 | SC_METHOD(genMoore); |
---|
[381] | 732 | dont_initialize(); |
---|
| 733 | sensitive << p_clk.neg(); |
---|
[151] | 734 | |
---|
[409] | 735 | size_t nbsegs = 0; |
---|
[408] | 736 | std::list<soclib::common::Segment>::iterator seg; |
---|
| 737 | for ( seg = m_seglist.begin() ; seg != m_seglist.end() ; seg++ ) |
---|
| 738 | { |
---|
[409] | 739 | nbsegs++; |
---|
[408] | 740 | |
---|
| 741 | if ( (seg->baseAddress() & 0x0000003F) != 0 ) |
---|
| 742 | { |
---|
| 743 | std::cout << "Error in component VciBlockDeviceTsar : " << name |
---|
| 744 | << "The base address of segment " << seg->name() |
---|
| 745 | << " must be multiple of 64 bytes" << std::endl; |
---|
| 746 | exit(1); |
---|
| 747 | } |
---|
| 748 | if ( seg->size() < 64 ) |
---|
| 749 | { |
---|
| 750 | std::cout << "Error in component VciBlockDeviceTsar : " << name |
---|
| 751 | << "The size of segment " << seg->name() |
---|
| 752 | << " cannot be smaller than 64 bytes" << std::endl; |
---|
| 753 | exit(1); |
---|
| 754 | } |
---|
[433] | 755 | std::cout << " => segment " << seg->name() |
---|
| 756 | << " / base = " << std::hex << seg->baseAddress() |
---|
| 757 | << " / size = " << seg->size() << std::endl; |
---|
[408] | 758 | } |
---|
| 759 | |
---|
[409] | 760 | if( nbsegs == 0 ) |
---|
[408] | 761 | { |
---|
| 762 | std::cout << "Error in component VciBlockDeviceTsar : " << name |
---|
| 763 | << " No segment allocated" << std::endl; |
---|
| 764 | exit(1); |
---|
| 765 | } |
---|
| 766 | |
---|
[400] | 767 | if( (block_size != 128) && |
---|
[256] | 768 | (block_size != 256) && |
---|
| 769 | (block_size != 512) && |
---|
| 770 | (block_size != 1024) && |
---|
| 771 | (block_size != 2048) && |
---|
| 772 | (block_size != 4096) ) |
---|
[151] | 773 | { |
---|
[408] | 774 | std::cout << "Error in component VciBlockDeviceTsar : " << name |
---|
| 775 | << " The block size must be 128, 256, 512, 1024, 2048 or 4096 bytes" |
---|
| 776 | << std::endl; |
---|
[151] | 777 | exit(1); |
---|
| 778 | } |
---|
[408] | 779 | |
---|
[433] | 780 | if( (burst_size != 8 ) && |
---|
[260] | 781 | (burst_size != 16) && |
---|
| 782 | (burst_size != 32) && |
---|
| 783 | (burst_size != 64) ) |
---|
| 784 | { |
---|
[408] | 785 | std::cout << "Error in component VciBlockDeviceTsar : " << name |
---|
[433] | 786 | << " The burst size must be 8, 16, 32 or 64 bytes" << std::endl; |
---|
[260] | 787 | exit(1); |
---|
| 788 | } |
---|
[408] | 789 | |
---|
[400] | 790 | if ( (vci_param::B != 4) and (vci_param::B != 8) ) |
---|
[151] | 791 | { |
---|
[408] | 792 | std::cout << "Error in component VciBlockDeviceTsar : " << name |
---|
| 793 | << " The VCI data fields must have 32 bits or 64 bits" << std::endl; |
---|
[151] | 794 | exit(1); |
---|
| 795 | } |
---|
[408] | 796 | |
---|
[151] | 797 | m_fd = ::open(filename.c_str(), O_RDWR); |
---|
| 798 | if ( m_fd < 0 ) |
---|
| 799 | { |
---|
[408] | 800 | std::cout << "Error in component VciBlockDeviceTsar : " << name |
---|
| 801 | << " Unable to open file " << filename << std::endl; |
---|
[151] | 802 | exit(1); |
---|
| 803 | } |
---|
| 804 | m_device_size = lseek(m_fd, 0, SEEK_END) / block_size; |
---|
[408] | 805 | |
---|
| 806 | if ( m_device_size > ((uint64_t)1<<vci_param::N ) ) |
---|
[151] | 807 | { |
---|
[408] | 808 | std::cout << "Error in component VciBlockDeviceTsar" << name |
---|
| 809 | << " The file " << filename |
---|
| 810 | << " has more blocks than addressable with the VCI address" << std::endl; |
---|
| 811 | exit(1); |
---|
[151] | 812 | } |
---|
| 813 | |
---|
[400] | 814 | r_local_buffer = new uint32_t[m_words_per_block]; |
---|
[260] | 815 | |
---|
[151] | 816 | } // end constructor |
---|
| 817 | |
---|
[580] | 818 | ///////////////////////////////// |
---|
[514] | 819 | tmpl(/**/)::~VciBlockDeviceTsar() |
---|
| 820 | { |
---|
| 821 | delete [] r_local_buffer; |
---|
| 822 | } |
---|
| 823 | |
---|
| 824 | |
---|
[151] | 825 | ////////////////////////// |
---|
| 826 | tmpl(void)::print_trace() |
---|
| 827 | { |
---|
[500] | 828 | const char* initiator_str[] = |
---|
| 829 | { |
---|
[580] | 830 | "INI_IDLE", |
---|
[260] | 831 | |
---|
[580] | 832 | "INI_READ_BLOCK", |
---|
| 833 | "INI_READ_BURST", |
---|
| 834 | "INI_READ_CMD", |
---|
| 835 | "INI_READ_RSP", |
---|
| 836 | "INI_READ_SUCCESS", |
---|
| 837 | "INI_READ_ERROR", |
---|
[260] | 838 | |
---|
[580] | 839 | "INI_WRITE_BURST", |
---|
| 840 | "INI_WRITE_CMD", |
---|
| 841 | "INI_WRITE_RSP", |
---|
| 842 | "INI_WRITE_BLOCK", |
---|
| 843 | "INI_WRITE_SUCCESS", |
---|
| 844 | "INI_WRITE_ERROR", |
---|
[151] | 845 | }; |
---|
[500] | 846 | const char* target_str[] = |
---|
| 847 | { |
---|
[580] | 848 | "TGT_IDLE", |
---|
| 849 | "TGT_WRITE_BUFFER", |
---|
| 850 | "TGT_READ_BUFFER", |
---|
| 851 | "TGT_WRITE_BUFFER_EXT", |
---|
| 852 | "TGT_READ_BUFFER_EXT", |
---|
| 853 | "TGT_WRITE_COUNT", |
---|
| 854 | "TGT_READ_COUNT", |
---|
| 855 | "TGT_WRITE_LBA", |
---|
| 856 | "TGT_READ_LBA", |
---|
| 857 | "TGT_WRITE_OP", |
---|
| 858 | "TGT_READ_STATUS", |
---|
| 859 | "TGT_WRITE_IRQEN", |
---|
| 860 | "TGT_READ_IRQEN", |
---|
| 861 | "TGT_READ_SIZE", |
---|
| 862 | "TGT_READ_BLOCK", |
---|
| 863 | "TGT_READ_ERROR", |
---|
| 864 | "TGT_WRITE_ERROR ", |
---|
[151] | 865 | }; |
---|
| 866 | |
---|
[580] | 867 | std::cout << "BDEV " << name() |
---|
| 868 | << " : " << target_str[r_target_fsm.read()] |
---|
| 869 | << " / " << initiator_str[r_initiator_fsm.read()] |
---|
| 870 | << " / buf = " << std::hex << r_buf_address.read() |
---|
| 871 | << " / lba = " << std::hex << r_lba.read() |
---|
| 872 | << " / block_count = " << std::dec << r_block_count.read() |
---|
| 873 | << " / burst_count = " << r_burst_count.read() |
---|
| 874 | << " / word_count = " << r_words_count.read() <<std::endl; |
---|
[151] | 875 | } |
---|
| 876 | |
---|
| 877 | }} // end namespace |
---|
| 878 | |
---|
| 879 | // Local Variables: |
---|
| 880 | // tab-width: 4 |
---|
| 881 | // c-basic-offset: 4 |
---|
| 882 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 883 | // indent-tabs-mode: nil |
---|
| 884 | // End: |
---|
| 885 | |
---|
| 886 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 887 | |
---|