Ignore:
Timestamp:
Sep 30, 2014, 3:32:13 PM (10 years ago)
Author:
devigne
Message:

RWT Commit : Cosmetic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/RWT/modules/vci_mem_cache/caba/source/include/xram_transaction.h

    r814 r823  
    1515class TransactionTabEntry
    1616{
    17     typedef sc_dt::sc_uint<64>    wide_data_t;
    18     typedef sc_dt::sc_uint<40>    addr_t;
    19     typedef uint32_t              data_t;
    20     typedef uint32_t              be_t;
     17    typedef sc_dt::sc_uint<64> wide_data_t;
     18    typedef sc_dt::sc_uint<40> addr_t;
     19    typedef uint32_t           data_t;
     20    typedef uint32_t           be_t;
    2121
    2222    public:
     
    154154class TransactionTab
    155155{
    156     typedef sc_dt::sc_uint<64>    wide_data_t;
    157     typedef sc_dt::sc_uint<40>    addr_t;
    158     typedef uint32_t              data_t;
    159     typedef uint32_t              be_t;
     156    typedef sc_dt::sc_uint<64> wide_data_t;
     157    typedef sc_dt::sc_uint<40> addr_t;
     158    typedef uint32_t           data_t;
     159    typedef uint32_t           be_t;
    160160
    161161    private:
    162     const std::string tab_name;                // the name for logs
    163     size_t            size_tab;                // the size of the tab
     162    const std::string tab_name; // the name for logs
     163    size_t            size_tab; // the size of the tab
    164164
    165165    data_t be_to_mask(be_t be)
    166166    {
    167167        data_t ret = 0;
    168         if ( be&0x1 ) {
     168        if (be & 0x1) {
    169169            ret = ret | 0x000000FF;
    170170        }
    171         if ( be&0x2 ) {
     171        if (be & 0x2) {
    172172            ret = ret | 0x0000FF00;
    173173        }
    174         if ( be&0x4 ) {
     174        if (be & 0x4) {
    175175            ret = ret | 0x00FF0000;
    176176        }
    177         if ( be&0x8 ) {
     177        if (be & 0x8) {
    178178            ret = ret | 0xFF000000;
    179179        }
     
    189189    TransactionTab()
    190190    {
    191         size_tab=0;
    192         tab=NULL;
     191        size_tab = 0;
     192        tab = NULL;
    193193    }
    194194
     
    196196                   size_t            n_entries,
    197197                   size_t            n_words )
    198     : tab_name( name ),
    199       size_tab( n_entries )
     198    : tab_name(name),
     199      size_tab(n_entries)
    200200    {
    201201        tab = new TransactionTabEntry[size_tab];
    202         for ( size_t i=0; i<size_tab; i++)
     202        for (size_t i = 0; i < size_tab; i++)
    203203        {
    204204            tab[i].alloc(n_words);
     
    222222    void init()
    223223    {
    224         for ( size_t i=0; i<size_tab; i++)
     224        for (size_t i = 0; i < size_tab; i++)
    225225        {
    226226            tab[i].init();
     
    234234    void print(const size_t index)
    235235    {
    236         assert( (index < size_tab) and
     236        assert((index < size_tab) and
    237237        "MEMC ERROR: The selected entry is out of range in TRT write_data_mask()");
    238238
     
    247247    TransactionTabEntry read(const size_t index)
    248248    {
    249         assert( (index < size_tab) and
     249        assert((index < size_tab) and
    250250        "MEMC ERROR: Invalid Transaction Tab Entry");
    251251
     
    260260    bool full(size_t &index)
    261261    {
    262         for(size_t i=0; i<size_tab; i++)
    263         {
    264             if(!tab[i].valid)
     262        for (size_t i = 0; i < size_tab; i++)
     263        {
     264            if (!tab[i].valid)
    265265            {
    266                 index=i;
     266                index = i;
    267267                return false;
    268268            }
     
    278278    // The function returns true if a read request has already been sent
    279279    //////////////////////////////////////////////////////////////////////
    280     bool hit_read(const addr_t nline,size_t &index)
    281     {
    282         for(size_t i=0; i<size_tab; i++)
    283         {
    284             if((tab[i].valid && (nline==tab[i].nline)) && (tab[i].xram_read))
     280    bool hit_read(const addr_t nline, size_t &index)
     281    {
     282        for (size_t i = 0; i < size_tab; i++)
     283        {
     284            if ((tab[i].valid && (nline == tab[i].nline)) && (tab[i].xram_read))
    285285            {
    286                 index=i;
     286                index = i;
    287287                return true;
    288288            }
     
    299299    bool hit_write(const addr_t nline)
    300300    {
    301         for(size_t i=0; i<size_tab; i++)
    302         {
    303             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))
    304304            {
    305305                return true;
     
    319319    bool hit_write(const addr_t nline, size_t* index)
    320320    {
    321         for(size_t i=0; i<size_tab; i++){
    322             if(tab[i].valid && (nline==tab[i].nline) && !(tab[i].xram_read)) {
     321        for (size_t i = 0; i < size_tab; i++){
     322            if (tab[i].valid && (nline == tab[i].nline) && !(tab[i].xram_read)) {
    323323                *index = i;
    324324                return true;
     
    337337    /////////////////////////////////////////////////////////////////////
    338338    void write_data_mask(const size_t index,
    339             const std::vector<be_t> &be,
    340             const std::vector<data_t> &data)
    341     {
    342         assert( (index < size_tab) and
     339                         const std::vector<be_t> &be,
     340                         const std::vector<data_t> &data)
     341    {
     342        assert((index < size_tab) and
    343343        "MEMC ERROR: The selected entry is out of range in TRT write_data_mask()");
    344344
    345         assert( (be.size()==tab[index].wdata_be.size()) and
     345        assert((be.size() == tab[index].wdata_be.size()) and
    346346        "MEMC ERROR: Bad be size in TRT write_data_mask()");
    347347
    348         assert( (data.size()==tab[index].wdata.size()) and
     348        assert((data.size() == tab[index].wdata.size()) and
    349349        "MEMC ERROR: Bad data size in TRT write_data_mask()");
    350350
    351         for(size_t i=0; i<tab[index].wdata_be.size() ; i++)
     351        for (size_t i = 0; i < tab[index].wdata_be.size(); i++)
    352352        {
    353353            tab[index].wdata_be[i] = tab[index].wdata_be[i] | be[i];
     
    375375    /////////////////////////////////////////////////////////////////////
    376376    void set(const size_t index,
    377             const bool xram_read,
    378             const addr_t nline,
    379             const size_t srcid,
    380             const size_t trdid,
    381             const size_t pktid,
    382             const bool proc_read,
    383             const size_t read_length,
    384             const size_t word_index,
    385             const std::vector<be_t> &data_be,
    386             const std::vector<data_t> &data,
    387             const data_t ll_key = 0,
    388             const bool config = false)
    389     {
    390         assert( (index < size_tab) and
     377             const bool xram_read,
     378             const addr_t nline,
     379             const size_t srcid,
     380             const size_t trdid,
     381             const size_t pktid,
     382             const bool proc_read,
     383             const size_t read_length,
     384             const size_t word_index,
     385             const std::vector<be_t> &data_be,
     386             const std::vector<data_t> &data,
     387             const data_t ll_key = 0,
     388             const bool config = false)
     389    {
     390        assert((index < size_tab) and
    391391        "MEMC ERROR: The selected entry is out of range in TRT set()");
    392392
    393         assert( (data_be.size()==tab[index].wdata_be.size()) and
     393        assert((data_be.size() == tab[index].wdata_be.size()) and
    394394        "MEMC ERROR: Bad data_be argument in TRT set()");
    395395
    396         assert( (data.size()==tab[index].wdata.size()) and
     396        assert((data.size() == tab[index].wdata.size()) and
    397397        "MEMC ERROR: Bad data argument in TRT set()");
    398398
     
    408408        tab[index].ll_key      = ll_key;
    409409        tab[index].config      = config;
    410         for(size_t i=0; i<tab[index].wdata.size(); i++)
    411         {
    412             tab[index].wdata_be[i]    = data_be[i];
    413             tab[index].wdata[i]       = data[i];
     410        for (size_t i = 0; i < tab[index].wdata.size(); i++)
     411        {
     412            tab[index].wdata_be[i] = data_be[i];
     413            tab[index].wdata[i]    = data[i];
    414414        }
    415415    }
     
    429429                   const bool        rerror)
    430430    {
    431         data_t  value;
    432         data_t  mask;
    433 
    434         assert( (index < size_tab) and
     431        data_t value;
     432        data_t mask;
     433
     434        assert((index < size_tab) and
    435435        "MEMC ERROR: The selected entry is out of range in TRT write_rsp()");
    436436
    437         assert( (word < tab[index].wdata_be.size()) and
     437        assert((word < tab[index].wdata_be.size()) and
    438438        "MEMC ERROR: Bad word index in TRT write_rsp()");
    439439
    440         assert( (tab[index].valid) and
     440        assert((tab[index].valid) and
    441441        "MEMC ERROR: TRT entry not valid in TRT write_rsp()");
    442442
    443         assert( (tab[index].xram_read ) and
     443        assert((tab[index].xram_read ) and
    444444        "MEMC ERROR: TRT entry is not a GET in TRT write_rsp()");
    445445
    446         if ( rerror )
     446        if (rerror)
    447447        {
    448448            tab[index].rerror = true;
     
    456456
    457457        // second 32 bits word
    458         value = (data_t)(data>>32);
    459         mask  = be_to_mask(tab[index].wdata_be[word+1]);
    460         tab[index].wdata[word+1] = (tab[index].wdata[word+1] & mask) | (value & ~mask);
     458        value = (data_t)(data >> 32);
     459        mask  = be_to_mask(tab[index].wdata_be[word + 1]);
     460        tab[index].wdata[word + 1] = (tab[index].wdata[word + 1] & mask) | (value & ~mask);
    461461    }
    462462    /////////////////////////////////////////////////////////////////////
     
    467467    void erase(const size_t index)
    468468    {
    469         assert( (index < size_tab) and
     469        assert((index < size_tab) and
    470470        "MEMC ERROR: The selected entry is out of range in TRT erase()");
    471471
     
    480480    bool is_config(const size_t index)
    481481    {
    482         assert( (index < size_tab) and
     482        assert((index < size_tab) and
    483483        "MEMC ERROR: The selected entry is out of range in TRT is_config()");
    484484
Note: See TracChangeset for help on using the changeset viewer.