Ignore:
Timestamp:
May 28, 2013, 12:35:01 AM (11 years ago)
Author:
alain
Message:

Introducing support for physical addresses larger than 32 bits.
A new addressable register has been defined: BLOCK_DEVICE_BUFFER_EXT

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_block_device_tsar/caba/source/src/vci_block_device_tsar.cpp

    r381 r392  
    4444    if(p_resetn.read() == false)
    4545    {
    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;
    5050        return;
    5151    }
     
    6767            sc_dt::sc_uint<vci_param::N> address = p_vci_target.address.read();
    6868            bool                  read    = (p_vci_target.cmd.read() == vci_param::CMD_READ);
    69             uint32_t              cell    = (uint32_t)((address & 0x1F)>>2);
     69            uint32_t              cell    = (uint32_t)((address & 0x3F)>>2);
    7070
    7171            if     ( !read && !m_segment.contains(address) )      r_target_fsm = T_WRITE_ERROR;
     
    7575            else if( !read && (cell == BLOCK_DEVICE_BUFFER) )     r_target_fsm = T_WRITE_BUFFER;
    7676            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;
    7779            else if( !read && (cell == BLOCK_DEVICE_COUNT) )      r_target_fsm = T_WRITE_COUNT;
    7880            else if(  read && (cell == BLOCK_DEVICE_COUNT) )      r_target_fsm = T_READ_COUNT;
     
    9193    case T_WRITE_BUFFER:
    9294    {
    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        }
    95111        break;
    96112    }
     
    98114    case T_WRITE_COUNT:
    99115    {
    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        }
    102121        break;
    103122    }
     
    105124    case T_WRITE_LBA:
    106125    {
    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        }
    109131        break;
    110132    }
     
    112134    case T_WRITE_OP:
    113135    {
    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) )
    117140            {
    118141                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) )
    122146            {
    123147                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        }
    128156        break;
    129157    }
     
    131159    case T_WRITE_IRQEN:
    132160    {
    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        }
    135166        break;
    136167    }
    137168    ///////////////////
    138169    case T_READ_BUFFER:
     170    case T_READ_BUFFER_EXT:
    139171    case T_READ_COUNT:
    140172    case T_READ_LBA:
     
    190222
    191223            // 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);
    193225
    194226            // start tranfer
     
    338370            if ( p_vci_initiator.reop.read() )  // last flit of the burst
    339371            {
    340                 r_flit_count  = 0;
     372                    r_flit_count  = 0;
    341373                r_buf_address = r_buf_address.read() + (r_burst_nflits.read()<<2);
    342374
    343                 if( (p_vci_initiator.rerror.read()&0x1) != 0 )
     375                    if( (p_vci_initiator.rerror.read()&0x1) != 0 )
    344376                {
    345377                    r_initiator_fsm = M_WRITE_ERROR;
     
    431463        p_vci_target.rspval = true;
    432464        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);
    433471        p_vci_target.rerror = VCI_READ_OK;
    434472        break;
     
    649687        };
    650688        const char* target_str[] = {
    651                 "IDLE        ",
     689                "IDLE",
    652690                "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",
    665705                "WRITE_ERROR ",
    666706        };
     
    668708        std::cout << "BDEV_TGT : " << target_str[r_target_fsm.read()]
    669709                  << "  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()
    671712                  << "  burst = " << r_burst_count.read()
    672713                  << "  flit  = " << r_flit_count.read() <<std::endl;
Note: See TracChangeset for help on using the changeset viewer.