Ignore:
Timestamp:
Oct 15, 2014, 11:41:49 AM (10 years ago)
Author:
meunier
Message:

Trunk:

  • Cosmetic in mem_cache_directory.h and xram_transaction.h
  • Renamed mem_cache param dspin_in_width and dspin_out_width to memc_dspin_in_width and memc_dspin_out_width (because of a bug in soclib-cc ?). Should have updated these names in the .sd or .py files of all platforms
  • Updated the scripts for tsar_generic_xbar to take into account the ideal write-through + added a graph in create_graphs.py
File:
1 edited

Legend:

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

    r601 r836  
    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:
    23     bool                        valid;              // entry valid
    24     bool                        xram_read;          // read request to XRAM
    25     addr_t              nline;              // index (zy) of the requested line
    26     size_t                  srcid;          // processor requesting the transaction
    27     size_t                  trdid;          // processor requesting the transaction
    28     size_t                  pktid;          // processor requesting the transaction
    29     bool                        proc_read;          // read request from processor
    30     size_t                  read_length;    // length of the read (for the response)
    31     size_t                  word_index;         // index of the first read word (for response)
    32     std::vector<data_t> wdata;          // write buffer (one cache line)
    33     std::vector<be_t>   wdata_be;       // be for each data in the write buffer
    34     bool                rerror;         // error returned by xram
    35     data_t              ll_key;         // LL key returned by the llsc_global_table
    36     bool                config;         // transaction required by CONFIG FSM
     23    bool   valid;                 // entry valid
     24    bool   xram_read;             // read request to XRAM
     25    addr_t nline;                 // index (zy) of the requested line
     26    size_t srcid;                 // processor requesting the transaction
     27    size_t trdid;                 // processor requesting the transaction
     28    size_t pktid;                 // processor requesting the transaction
     29    bool   proc_read;             // read request from processor
     30    size_t read_length;           // length of the read (for the response)
     31    size_t word_index;            // index of the first read word (for response)
     32    std::vector<data_t> wdata;    // write buffer (one cache line)
     33    std::vector<be_t>   wdata_be; // be for each data in the write buffer
     34    bool    rerror;               // error returned by xram
     35    data_t  ll_key;               // LL key returned by the llsc_global_table
     36    bool    config;               // transaction required by CONFIG FSM
    3737
    3838    /////////////////////////////////////////////////////////////////////
     
    4141    void init()
    4242    {
    43         valid           = false;
    44         rerror      = false;
    45         config      = false;
     43        valid  = false;
     44        rerror = false;
     45        config = false;
    4646    }
    4747
     
    5252    void alloc(size_t n_words)
    5353    {
    54         wdata_be.reserve( (int)n_words );
    55         wdata.reserve( (int)n_words );
    56         for(size_t i=0; i<n_words; i++)
     54        wdata_be.reserve((int) n_words);
     55        wdata.reserve((int) n_words);
     56        for (size_t i = 0; i < n_words; i++)
    5757        {
    5858            wdata_be.push_back(0);
     
    6666    void copy(const TransactionTabEntry &source)
    6767    {
    68         valid       = source.valid;
    69         xram_read       = source.xram_read;
    70         nline       = source.nline;
    71         srcid       = source.srcid;
    72         trdid       = source.trdid;
    73         pktid       = source.pktid;
    74         proc_read       = source.proc_read;
     68        valid       = source.valid;
     69        xram_read   = source.xram_read;
     70        nline       = source.nline;
     71        srcid       = source.srcid;
     72        trdid       = source.trdid;
     73        pktid       = source.pktid;
     74        proc_read   = source.proc_read;
    7575        read_length = source.read_length;
    76         word_index      = source.word_index;
     76        word_index  = source.word_index;
    7777        wdata_be.assign(source.wdata_be.begin(),source.wdata_be.end());
    7878        wdata.assign(source.wdata.begin(),source.wdata.end());
     
    8585    // The print() function prints the entry identified by "index".
    8686    ////////////////////////////////////////////////////////////////////
    87     void print( size_t index, size_t mode )
     87    void print(size_t index, size_t mode)
    8888    {
    8989        std::cout << "  TRT[" << std::dec << index << "] "
    90                   << " valid = " << valid
    91                   << " / error = " << rerror
    92                   << " / get = " << xram_read
    93                   << " / config = " << config << std::hex
    94                   << " / address = " << nline*4*wdata.size()
    95                   << " / srcid = " << srcid << std::endl;
    96         if ( mode )
     90            << " valid = " << valid
     91            << " / error = " << rerror
     92            << " / get = " << xram_read
     93            << " / config = " << config << std::hex
     94            << " / address = " << nline*4*wdata.size()
     95            << " / srcid = " << srcid << std::endl;
     96        if (mode)
    9797        {
    9898            std::cout << "        trdid = " << trdid
    99                       << " / pktid = " << pktid << std::dec
    100                       << " / proc_read = " << proc_read
    101                       << " / read_length = " << read_length
    102                       << " / word_index  = " << word_index << std::hex
    103                       << " / ll_key = " << ll_key << std::endl;
     99                << " / pktid = " << pktid << std::dec
     100                << " / proc_read = " << proc_read
     101                << " / read_length = " << read_length
     102                << " / word_index  = " << word_index << std::hex
     103                << " / ll_key = " << ll_key << std::endl;
    104104            std::cout << "        wdata = ";
    105             for(size_t i=0; i<wdata.size() ; i++)
     105            for (size_t i = 0; i < wdata.size(); i++)
    106106            {
    107107                std::cout << std::hex << wdata[i] << " / ";
     
    112112
    113113    /////////////////////////////////////////////////////////////////////
    114     //          Constructors
     114    //         Constructors
    115115    /////////////////////////////////////////////////////////////////////
    116116
     
    126126    TransactionTabEntry(const TransactionTabEntry &source)
    127127    {
    128         valid       = source.valid;
    129         xram_read       = source.xram_read;
    130         nline       = source.nline;
    131         srcid       = source.srcid;
    132         trdid       = source.trdid;
    133         pktid       = source.pktid;
    134         proc_read       = source.proc_read;
     128        valid       = source.valid;
     129        xram_read   = source.xram_read;
     130        nline       = source.nline;
     131        srcid       = source.srcid;
     132        trdid       = source.trdid;
     133        pktid       = source.pktid;
     134        proc_read   = source.proc_read;
    135135        read_length = source.read_length;
    136         word_index      = source.word_index;
    137         wdata_be.assign(source.wdata_be.begin(),source.wdata_be.end());
    138         wdata.assign(source.wdata.begin(),source.wdata.end()); 
     136        word_index  = source.word_index;
     137        wdata_be.assign(source.wdata_be.begin(), source.wdata_be.end());
     138        wdata.assign(source.wdata.begin(), source.wdata.end());   
    139139        rerror      = source.rerror;
    140140        ll_key      = source.ll_key;
     
    149149class TransactionTab
    150150{
    151     typedef sc_dt::sc_uint<64>    wide_data_t;
    152     typedef sc_dt::sc_uint<40>    addr_t;
    153     typedef uint32_t              data_t;
    154     typedef uint32_t              be_t;
     151    typedef sc_dt::sc_uint<64> wide_data_t;
     152    typedef sc_dt::sc_uint<40> addr_t;
     153    typedef uint32_t           data_t;
     154    typedef uint32_t           be_t;
    155155
    156156    private:
    157     const std::string tab_name;                // the name for logs
    158     size_t            size_tab;                // the size of the tab
     157    const std::string tab_name; // the name for logs
     158    size_t size_tab; // the size of the tab
    159159
    160160    data_t be_to_mask(be_t be)
    161161    {
    162162        data_t ret = 0;
    163         if ( be&0x1 ) {
     163        if (be & 0x1) {
    164164            ret = ret | 0x000000FF;
    165165        }
    166         if ( be&0x2 ) {
     166        if (be & 0x2) {
    167167            ret = ret | 0x0000FF00;
    168168        }
    169         if ( be&0x4 ) {
     169        if (be & 0x4) {
    170170            ret = ret | 0x00FF0000;
    171171        }
    172         if ( be&0x8 ) {
     172        if (be & 0x8) {
    173173            ret = ret | 0xFF000000;
    174174        }
     
    177177
    178178    public:
    179     TransactionTabEntry *tab;      // The transaction tab
    180 
    181     ////////////////////////////////////////////////////////////////////
    182     //          Constructors
     179    TransactionTabEntry * tab; // The transaction tab
     180
     181    ////////////////////////////////////////////////////////////////////
     182    //        Constructors
    183183    ////////////////////////////////////////////////////////////////////
    184184    TransactionTab()
    185185    {
    186         size_tab=0;
    187         tab=NULL;
     186        size_tab = 0;
     187        tab = NULL;
    188188    }
    189189
    190190    TransactionTab(const std::string &name,
    191                    size_t            n_entries,
    192                    size_t            n_words )
    193     : tab_name( name ),
    194       size_tab( n_entries )
     191            size_t n_entries,
     192            size_t n_words)
     193        : tab_name(name),
     194        size_tab(n_entries)
    195195    {
    196196        tab = new TransactionTabEntry[size_tab];
    197         for ( size_t i=0; i<size_tab; i++)
     197        for (size_t i = 0; i < size_tab; i++)
    198198        {
    199199            tab[i].alloc(n_words);
     
    217217    void init()
    218218    {
    219         for ( size_t i=0; i<size_tab; i++)
     219        for (size_t i = 0; i < size_tab; i++)
    220220        {
    221221            tab[i].init();
     
    226226    // Detailed content if detailed argument is non zero.
    227227    /////////////////////////////////////////////////////////////////////
    228     void print( size_t detailed = 0 )
     228    void print(size_t detailed = 0)
    229229    {
    230230        std::cout << "  < TRT content in " <<  tab_name << " >" << std::endl;
    231         for ( size_t id = 0 ; id < size_tab ; id++ )
     231        for (size_t id = 0; id < size_tab; id++)
    232232        {
    233233            tab[id].print( id , detailed );
     
    241241    TransactionTabEntry read(const size_t index)
    242242    {
    243         assert( (index < size_tab) and
    244         "MEMC ERROR: Invalid Transaction Tab Entry");
     243        assert((index < size_tab) and "MEMC ERROR: Invalid Transaction Tab Entry");
    245244
    246245        return tab[index];
     
    252251    // The function returns true if the transaction tab is full
    253252    /////////////////////////////////////////////////////////////////////
    254     bool full(size_t &index)
    255     {
    256         for(size_t i=0; i<size_tab; i++)
    257         {
    258             if(!tab[i].valid)
     253    bool full(size_t & index)
     254    {
     255        for (size_t i = 0; i < size_tab; i++)
     256        {
     257            if (!tab[i].valid)
    259258            {
    260                 index=i;
    261                 return false;   
     259                index = i;
     260                return false;   
    262261            }
    263262        }
     
    274273    bool hit_read(const addr_t nline,size_t &index)
    275274    {
    276         for(size_t i=0; i<size_tab; i++)
    277         {
    278             if((tab[i].valid && (nline==tab[i].nline)) && (tab[i].xram_read))
     275        for (size_t i = 0; i < size_tab; i++)
     276        {
     277            if ((tab[i].valid && (nline == tab[i].nline)) && (tab[i].xram_read))
    279278            {
    280                 index=i;
    281                 return true;   
     279                index = i;
     280                return true;   
    282281            }
    283282        }
     
    293292    bool hit_write(const addr_t nline)
    294293    {
    295         for(size_t i=0; i<size_tab; i++)
    296         {
    297             if(tab[i].valid && (nline==tab[i].nline) && !(tab[i].xram_read))
     294        for (size_t i = 0; i < size_tab; i++)
     295        {
     296            if (tab[i].valid && (nline == tab[i].nline) && !(tab[i].xram_read))
    298297            {
    299                 return true;   
     298                return true;   
    300299            }
    301300        }
     
    312311    /////////////////////////////////////////////////////////////////////
    313312    void write_data_mask(const size_t index,
    314             const std::vector<be_t> &be,
    315             const std::vector<data_t> &data)
     313            const std::vector<be_t> & be,
     314            const std::vector<data_t> & data)
    316315    {
    317316        assert( (index < size_tab) and
    318         "MEMC ERROR: The selected entry is out of range in TRT write_data_mask()");
    319 
    320         assert( (be.size()==tab[index].wdata_be.size()) and
    321         "MEMC ERROR: Bad be size in TRT write_data_mask()");
    322 
    323         assert( (data.size()==tab[index].wdata.size()) and
    324         "MEMC ERROR: Bad data size in TRT write_data_mask()");
    325 
    326         for(size_t i=0; i<tab[index].wdata_be.size() ; i++)
     317                "MEMC ERROR: The selected entry is out of range in TRT write_data_mask()");
     318
     319        assert( (be.size() == tab[index].wdata_be.size()) and
     320                "MEMC ERROR: Bad be size in TRT write_data_mask()");
     321
     322        assert( (data.size() == tab[index].wdata.size()) and
     323                "MEMC ERROR: Bad data size in TRT write_data_mask()");
     324
     325        for (size_t i = 0; i < tab[index].wdata_be.size(); i++)
    327326        {
    328327            tab[index].wdata_be[i] = tab[index].wdata_be[i] | be[i];
     
    358357            const size_t read_length,
    359358            const size_t word_index,
    360             const std::vector<be_t> &data_be,
    361             const std::vector<data_t> &data,
     359            const std::vector<be_t> & data_be,
     360            const std::vector<data_t> & data,
    362361            const data_t ll_key = 0,
    363362            const bool config = false)
    364363    {
    365         assert( (index < size_tab) and
    366         "MEMC ERROR: The selected entry is out of range in TRT set()");
    367 
    368         assert( (data_be.size()==tab[index].wdata_be.size()) and
    369         "MEMC ERROR: Bad data_be argument in TRT set()");
    370 
    371         assert( (data.size()==tab[index].wdata.size()) and
    372         "MEMC ERROR: Bad data argument in TRT set()");
    373 
    374         tab[index].valid                = true;
    375         tab[index].xram_read        = xram_read;
    376         tab[index].nline                = nline;
    377         tab[index].srcid                = srcid;
    378         tab[index].trdid                = trdid;
    379         tab[index].pktid                = pktid;
    380         tab[index].proc_read        = proc_read;
    381         tab[index].read_length      = read_length;
    382         tab[index].word_index       = word_index;
    383         tab[index].ll_key           = ll_key;
    384         tab[index].config           = config;
    385         for(size_t i=0; i<tab[index].wdata.size(); i++)
    386         {
    387             tab[index].wdata_be[i]    = data_be[i];
    388             tab[index].wdata[i]       = data[i];
     364        assert((index < size_tab) and
     365                "MEMC ERROR: The selected entry is out of range in TRT set()");
     366
     367        assert((data_be.size()==tab[index].wdata_be.size()) and
     368                "MEMC ERROR: Bad data_be argument in TRT set()");
     369
     370        assert((data.size()==tab[index].wdata.size()) and
     371                "MEMC ERROR: Bad data argument in TRT set()");
     372
     373        tab[index].valid       = true;
     374        tab[index].xram_read   = xram_read;
     375        tab[index].nline       = nline;
     376        tab[index].srcid       = srcid;
     377        tab[index].trdid       = trdid;
     378        tab[index].pktid       = pktid;
     379        tab[index].proc_read   = proc_read;
     380        tab[index].read_length = read_length;
     381        tab[index].word_index  = word_index;
     382        tab[index].ll_key      = ll_key;
     383        tab[index].config      = config;
     384        for (size_t i = 0; i < tab[index].wdata.size(); i++)
     385        {
     386            tab[index].wdata_be[i] = data_be[i];
     387            tab[index].wdata[i]    = data[i];
    389388        }
    390389    }
     
    399398    // - data  : 64 bits value (first data right)
    400399    /////////////////////////////////////////////////////////////////////
    401     void write_rsp(const size_t      index,
    402                    const size_t      word,
    403                    const wide_data_t data,
    404                    const bool        rerror)
    405     {
    406         data_t  value;
    407         data_t  mask;
    408 
    409         assert( (index < size_tab) and
    410         "MEMC ERROR: The selected entry is out of range in TRT write_rsp()");
    411 
    412         assert( (word < tab[index].wdata_be.size()) and
    413         "MEMC ERROR: Bad word index in TRT write_rsp()");
    414 
    415         assert( (tab[index].valid) and
    416         "MEMC ERROR: TRT entry not valid in TRT write_rsp()");
    417 
    418         assert( (tab[index].xram_read ) and
    419         "MEMC ERROR: TRT entry is not a GET in TRT write_rsp()");
    420 
    421         if ( rerror )
     400    void write_rsp(const size_t index,
     401            const size_t        word,
     402            const wide_data_t  data,
     403            const bool          rerror)
     404    {
     405        data_t value;
     406        data_t mask;
     407
     408        assert((index < size_tab) and
     409                "MEMC ERROR: The selected entry is out of range in TRT write_rsp()");
     410
     411        assert((word < tab[index].wdata_be.size()) and
     412                "MEMC ERROR: Bad word index in TRT write_rsp()");
     413
     414        assert((tab[index].valid) and
     415                "MEMC ERROR: TRT entry not valid in TRT write_rsp()");
     416
     417        assert((tab[index].xram_read ) and
     418                "MEMC ERROR: TRT entry is not a GET in TRT write_rsp()");
     419
     420        if (rerror)
    422421        {
    423422            tab[index].rerror = true;
     
    426425
    427426        // first 32 bits word
    428         value = (data_t)data;
     427        value = (data_t) data;
    429428        mask  = be_to_mask(tab[index].wdata_be[word]);
    430429        tab[index].wdata[word] = (tab[index].wdata[word] & mask) | (value & ~mask);
    431430
    432431        // second 32 bits word
    433         value = (data_t)(data>>32);
    434         mask  = be_to_mask(tab[index].wdata_be[word+1]);
    435         tab[index].wdata[word+1] = (tab[index].wdata[word+1] & mask) | (value & ~mask);
     432        value = (data_t) (data >> 32);
     433        mask  = be_to_mask(tab[index].wdata_be[word + 1]);
     434        tab[index].wdata[word + 1] = (tab[index].wdata[word + 1] & mask) | (value & ~mask);
    436435    }
    437436    /////////////////////////////////////////////////////////////////////
     
    443442    {
    444443        assert( (index < size_tab) and
    445         "MEMC ERROR: The selected entry is out of range in TRT erase()");
    446 
    447         tab[index].valid        = false;
    448         tab[index].rerror   = false;
     444                "MEMC ERROR: The selected entry is out of range in TRT erase()");
     445
     446        tab[index].valid  = false;
     447        tab[index].rerror = false;
    449448    }
    450449    /////////////////////////////////////////////////////////////////////
     
    456455    {
    457456        assert( (index < size_tab) and
    458         "MEMC ERROR: The selected entry is out of range in TRT is_config()");
     457                "MEMC ERROR: The selected entry is out of range in TRT is_config()");
    459458
    460459        return tab[index].config;
Note: See TracChangeset for help on using the changeset viewer.