Changeset 836


Ignore:
Timestamp:
Oct 15, 2014, 11:41:49 AM (9 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
Location:
trunk
Files:
20 edited

Legend:

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

    r816 r836  
    13871387            int state;
    13881388            paddr_t tag;
    1389             size_t way = r_icache_flush_count.read()/m_icache_sets;
    1390             size_t set = r_icache_flush_count.read()%m_icache_sets;
     1389            size_t way = r_icache_flush_count.read() / m_icache_sets;
     1390            size_t set = r_icache_flush_count.read() % m_icache_sets;
    13911391
    13921392#ifdef INSTRUMENTATION
     
    24382438            if (m_dreq.type == iss_t::XTN_READ)
    24392439            {
    2440                 int xtn_opcode = (int)m_dreq.addr / 4;
     2440                int xtn_opcode = (int) m_dreq.addr / 4;
    24412441
    24422442                // checking processor mode:
     
    29722972
    29732973        // itlb miss request
    2974         else if (r_icache_tlb_miss_req.read() and not wbuf_write_miss )
     2974        else if (r_icache_tlb_miss_req.read() and not wbuf_write_miss)
    29752975        {
    29762976            r_dcache_tlb_ins    = true;
     
    31113111
    31123112            }
    3113             else if (entry & PTE_T_MASK ) //  PTD : me must access PT2
     3113            else if (entry & PTE_T_MASK) //  PTD : me must access PT2
    31143114            {
    31153115                // mark the cache line ac containing a PTD
     
    38473847            int     state;
    38483848            paddr_t tag;
    3849             size_t  way = r_dcache_flush_count.read()/m_dcache_sets;
    3850             size_t  set = r_dcache_flush_count.read()%m_dcache_sets;
     3849            size_t  way = r_dcache_flush_count.read() / m_dcache_sets;
     3850            size_t  set = r_dcache_flush_count.read() % m_dcache_sets;
    38513851
    38523852#ifdef INSTRUMENTATION
     
    44604460                r_dcache_contains_ptd[way * m_dcache_sets + set] = false;
    44614461            }
    4462             if      (r_dcache_miss_type.read()==PTE1_MISS) r_dcache_fsm = DCACHE_TLB_PTE1_GET;
    4463             else if (r_dcache_miss_type.read()==PTE2_MISS) r_dcache_fsm = DCACHE_TLB_PTE2_GET;
    4464             else                                           r_dcache_fsm = DCACHE_IDLE;
     4462            if      (r_dcache_miss_type.read() == PTE1_MISS) r_dcache_fsm = DCACHE_TLB_PTE1_GET;
     4463            else if (r_dcache_miss_type.read() == PTE2_MISS) r_dcache_fsm = DCACHE_TLB_PTE2_GET;
     4464            else                                             r_dcache_fsm = DCACHE_IDLE;
    44654465        }
    44664466        break;
     
    47604760        }
    47614761
    4762         assert ( not r_dcache_cc_send_req.read() and
    4763         "CC_SEND must be available in DCACHE_CC_CHECK" );
     4762        assert(not r_dcache_cc_send_req.read() and
     4763        "CC_SEND must be available in DCACHE_CC_CHECK");
    47644764
    47654765        // Match between MISS address and CC address
     
    60216021        p_vci.trdid   = 0;
    60226022        p_vci.pktid   = TYPE_READ_INS_MISS;
    6023         p_vci.plen    = m_icache_words<<2;
     6023        p_vci.plen    = m_icache_words << 2;
    60246024        p_vci.cmd     = vci_param::CMD_READ;
    60256025        p_vci.eop     = true;
  • trunk/modules/vci_mem_cache/caba/metadata/vci_mem_cache.sd

    r468 r836  
    1515                cell_size = parameter.Reference('memc_cell_size_ext')
    1616            ),
    17             parameter.Int('dspin_in_width'),
    18             parameter.Int('dspin_out_width'),
     17            parameter.Int('memc_dspin_in_width'),
     18            parameter.Int('memc_dspin_out_width'),
    1919        ],
    2020
     
    5050            Port('caba:dspin_input',
    5151                'p_dspin_p2m',
    52                 dspin_data_size = parameter.Reference('dspin_in_width')
     52                dspin_data_size = parameter.Reference('memc_dspin_in_width')
    5353            ),
    5454            Port('caba:dspin_output',
    5555                'p_dspin_m2p',
    56                 dspin_data_size = parameter.Reference('dspin_out_width')
     56                dspin_data_size = parameter.Reference('memc_dspin_out_width')
    5757            ),
    5858            Port('caba:dspin_output',
    5959                'p_dspin_clack',
    60                 dspin_data_size = parameter.Reference('dspin_out_width')
     60                dspin_data_size = parameter.Reference('memc_dspin_out_width')
    6161            ),
    6262        ],
  • trunk/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h

    r753 r836  
    1212namespace soclib { namespace caba {
    1313
    14   using namespace sc_core;
    15 
    16   ////////////////////////////////////////////////////////////////////////
    17   //                    A LRU entry
    18   ////////////////////////////////////////////////////////////////////////
    19   class LruEntry {
     14using namespace sc_core;
     15
     16////////////////////////////////////////////////////////////////////////
     17//                    A LRU entry
     18////////////////////////////////////////////////////////////////////////
     19class LruEntry {
    2020
    2121    public:
    2222
    23       bool recent;           
    24 
    25       void init()
    26       {
    27         recent=false;
    28       }
    29 
    30   }; // end class LruEntry
    31 
    32   ////////////////////////////////////////////////////////////////////////
    33   //                    An Owner
    34   ////////////////////////////////////////////////////////////////////////
    35   class Owner{
    36    
     23        bool recent;           
     24
     25        void init()
     26        {
     27            recent = false;
     28        }
     29
     30}; // end class LruEntry
     31
     32////////////////////////////////////////////////////////////////////////
     33//                    An Owner
     34////////////////////////////////////////////////////////////////////////
     35class Owner{
     36
    3737    public:
    38     // Fields
    39       bool      inst;       // Is the owner an ICache ?
    40       size_t    srcid;      // The SRCID of the owner
    41 
    42     ////////////////////////
    43     // Constructors
    44     ////////////////////////
    45       Owner(bool  i_inst,
    46             size_t i_srcid)
    47       {
    48         inst    = i_inst;
    49         srcid  = i_srcid;
    50       }
    51 
    52       Owner(const Owner &a)
    53       {
    54         inst    = a.inst;
    55         srcid  = a.srcid;
    56       }
    57 
    58       Owner()
    59       {
    60         inst    = false;
    61         srcid  = 0;
    62       }
    63       // end constructors
    64 
    65   }; // end class Owner
    66 
    67 
    68   ////////////////////////////////////////////////////////////////////////
    69   //                    A directory entry                               
    70   ////////////////////////////////////////////////////////////////////////
    71   class DirectoryEntry {
     38        // Fields
     39        bool   inst;  // Is the owner an ICache ?
     40        size_t srcid; // The SRCID of the owner
     41
     42        ////////////////////////
     43        // Constructors
     44        ////////////////////////
     45        Owner(bool i_inst,
     46                size_t i_srcid)
     47        {
     48            inst  = i_inst;
     49            srcid = i_srcid;
     50        }
     51
     52        Owner(const Owner &a)
     53        {
     54            inst  = a.inst;
     55            srcid = a.srcid;
     56        }
     57
     58        Owner()
     59        {
     60            inst  = false;
     61            srcid = 0;
     62        }
     63        // end constructors
     64
     65}; // end class Owner
     66
     67
     68////////////////////////////////////////////////////////////////////////
     69//                    A directory entry                               
     70////////////////////////////////////////////////////////////////////////
     71class DirectoryEntry {
    7272
    7373    typedef uint32_t tag_t;
     
    7575    public:
    7676
    77     bool    valid;                  // entry valid
    78     bool    is_cnt;                 // directory entry is in counter mode
    79     bool    dirty;                  // entry dirty
    80     bool    lock;                   // entry locked
    81     tag_t   tag;                    // tag of the entry
    82     size_t  count;                  // number of copies
    83     Owner   owner;                  // an owner of the line
    84     size_t  ptr;                    // pointer to the next owner
     77    bool    valid;  // entry valid
     78    bool    is_cnt; // directory entry is in counter mode
     79    bool    dirty;  // entry dirty
     80    bool    lock;   // entry locked
     81    tag_t   tag;    // tag of the entry
     82    size_t  count;  // number of copies
     83    Owner   owner;  // an owner of the line
     84    size_t  ptr;    // pointer to the next owner
    8585
    8686    DirectoryEntry()
    8787    {
    88       valid         = false;
    89       is_cnt        = false;
    90       dirty         = false;
    91       lock          = false;
    92       tag           = 0;
    93       count         = 0;
    94       owner.inst    = 0;
    95       owner.srcid  = 0;
    96       ptr           = 0;
     88        valid       = false;
     89        is_cnt      = false;
     90        dirty       = false;
     91        lock        = false;
     92        tag         = 0;
     93        count       = 0;
     94        owner.inst  = 0;
     95        owner.srcid = 0;
     96        ptr         = 0;
    9797    }
    9898
    9999    DirectoryEntry(const DirectoryEntry &source)
    100100    {
    101       valid         = source.valid;
    102       is_cnt        = source.is_cnt;
    103       dirty         = source.dirty;
    104       lock          = source.lock;
    105       tag           = source.tag;
    106       count         = source.count;
    107       owner         = source.owner;
    108       ptr           = source.ptr;
     101        valid  = source.valid;
     102        is_cnt = source.is_cnt;
     103        dirty  = source.dirty;
     104        lock   = source.lock;
     105        tag    = source.tag;
     106        count  = source.count;
     107        owner  = source.owner;
     108        ptr    = source.ptr;
    109109    }         
    110110
     
    114114    void init()
    115115    {
    116       valid     = false;
    117       is_cnt    = false;
    118       dirty     = false;
    119       lock      = false;
    120       count     = 0;
     116        valid  = false;
     117        is_cnt = false;
     118        dirty  = false;
     119        lock   = false;
     120        count  = 0;
    121121    }
    122122
     
    126126    void copy(const DirectoryEntry &source)
    127127    {
    128       valid         = source.valid;
    129       is_cnt    = source.is_cnt;
    130       dirty         = source.dirty;
    131       lock          = source.lock;
    132       tag           = source.tag;
    133       count     = source.count;
    134       owner     = source.owner;
    135       ptr       = source.ptr;
     128        valid  = source.valid;
     129        is_cnt = source.is_cnt;
     130        dirty  = source.dirty;
     131        lock   = source.lock;
     132        tag    = source.tag;
     133        count  = source.count;
     134        owner  = source.owner;
     135        ptr    = source.ptr;
    136136    }
    137137
     
    141141    void print()
    142142    {
    143       std::cout << "Valid = " << valid
    144                 << " ; IS COUNT = " << is_cnt
    145                 << " ; Dirty = " << dirty
    146                 << " ; Lock = " << lock
    147                 << " ; Tag = " << std::hex << tag << std::dec
    148                 << " ; Count = " << count
    149                 << " ; Owner = " << owner.srcid
    150                 << " " << owner.inst
    151                 << " ; Pointer = " << ptr << std::endl;
     143        std::cout << "Valid = " << valid
     144            << " ; IS COUNT = " << is_cnt
     145            << " ; Dirty = " << dirty
     146            << " ; Lock = " << lock
     147            << " ; Tag = " << std::hex << tag << std::dec
     148            << " ; Count = " << count
     149            << " ; Owner = " << owner.srcid
     150            << " " << owner.inst
     151            << " ; Pointer = " << ptr << std::endl;
    152152    }
    153153
    154   }; // end class DirectoryEntry
    155 
    156   ////////////////////////////////////////////////////////////////////////
    157   //                       The directory 
    158   ////////////////////////////////////////////////////////////////////////
    159   class CacheDirectory {
     154}; // end class DirectoryEntry
     155
     156////////////////////////////////////////////////////////////////////////
     157//                       The directory 
     158////////////////////////////////////////////////////////////////////////
     159class CacheDirectory {
    160160
    161161    typedef sc_dt::sc_uint<40> addr_t;
     
    166166
    167167    // Directory constants
    168     size_t                                      m_ways;
    169     size_t                                      m_sets;
    170     size_t                                      m_words;
    171     size_t                                      m_width;
    172     uint32_t                lfsr;
     168    size_t   m_ways;
     169    size_t   m_sets;
     170    size_t   m_words;
     171    size_t   m_width;
     172    uint32_t lfsr;
    173173
    174174    // the directory & lru tables
    175     DirectoryEntry                              **m_dir_tab;
    176     LruEntry                                    **m_lru_tab;
     175    DirectoryEntry ** m_dir_tab;
     176    LruEntry       ** m_lru_tab;
    177177
    178178    public:
     
    181181    // Constructor
    182182    ////////////////////////
    183     CacheDirectory( size_t ways, size_t sets, size_t words, size_t address_width)       
    184     {
    185       m_ways  = ways;
    186       m_sets  = sets;
    187       m_words = words;
    188       m_width = address_width;
    189       lfsr = -1;
    190 
    191       m_dir_tab = new DirectoryEntry*[sets];
    192       for ( size_t i=0; i<sets; i++ ) {
    193         m_dir_tab[i] = new DirectoryEntry[ways];
    194         for ( size_t j=0 ; j<ways ; j++) m_dir_tab[i][j].init();
    195       }
    196       m_lru_tab = new LruEntry*[sets];
    197       for ( size_t i=0; i<sets; i++ ) {
    198         m_lru_tab[i] = new LruEntry[ways];
    199         for ( size_t j=0 ; j<ways ; j++) m_lru_tab[i][j].init();
    200       }
     183    CacheDirectory( size_t ways, size_t sets, size_t words, size_t address_width)   
     184    {
     185        m_ways  = ways;
     186        m_sets  = sets;
     187        m_words = words;
     188        m_width = address_width;
     189        lfsr = -1;
     190
     191        m_dir_tab = new DirectoryEntry*[sets];
     192        for (size_t i = 0; i < sets; i++ ) {
     193            m_dir_tab[i] = new DirectoryEntry[ways];
     194            for (size_t j = 0; j < ways; j++) m_dir_tab[i][j].init();
     195        }
     196        m_lru_tab = new LruEntry*[sets];
     197        for (size_t i = 0; i < sets; i++) {
     198            m_lru_tab[i] = new LruEntry[ways];
     199            for (size_t j = 0; j < ways; j++) m_lru_tab[i][j].init();
     200        }
    201201    } // end constructor
    202202
     
    206206    ~CacheDirectory()
    207207    {
    208       for(size_t i=0 ; i<m_sets ; i++){
    209         delete [] m_dir_tab[i];
    210         delete [] m_lru_tab[i];
    211       }
    212       delete [] m_dir_tab;
    213       delete [] m_lru_tab;
     208        for(size_t i = 0; i < m_sets; i++){
     209            delete [] m_dir_tab[i];
     210            delete [] m_lru_tab[i];
     211        }
     212        delete [] m_dir_tab;
     213        delete [] m_lru_tab;
    214214    } // end destructor
    215215
     
    230230#undef L2
    231231
    232         bool hit       = false;
    233         for ( size_t i=0 ; i<m_ways ; i++ )
    234         {
    235             bool equal = ( m_dir_tab[set][i].tag == tag );
     232        bool hit = false;
     233        for (size_t i = 0; i < m_ways; i++ )
     234        {
     235            bool equal = (m_dir_tab[set][i].tag == tag);
    236236            bool valid = m_dir_tab[set][i].valid;
    237237            hit        = equal && valid;
    238             if ( hit )
    239             {                   
     238            if (hit)
     239            {           
    240240                way = i;
    241241                break;
    242242            }
    243243        }
    244         if ( hit )
     244        if (hit)
    245245        {
    246246            m_lru_tab[set][way].recent = true;
     
    257257    // way arguments.
    258258    /////////////////////////////////////////////////////////////////////
    259     void inval( const size_t &way, const size_t &set )
     259    void inval(const size_t &way, const size_t &set)
    260260    {
    261261        m_dir_tab[set][way].init();
     
    269269    // The function returns a copy of a (valid or invalid) entry 
    270270    /////////////////////////////////////////////////////////////////////
    271     DirectoryEntry read_neutral( const addr_t &address,
    272                                  size_t*      ret_way,
    273                                  size_t*      ret_set )
     271    DirectoryEntry read_neutral(const addr_t &address,
     272            size_t * ret_way,
     273            size_t * ret_set )
    274274    {
    275275
    276276#define L2 soclib::common::uint32_log2
    277         size_t set = (size_t)(address >> (L2(m_words) + 2)) & (m_sets - 1);
    278         tag_t  tag = (tag_t)(address >> (L2(m_sets) + L2(m_words) + 2));
     277        size_t set = (size_t) (address >> (L2(m_words) + 2)) & (m_sets - 1);
     278        tag_t  tag = (tag_t) (address >> (L2(m_sets) + L2(m_words) + 2));
    279279#undef L2
    280280
    281         for ( size_t way = 0 ; way < m_ways ; way++ )
    282         {
    283             bool equal = ( m_dir_tab[set][way].tag == tag );
     281        for (size_t way = 0; way < m_ways; way++)
     282        {
     283            bool equal = (m_dir_tab[set][way].tag == tag);
    284284            bool valid = m_dir_tab[set][way].valid;
    285             if ( equal and valid )
     285            if (equal and valid)
    286286            {
    287287                *ret_set = set;
     
    301301    // - entry : the entry value
    302302    /////////////////////////////////////////////////////////////////////
    303     void write( const size_t         &set,
    304                 const size_t         &way,
    305                 const DirectoryEntry &entry)
    306     {
    307       assert( (set<m_sets)
    308           && "Cache Directory write : The set index is invalid");
    309       assert( (way<m_ways)
    310           && "Cache Directory write : The way index is invalid");
    311 
    312       // update Directory
    313       m_dir_tab[set][way].copy(entry);
    314 
    315       // update LRU bits
    316       bool all_recent = true;
    317       for ( size_t i=0 ; i<m_ways ; i++ )
    318       {
    319           if ( i != way ) all_recent = m_lru_tab[set][i].recent && all_recent;
    320       }
    321       if ( all_recent )
    322       {
    323           for( size_t i=0 ; i<m_ways ; i++ ) m_lru_tab[set][i].recent = false;
    324       }
    325       else
    326       {
    327           m_lru_tab[set][way].recent = true;
    328       }
     303    void write(const size_t &set,
     304               const size_t &way,
     305               const DirectoryEntry &entry)
     306    {
     307        assert((set < m_sets) && "Cache Directory write : The set index is invalid");
     308        assert((way < m_ways) && "Cache Directory write : The way index is invalid");
     309
     310        // update Directory
     311        m_dir_tab[set][way].copy(entry);
     312
     313        // update LRU bits
     314        bool all_recent = true;
     315        for (size_t i = 0; i < m_ways; i++)
     316        {
     317            if (i != way) all_recent = m_lru_tab[set][i].recent && all_recent;
     318        }
     319        if (all_recent)
     320        {
     321            for (size_t i = 0; i < m_ways; i++) m_lru_tab[set][i].recent = false;
     322        }
     323        else
     324        {
     325            m_lru_tab[set][way].recent = true;
     326        }
    329327    } // end write()
    330328
     
    337335    void print(const size_t &set, const size_t &way)
    338336    {
    339       std::cout << std::dec << " set : " << set << " ; way : " << way << " ; " ;
    340       m_dir_tab[set][way].print();
     337        std::cout << std::dec << " set : " << set << " ; way : " << way << " ; " ;
     338        m_dir_tab[set][way].print();
    341339    } // end print()
    342340
     
    349347    DirectoryEntry select(const size_t &set, size_t &way)
    350348    {
    351         assert( (set < m_sets)
    352           && "Cache Directory : (select) The set index is invalid");
     349        assert((set < m_sets)
     350                && "Cache Directory : (select) The set index is invalid");
    353351
    354352        // looking for an empty slot
    355         for(size_t i=0; i<m_ways; i++)
    356         {
    357             if( not m_dir_tab[set][i].valid )
    358             {
    359                 way=i;
     353        for (size_t i = 0; i < m_ways; i++)
     354        {
     355            if (not m_dir_tab[set][i].valid)
     356            {
     357                way = i;
    360358                return DirectoryEntry(m_dir_tab[set][way]);
    361359            }
     
    369367
    370368        // looking for a not locked and not recently used entry
    371         for(size_t i=0; i<m_ways; i++)
    372         {
    373             if((not m_lru_tab[set][i].recent) && (not m_dir_tab[set][i].lock) )
    374             {
    375                 way=i;
     369        for (size_t i = 0; i < m_ways; i++)
     370        {
     371            if ((not m_lru_tab[set][i].recent) && (not m_dir_tab[set][i].lock))
     372            {
     373                way = i;
    376374                return DirectoryEntry(m_dir_tab[set][way]);
    377375            }
     
    379377
    380378        // looking for a locked not recently used entry
    381         for(size_t i=0; i<m_ways; i++)
    382         {
    383             if( (not m_lru_tab[set][i].recent) && (m_dir_tab[set][i].lock))
    384             {
    385                 way=i;
     379        for (size_t i = 0; i < m_ways; i++)
     380        {
     381            if ((not m_lru_tab[set][i].recent) && (m_dir_tab[set][i].lock))
     382            {
     383                way = i;
    386384                return DirectoryEntry(m_dir_tab[set][way]);
    387385            }
     
    389387
    390388        // looking for a recently used entry not locked
    391         for(size_t i=0; i<m_ways; i++)
    392         {
    393             if( (m_lru_tab[set][i].recent) && (not m_dir_tab[set][i].lock))
    394             {
    395                 way=i;
     389        for (size_t i = 0; i < m_ways; i++)
     390        {
     391            if ((m_lru_tab[set][i].recent) && (not m_dir_tab[set][i].lock))
     392            {
     393                way = i;
    396394                return DirectoryEntry(m_dir_tab[set][way]);
    397395            }
     
    404402
    405403    /////////////////////////////////////////////////////////////////////
    406     //          Global initialisation function
     404    //         Global initialisation function
    407405    /////////////////////////////////////////////////////////////////////
    408406    void init()
    409407    {
    410       for ( size_t set=0 ; set<m_sets ; set++ )
    411       {
    412         for ( size_t way=0 ; way<m_ways ; way++ )
    413         {
    414           m_dir_tab[set][way].init();
    415           m_lru_tab[set][way].init();
    416         }
    417       }
     408        for (size_t set = 0; set < m_sets; set++)
     409        {
     410            for (size_t way = 0; way < m_ways; way++)
     411            {
     412                m_dir_tab[set][way].init();
     413                m_lru_tab[set][way].init();
     414            }
     415        }
    418416    } // end init()
    419417
    420   }; // end class CacheDirectory
    421 
    422   ///////////////////////////////////////////////////////////////////////
    423   //                    A Heap Entry
    424   ///////////////////////////////////////////////////////////////////////
    425   class HeapEntry{
     418}; // end class CacheDirectory
     419
     420///////////////////////////////////////////////////////////////////////
     421//                    A Heap Entry
     422///////////////////////////////////////////////////////////////////////
     423class HeapEntry{
    426424
    427425    public:
    428     // Fields of the entry
    429       Owner     owner;
    430       size_t    next;
    431 
    432     ////////////////////////
    433     // Constructor
    434     ////////////////////////
    435       HeapEntry()
    436       :owner(false,0)
    437       {
    438         next = 0;
    439       } // end constructor
    440 
    441     ////////////////////////
    442     // Constructor
    443     ////////////////////////
    444       HeapEntry(const HeapEntry &entry)
    445       {
    446         owner.inst  = entry.owner.inst;
    447         owner.srcid = entry.owner.srcid;
    448         next           = entry.next;
    449       } // end constructor
    450 
    451     /////////////////////////////////////////////////////////////////////
    452     // The copy() function copies an existing source entry to a target
    453     /////////////////////////////////////////////////////////////////////
    454       void copy(const HeapEntry &entry)
    455       {
    456         owner.inst     = entry.owner.inst;
    457         owner.srcid    = entry.owner.srcid;
    458         next           = entry.next;
    459       } // end copy()
    460 
    461     ////////////////////////////////////////////////////////////////////
    462     // The print() function prints the entry
    463     ////////////////////////////////////////////////////////////////////
    464       void print(){
    465         std::cout
    466         << " -- owner.inst     : " << std::dec << owner.inst << std::endl
    467         << " -- owner.srcid    : " << std::dec << owner.srcid << std::endl
    468         << " -- next           : " << std::dec << next << std::endl;
    469 
    470       } // end print()
    471 
    472   }; // end class HeapEntry
    473 
    474   ////////////////////////////////////////////////////////////////////////
    475   //                        The Heap
    476   ////////////////////////////////////////////////////////////////////////
    477   class HeapDirectory{
    478    
     426        // Fields of the entry
     427        Owner  owner;
     428        size_t next;
     429
     430        ////////////////////////
     431        // Constructor
     432        ////////////////////////
     433        HeapEntry()
     434            :owner(false, 0)
     435        {
     436            next = 0;
     437        } // end constructor
     438
     439        ////////////////////////
     440        // Constructor
     441        ////////////////////////
     442        HeapEntry(const HeapEntry &entry)
     443        {
     444            owner.inst  = entry.owner.inst;
     445            owner.srcid = entry.owner.srcid;
     446            next        = entry.next;
     447        } // end constructor
     448
     449        /////////////////////////////////////////////////////////////////////
     450        // The copy() function copies an existing source entry to a target
     451        /////////////////////////////////////////////////////////////////////
     452        void copy(const HeapEntry &entry)
     453        {
     454            owner.inst     = entry.owner.inst;
     455            owner.srcid    = entry.owner.srcid;
     456            next           = entry.next;
     457        } // end copy()
     458
     459        ////////////////////////////////////////////////////////////////////
     460        // The print() function prints the entry
     461        ////////////////////////////////////////////////////////////////////
     462        void print() {
     463            std::cout
     464                << " -- owner.inst     : " << std::dec << owner.inst << std::endl
     465                << " -- owner.srcid    : " << std::dec << owner.srcid << std::endl
     466                << " -- next           : " << std::dec << next << std::endl;
     467
     468        } // end print()
     469
     470}; // end class HeapEntry
     471
     472////////////////////////////////////////////////////////////////////////
     473//                        The Heap
     474////////////////////////////////////////////////////////////////////////
     475class HeapDirectory{
     476
    479477    private:
    480     // Registers and the heap
    481       size_t    ptr_free;
    482       bool      full;
    483       HeapEntry *m_heap_tab;
    484 
    485     // Constants for debugging purpose
    486       size_t    tab_size;
     478        // Registers and the heap
     479        size_t ptr_free;
     480        bool   full;
     481        HeapEntry * m_heap_tab;
     482
     483        // Constants for debugging purpose
     484        size_t    tab_size;
    487485
    488486    public:
    489     ////////////////////////
    490     // Constructor
    491     ////////////////////////
    492       HeapDirectory(uint32_t size){
    493         assert(size>0 && "Memory Cache, HeapDirectory constructor : invalid size");
    494         ptr_free    = 0;
    495         full        = false;
    496         m_heap_tab  = new HeapEntry[size];
    497         tab_size    = size;
    498       } // end constructor
    499 
    500     /////////////////
    501     // Destructor
    502     /////////////////
    503       ~HeapDirectory(){
    504         delete [] m_heap_tab;
    505       } // end destructor
    506 
    507     /////////////////////////////////////////////////////////////////////
    508     //          Global initialisation function
    509     /////////////////////////////////////////////////////////////////////
    510       void init(){
    511         ptr_free=0;
    512         full=false;
    513         for(size_t i=0; i< tab_size-1;i++){
    514           m_heap_tab[i].next = i+1;
    515         }
    516         m_heap_tab[tab_size-1].next = tab_size-1;
    517         return;
    518       }
    519 
    520     /////////////////////////////////////////////////////////////////////
    521     // The print() function prints a selected directory entry
    522     // Arguments :
    523     // - ptr : the pointer to the entry to print
    524     /////////////////////////////////////////////////////////////////////
    525       void print(const size_t &ptr){
    526         std::cout << "Heap, printing the entry : " << std::dec << ptr << std::endl;
    527         m_heap_tab[ptr].print();
    528       } // end print()
    529 
    530     /////////////////////////////////////////////////////////////////////
    531     // The print_list() function prints a list from selected directory entry
    532     // Arguments :
    533     // - ptr : the pointer to the first entry to print
    534     /////////////////////////////////////////////////////////////////////
    535       void print_list(const size_t &ptr){
    536         bool end = false;
    537         size_t ptr_temp = ptr;
    538         std::cout << "Heap, printing the list from : " << std::dec << ptr << std::endl;
    539         while(!end){
    540             m_heap_tab[ptr_temp].print();
    541             if(ptr_temp == m_heap_tab[ptr_temp].next) end = true;
    542             ptr_temp = m_heap_tab[ptr_temp].next;
    543         }
    544       } // end print_list()
    545 
    546     /////////////////////////////////////////////////////////////////////
    547     // The is_full() function return true if the heap is full.
    548     /////////////////////////////////////////////////////////////////////
    549       bool is_full(){
    550         return full;
    551       } // end is_full()
    552 
    553     /////////////////////////////////////////////////////////////////////
    554     // The next_free_ptr() function returns the pointer
    555     // to the next free entry.
    556     /////////////////////////////////////////////////////////////////////
    557       size_t next_free_ptr(){
    558         return ptr_free;
    559       } // end next_free_ptr()
    560 
    561     /////////////////////////////////////////////////////////////////////
    562     // The next_free_entry() function returns
    563     // a copy of the next free entry.
    564     /////////////////////////////////////////////////////////////////////
    565       HeapEntry next_free_entry(){
    566         return HeapEntry(m_heap_tab[ptr_free]);
    567       } // end next_free_entry()
    568    
    569     /////////////////////////////////////////////////////////////////////
    570     // The write_free_entry() function modify the next free entry.
    571     // Arguments :
    572     // - entry : the entry to write
    573     /////////////////////////////////////////////////////////////////////
    574       void write_free_entry(const HeapEntry &entry){
    575         m_heap_tab[ptr_free].copy(entry);
    576       } // end write_free_entry()
    577 
    578     /////////////////////////////////////////////////////////////////////
    579     // The write_free_ptr() function writes the pointer
    580     // to the next free entry
    581     /////////////////////////////////////////////////////////////////////
    582       void write_free_ptr(const size_t &ptr){
    583         assert( (ptr<tab_size) && "HeapDirectory error : try to write a wrong free pointer");
    584         ptr_free = ptr;
    585       } // end write_free_ptr()
    586 
    587     /////////////////////////////////////////////////////////////////////
    588     // The set_full() function sets the full bit (to true).
    589     /////////////////////////////////////////////////////////////////////
    590       void set_full(){
    591         full = true;
    592       } // end set_full()
    593 
    594     /////////////////////////////////////////////////////////////////////
    595     // The unset_full() function unsets the full bit (to false).
    596     /////////////////////////////////////////////////////////////////////
    597       void unset_full(){
    598         full = false;
    599       } // end unset_full()
    600 
    601     /////////////////////////////////////////////////////////////////////
    602     // The read() function returns a copy of
    603     // the entry pointed by the argument
    604     // Arguments :
    605     //  - ptr : the pointer to the entry to read
    606     /////////////////////////////////////////////////////////////////////
    607       HeapEntry read(const size_t &ptr){
    608         assert( (ptr<tab_size) && "HeapDirectory error : try to write a wrong free pointer");
    609         return HeapEntry(m_heap_tab[ptr]);
    610       } // end read()
    611 
    612     /////////////////////////////////////////////////////////////////////
    613     // The write() function writes an entry in the heap
    614     // Arguments :
    615     //  - ptr : the pointer to the entry to replace
    616     //  - entry : the entry to write
    617     /////////////////////////////////////////////////////////////////////
    618       void write(const size_t &ptr, const HeapEntry &entry){
    619         assert( (ptr<tab_size) && "HeapDirectory error : try to write a wrong free pointer");
    620         m_heap_tab[ptr].copy(entry);
    621       } // end write()
    622 
    623   }; // end class HeapDirectory
    624 
    625   ////////////////////////////////////////////////////////////////////////
    626   //                        Cache Data
    627   ////////////////////////////////////////////////////////////////////////
    628   class CacheData
    629   {
     487        ////////////////////////
     488        // Constructor
     489        ////////////////////////
     490        HeapDirectory(uint32_t size) {
     491            assert(size > 0 && "Memory Cache, HeapDirectory constructor : invalid size");
     492            ptr_free    = 0;
     493            full        = false;
     494            m_heap_tab  = new HeapEntry[size];
     495            tab_size    = size;
     496        } // end constructor
     497
     498        /////////////////
     499        // Destructor
     500        /////////////////
     501        ~HeapDirectory() {
     502            delete [] m_heap_tab;
     503        } // end destructor
     504
     505        /////////////////////////////////////////////////////////////////////
     506        //         Global initialisation function
     507        /////////////////////////////////////////////////////////////////////
     508        void init() {
     509            ptr_free = 0;
     510            full = false;
     511            for (size_t i = 0; i< tab_size - 1; i++){
     512                m_heap_tab[i].next = i + 1;
     513            }
     514            m_heap_tab[tab_size - 1].next = tab_size - 1;
     515            return;
     516        }
     517
     518        /////////////////////////////////////////////////////////////////////
     519        // The print() function prints a selected directory entry
     520        // Arguments :
     521        // - ptr : the pointer to the entry to print
     522        /////////////////////////////////////////////////////////////////////
     523        void print(const size_t &ptr) {
     524            std::cout << "Heap, printing the entry : " << std::dec << ptr << std::endl;
     525            m_heap_tab[ptr].print();
     526        } // end print()
     527
     528        /////////////////////////////////////////////////////////////////////
     529        // The print_list() function prints a list from selected directory entry
     530        // Arguments :
     531        // - ptr : the pointer to the first entry to print
     532        /////////////////////////////////////////////////////////////////////
     533        void print_list(const size_t &ptr) {
     534            bool end = false;
     535            size_t ptr_temp = ptr;
     536            std::cout << "Heap, printing the list from : " << std::dec << ptr << std::endl;
     537            while (!end){
     538                m_heap_tab[ptr_temp].print();
     539                if (ptr_temp == m_heap_tab[ptr_temp].next) {
     540                    end = true;
     541                }
     542                ptr_temp = m_heap_tab[ptr_temp].next;
     543            }
     544        } // end print_list()
     545
     546        /////////////////////////////////////////////////////////////////////
     547        // The is_full() function return true if the heap is full.
     548        /////////////////////////////////////////////////////////////////////
     549        bool is_full() {
     550            return full;
     551        } // end is_full()
     552
     553        /////////////////////////////////////////////////////////////////////
     554        // The next_free_ptr() function returns the pointer
     555        // to the next free entry.
     556        /////////////////////////////////////////////////////////////////////
     557        size_t next_free_ptr() {
     558            return ptr_free;
     559        } // end next_free_ptr()
     560
     561        /////////////////////////////////////////////////////////////////////
     562        // The next_free_entry() function returns
     563        // a copy of the next free entry.
     564        /////////////////////////////////////////////////////////////////////
     565        HeapEntry next_free_entry() {
     566            return HeapEntry(m_heap_tab[ptr_free]);
     567        } // end next_free_entry()
     568
     569        /////////////////////////////////////////////////////////////////////
     570        // The write_free_entry() function modify the next free entry.
     571        // Arguments :
     572        // - entry : the entry to write
     573        /////////////////////////////////////////////////////////////////////
     574        void write_free_entry(const HeapEntry &entry){
     575            m_heap_tab[ptr_free].copy(entry);
     576        } // end write_free_entry()
     577
     578        /////////////////////////////////////////////////////////////////////
     579        // The write_free_ptr() function writes the pointer
     580        // to the next free entry
     581        /////////////////////////////////////////////////////////////////////
     582        void write_free_ptr(const size_t &ptr){
     583            assert((ptr < tab_size) && "HeapDirectory error : try to write a wrong free pointer");
     584            ptr_free = ptr;
     585        } // end write_free_ptr()
     586
     587        /////////////////////////////////////////////////////////////////////
     588        // The set_full() function sets the full bit (to true).
     589        /////////////////////////////////////////////////////////////////////
     590        void set_full() {
     591            full = true;
     592        } // end set_full()
     593
     594        /////////////////////////////////////////////////////////////////////
     595        // The unset_full() function unsets the full bit (to false).
     596        /////////////////////////////////////////////////////////////////////
     597        void unset_full() {
     598            full = false;
     599        } // end unset_full()
     600
     601        /////////////////////////////////////////////////////////////////////
     602        // The read() function returns a copy of
     603        // the entry pointed by the argument
     604        // Arguments :
     605        //  - ptr : the pointer to the entry to read
     606        /////////////////////////////////////////////////////////////////////
     607        HeapEntry read(const size_t &ptr) {
     608            assert((ptr < tab_size) && "HeapDirectory error : try to write a wrong free pointer");
     609            return HeapEntry(m_heap_tab[ptr]);
     610        } // end read()
     611
     612        /////////////////////////////////////////////////////////////////////
     613        // The write() function writes an entry in the heap
     614        // Arguments :
     615        //  - ptr : the pointer to the entry to replace
     616        //  - entry : the entry to write
     617        /////////////////////////////////////////////////////////////////////
     618        void write(const size_t &ptr, const HeapEntry &entry) {
     619            assert((ptr < tab_size) && "HeapDirectory error : try to write a wrong free pointer");
     620            m_heap_tab[ptr].copy(entry);
     621        } // end write()
     622
     623}; // end class HeapDirectory
     624
     625////////////////////////////////////////////////////////////////////////
     626//                        Cache Data
     627////////////////////////////////////////////////////////////////////////
     628class CacheData
     629{
    630630    private:
    631       const uint32_t m_sets;
    632       const uint32_t m_ways;
    633       const uint32_t m_words;
    634 
    635       uint32_t *** m_cache_data;
     631        const uint32_t m_sets;
     632        const uint32_t m_ways;
     633        const uint32_t m_words;
     634
     635        uint32_t *** m_cache_data;
    636636
    637637    public:
    638638
    639       ///////////////////////////////////////////////////////
    640       CacheData(uint32_t ways, uint32_t sets, uint32_t words)
    641         : m_sets(sets), m_ways(ways), m_words(words)
    642       {
    643           m_cache_data = new uint32_t ** [ways];
    644           for ( size_t i=0 ; i < ways ; i++ )
    645           {
    646               m_cache_data[i] = new uint32_t * [sets];
    647           }
    648           for ( size_t i=0; i<ways; i++ )
    649           {
    650               for ( size_t j=0; j<sets; j++ )
    651               {
    652                   m_cache_data[i][j] = new uint32_t [words];
    653                   // Init to avoid potential errors from memory checkers
    654                   std::memset(m_cache_data[i][j], 0, sizeof(uint32_t) * words);
    655               }
    656           }
    657       }
    658       ////////////
    659       ~CacheData()
    660       {
    661           for(size_t i=0; i<m_ways ; i++)
    662           {
    663               for(size_t j=0; j<m_sets ; j++)
    664               {
    665                   delete [] m_cache_data[i][j];
    666               }
    667           }
    668           for(size_t i=0; i<m_ways ; i++)
    669           {
    670               delete [] m_cache_data[i];
    671           }
    672           delete [] m_cache_data;
    673       }
    674       //////////////////////////////////////////
    675       uint32_t read ( const uint32_t &way,
    676                       const uint32_t &set,
    677                       const uint32_t &word) const
    678       {
    679           assert((set  < m_sets ) && "Cache data error: Trying to read a wrong set" );
    680           assert((way  < m_ways ) && "Cache data error: Trying to read a wrong way" );
    681           assert((word < m_words) && "Cache data error: Trying to read a wrong word");
    682 
    683           return m_cache_data[way][set][word];
    684       }
    685       //////////////////////////////////////////
    686       void read_line( const uint32_t &way,
    687                       const uint32_t &set,
    688                       sc_core::sc_signal<uint32_t> * cache_line)
    689       {
    690           assert((set < m_sets ) && "Cache data error: Trying to read a wrong set" );
    691           assert((way < m_ways ) && "Cache data error: Trying to read a wrong way" );
    692 
    693           for (uint32_t word=0; word<m_words; word++)
    694               cache_line[word].write(m_cache_data[way][set][word]);
    695       }
    696       /////////////////////////////////////////
    697       void write ( const uint32_t &way,
    698                    const uint32_t &set,
    699                    const uint32_t &word,
    700                    const uint32_t &data,
    701                    const uint32_t &be = 0xF)
    702       {
    703 
    704           assert((set  < m_sets ) && "Cache data error: Trying to write a wrong set" );
    705           assert((way  < m_ways ) && "Cache data error: Trying to write a wrong way" );
    706           assert((word < m_words) && "Cache data error: Trying to write a wrong word");
    707           assert((be  <= 0xF    ) && "Cache data error: Trying to write a wrong be");
    708 
    709           if (be == 0x0) return;
    710 
    711           if (be == 0xF)
    712           {
    713               m_cache_data[way][set][word] = data;
    714               return;
    715           }
    716 
    717           uint32_t mask = 0;
    718           if  (be & 0x1) mask = mask | 0x000000FF;
    719           if  (be & 0x2) mask = mask | 0x0000FF00;
    720           if  (be & 0x4) mask = mask | 0x00FF0000;
    721           if  (be & 0x8) mask = mask | 0xFF000000;
    722 
    723           m_cache_data[way][set][word] =
    724               (data & mask) | (m_cache_data[way][set][word] & ~mask);
    725       }
    726   }; // end class CacheData
     639        ///////////////////////////////////////////////////////
     640        CacheData(uint32_t ways, uint32_t sets, uint32_t words)
     641            : m_sets(sets), m_ways(ways), m_words(words)
     642        {
     643            m_cache_data = new uint32_t ** [ways];
     644            for (size_t i = 0; i < ways; i++)
     645            {
     646                m_cache_data[i] = new uint32_t * [sets];
     647            }
     648            for (size_t i = 0; i < ways; i++)
     649            {
     650                for (size_t j = 0; j < sets; j++)
     651                {
     652                    m_cache_data[i][j] = new uint32_t[words];
     653                    // Init to avoid potential errors from memory checkers
     654                    std::memset(m_cache_data[i][j], 0, sizeof(uint32_t) * words);
     655                }
     656            }
     657        }
     658        ////////////
     659        ~CacheData()
     660        {
     661            for (size_t i = 0; i < m_ways; i++)
     662            {
     663                for (size_t j = 0; j < m_sets; j++)
     664                {
     665                    delete [] m_cache_data[i][j];
     666                }
     667            }
     668            for (size_t i = 0; i < m_ways; i++)
     669            {
     670                delete [] m_cache_data[i];
     671            }
     672            delete [] m_cache_data;
     673        }
     674        //////////////////////////////////////////
     675        uint32_t read (const uint32_t &way,
     676                const uint32_t &set,
     677                const uint32_t &word) const
     678        {
     679            assert((set  < m_sets)  && "Cache data error: Trying to read a wrong set" );
     680            assert((way  < m_ways)  && "Cache data error: Trying to read a wrong way" );
     681            assert((word < m_words) && "Cache data error: Trying to read a wrong word");
     682
     683            return m_cache_data[way][set][word];
     684        }
     685        //////////////////////////////////////////
     686        void read_line(const uint32_t &way,
     687                const uint32_t &set,
     688                sc_core::sc_signal<uint32_t> * cache_line)
     689        {
     690            assert((set < m_sets) && "Cache data error: Trying to read a wrong set" );
     691            assert((way < m_ways) && "Cache data error: Trying to read a wrong way" );
     692
     693            for (uint32_t word = 0; word < m_words; word++) {
     694                cache_line[word].write(m_cache_data[way][set][word]);
     695            }
     696        }
     697        /////////////////////////////////////////
     698        void write (const uint32_t &way,
     699                const uint32_t &set,
     700                const uint32_t &word,
     701                const uint32_t &data,
     702                const uint32_t &be = 0xF)
     703        {
     704
     705            assert((set  < m_sets)  && "Cache data error: Trying to write a wrong set" );
     706            assert((way  < m_ways)  && "Cache data error: Trying to write a wrong way" );
     707            assert((word < m_words) && "Cache data error: Trying to write a wrong word");
     708            assert((be  <= 0xF)     && "Cache data error: Trying to write a wrong be");
     709
     710            if (be == 0x0) return;
     711
     712            if (be == 0xF)
     713            {
     714                m_cache_data[way][set][word] = data;
     715                return;
     716            }
     717
     718            uint32_t mask = 0;
     719            if (be & 0x1) mask = mask | 0x000000FF;
     720            if (be & 0x2) mask = mask | 0x0000FF00;
     721            if (be & 0x4) mask = mask | 0x00FF0000;
     722            if (be & 0x8) mask = mask | 0xFF000000;
     723
     724            m_cache_data[way][set][word] =
     725                (data & mask) | (m_cache_data[way][set][word] & ~mask);
     726        }
     727}; // end class CacheData
    727728
    728729}} // end namespaces
  • trunk/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h

    r752 r836  
    6464  template<typename vci_param_int,
    6565           typename vci_param_ext,
    66            size_t   dspin_in_width,
    67            size_t   dspin_out_width>
     66           size_t   memc_dspin_in_width,
     67           size_t   memc_dspin_out_width>
    6868    class VciMemCache
    6969    : public soclib::caba::BaseModule
     
    470470      soclib::caba::VciTarget<vci_param_int>      p_vci_tgt;
    471471      soclib::caba::VciInitiator<vci_param_ext>   p_vci_ixr;
    472       soclib::caba::DspinInput<dspin_in_width>    p_dspin_p2m;
    473       soclib::caba::DspinOutput<dspin_out_width>  p_dspin_m2p;
    474       soclib::caba::DspinOutput<dspin_out_width>  p_dspin_clack;
     472      soclib::caba::DspinInput<memc_dspin_in_width>    p_dspin_p2m;
     473      soclib::caba::DspinOutput<memc_dspin_out_width>  p_dspin_m2p;
     474      soclib::caba::DspinOutput<memc_dspin_out_width>  p_dspin_clack;
    475475
    476476#if MONITOR_MEMCACHE_FSM == 1
  • 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;
  • trunk/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r811 r836  
    319319    template<typename vci_param_int, \
    320320    typename vci_param_ext, \
    321     size_t dspin_in_width,  \
    322     size_t dspin_out_width> x \
    323     VciMemCache<vci_param_int, vci_param_ext, dspin_in_width, dspin_out_width>
     321    size_t memc_dspin_in_width,  \
     322    size_t memc_dspin_out_width> x \
     323    VciMemCache<vci_param_int, vci_param_ext, memc_dspin_in_width, memc_dspin_out_width>
    324324
    325325    using namespace soclib::common;
  • trunk/platforms/almos-tsar-mipsel/tsar_xbar_cluster/caba/metadata/tsar_xbar_cluster.sd

    r663 r836  
    3434              memc_cell_size_int = parameter.Reference('vci_data_width_int'),
    3535              memc_cell_size_ext = parameter.Reference('vci_data_width_ext'),
    36               dspin_in_width  = parameter.Reference('dspin_rsp_width'),
    37               dspin_out_width = parameter.Reference('dspin_cmd_width')),
     36              memc_dspin_in_width  = parameter.Reference('dspin_rsp_width'),
     37              memc_dspin_out_width = parameter.Reference('dspin_cmd_width')),
    3838
    3939      Uses('caba:vci_simple_rom',
  • trunk/platforms/linux_monocluster/desc.py

    r828 r836  
    2323                memc_cell_size_int = cell_size,
    2424                memc_cell_size_ext = 8,
    25                 dspin_out_width = dspin_cmd_flit_size,
    26                 dspin_in_width = dspin_rsp_flit_size,
     25                memc_dspin_out_width = dspin_cmd_flit_size,
     26                memc_dspin_in_width = dspin_rsp_flit_size,
    2727                ),
    2828            Uses('caba:dspin_local_crossbar',
  • trunk/platforms/tsar_generic_iob/tsar_iob_cluster/caba/metadata/tsar_iob_cluster.sd

    r718 r836  
    3939
    4040        Uses('caba:vci_mem_cache',
    41               memc_cell_size_int = parameter.Reference('vci_data_width_int'),
    42               memc_cell_size_ext = parameter.Reference('vci_data_width_ext'),
    43               dspin_in_width     = parameter.Reference('dspin_int_rsp_width'),
    44               dspin_out_width    = parameter.Reference('dspin_int_cmd_width')),
     41              memc_cell_size_int   = parameter.Reference('vci_data_width_int'),
     42              memc_cell_size_ext   = parameter.Reference('vci_data_width_ext'),
     43              memc_dspin_in_width  = parameter.Reference('dspin_int_rsp_width'),
     44              memc_dspin_out_width = parameter.Reference('dspin_int_cmd_width')),
    4545
    4646        Uses('caba:vci_xicu',
  • trunk/platforms/tsar_generic_leti/tsar_leti_cluster/caba/metadata/tsar_leti_cluster.sd

    r692 r836  
    3232
    3333      Uses('caba:vci_mem_cache',
    34               memc_cell_size_int = parameter.Reference('vci_data_width_int'),
    35               memc_cell_size_ext = parameter.Reference('vci_data_width_ext'),
    36               dspin_in_width  = parameter.Reference('dspin_rsp_width'),
    37               dspin_out_width = parameter.Reference('dspin_cmd_width')),
     34              memc_cell_size_int   = parameter.Reference('vci_data_width_int'),
     35              memc_cell_size_ext   = parameter.Reference('vci_data_width_ext'),
     36              memc_dspin_in_width  = parameter.Reference('dspin_rsp_width'),
     37              memc_dspin_out_width = parameter.Reference('dspin_cmd_width')),
    3838
    3939      Uses('caba:vci_simple_ram',
  • trunk/platforms/tsar_generic_xbar/scripts/counter_defs.py

    r790 r836  
    99m_prot_name['dhccp'] = "DHCCP"
    1010m_prot_name['rwt'] = "RWT"
    11 m_prot_name['mesi'] = "HMESI"
     11m_prot_name['hmesi'] = "HMESI"
    1212
    1313m_app_name = {}
  • trunk/platforms/tsar_generic_xbar/scripts/create_graphs.py

    r790 r836  
    77
    88
    9 #apps = [ 'histogram', 'mandel', 'filter', 'radix', 'fft_ga' ]
    10 #apps = [ 'histogram', 'mandel', 'filter', 'radix', 'radix_ga', 'fft', 'fft_ga', 'filt_ga', 'kmeans', 'pca', 'lu' ]
    11 apps = [ 'fft', 'fft_ga' ]
    12 nb_procs = [ 1, 4, 8, 16, 32, 64, 128, 256 ]
    13 single_protocols = ['dhccp', 'rwt']
    14 joint_protocols = ['dhccp', 'rwt']
     9apps = [ 'filter', 'lu', 'fft_ga' ]
     10#apps = [ 'histogram', 'mandel', 'filter', 'fft', 'fft_ga', 'filt_ga', 'pca', 'lu' ]  # radix radix_ga kmeans
     11#apps = [ 'filt_ga' ]
     12nb_procs = [ 1, 4, 8, 16, 32, 64 ]
     13single_protocols = ['dhccp', 'rwt' ]
     14joint_protocols = ['dhccp', 'rwt' ]
    1515#joint_protocols = []
    1616
     
    403403   gp_stacked_name   = os.path.join(scripts_path, gen_dir, prot + '_stacked.gp')
    404404   
    405    norm_factor_value = 256
     405   norm_factor_value = nb_procs[-1]
    406406   
    407407   # Creating the gp file
     
    616616gp_cost_filename   = os.path.join(scripts_path, gen_dir, 'joint_relative_cost.gp')
    617617   
    618 direct_cost_metrics = [ 'read_cost', 'write_cost' ]
    619 coherence_cost_metrics = ['update_cost', 'm_inv_cost', 'broadcast_cost' ]
    620   
     618direct_cost_metrics = [ 'read_cost', 'write_cost', 'getm_cost' ]
     619coherence_cost_metrics = ['update_cost', 'm_inv_cost', 'broadcast_cost', 'inval_ro_cost', 'cleanup_cost', 'cleanup_d_cost' ]
     620 
    621621# Creating the gp file
    622622template_file = open(stacked_tmpl, 'r')
     
    702702
    703703
    704 
    705 
     704#################################################################################
     705### Graph 9 :         ###
     706#################################################################################
     707
     708
     709data_metric_filename = os.path.join(scripts_path, gen_dir, 'single_metric.dat')
     710gp_metric_filename   = os.path.join(scripts_path, gen_dir, 'single_metric.gp')
     711   
     712metric = 'total_write'
     713 
     714# Creating the gp file
     715template_file = open(stacked_tmpl, 'r')
     716template = template_file.read()
     717   
     718xtics_str = "("
     719first = True
     720xpos = 0 # successive x position of the center of the first bar in a application
     721app_labels = ""
     722prot_labels = ""
     723for num_appli in range(0, len(apps)):
     724   first_proc = True
     725   for i in nb_procs:
     726      x = 0 # local var for computing position of protocol names
     727      #for prot in joint_protocols:
     728         #prot_labels += "set label \"%s\" at first %f, character 2 center font \"Times,10\"\n" % (m_prot_name[prot], float((xpos - 0.5)) + x) # -0.5 instead of +0.5, don't know why... (bug gnuplot?)
     729         #x += 1
     730
     731      if not first:
     732         xtics_str += ", "
     733      first = False
     734      if first_proc:
     735         first_proc = False
     736         xpos_first = xpos
     737      xtics_str += "\"%d\" %f -1" % (i, float(xpos - 0.5 + len(joint_protocols)))
     738      xpos_last = xpos
     739      xpos += 1 + len(joint_protocols)
     740   app_name_xpos = float((xpos_first + xpos_last)) / 2
     741   app_labels += "set label \"%s\" at first %f,character 1 center font \"Times,12\"\n" % (m_app_name[apps[num_appli]], app_name_xpos)
     742   xpos += 1
     743xtics_str += ")"
     744
     745n = 1
     746plot_str = "newhistogram \"\""
     747for prot in joint_protocols:
     748   plot_str += ", \\\n    " + "'" + data_metric_filename + "'" + " using " + str(n) + " lc rgb " + colors[n] + " title \"" + m_metric_name[metric] + " for " + m_prot_name[prot] + "\""
     749   n += 1
     750
     751ylabel_str = "%(m)s" % dict(m = m_metric_name[metric])
     752content = template % dict(svg_name = os.path.join(graph_dir, 'single_metric'), xtics_str = xtics_str, plot_str = plot_str, ylabel_str = ylabel_str, app_labels = app_labels, prot_labels = prot_labels)
     753
     754create_file(gp_metric_filename, content)
     755
     756# Creating the data file
     757content = "#" + metric
     758content += "\n"
     759for app in apps:
     760   if app != apps[0]:
     761      for prot in joint_protocols:
     762         for p in joint_protocols:
     763            content += "%-15f " % 0.0
     764         content += "\n"
     765   for i in nb_procs:
     766      for prot in joint_protocols:
     767         for p in joint_protocols:
     768            if p != prot:
     769               content += "%-15f " % 0
     770            else:
     771               content += "%-15f " % (float(metrics_val[prot][app][i][metric]))
     772         content += "\n"
     773      if i != nb_procs[-1]:
     774         for p in joint_protocols:
     775            content += "%-15f " % 0.0
     776         content += "\n"
     777
     778create_file(data_metric_filename, content)
     779# Calling gnuplot
     780print "gnuplot", gp_metric_filename
     781subprocess.call([ 'gnuplot', gp_metric_filename ])
     782
     783
     784
     785
  • trunk/platforms/tsar_generic_xbar/scripts/run_simus.py

    r790 r836  
    1212# User parameters
    1313nb_procs = [ 4 ]
    14 #nb_procs = [ 16, 32, 64, 128, 256 ]
     14#nb_procs = [ 1, 4, 8, 16, 32, 64, 128, 256 ]
    1515rerun_stats = False
    1616use_omp = False
    17 protocol = 'dhccp'
     17protocol = 'wtidl'
    1818
    1919#apps = [ 'histogram', 'mandel', 'filter', 'radix_ga', 'fft_ga', 'kmeans' ]
     
    3232# to come: 'barnes', 'fmm', 'ocean', 'raytrace', 'radiosity', 'waters', 'watern'
    3333
    34 all_protocols = [ 'dhccp', 'rwt', 'hmesi' ]
     34all_protocols = [ 'dhccp', 'rwt', 'hmesi', 'wtidl' ]
    3535
    3636top_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
     
    6666 - apps_dir:      path to almos-tsar-mipsel/apps directory
    6767 - almos_src_dir: path to almos source directory (for kernel and bootloader binaries)
    68  - hdd_img_name:  path to the hdd image to use
     68 - hdd_img_name:  path to the hdd image to use (will be copied but not modified)
     69 - tsar_dir:      path to tsar repository
     70Optional definitions (necessary if you want to use alternative protocols):
     71 - rwt_dir:       path to the RWT repository
     72 - hmesi_dir:     path to HMESI directory
     73 - wtidl_dir:     path to the ideal write-through protocol directory
    6974*** Stopping execution
    7075'''
     
    98103    if not os.path.exists(hmesi_dir):
    99104        print "*** Error: variable hmesi_dir does not define a valid path"
     105        sys.exit()
     106
     107if protocol == "wtidl":
     108    if wtidl_dir == "":
     109        print "*** Error: variable wtidl_dir not defined in config file"
     110        sys.exit()
     111    if not os.path.exists(wtidl_dir):
     112        print "*** Error: variable wtidl_dir does not define a valid path"
    100113        sys.exit()
    101114
     
    156169            'modules/vci_io_bridge',
    157170            'modules/vci_iox_network',
    158             'modules/vci_spi'
     171            'modules/vci_spi',
    159172            'platforms/tsar_generic_xbar/tsar_xbar_cluster'
    160173    ]
     
    164177            'lib/generic_cache_tsar',
    165178            'modules/vci_cc_vcache_wrapper',
    166             'modules/vci_mem_cache'
     179            'modules/vci_mem_cache',
    167180    ]
    168181
     
    179192    elif protocol == "hmesi":
    180193        arch_dir = hmesi_dir
     194    elif protocol == "wtidl":
     195        arch_dir = wtidl_dir
    181196    else:
    182197        assert(False)
     
    213228#define IOMMU_ACTIVE        0
    214229
    215 #define   IRQ_PER_PROCESSOR   1
    216 
    217 #endif //_HD_CONFIG_H
     230#define IRQ_PER_PROCESSOR   1
    218231''' % dict(x = x, y = y, nb_clus = x * y)
     232
     233   if protocol == 'wtidl':
     234       header += '#define WT_IDL\n'
     235
     236   header += '#endif //_HD_CONFIG_H\n'
     237
    219238   file = open(hard_config, 'w')
    220239   file.write(header)
    221240   file.close()
     241
    222242
    223243
  • trunk/platforms/tsar_generic_xbar/soclib.conf

    r779 r836  
    11
    22# DescPath modified by a script
     3
     4
     5
     6config.default = config.mysystemcass
    37
    48config.addDescPath("/users/cao/meunier/src/tsar/lib/generic_llsc_global_table")
     
    913config.addDescPath("/users/cao/meunier/src/tsar/modules/vci_io_bridge")
    1014config.addDescPath("/users/cao/meunier/src/tsar/modules/vci_iox_network")
    11 config.addDescPath("/users/cao/meunier/src/tsar/modules/vci_spiplatforms/tsar_generic_xbar/tsar_xbar_cluster")
    12 config.addDescPath("/users/cao/meunier/src/rwt/communication")
    13 config.addDescPath("/users/cao/meunier/src/rwt/lib/generic_cache_tsar")
    14 config.addDescPath("/users/cao/meunier/src/rwt/modules/vci_cc_vcache_wrapper")
    15 config.addDescPath("/users/cao/meunier/src/rwt/modules/vci_mem_cache")
    16 
     15config.addDescPath("/users/cao/meunier/src/tsar/modules/vci_spi")
     16config.addDescPath("/users/cao/meunier/src/tsar/platforms/tsar_generic_xbar/tsar_xbar_cluster")
     17config.addDescPath("/users/cao/meunier/src/wt_ideal/communication")
     18config.addDescPath("/users/cao/meunier/src/wt_ideal/lib/generic_cache_tsar")
     19config.addDescPath("/users/cao/meunier/src/wt_ideal/modules/vci_cc_vcache_wrapper")
     20config.addDescPath("/users/cao/meunier/src/wt_ideal/modules/vci_mem_cache")
  • trunk/platforms/tsar_generic_xbar/top.cpp

    r779 r836  
    397397#else
    398398            size_t x = debug_memc_id >> Y_WIDTH;
    399             size_t y = debug_memc_id & ((1<<Y_WIDTH)-1);
     399            size_t y = debug_memc_id & ((1 << Y_WIDTH) - 1);
    400400
    401401            assert( (x <= X_SIZE) and (y <= Y_SIZE) &&
     
    411411#else
    412412            size_t cluster_xy = debug_proc_id / NB_PROCS_MAX ;
    413             size_t x          = cluster_xy >> Y_WIDTH;
    414             size_t y          = cluster_xy & ((1<<Y_WIDTH)-1);
     413            size_t x = cluster_xy >> Y_WIDTH;
     414            size_t y = cluster_xy & ((1 << Y_WIDTH) - 1);
    415415
    416416            assert( (x <= X_SIZE) and (y <= Y_SIZE) &&
     
    635635         sc_uint<vci_address_width> offset;
    636636         offset = (sc_uint<vci_address_width>)cluster(x,y)
    637                    << (vci_address_width-x_width-y_width);
     637                   << (vci_address_width - x_width - y_width);
    638638
    639639         std::ostringstream sh;
     
    699699                   dspin_rsp_width,
    700700                   vci_param_int,
    701                    vci_param_ext>*          clusters[X_SIZE][Y_SIZE];
     701                   vci_param_ext> * clusters[X_SIZE][Y_SIZE];
    702702
    703703#if USE_OPENMP
     
    769769                frozen_cycles,
    770770                debug_from,
    771                 debug_ok and (cluster(x,y) == debug_memc_id),
    772                 debug_ok and (cluster(x,y) == debug_proc_id)
     771                debug_ok,
     772                debug_ok
    773773            );
    774774
     
    880880
    881881
     882#ifdef WT_IDL
     883    std::list<VciCcVCacheWrapper<vci_param_int,
     884        dspin_cmd_width,
     885        dspin_rsp_width,
     886        GdbServer<Mips32ElIss> > * > l1_caches;
     887
     888   for (size_t x = 0; x < X_SIZE; x++) {
     889      for (size_t y = 0; y < Y_SIZE; y++) {
     890         for (int proc = 0; proc < NB_PROCS_MAX; proc++) {
     891            l1_caches.push_back(clusters[x][y]->proc[proc]);
     892         }
     893      }
     894   }
     895
     896   for (size_t x = 0; x < X_SIZE; x++) {
     897      for (size_t y = 0; y < Y_SIZE; y++) {
     898         clusters[x][y]->memc->set_vcache_list(l1_caches);
     899      }
     900   }
     901#endif
     902
     903
    882904//#define SC_TRACE
    883905#ifdef SC_TRACE
     
    943965               signal_dspin_false_cmd_out[x][y][a][k].read  = true;
    944966            }
    945              for (size_t k = 0; k < 2; k++){
    946                 signal_dspin_false_rsp_in [x][y][a][k].write = false;
    947                 signal_dspin_false_rsp_in [x][y][a][k].read  = true;
    948                 signal_dspin_false_rsp_out[x][y][a][k].write = false;
    949                 signal_dspin_false_rsp_out[x][y][a][k].read  = true;
    950              }
     967            for (size_t k = 0; k < 2; k++){
     968               signal_dspin_false_rsp_in [x][y][a][k].write = false;
     969               signal_dspin_false_rsp_in [x][y][a][k].read  = true;
     970               signal_dspin_false_rsp_out[x][y][a][k].write = false;
     971               signal_dspin_false_rsp_out[x][y][a][k].read  = true;
     972            }
    951973         }
    952974      }
     
    968990      for (int64_t n = 1; n < ncycles && !stop_called; n++)
    969991      {
    970          // Monitor a specific address for L1 & L2 caches
    971          //clusters[0][0]->proc[0]->cache_monitor(0x800002c000ULL);
    972          //clusters[1][0]->memc->copies_monitor(0x800002C000ULL);
    973 
    974992         if ((n % max_cycles) == 0)
    975993         {
     
    10121030         {
    10131031            std::cout << "****************** cycle " << std::dec << n ;
    1014             std::cout << " ************************************************" << std::endl;
    1015 
    1016             // trace proc[debug_proc_id]
    1017             size_t l = debug_proc_id % NB_PROCS_MAX ;
    1018             size_t y = (debug_proc_id / NB_PROCS_MAX) % Y_SIZE ;
    1019             size_t x = debug_proc_id / (Y_SIZE * NB_PROCS_MAX) ;
    1020 
    1021             std::ostringstream proc_signame;
    1022             proc_signame << "[SIG]PROC_" << x << "_" << y << "_" << l ;
    1023             std::ostringstream p2m_signame;
    1024             p2m_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " P2M" ;
    1025             std::ostringstream m2p_signame;
    1026             m2p_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " M2P" ;
    1027 
    1028             //clusters[x][y]->signal_vci_ini_proc[l].print_trace(proc_signame.str());
    1029             //clusters[x][y]->signal_dspin_p2m_proc[l].print_trace(p2m_signame.str());
    1030             //clusters[x][y]->signal_dspin_m2p_proc[l].print_trace(m2p_signame.str());
    1031 
    1032             //clusters[x][y]->signal_dspin_cmd_l2g_d.print_trace("[SIG]L2G CMD");
    1033             //clusters[x][y]->signal_dspin_cmd_g2l_d.print_trace("[SIG]G2L CMD");
    1034             //clusters[x][y]->signal_dspin_rsp_l2g_d.print_trace("[SIG]L2G RSP");
    1035             //clusters[x][y]->signal_dspin_rsp_g2l_d.print_trace("[SIG]G2L RSP");
    1036 
    1037             // trace memc[debug_memc_id]
    1038             x = debug_memc_id / Y_SIZE;
    1039             y = debug_memc_id % Y_SIZE;
    1040 
    1041             std::ostringstream smemc;
    1042             smemc << "[SIG]MEMC_" << x << "_" << y;
    1043             std::ostringstream sxram;
    1044             sxram << "[SIG]XRAM_" << x << "_" << y;
    1045             std::ostringstream sm2p;
    1046             sm2p << "[SIG]MEMC_" << x << "_" << y << " M2P" ;
    1047             std::ostringstream sp2m;
    1048             sp2m << "[SIG]MEMC_" << x << "_" << y << " P2M" ;
    1049 
    1050             //clusters[x][y]->memc->print_trace();
    1051             //clusters[x][y]->signal_vci_tgt_memc.print_trace(smemc.str());
    1052             //clusters[x][y]->signal_vci_xram.print_trace(sxram.str());
    1053             //clusters[x][y]->signal_dspin_p2m_memc.print_trace(sp2m.str());
    1054             //clusters[x][y]->signal_dspin_m2p_memc.print_trace(sm2p.str());
    1055 
    1056             // trace replicated peripherals
    1057             //clusters[1][1]->mdma->print_trace();
    1058             //clusters[1][1]->signal_vci_tgt_mdma.print_trace("[SIG]MDMA_TGT_1_1");
    1059             //clusters[1][1]->signal_vci_ini_mdma.print_trace("[SIG]MDMA_INI_1_1");
    1060 
    1061 
    1062             // trace external peripherals
    1063             //size_t io_x   = cluster_io_id / Y_SIZE;
    1064             //size_t io_y   = cluster_io_id % Y_SIZE;
    1065 
    1066             //clusters[io_x][io_y]->brom->print_trace();
    1067             //clusters[io_x][io_y]->signal_vci_tgt_brom.print_trace("[SIG]BROM");
    1068 
    1069             //clusters[io_x][io_y]->bdev->print_trace();
    1070             //clusters[io_x][io_y]->signal_vci_tgt_bdev.print_trace("[SIG]BDEV_TGT");
    1071             //clusters[io_x][io_y]->signal_vci_ini_bdev.print_trace("[SIG]BDEV_INI");
     1032            std::cout << "************************************************" << std::endl;
     1033
     1034            for (size_t x = 0; x < X_SIZE ; x++){
     1035               for (size_t y = 0; y < Y_SIZE ; y++){
     1036                  for (int proc = 0; proc < NB_PROCS_MAX; proc++) {
     1037
     1038                     clusters[x][y]->proc[proc]->print_trace();
     1039                     
     1040                     std::ostringstream proc_signame;
     1041                     proc_signame << "[SIG]PROC_" << x << "_" << y << "_" << proc ;
     1042                     std::ostringstream p2m_signame;
     1043                     p2m_signame << "[SIG]PROC_" << x << "_" << y << "_" << proc << " P2M";
     1044                     std::ostringstream m2p_signame;
     1045                     m2p_signame << "[SIG]PROC_" << x << "_" << y << "_" << proc << " M2P";
     1046
     1047                     clusters[x][y]->signal_vci_ini_proc[proc].print_trace(proc_signame.str());
     1048                     clusters[x][y]->signal_dspin_p2m_proc[proc].print_trace(p2m_signame.str());
     1049                     clusters[x][y]->signal_dspin_m2p_proc[proc].print_trace(m2p_signame.str());
     1050                  }
     1051
     1052                  clusters[x][y]->memc->print_trace();
     1053
     1054                  std::ostringstream smemc;
     1055                  smemc << "[SIG]MEMC_" << x << "_" << y;
     1056                  std::ostringstream sxram;
     1057                  sxram << "[SIG]XRAM_" << x << "_" << y;
     1058                  std::ostringstream sm2p;
     1059                  sm2p << "[SIG]MEMC_" << x << "_" << y << " M2P";
     1060                  std::ostringstream sp2m;
     1061                  sp2m << "[SIG]MEMC_" << x << "_" << y << " P2M";
     1062
     1063                  clusters[x][y]->signal_vci_tgt_memc.print_trace(smemc.str());
     1064                  clusters[x][y]->signal_vci_xram.print_trace(sxram.str());
     1065                  clusters[x][y]->signal_dspin_p2m_memc.print_trace(sp2m.str());
     1066                  clusters[x][y]->signal_dspin_m2p_memc.print_trace(sm2p.str());
     1067               }
     1068            }
    10721069         }
    10731070
  • trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/metadata/tsar_xbar_cluster.sd

    r779 r836  
    3232                memc_cell_size_int = parameter.Reference('vci_data_width_int'),
    3333                memc_cell_size_ext = parameter.Reference('vci_data_width_ext'),
    34                 dspin_in_width  = parameter.Reference('dspin_rsp_width'),
    35                 dspin_out_width = parameter.Reference('dspin_cmd_width')),
     34                memc_dspin_in_width  = parameter.Reference('dspin_rsp_width'),
     35                memc_dspin_out_width = parameter.Reference('dspin_cmd_width')),
    3636
    3737        Uses('caba:vci_simple_rom',
  • trunk/platforms/tsar_generic_xbar/tsar_xbar_cluster/caba/source/src/tsar_xbar_cluster.cpp

    r752 r836  
    142142                     IntTab(cluster_id),                 // SRCID external space
    143143                     IntTab(cluster_id, tgtid_memc),     // TGTID direct space
    144                      //(cluster_id << l_width) + nb_procs, // CC_GLOBAL_ID
    145144                     x_width,                            // Number of x bits in platform
    146145                     y_width,                            // Number of y bits in platform
     
    215214    wt_xbar_d = new VciDspinTargetWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>(
    216215                swtxbar.str().c_str(),
    217                 x_width + y_width + l_width );
     216                x_width + y_width + l_width);
    218217
    219218    std::ostringstream swixbar;
  • trunk/platforms/tsar_mono_mmu/top.desc

    r516 r836  
    2222            memc_cell_size_int = cell_size,
    2323            memc_cell_size_ext = 8,
    24             dspin_out_width = dspin_cmd_flit_size,
    25             dspin_in_width = dspin_rsp_flit_size,
     24            memc_dspin_out_width = dspin_cmd_flit_size,
     25            memc_dspin_in_width = dspin_rsp_flit_size,
    2626        ),
    2727        Uses('caba:dspin_local_crossbar',
  • trunk/softs/tests_cc_vcache/common/common.sh

    r520 r836  
    1 SIMUL=../../../platforms/tsar_mono_mmu/simul.x
     1SIMUL="../../../platforms/tsar_mono_mmu/simul.x"
    22
    33#SIMUL=../../../../soclib-svn-june-2009/soclib/soclib/platform/topcells/caba_vgsb_almo_mmu/simul.x
  • trunk/softs/tests_cc_vcache/run_tests

    r520 r836  
    11#!/bin/sh
    22
    3 PATH=${PATH}:/dsk/l1/misc/bouyer/tmp/tsarmips/obj/netbsd-5/tooldir/bin
    4 export PATH
    53SOCLIB_TTY=TERM
    64export SOCLIB_TTY
Note: See TracChangeset for help on using the changeset viewer.