Ignore:
Timestamp:
Aug 20, 2013, 2:13:08 PM (11 years ago)
Author:
devigne
Message:

Merge with the lastest version of trunk

Location:
branches/ODCCP/modules/vci_mem_cache
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ODCCP/modules/vci_mem_cache

  • branches/ODCCP/modules/vci_mem_cache/caba/source/include/xram_transaction.h

    r460 r494  
    3434    bool                rerror;         // error returned by xram
    3535    data_t              ll_key;         // LL key returned by the llsc_global_table
     36    bool                config;         // transaction required by CONFIG FSM
    3637
    3738    /////////////////////////////////////////////////////////////////////
     
    4243        valid           = false;
    4344        rerror      = false;
     45        config      = false;
    4446    }
    4547
     
    8082        rerror      = source.rerror;
    8183        ll_key      = source.ll_key;
     84        config      = source.config;
    8285    }
    8386
     
    8790    void print()
    8891    {
     92        std::cout << "------- TRT entry -------" << std::endl;
    8993        std::cout << "valid       = " << valid        << std::endl;
    9094        std::cout << "xram_read   = " << xram_read    << std::endl;
     
    96100        std::cout << "read_length = " << read_length  << std::endl;
    97101        std::cout << "word_index  = " << word_index   << std::endl;
    98         for(size_t i=0; i<wdata_be.size() ; i++){
    99             std::cout << "wdata_be [" << i <<"] = " << wdata_be[i] << std::endl;
    100         }
    101         for(size_t i=0; i<wdata.size() ; i++){
    102             std::cout << "wdata [" << i <<"] = " << wdata[i] << std::endl;
    103         }
     102        for(size_t i=0; i<wdata_be.size() ; i++)
     103        {
     104            std::cout << "wdata_be[" << std::dec << i << "] = "
     105                      << std::hex << wdata_be[i] << std::endl;
     106        }
     107        for(size_t i=0; i<wdata.size() ; i++)
     108        {
     109            std::cout << "wdata[" << std::dec << i << "] = "
     110                      << std::hex << wdata[i] << std::endl;
     111        }
     112        std::cout << "rerror      = " << rerror       << std::endl;
     113        std::cout << "ll_key      = " << ll_key       << std::endl;
     114        std::cout << "config      = " << config       << std::endl;
    104115        std::cout << std::endl;
    105         std::cout << "rerror      = " << rerror       << std::endl;
    106116    }
    107117
     
    114124        wdata_be.clear();
    115125        wdata.clear();
    116         valid=false;
    117         rerror=false;
    118     }
    119 
    120     TransactionTabEntry(const TransactionTabEntry &source){
     126        valid  = false;
     127        rerror = false;
     128        config = false;
     129    }
     130
     131    TransactionTabEntry(const TransactionTabEntry &source)
     132    {
    121133        valid       = source.valid;
    122134        xram_read       = source.xram_read;
     
    132144        rerror      = source.rerror;
    133145        ll_key      = source.ll_key;
     146        config      = source.config;
    134147    }
    135148
     
    197210        delete [] tab;
    198211    }
    199 
    200212    /////////////////////////////////////////////////////////////////////
    201213    // The size() function returns the size of the tab
     
    205217        return size_tab;
    206218    }
    207 
    208219    /////////////////////////////////////////////////////////////////////
    209220    // The init() function initializes the transaction tab entries
     
    211222    void init()
    212223    {
    213         for ( size_t i=0; i<size_tab; i++) {
     224        for ( size_t i=0; i<size_tab; i++)
     225        {
    214226            tab[i].init();
    215227        }
    216228    }
    217 
    218229    /////////////////////////////////////////////////////////////////////
    219230    // The print() function prints a transaction tab entry
     
    223234    void print(const size_t index)
    224235    {
    225         assert( (index < size_tab)
    226                 && "Invalid Transaction Tab Entry");
     236        assert( (index < size_tab) and
     237        "MEMC ERROR: The selected entry is out of range in TRT write_data_mask()");
     238
    227239        tab[index].print();
    228240        return;
    229241    }
    230 
    231242    /////////////////////////////////////////////////////////////////////
    232243    // The read() function returns a transaction tab entry.
     
    236247    TransactionTabEntry read(const size_t index)
    237248    {
    238         assert( (index < size_tab)
    239                 && "Invalid Transaction Tab Entry");
     249        assert( (index < size_tab) and
     250        "MEMC ERROR: Invalid Transaction Tab Entry");
     251
    240252        return tab[index];
    241253    }
    242 
    243254    /////////////////////////////////////////////////////////////////////
    244255    // The full() function returns the state of the transaction tab
     
    249260    bool full(size_t &index)
    250261    {
    251         for(size_t i=0; i<size_tab; i++){
    252             if(!tab[i].valid){
     262        for(size_t i=0; i<size_tab; i++)
     263        {
     264            if(!tab[i].valid)
     265            {
    253266                index=i;
    254267                return false;   
     
    257270        return true;
    258271    }
    259 
    260272    /////////////////////////////////////////////////////////////////////
    261273    // The hit_read() function checks if an XRAM read transaction exists
     
    268280    bool hit_read(const addr_t nline,size_t &index)
    269281    {
    270         for(size_t i=0; i<size_tab; i++){
    271             if((tab[i].valid && (nline==tab[i].nline)) && (tab[i].xram_read)) {
     282        for(size_t i=0; i<size_tab; i++)
     283        {
     284            if((tab[i].valid && (nline==tab[i].nline)) && (tab[i].xram_read))
     285            {
    272286                index=i;
    273287                return true;   
     
    276290        return false;
    277291    }
    278 
    279292    ///////////////////////////////////////////////////////////////////////
    280293    // The hit_write() function looks if an XRAM write transaction exists
     
    286299    bool hit_write(const addr_t nline)
    287300    {
    288         for(size_t i=0; i<size_tab; i++){
    289             if(tab[i].valid && (nline==tab[i].nline) && !(tab[i].xram_read)) {
     301        for(size_t i=0; i<size_tab; i++)
     302        {
     303            if(tab[i].valid && (nline==tab[i].nline) && !(tab[i].xram_read))
     304            {
    290305                return true;   
    291306            }
     
    325340            const std::vector<data_t> &data)
    326341    {
    327         assert( (index < size_tab)
    328                 && "Invalid Transaction Tab Entry");
    329         assert(be.size()==tab[index].wdata_be.size()
    330                 && "Bad data mask in write_data_mask in TransactionTab");
    331         assert(data.size()==tab[index].wdata.size()
    332                 && "Bad data in write_data_mask in TransactionTab");
    333 
    334         for(size_t i=0; i<tab[index].wdata_be.size() ; i++) {
     342        assert( (index < size_tab) and
     343        "MEMC ERROR: The selected entry is out of range in TRT write_data_mask()");
     344
     345        assert( (be.size()==tab[index].wdata_be.size()) and
     346        "MEMC ERROR: Bad be size in TRT write_data_mask()");
     347
     348        assert( (data.size()==tab[index].wdata.size()) and
     349        "MEMC ERROR: Bad data size in TRT write_data_mask()");
     350
     351        for(size_t i=0; i<tab[index].wdata_be.size() ; i++)
     352        {
    335353            tab[index].wdata_be[i] = tab[index].wdata_be[i] | be[i];
    336354            data_t mask = be_to_mask(be[i]);
     
    338356        }
    339357    }
    340 
    341358    /////////////////////////////////////////////////////////////////////
    342359    // The set() function registers a transaction (read or write)
     
    355372    // - data_be : the mask of the data to write (in case of write)
    356373    // - ll_key  : the ll key (if any) returned by the llsc_global_table
     374    // - config  : transaction required by config FSM
    357375    /////////////////////////////////////////////////////////////////////
    358376    void set(const size_t index,
     
    367385            const std::vector<be_t> &data_be,
    368386            const std::vector<data_t> &data,
    369             const data_t ll_key = 0)
    370     {
    371         assert( (index < size_tab)
    372                 && "The selected entry is out of range in set() Transaction Tab");
    373         assert(data_be.size()==tab[index].wdata_be.size()
    374                 && "Bad data_be argument in set() TransactionTab");
    375         assert(data.size()==tab[index].wdata.size()
    376                 && "Bad data argument in set() TransactionTab");
     387            const data_t ll_key = 0,
     388            const bool config = false)
     389    {
     390        assert( (index < size_tab) and
     391        "MEMC ERROR: The selected entry is out of range in TRT set()");
     392
     393        assert( (data_be.size()==tab[index].wdata_be.size()) and
     394        "MEMC ERROR: Bad data_be argument in TRT set()");
     395
     396        assert( (data.size()==tab[index].wdata.size()) and
     397        "MEMC ERROR: Bad data argument in TRT set()");
    377398
    378399        tab[index].valid                = true;
     
    386407        tab[index].word_index       = word_index;
    387408        tab[index].ll_key           = ll_key;
     409        tab[index].config           = config;
    388410        for(size_t i=0; i<tab[index].wdata.size(); i++)
    389411        {
     
    398420    // The BE field in TRT is taken into account.
    399421    // Arguments :
    400     // - index : the index of the transaction in the transaction tab
    401     // - word_index : the index of the data in the line
    402     // - data : a 64 bits value
    403     // - error : invalid data
     422    // - index : index of the entry in TRT
     423    // - word  : index of the 32 bits word in the line
     424    // - data  : 64 bits value (first data right)
    404425    /////////////////////////////////////////////////////////////////////
    405426    void write_rsp(const size_t      index,
    406427                   const size_t      word,
    407                    const wide_data_t data,
    408                    const bool        rerror)
     428                   const wide_data_t data)
    409429    {
    410430        data_t  value;
    411431        data_t  mask;
    412432
    413         if ( index >= size_tab )
    414         {
    415             std::cout << "VCI_MEM_CACHE ERRROR " << tab_name
    416                       <<  " TRT entry  out of range in write_rsp()" << std::endl;
    417             exit(0);
    418         }
    419         if ( word > tab[index].wdata_be.size() )
    420         {
    421             std::cout << "VCI_MEM_CACHE ERRROR " << tab_name
    422                       <<  " Bad word_index in write_rsp() in TRT" << std::endl;
    423             exit(0);
    424         }
    425         if ( not tab[index].valid )
    426         {
    427             std::cout << "VCI_MEM_CACHE ERRROR " << tab_name
    428                       <<  " TRT Entry invalid in write_rsp()" << std::endl;
    429             exit(0);
    430         }
    431         if ( not tab[index].xram_read )
    432         {
    433             std::cout << "VCI_MEM_CACHE ERRROR " << tab_name
    434                       <<  " TRT entry is not an XRAM GET in write_rsp()" << std::endl;
    435             exit(0);
    436         }
     433        assert( (index < size_tab) and
     434        "MEMC ERROR: The selected entry is out of range in TRT write_rsp()");
     435
     436        assert( (word < tab[index].wdata_be.size()) and
     437        "MEMC ERROR: Bad word index in TRT write_rsp()");
     438
     439        assert( (tab[index].valid) and
     440        "MEMC ERROR: TRT entry not valid in TRT write_rsp()");
     441
     442        assert( (tab[index].xram_read ) and
     443        "MEMC ERROR: TRT entry is not a GET in TRT write_rsp()");
    437444
    438445        // first 32 bits word
     
    445452        mask  = be_to_mask(tab[index].wdata_be[word+1]);
    446453        tab[index].wdata[word+1] = (tab[index].wdata[word+1] & mask) | (value & ~mask);
    447 
    448         // error update
    449         tab[index].rerror |= rerror;
    450     }
    451 
     454    }
    452455    /////////////////////////////////////////////////////////////////////
    453456    // The erase() function erases an entry in the transaction tab.
     
    457460    void erase(const size_t index)
    458461    {
    459         assert( (index < size_tab)
    460                 && "The selected entry is out of range in erase() Transaction Tab");
     462        assert( (index < size_tab) and
     463        "MEMC ERROR: The selected entry is out of range in TRT erase()");
     464
    461465        tab[index].valid        = false;
    462466        tab[index].rerror   = false;
     467    }
     468    /////////////////////////////////////////////////////////////////////
     469    // The is_config() function returns the config flag value.
     470    // Arguments :
     471    // - index : the index of the entry in the transaction tab
     472    /////////////////////////////////////////////////////////////////////
     473    bool is_config(const size_t index)
     474    {
     475        assert( (index < size_tab) and
     476        "MEMC ERROR: The selected entry is out of range in TRT is_config()");
     477
     478        return tab[index].config;
    463479    }
    464480}; // end class TransactionTab
Note: See TracChangeset for help on using the changeset viewer.