Ignore:
Timestamp:
Mar 9, 2011, 4:11:43 PM (13 years ago)
Author:
kane
Message:

yAjout du multi_cache : plusieurs processeur peuvent ce partager le même cache L1.
2 remarques, (1) deux nouveaux paramètres : nb_cpu, nb_cache. Pour avoir un cache dont le comportement est identique à la version d'avant, mettre ces paramètres à 1.
(2) le port d'interruption est maintenant un tableau dépendant du nombre de processeur.
Voir le fichier "platforms/caba-ring-ccxcachev4_memcachev4-mips32el/top.cpp" pour plus de détails.

--Cette ligne, et les suivantes ci-dessous, seront ignorées--

M platforms/tsarv4_dspin_generic_32/tsarv4_dspin_generic_32_top.cpp
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/segmentation.h
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/top.cpp
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/configuration/default.cfg
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/configuration/gen_config.sh
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/dhrystone/dhry21a.c
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/define.h
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/matrix_multiplication/matrix_multiplication.c
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/common/common.c
A platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/self_code_modifying
A platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/self_code_modifying/self_code_modifying.c
A platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/self_code_modifying/self_code_modifying.h
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark.h
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_sort.c
A platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_self_code_modifying.c
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark.c
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/benchmark/benchmark_matrix_multiplication.c
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/Makefile
M platforms/caba-ring-ccxcachev4_memcachev4-mips32el/Makefile
M platforms/tsarv4_vgmn_generic_32/tsarv4_vgmn_generic_32_top.cpp
M modules/vci_cc_xcache_wrapper_v4/caba/source/include/vci_cc_xcache_wrapper_v4.h
M modules/vci_cc_xcache_wrapper_v4/caba/source/src/vci_cc_xcache_wrapper_v4.cpp
M modules/vci_mem_cache_v4/caba/source/include/vci_mem_cache_v4.h
M modules/vci_mem_cache_v4/caba/source/include/mem_cache_directory_v4.h
M modules/vci_mem_cache_v4/caba/source/src/vci_mem_cache_v4.cpp

File:
1 edited

Legend:

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

    r138 r140  
    2929#include "../include/vci_mem_cache_v4.h"
    3030
    31 //#define TDEBUG // Transaction tab debug
    32 //#define IDEBUG // Update tab debug
    33 //#define DDEBUG // Directory debug
    34 //#define LOCK_DEBUG // Lock debug
     31// #define TDEBUG // Transaction tab debug
     32// #define IDEBUG // Update tab debug
     33// #define DDEBUG // Directory debug
     34// #define LOCK_DEBUG // Lock debug
     35
    3536#define DEBUG_VCI_MEM_CACHE 0
    36 #define DEBUG_START_CYCLE   200000
     37#define DEBUG_START_CYCLE   949900
    3738#define RANDOMIZE_SC
    3839
     40#define ASSERT_VERBOSE
     41#define ASSERT_NCYCLES m_cpt_cycles
     42
     43#include "debug.h"
     44
    3945#if DEBUG_VCI_MEM_CACHE
    40 # define PRINTF(msg...) do { if (m_cpt_cycles > DEBUG_START_CYCLE) printf(msg); } while (0);
     46# define PRINTF(msg...) PRINTF_COND(m_cpt_cycles > DEBUG_START_CYCLE,msg)
    4147#else
    4248# define PRINTF(msg...)
     
    301307    m_write_to_init_cmd_inst_fifo("m_write_to_init_cmd_inst_fifo",8),
    302308    m_write_to_init_cmd_srcid_fifo("m_write_to_init_cmd_srcid_fifo",8),
     309#if L1_MULTI_CACHE
     310    m_write_to_init_cmd_cache_id_fifo("m_write_to_init_cmd_cache_id_fifo",8),
     311#endif
    303312    r_init_rsp_fsm("r_init_rsp_fsm"),
    304313    r_cleanup_fsm("r_cleanup_fsm"),
     
    306315    m_llsc_to_init_cmd_inst_fifo("m_llsc_to_init_cmd_inst_fifo",8),
    307316    m_llsc_to_init_cmd_srcid_fifo("m_llsc_to_init_cmd_srcid_fifo",8),
     317#if L1_MULTI_CACHE
     318    m_llsc_to_init_cmd_cache_id_fifo("m_llsc_to_init_cmd_cache_id_fifo",8),
     319#endif
    308320    r_ixr_rsp_fsm("r_ixr_rsp_fsm"),
    309321    r_xram_rsp_fsm("r_xram_rsp_fsm"),
    310322    m_xram_rsp_to_init_cmd_inst_fifo("m_xram_rsp_to_init_cmd_inst_fifo",8),
    311323    m_xram_rsp_to_init_cmd_srcid_fifo("m_xram_rsp_to_init_cmd_srcid_fifo",8),
     324#if L1_MULTI_CACHE
     325    m_xram_rsp_to_init_cmd_cache_id_fifo("m_xram_rsp_to_init_cmd_cache_id_fifo",8),
     326#endif
    312327    r_ixr_cmd_fsm("r_ixr_cmd_fsm"),
    313328    r_tgt_rsp_fsm("r_tgt_rsp_fsm"),
     
    532547      m_write_to_init_cmd_inst_fifo.init();
    533548      m_write_to_init_cmd_srcid_fifo.init();
     549#if L1_MULTI_CACHE
     550      m_write_to_init_cmd_cache_id_fifo.init();
     551#endif
    534552
    535553      r_cleanup_to_tgt_rsp_req  = false;
     
    545563      m_llsc_to_init_cmd_inst_fifo.init();
    546564      m_llsc_to_init_cmd_srcid_fifo.init();
     565#if L1_MULTI_CACHE
     566      m_llsc_to_init_cmd_cache_id_fifo.init();
     567#endif
    547568
    548569      for(size_t i=0; i<TRANSACTION_TAB_LINES ; i++){
     
    557578      m_xram_rsp_to_init_cmd_inst_fifo.init();
    558579      m_xram_rsp_to_init_cmd_srcid_fifo.init();
     580#if L1_MULTI_CACHE
     581      m_xram_rsp_to_init_cmd_cache_id_fifo.init();
     582#endif
    559583
    560584      r_ixr_cmd_cpt         = 0;
     
    591615    bool    cmd_llsc_fifo_get = false;
    592616
    593     bool    write_to_init_cmd_fifo_put   = false;
    594     bool    write_to_init_cmd_fifo_get   = false;
    595     bool    write_to_init_cmd_fifo_inst  = false;
    596     size_t  write_to_init_cmd_fifo_srcid = 0;
    597 
    598     bool    xram_rsp_to_init_cmd_fifo_put   = false;
    599     bool    xram_rsp_to_init_cmd_fifo_get   = false;
    600     bool    xram_rsp_to_init_cmd_fifo_inst  = false;
    601     size_t  xram_rsp_to_init_cmd_fifo_srcid = 0;
    602 
    603     bool    llsc_to_init_cmd_fifo_put   = false;
    604     bool    llsc_to_init_cmd_fifo_get   = false;
    605     bool    llsc_to_init_cmd_fifo_inst  = false;
    606     size_t  llsc_to_init_cmd_fifo_srcid = 0;
     617    bool    write_to_init_cmd_fifo_put      = false;
     618    bool    write_to_init_cmd_fifo_get      = false;
     619    bool    write_to_init_cmd_fifo_inst     = false;
     620    size_t  write_to_init_cmd_fifo_srcid    = 0;
     621#if L1_MULTI_CACHE
     622    size_t  write_to_init_cmd_fifo_cache_id = 0;
     623#endif
     624
     625    bool    xram_rsp_to_init_cmd_fifo_put      = false;
     626    bool    xram_rsp_to_init_cmd_fifo_get      = false;
     627    bool    xram_rsp_to_init_cmd_fifo_inst     = false;
     628    size_t  xram_rsp_to_init_cmd_fifo_srcid    = 0;
     629#if L1_MULTI_CACHE
     630    size_t  xram_rsp_to_init_cmd_fifo_cache_id = 0;
     631#endif
     632
     633    bool    llsc_to_init_cmd_fifo_put      = false;
     634    bool    llsc_to_init_cmd_fifo_get      = false;
     635    bool    llsc_to_init_cmd_fifo_inst     = false;
     636    size_t  llsc_to_init_cmd_fifo_srcid    = 0;
     637#if L1_MULTI_CACHE
     638    size_t  llsc_to_init_cmd_fifo_cache_id = 0;
     639#endif
    607640
    608641#if DEBUG_VCI_MEM_CACHE
     
    628661#endif
    629662
     663#ifdef IDEBUG
     664if(m_cpt_cycles > DEBUG_START_CYCLE){
     665        std::cout << sc_time_stamp() << " " << name() << " INIT_RSP_UPT_LOCK update table : " << std::endl;
     666        m_update_tab.print();
     667}
     668#endif
     669
    630670    ////////////////////////////////////////////////////////////////////////////////////
    631671    //          TGT_CMD FSM
     
    651691          if ( p_vci_tgt.cmdval ) {
    652692
    653               PRINTF("  * <TGT> Request from %d at address %llx\n",(uint32_t)p_vci_tgt.srcid.read(),(uint64_t)p_vci_tgt.address.read());
     693              PRINTF("  * <MEM_CACHE.TGT> Request from %d.%d (%d) at address %llx\n",(uint32_t)p_vci_tgt.srcid.read(),(uint32_t)p_vci_tgt.pktid.read(),(uint32_t)p_vci_tgt.trdid.read(),(uint64_t)p_vci_tgt.address.read());
    654694
    655695            if ( p_vci_tgt.cmd.read() == vci_param::CMD_READ )
     
    676716
    677717        {
    678           assert(((m_x[(vci_addr_t)p_vci_tgt.address.read()]+(p_vci_tgt.plen.read()>>2))<=16)
    679               && "VCI_MEM_CACHE All read request to the MemCache must stay within a cache line");
     718            ASSERT(((m_x[(vci_addr_t)p_vci_tgt.address.read()]+(p_vci_tgt.plen.read()>>2))<=16),
     719                  "VCI_MEM_CACHE All read request to the MemCache must stay within a cache line");
    680720
    681721          if ( p_vci_tgt.cmdval && m_cmd_read_addr_fifo.wok() ) {
     
    744784
    745785          if ( p_vci_ini.rspval ) {
    746 
    747             assert ( ( p_vci_ini.rtrdid.read() < m_update_tab.size() )
    748                 && "VCI_MEM_CACHE UPT index too large in VCI response paquet received by memory cache" );
    749             assert ( p_vci_ini.reop
    750                 && "VCI_MEM_CACHE All response packets to update/invalidate requests must be one cell" );
     786            PRINTF("  * <MEM_CACHE.INIT_RSP> rsp val - trdid %d\n",(uint32_t)p_vci_ini.rtrdid.read());
     787
     788            ASSERT (( p_vci_ini.rtrdid.read() < m_update_tab.size())
     789                    ,"VCI_MEM_CACHE UPT index too large in VCI response paquet received by memory cache" );
     790            ASSERT (p_vci_ini.reop
     791                    ,"VCI_MEM_CACHE All response packets to update/invalidate requests must be one cell") ;
    751792            r_init_rsp_upt_index = p_vci_ini.rtrdid.read();
    752793            r_init_rsp_fsm = INIT_RSP_UPT_LOCK;
     
    772813#endif
    773814            while(!valid);
    774             assert ( valid
    775                 && "VCI_MEM_CACHE Invalid UPT entry in VCI response paquet received by memory cache" );
     815            ASSERT ( valid
     816                     ,"VCI_MEM_CACHE Invalid UPT entry in VCI response paquet received by memory cache" );
    776817
    777818            if ( count == 0 ) r_init_rsp_fsm = INIT_RSP_UPT_CLEAR;
     
    830871    ////////////////////////////////////////////////////////////////////////////////////
    831872
    832     PRINTF("  * TOP : Request from %d at address %llx\n",(uint32_t)m_cmd_read_srcid_fifo.read(),(uint64_t)m_cmd_read_addr_fifo.read());
     873    PRINTF("  * <MEM_CACHE.TOP> Request from %d.%d at address %llx\n",(uint32_t)m_cmd_read_srcid_fifo.read(),(uint32_t)m_cmd_read_pktid_fifo.read(),(uint64_t)m_cmd_read_addr_fifo.read());
    833874
    834875    switch ( r_read_fsm.read() ) {
     
    838879        {
    839880          if (m_cmd_read_addr_fifo.rok()) {
    840             PRINTF("  * <READ> Request from %d at address %llx\n",(uint32_t)m_cmd_read_srcid_fifo.read(),(uint64_t)m_cmd_read_addr_fifo.read());
     881            PRINTF("  * <MEM_CACHE.READ> Request from %d.%d at address %llx\n",(uint32_t)m_cmd_read_srcid_fifo.read(),(uint32_t)m_cmd_read_pktid_fifo.read(),(uint64_t)m_cmd_read_addr_fifo.read());
    841882
    842883            m_cpt_read++;
     
    858899}
    859900#endif
    860             r_read_is_cnt   = entry.is_cnt;
    861             r_read_dirty    = entry.dirty;
    862             r_read_lock     = entry.lock;
    863             r_read_tag      = entry.tag;
    864             r_read_way      = way;
    865             r_read_count    = entry.count;
    866             r_read_copy     = entry.owner.srcid;
    867             r_read_copy_inst= entry.owner.inst;
    868             r_read_ptr      = entry.ptr;
     901            r_read_is_cnt     = entry.is_cnt;
     902            r_read_dirty      = entry.dirty;
     903            r_read_lock       = entry.lock;
     904            r_read_tag        = entry.tag;
     905            r_read_way        = way;
     906            r_read_count      = entry.count;
     907            r_read_copy       = entry.owner.srcid;
     908#if L1_MULTI_CACHE
     909            r_read_copy_cache = entry.owner.cache_id;
     910#endif
     911            r_read_copy_inst  = entry.owner.inst;
     912            r_read_ptr        = entry.ptr;
    869913
    870914            bool cached_read = (m_cmd_read_trdid_fifo.read() & 0x1);
     
    910954              if(!is_cnt){ // Not counter mode
    911955                entry.owner.srcid   = m_cmd_read_srcid_fifo.read();
     956#if L1_MULTI_CACHE
     957                entry.owner.cache_id= m_cmd_read_pktid_fifo.read();
     958#endif
     959
    912960                entry.owner.inst    = inst_read;
    913961                entry.count         = r_read_count.read() + 1;
    914962              } else { // Counter mode
    915963                entry.owner.srcid   = 0;
     964#if L1_MULTI_CACHE
     965                entry.owner.cache_id= 0;
     966#endif
    916967                entry.owner.inst    = false;
    917968                entry.count         = r_read_count.read() + 1;
     
    919970            } else { // Uncached read
    920971              entry.owner.srcid     = r_read_copy.read();
     972#if L1_MULTI_CACHE
     973              entry.owner.cache_id  = r_read_copy_cache.read();
     974#endif
     975
    921976              entry.owner.inst      = r_read_copy_inst.read();
    922977              entry.count           = r_read_count.read();
     
    9561011            if(!is_cnt){ // Not counter mode
    9571012                entry.owner.srcid   = r_read_copy.read();
     1013#if L1_MULTI_CACHE
     1014                entry.owner.cache_id= r_read_copy_cache.read();
     1015#endif
    9581016                entry.owner.inst    = r_read_copy_inst.read();
    9591017                entry.count         = r_read_count.read() + 1;
     
    9611019            } else { // Counter mode
    9621020                entry.owner.srcid   = 0;
     1021#if L1_MULTI_CACHE
     1022                entry.owner.cache_id= 0;
     1023#endif
    9631024                entry.owner.inst    = false;
    9641025                entry.count         = r_read_count.read() + 1;
     
    10081069            bool inst_read = (m_cmd_read_trdid_fifo.read() & 0x2);
    10091070            HeapEntry new_heap_entry;
    1010             new_heap_entry.owner.srcid  = m_cmd_read_srcid_fifo.read();
    1011             new_heap_entry.owner.inst   = inst_read;
     1071            new_heap_entry.owner.srcid    = m_cmd_read_srcid_fifo.read();
     1072#if L1_MULTI_CACHE
     1073            new_heap_entry.owner.cache_id = m_cmd_read_pktid_fifo.read();
     1074#endif
     1075            new_heap_entry.owner.inst     = inst_read;
    10121076            if(r_read_count.read() == 1){ // creation of a new list
    10131077              new_heap_entry.next         = m_heap_directory.next_free_ptr();
     
    10231087            r_read_fsm = READ_RSP;
    10241088          } else {
    1025             assert(false && "MEMCACHE Error : Bad HEAP allocation");
     1089              ASSERT(false,"MEMCACHE Error : Bad HEAP allocation");
    10261090          }
    10271091          break;
     
    10391103            }
    10401104          } else {
    1041             assert(false && "MEMCACHE Error : Bad HEAP allocation");
     1105              ASSERT(false,"MEMCACHE Error : Bad HEAP allocation");
    10421106          }
    10431107          break;
     
    10481112          if(r_alloc_heap_fsm.read() == ALLOC_HEAP_READ){
    10491113            HeapEntry last_entry;
    1050             last_entry.owner.srcid = 0;
    1051             last_entry.owner.inst  = false;
     1114            last_entry.owner.srcid    = 0;
     1115#if L1_MULTI_CACHE
     1116            last_entry.owner.cache_id = 0;
     1117#endif
     1118            last_entry.owner.inst     = false;
    10521119            if(m_heap_directory.is_full()){
    10531120              last_entry.next      = r_read_ptr.read();
     
    10591126            r_read_fsm = READ_RSP;
    10601127          } else {
    1061             assert(false && "MEMCACHE Error : Bad HEAP allocation");
     1128              ASSERT(false,"MEMCACHE Error : Bad HEAP allocation");
    10621129          }
    10631130          break;
     
    11071174        {
    11081175          if ( r_alloc_trt_fsm.read() == ALLOC_TRT_READ ) {
    1109             m_transaction_tab.set(r_read_trt_index.read(),
     1176              m_transaction_tab.set(r_read_trt_index.read(),
    11101177                true,
    11111178                m_nline[(vci_addr_t)(m_cmd_read_addr_fifo.read())],
     
    11781245        {
    11791246          if ( m_cmd_write_addr_fifo.rok()) {
     1247              PRINTF("  * <MEM_CACHE.WRITE> KANE Request from %d.%d (%d) at address %llx\n",(uint32_t)m_cmd_write_srcid_fifo.read(),(uint32_t)m_cmd_write_pktid_fifo.read(),(uint32_t) m_cmd_write_trdid_fifo.read(), (uint64_t)m_cmd_write_addr_fifo.read());
     1248
    11801249            m_cpt_write++;
    11811250            m_cpt_write_cells++;
     
    12121281
    12131282            // check that the next word is in the same cache line
    1214             assert( (m_nline[(vci_addr_t)(r_write_address.read())] == m_nline[(vci_addr_t)(m_cmd_write_addr_fifo.read())]) 
    1215                 && "VCI_MEM_CACHE write error in vci_mem_cache : write burst over a line" );
     1283            ASSERT( (m_nline[(vci_addr_t)(r_write_address.read())] == m_nline[(vci_addr_t)(m_cmd_write_addr_fifo.read())]) 
     1284                    ,"VCI_MEM_CACHE write error in vci_mem_cache : write burst over a line" );
    12161285            // consume a word in the FIFO & write it in the local buffer
    12171286            cmd_write_fifo_get=true;
     
    12391308              r_write_tag       = entry.tag;
    12401309              r_write_copy      = entry.owner.srcid;
     1310#if L1_MULTI_CACHE
     1311              r_write_copy_cache= entry.owner.cache_id;
     1312#endif
    12411313              r_write_copy_inst = entry.owner.inst;
    12421314              r_write_count     = entry.count;
     
    12871359          // update directory with Dirty bit
    12881360          DirectoryEntry entry;
    1289           entry.valid       = true;
    1290           entry.dirty       = true;
    1291           entry.tag             = r_write_tag.read();
    1292           entry.is_cnt      = r_write_is_cnt.read();
    1293           entry.lock        = r_write_lock.read();
    1294           entry.owner.srcid = r_write_copy.read();
    1295           entry.owner.inst  = r_write_copy_inst.read();
    1296           entry.count       = r_write_count.read();
    1297           entry.ptr         = r_write_ptr.read();
    1298           size_t set        = m_y[(vci_addr_t)(r_write_address.read())];
    1299           size_t way        = r_write_way.read();
     1361          entry.valid         = true;
     1362          entry.dirty         = true;
     1363          entry.tag               = r_write_tag.read();
     1364          entry.is_cnt        = r_write_is_cnt.read();
     1365          entry.lock          = r_write_lock.read();
     1366          entry.owner.srcid   = r_write_copy.read();
     1367#if L1_MULTI_CACHE
     1368          entry.owner.cache_id= r_write_copy_cache.read();
     1369#endif
     1370          entry.owner.inst    = r_write_copy_inst.read();
     1371          entry.count         = r_write_count.read();
     1372          entry.ptr           = r_write_ptr.read();
     1373          size_t set          = m_y[(vci_addr_t)(r_write_address.read())];
     1374          size_t way          = r_write_way.read();
    13001375          m_cache_directory.write(set, way, entry);
    13011376
    1302           bool owner = (r_write_copy.read()==r_write_srcid.read()) && !r_write_copy_inst.read();
     1377          bool owner = (((r_write_copy.read()==r_write_srcid.read())
     1378#if L1_MULTI_CACHE
     1379                         and (r_write_copy_cache.read()==r_write_pktid.read())
     1380#endif
     1381                         ) and not r_write_copy_inst.read());
     1382
    13031383          bool no_update = (r_write_count.read()==0) || ( owner && (r_write_count.read()==1));
    13041384
     
    13871467      case WRITE_UPT_REQ:
    13881468        {
    1389           assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_WRITE) &&
    1390                     "MemCache ERROR : bad HEAP allocation");
     1469          ASSERT( (r_alloc_heap_fsm.read() == ALLOC_HEAP_WRITE)
     1470                  ,"MemCache ERROR : bad HEAP allocation");
    13911471          if( !r_write_to_init_cmd_multi_req.read() &&
    13921472              !r_write_to_init_cmd_brdcast_req.read()  ){
     
    14071487            }
    14081488           
    1409             if( (r_write_copy.read() != r_write_srcid.read()) || r_write_copy_inst.read() ) {
     1489            if((r_write_copy.read() != r_write_srcid.read()) or
     1490#if L1_MULTI_CACHE
     1491               (r_write_copy_cache.read() != r_write_pktid.read()) or
     1492#endif
     1493               r_write_copy_inst.read() ) {
    14101494              // We put the first copy in the fifo
    14111495              write_to_init_cmd_fifo_put     = true;
    14121496              write_to_init_cmd_fifo_inst    = r_write_copy_inst.read();
    14131497              write_to_init_cmd_fifo_srcid   = r_write_copy.read();
     1498#if L1_MULTI_CACHE
     1499              write_to_init_cmd_fifo_cache_id= r_write_copy_cache.read();
     1500#endif
    14141501              if(r_write_count.read() == 1){
    14151502                r_write_fsm = WRITE_IDLE;
     
    14271514      case WRITE_UPDATE:        // send a multi-update request to INIT_CMD fsm
    14281515        {
    1429           assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_WRITE) &&
    1430                     "MemCache ERROR : bad HEAP allocation");
     1516          ASSERT( (r_alloc_heap_fsm.read() == ALLOC_HEAP_WRITE)
     1517                  ,"MemCache ERROR : bad HEAP allocation");
    14311518          HeapEntry entry = m_heap_directory.read(r_write_ptr.read());
    1432           write_to_init_cmd_fifo_inst  = entry.owner.inst;
    1433           write_to_init_cmd_fifo_srcid = entry.owner.srcid;
     1519          write_to_init_cmd_fifo_inst     = entry.owner.inst;
     1520          write_to_init_cmd_fifo_srcid    = entry.owner.srcid;
     1521#if L1_MULTI_CACHE
     1522          write_to_init_cmd_fifo_cache_id = entry.owner.cache_id;
     1523#endif
     1524         
    14341525          bool dec_upt_counter = r_write_to_dec.read();
    1435           if( (entry.owner.srcid != r_write_srcid.read()) || entry.owner.inst ){
     1526          if( (entry.owner.srcid != r_write_srcid.read()) or
     1527#if L1_MULTI_CACHE
     1528              (entry.owner.cache_id != r_write_pktid.read()) or
     1529#endif
     1530              entry.owner.inst){
    14361531            write_to_init_cmd_fifo_put = true;
    14371532          } else {
     
    14711566        {
    14721567          if ( !r_write_to_tgt_rsp_req.read() ) {
     1568
     1569            PRINTF("  * <MEM_CACHE.WRITE> YURI Request from %d.%d (%d)\n",(uint32_t)r_write_srcid.read(), (uint32_t)r_write_trdid.read(), (uint32_t)r_write_pktid.read());
     1570
    14731571            r_write_to_tgt_rsp_req          = true;
    14741572            r_write_to_tgt_rsp_srcid    = r_write_srcid.read();
     
    16441742      case WRITE_DIR_INVAL:
    16451743        {
    1646             assert(((r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE ) &&
     1744            ASSERT(((r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE ) &&
    16471745                    (r_alloc_upt_fsm.read() == ALLOC_UPT_WRITE ) &&
    1648                     (r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE ))&&
    1649                     "MemCache ERROR : bad TRT,DIR or UPT allocation error");
     1746                    (r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE ))
     1747                   ,"MemCache ERROR : bad TRT,DIR or UPT allocation error");
    16501748            m_transaction_tab.set(r_write_trt_index.read(),
    16511749                false,                          // write request to XRAM
     
    16751773            entry.lock          = false;
    16761774            entry.owner.srcid   = 0;
     1775#if L1_MULTI_CACHE
     1776            entry.owner.cache_id= 0;
     1777#endif
    16771778            entry.owner.inst    = false;
    16781779            entry.ptr           = 0;
     
    18901991            data_t data         = p_vci_ixr.rdata.read();
    18911992            size_t index        = r_ixr_rsp_trt_index.read();
    1892             assert( ((eop == (r_ixr_rsp_cpt.read() == (m_words-1))) ||
    1893                      p_vci_ixr.rerror.read())
    1894                 && "Error in VCI_MEM_CACHE : invalid length for a response from XRAM");
     1993            ASSERT(((eop == (r_ixr_rsp_cpt.read() == (m_words-1))) ||
     1994                    p_vci_ixr.rerror.read())
     1995                   ,"Error in VCI_MEM_CACHE : invalid length for a response from XRAM");
    18951996            m_transaction_tab.write_rsp(index, r_ixr_rsp_cpt.read(), data, p_vci_ixr.rerror.read()&0x1);
    18961997            r_ixr_rsp_cpt = r_ixr_rsp_cpt.read() + 1;
     
    19882089
    19892090            r_xram_rsp_victim_copy      = victim.owner.srcid;
     2091#if L1_MULTI_CACHE
     2092            r_xram_rsp_victim_copy_cache= victim.owner.cache_id;
     2093#endif
    19902094            r_xram_rsp_victim_copy_inst = victim.owner.inst;
    19912095            r_xram_rsp_victim_count     = victim.count;
     
    20052109if(m_cpt_cycles > DEBUG_START_CYCLE){
    20062110        std::cout << "XRAM_RSP FSM in XRAM_RSP_TRT_COPY state" << std::endl;
    2007         std::cout << "Victim way : " << std::hex << way << " set " << std::hex << set << std::endl;
     2111        std::cout << "Victim way : " << std::hex << way << " set " << set << std::dec << std::endl;
    20082112        victim.print();
    20092113}
     
    20932197          entry.ptr       = 0;
    20942198          if(cached_read) {
    2095             if(inst_read) {
    2096               entry.owner.srcid = r_xram_rsp_trt_buf.srcid;
    2097               entry.owner.inst  = true;
    2098               entry.count       = 1;
    2099             } else {
    2100               entry.owner.srcid = r_xram_rsp_trt_buf.srcid;
    2101               entry.owner.inst  = false;
    2102               entry.count       = 1;
    2103             }
     2199              entry.owner.srcid   = r_xram_rsp_trt_buf.srcid;
     2200#if L1_MULTI_CACHE
     2201              entry.owner.cache_id= r_xram_rsp_trt_buf.pktid;
     2202#endif
     2203              entry.owner.inst    = inst_read;
     2204              entry.count         = 1;
    21042205          } else {
    2105             entry.owner.srcid = 0;
    2106             entry.owner.inst  = 0;
    2107             entry.count       = 0;
     2206            entry.owner.srcid    = 0;
     2207#if L1_MULTI_CACHE
     2208            entry.owner.cache_id = 0;
     2209#endif
     2210            entry.owner.inst     = 0;
     2211            entry.count          = 0;
    21082212          }
    21092213          m_cache_directory.write(set, way, entry);
     
    21252229
    21262230          if(r_xram_rsp_victim_inval.read()){
    2127             bool    brdcast = r_xram_rsp_victim_is_cnt.read();
    2128             size_t index;
     2231            bool   brdcast = r_xram_rsp_victim_is_cnt.read();
     2232            size_t index = 0;
    21292233            size_t count_copies = r_xram_rsp_victim_count.read();
    2130 
     2234           
     2235            //@@
    21312236            bool         wok = m_update_tab.set(false,  // it's an inval transaction
    21322237                brdcast,                          // set brdcast bit
    21332238                false,  // it does not need a response
    2134                 0,
    2135                 0,
    2136                 0,
     2239                0,//srcid
     2240                0,//trdid
     2241                0,//pktid
    21372242                r_xram_rsp_victim_nline.read(),
    21382243                count_copies,
     
    21472252            r_xram_rsp_upt_index = index;
    21482253            if(!wok) {
    2149               assert(false && "mem_cache error : xram_rsp_dir_upt, an update_tab entry was free but write unsuccessful");
     2254                ASSERT(false,"mem_cache error : xram_rsp_dir_upt, an update_tab entry was free but write unsuccessful");
    21502255            }
    21512256          }
     
    22342339            xram_rsp_to_init_cmd_fifo_srcid     = r_xram_rsp_victim_copy.read();
    22352340            xram_rsp_to_init_cmd_fifo_inst      = r_xram_rsp_victim_copy_inst.read();
     2341#if L1_MULTI_CACHE
     2342            xram_rsp_to_init_cmd_fifo_cache_id  = r_xram_rsp_victim_copy_cache.read();
     2343#endif
    22362344            xram_rsp_to_init_cmd_fifo_put       = multi_req;
    22372345           
     
    22772385          if( r_alloc_heap_fsm.read() == ALLOC_HEAP_XRAM_RSP ) {
    22782386            HeapEntry entry = m_heap_directory.read(r_xram_rsp_next_ptr.read());
    2279             xram_rsp_to_init_cmd_fifo_srcid = entry.owner.srcid;
     2387            xram_rsp_to_init_cmd_fifo_srcid    = entry.owner.srcid;
     2388#if L1_MULTI_CACHE
     2389            xram_rsp_to_init_cmd_fifo_cache_id = entry.owner.cache_id;
     2390#endif
    22802391            xram_rsp_to_init_cmd_fifo_inst  = entry.owner.inst;
    22812392            xram_rsp_to_init_cmd_fifo_put   = true;
     
    22972408      case XRAM_RSP_HEAP_LAST:  // last member of the list
    22982409        {
    2299           assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_XRAM_RSP) &&
    2300                   "MemCache ERROR : bad HEAP allocation");
     2410          ASSERT((r_alloc_heap_fsm.read() == ALLOC_HEAP_XRAM_RSP)
     2411                 ,"MemCache ERROR : bad HEAP allocation");
    23012412          size_t free_pointer = m_heap_directory.next_free_ptr();
    23022413
    23032414          HeapEntry last_entry;
    2304           last_entry.owner.srcid = 0;
    2305           last_entry.owner.inst  = false;
     2415          last_entry.owner.srcid    = 0;
     2416#if L1_MULTI_CACHE
     2417          last_entry.owner.cache_id = 0;
     2418#endif
     2419          last_entry.owner.inst     = false;
    23062420          if(m_heap_directory.is_full()){
    23072421            last_entry.next     = r_xram_rsp_next_ptr.read();
     
    23772491        {
    23782492          if ( p_vci_tgt_cleanup.cmdval.read() ) {
    2379             assert( (p_vci_tgt_cleanup.srcid.read() < m_initiators) &&
    2380             "VCI_MEM_CACHE error in a cleanup request : received SRCID is larger than the number of initiators");
     2493            ASSERT((p_vci_tgt_cleanup.srcid.read() < m_initiators)
     2494                   ,"VCI_MEM_CACHE error in a cleanup request : received SRCID is larger than the number of initiators");
    23812495
    23822496            bool reached = false;
     
    23912505                 reached)
    23922506            {
     2507              PRINTF("  * <MEM_CACHE.CLEANUP> Request from %d.%d at address %llx\n",(uint32_t)p_vci_tgt_cleanup.srcid.read(),(uint32_t)p_vci_tgt_cleanup.pktid.read(),(uint64_t)p_vci_tgt_cleanup.address.read());
     2508
    23932509              m_cpt_cleanup++;
    23942510
     
    24252541            r_cleanup_way           = way;
    24262542            r_cleanup_copy      = entry.owner.srcid;
     2543#if L1_MULTI_CACHE
     2544            r_cleanup_copy_cache= entry.owner.cache_id;
     2545#endif
    24272546            r_cleanup_copy_inst = entry.owner.inst;
    24282547            r_cleanup_count     = entry.count;
    24292548            r_cleanup_ptr       = entry.ptr;
    2430 
    24312549
    24322550            // In case of hit, the copy must be cleaned in the copies bit-vector
     
    24462564      case CLEANUP_DIR_WRITE:
    24472565        {
    2448           assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_CLEANUP ) &&
    2449                 "MemCache ERROR : Bad DIR allocation");
     2566          ASSERT((r_alloc_dir_fsm.read() == ALLOC_DIR_CLEANUP)
     2567                 ,"MemCache ERROR : Bad DIR allocation");
    24502568          size_t way      = r_cleanup_way.read();
    24512569#define L2 soclib::common::uint32_log2
     
    24532571#undef L2
    24542572          bool cleanup_inst  = r_cleanup_trdid.read() & 0x1;
    2455           bool match_srcid   = (r_cleanup_copy.read() == r_cleanup_srcid.read());
     2573          bool match_srcid   = ((r_cleanup_copy.read() == r_cleanup_srcid.read())
     2574#if L1_MULTI_CACHE
     2575                                and (r_cleanup_copy_cache.read() == r_cleanup_pktid.read())
     2576#endif
     2577                                );
    24562578          bool match_inst    = (r_cleanup_copy_inst.read()  == cleanup_inst);
    24572579          bool match         = match_srcid && match_inst;
     
    24672589          if(r_cleanup_is_cnt.read()) { // Directory is a counter
    24682590            entry.count  = r_cleanup_count.read() -1;
    2469             entry.owner.srcid = 0;
    2470             entry.owner.inst  = 0;
     2591            entry.owner.srcid   = 0;
     2592#if L1_MULTI_CACHE
     2593            entry.owner.cache_id= 0;
     2594#endif
     2595            entry.owner.inst    = 0;
    24712596            // response to the cache
    24722597            r_cleanup_fsm = CLEANUP_RSP;
     
    24742599          else{                         // Directory is a list
    24752600            if(match) { // hit
    2476               entry.count       = 0; // no more copy
    2477               entry.owner.srcid = 0;
    2478               entry.owner.inst  = 0;
    2479               r_cleanup_fsm     = CLEANUP_RSP;
     2601              entry.count         = 0; // no more copy
     2602              entry.owner.srcid   = 0;
     2603#if L1_MULTI_CACHE
     2604              entry.owner.cache_id=0;
     2605#endif
     2606              entry.owner.inst    = 0;
     2607              r_cleanup_fsm       = CLEANUP_RSP;
    24802608            } else { // miss
    2481               entry.count       = r_cleanup_count.read();
    2482               entry.owner.srcid = r_cleanup_copy.read();
    2483               entry.owner.inst  = r_cleanup_copy_inst.read();
    2484               r_cleanup_fsm     = CLEANUP_UPT_LOCK;
     2609              entry.count          = r_cleanup_count.read();
     2610              entry.owner.srcid    = r_cleanup_copy.read();
     2611#if L1_MULTI_CACHE
     2612              entry.owner.cache_id = r_cleanup_copy_cache.read();
     2613#endif
     2614              entry.owner.inst     = r_cleanup_copy_inst.read();
     2615              r_cleanup_fsm        = CLEANUP_UPT_LOCK;
    24852616            }
    24862617          }
     
    25012632            bool cleanup_inst       = r_cleanup_trdid.read() & 0x1;
    25022633            bool match_dir_srcid    = (r_cleanup_copy.read() == r_cleanup_srcid.read());
     2634#if L1_MULTI_CACHE
     2635            bool match_dir_cache_id = (r_cleanup_copy_cache.read() == r_cleanup_pktid.read());
     2636#endif
    25032637            bool match_dir_inst     = (r_cleanup_copy_inst.read()  == cleanup_inst);
    2504             bool match_dir          = match_dir_srcid && match_dir_inst;
     2638            bool match_dir          = match_dir_srcid and match_dir_cache_id and match_dir_inst;
    25052639            bool match_heap_srcid   = (heap_entry.owner.srcid == r_cleanup_srcid.read());
     2640#if L1_MULTI_CACHE
     2641            bool match_heap_cache_id= (heap_entry.owner.cache_id == r_cleanup_pktid.read());
     2642#endif
    25062643            bool match_heap_inst    = (heap_entry.owner.inst  == cleanup_inst);
    2507             bool match_heap         = match_heap_srcid && match_heap_inst;
    2508 
    2509             r_cleanup_prev_ptr = r_cleanup_ptr.read();
    2510             r_cleanup_prev_srcid = heap_entry.owner.srcid;
    2511             r_cleanup_prev_inst  = heap_entry.owner.inst;
     2644            bool match_heap         = match_heap_srcid and match_heap_cache_id and match_heap_inst;
     2645
     2646#if L1_MULTI_CACHE
     2647            PRINTF("  * <MEM_CACHE.CLEANUP> match_dir  %d (match_dir_srcid  %d, match_dir_cache_id  %d, match_dir_inst  %d)\n",
     2648                   match_dir , match_dir_srcid , match_dir_cache_id , match_dir_inst);
     2649            PRINTF("  * <MEM_CACHE.CLEANUP> match_heap %d (match_heap_srcid %d, match_heap_cache_id %d, match_heap_inst %d)\n",
     2650                   match_heap, match_heap_srcid, match_heap_cache_id, match_heap_inst);
     2651#else
     2652            PRINTF("  * <MEM_CACHE.CLEANUP> match_dir  %d (match_dir_srcid  %d, match_dir_inst  %d)\n",
     2653                   match_dir , match_dir_srcid , match_dir_inst);
     2654            PRINTF("  * <MEM_CACHE.CLEANUP> match_heap %d (match_heap_srcid %d, match_heap_inst %d)\n",
     2655                   match_heap, match_heap_srcid, match_heap_inst);
     2656#endif
     2657            PRINTF("  * <MEM_CACHE.CLEANUP> last %d\n",last);
     2658
     2659            r_cleanup_prev_ptr      = r_cleanup_ptr.read();
     2660            r_cleanup_prev_srcid    = heap_entry.owner.srcid;
     2661#if L1_MULTI_CACHE
     2662            r_cleanup_prev_cache_id = heap_entry.owner.cache_id;
     2663#endif
     2664
     2665            r_cleanup_prev_inst     = heap_entry.owner.inst;
    25122666
    25132667            if(match_dir){
    25142668              DirectoryEntry dir_entry;
    2515               dir_entry.valid       = true;
    2516               dir_entry.is_cnt      = r_cleanup_is_cnt.read();
    2517               dir_entry.dirty       = r_cleanup_dirty.read();
    2518               dir_entry.tag             = r_cleanup_tag.read();
    2519               dir_entry.lock        = r_cleanup_lock.read();
    2520               dir_entry.ptr         = heap_entry.next;
    2521               dir_entry.count       = r_cleanup_count.read()-1;
    2522               dir_entry.owner.srcid = heap_entry.owner.srcid;
    2523               dir_entry.owner.inst  = heap_entry.owner.inst;
     2669              dir_entry.valid          = true;
     2670              dir_entry.is_cnt         = r_cleanup_is_cnt.read();
     2671              dir_entry.dirty          = r_cleanup_dirty.read();
     2672              dir_entry.tag                = r_cleanup_tag.read();
     2673              dir_entry.lock           = r_cleanup_lock.read();
     2674              dir_entry.ptr            = heap_entry.next;
     2675              dir_entry.count          = r_cleanup_count.read()-1;
     2676              dir_entry.owner.srcid    = heap_entry.owner.srcid;
     2677#if L1_MULTI_CACHE
     2678              dir_entry.owner.cache_id = heap_entry.owner.cache_id;
     2679#endif
     2680              dir_entry.owner.inst     = heap_entry.owner.inst;
    25242681              m_cache_directory.write(set,way,dir_entry);
    2525               r_cleanup_next_ptr    = r_cleanup_ptr.read();
    2526               r_cleanup_fsm         = CLEANUP_HEAP_FREE;
     2682              r_cleanup_next_ptr       = r_cleanup_ptr.read();
     2683              r_cleanup_fsm            = CLEANUP_HEAP_FREE;
    25272684            }
    25282685            else if(match_heap){
    25292686              DirectoryEntry dir_entry;
    2530               dir_entry.valid       = true;
    2531               dir_entry.is_cnt      = r_cleanup_is_cnt.read();
    2532               dir_entry.dirty       = r_cleanup_dirty.read();
    2533               dir_entry.tag             = r_cleanup_tag.read();
    2534               dir_entry.lock        = r_cleanup_lock.read();
    2535               dir_entry.ptr         = heap_entry.next;
    2536               dir_entry.count       = r_cleanup_count.read()-1;
    2537               dir_entry.owner.srcid = r_cleanup_copy.read();
    2538               dir_entry.owner.inst  = r_cleanup_copy_inst.read();
     2687              dir_entry.valid          = true;
     2688              dir_entry.is_cnt         = r_cleanup_is_cnt.read();
     2689              dir_entry.dirty          = r_cleanup_dirty.read();
     2690              dir_entry.tag                = r_cleanup_tag.read();
     2691              dir_entry.lock           = r_cleanup_lock.read();
     2692              dir_entry.ptr            = heap_entry.next;
     2693              dir_entry.count          = r_cleanup_count.read()-1;
     2694              dir_entry.owner.srcid    = r_cleanup_copy.read();
     2695#if L1_MULTI_CACHE
     2696              dir_entry.owner.cache_id = r_cleanup_copy_cache.read();
     2697#endif
     2698              dir_entry.owner.inst     = r_cleanup_copy_inst.read();
    25392699              m_cache_directory.write(set,way,dir_entry);
    2540               r_cleanup_next_ptr    = r_cleanup_ptr.read();
    2541               r_cleanup_fsm         = CLEANUP_HEAP_FREE;
     2700              r_cleanup_next_ptr       = r_cleanup_ptr.read();
     2701              r_cleanup_fsm            = CLEANUP_HEAP_FREE;
    25422702            }
    25432703            else{
     
    25522712                dir_entry.count         = r_cleanup_count.read()-1;
    25532713                dir_entry.owner.srcid   = r_cleanup_copy.read();
     2714#if L1_MULTI_CACHE
     2715                dir_entry.owner.cache_id= r_cleanup_copy_cache.read();
     2716#endif
    25542717                dir_entry.owner.inst    = r_cleanup_copy_inst.read();
    25552718                m_cache_directory.write(set,way,dir_entry);
     
    25592722
    25602723              } else{
    2561                 assert(false && "MemCache ERROR : CLEANUP hit but line not shared");
     2724                  ASSERT(false,"MemCache ERROR : CLEANUP hit but line not shared");
    25622725              }
    25632726            }
     
    25682731      case CLEANUP_HEAP_SEARCH:
    25692732        {
    2570           assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) &&
    2571                     "MemCache ERROR : bad HEAP allocation");
     2733          ASSERT((r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP)
     2734                 ,"MemCache ERROR : bad HEAP allocation");
    25722735          HeapEntry heap_entry = m_heap_directory.read(r_cleanup_next_ptr.read());
    25732736          bool last = (heap_entry.next == r_cleanup_next_ptr.read());
    25742737          bool cleanup_inst       = r_cleanup_trdid.read() & 0x1;
    2575           bool match_heap_srcid   = (heap_entry.owner.srcid == r_cleanup_srcid.read());
     2738          bool match_heap_srcid   = ((heap_entry.owner.srcid == r_cleanup_srcid.read())
     2739#if L1_MULTI_CACHE
     2740                                     and (heap_entry.owner.cache_id == r_cleanup_pktid.read())
     2741#endif
     2742                                     );
    25762743          bool match_heap_inst    = (heap_entry.owner.inst  == cleanup_inst);
    25772744          bool match_heap         = match_heap_srcid && match_heap_inst;
     
    25832750          else{
    25842751            if(last) {
    2585               assert(false && "MemCache ERROR : CLEANUP hit but line not shared");
     2752                ASSERT(false,"MemCache ERROR : CLEANUP hit but line not shared");
    25862753            } else {
    2587               r_cleanup_prev_ptr = r_cleanup_next_ptr.read();
    2588               r_cleanup_prev_srcid = heap_entry.owner.srcid;
    2589               r_cleanup_prev_inst  = heap_entry.owner.inst;
     2754              r_cleanup_prev_ptr      = r_cleanup_next_ptr.read();
     2755              r_cleanup_prev_srcid    = heap_entry.owner.srcid;
     2756#if L1_MULTI_CACHE
     2757              r_cleanup_prev_cache_id = heap_entry.owner.cache_id;
     2758#endif
     2759              r_cleanup_prev_inst     = heap_entry.owner.inst;
    25902760              r_cleanup_next_ptr = heap_entry.next;
    25912761              r_cleanup_fsm      = CLEANUP_HEAP_SEARCH;
     
    25982768      case CLEANUP_HEAP_CLEAN:
    25992769        {
    2600           assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) &&
    2601                     "MemCache ERROR : bad HEAP allocation");
     2770            ASSERT((r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP)
     2771                   ,"MemCache ERROR : bad HEAP allocation");
    26022772          bool last = (r_cleanup_next_ptr.read() == r_cleanup_ptr.read());
    26032773          HeapEntry heap_entry;
    2604           heap_entry.owner.srcid = r_cleanup_prev_srcid.read();
    2605           heap_entry.owner.inst  = r_cleanup_prev_inst.read();
     2774          heap_entry.owner.srcid    = r_cleanup_prev_srcid.read();
     2775#if L1_MULTI_CACHE
     2776          heap_entry.owner.cache_id = r_cleanup_prev_cache_id.read();
     2777#endif
     2778          heap_entry.owner.inst     = r_cleanup_prev_inst.read();
    26062779          if(last){ // this is the last entry of the list of copies
    26072780            heap_entry.next     = r_cleanup_prev_ptr.read();
     
    26162789      case CLEANUP_HEAP_FREE:
    26172790        {
    2618           assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) &&
    2619                     "MemCache ERROR : bad HEAP allocation");
     2791          ASSERT((r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP)
     2792                 ,"MemCache ERROR : bad HEAP allocation");
    26202793          HeapEntry heap_entry;
    2621           heap_entry.owner.srcid = 0;
    2622           heap_entry.owner.inst  = false;
     2794          heap_entry.owner.srcid    = 0;
     2795#if L1_MULTI_CACHE
     2796          heap_entry.owner.cache_id = 0;
     2797#endif
     2798          heap_entry.owner.inst     = false;
    26232799          if(m_heap_directory.is_full()){
    26242800            heap_entry.next     = r_cleanup_next_ptr.read();
     
    27602936                r_llsc_wdata = m_cmd_llsc_wdata_fifo.read();
    27612937            if(r_llsc_cpt.read()>3)
    2762                 assert(false && "MEMCACHE error : SC too long");
     2938                ASSERT(false,"MEMCACHE error : SC too long");
    27632939            if(r_llsc_cpt.read()==2){
    27642940                r_llsc_wdata = m_cmd_llsc_wdata_fifo.read();
     
    27742950            size_t way = 0;
    27752951            DirectoryEntry entry(m_cache_directory.read(m_cmd_llsc_addr_fifo.read(), way));
    2776             r_llsc_is_cnt   = entry.is_cnt;
    2777             r_llsc_dirty    = entry.dirty;
    2778             r_llsc_tag      = entry.tag;
    2779             r_llsc_way      = way;
    2780             r_llsc_copy     = entry.owner.srcid;
    2781             r_llsc_copy_inst= entry.owner.inst;
    2782             r_llsc_ptr      = entry.ptr;
    2783             r_llsc_count    = entry.count;
     2952            r_llsc_is_cnt     = entry.is_cnt;
     2953            r_llsc_dirty      = entry.dirty;
     2954            r_llsc_tag        = entry.tag;
     2955            r_llsc_way        = way;
     2956            r_llsc_copy       = entry.owner.srcid;
     2957#if L1_MULTI_CACHE
     2958            r_llsc_copy_cache = entry.owner.cache_id;
     2959#endif
     2960
     2961            r_llsc_copy_inst  = entry.owner.inst;
     2962            r_llsc_ptr        = entry.ptr;
     2963            r_llsc_count      = entry.count;
    27842964            if ( entry.valid ){
    27852965                r_llsc_fsm = SC_DIR_HIT_READ;
     
    27982978          // update directory (lock & dirty bits
    27992979          DirectoryEntry entry;
    2800           entry.valid       = true;
    2801           entry.is_cnt      = r_llsc_is_cnt.read();
    2802           entry.dirty       = true;
    2803           entry.lock        = true;
    2804           entry.tag             = r_llsc_tag.read();
    2805           entry.owner.srcid = r_llsc_copy.read();
    2806           entry.owner.inst  = r_llsc_copy_inst.read();
    2807           entry.count       = r_llsc_count.read();
    2808           entry.ptr         = r_llsc_ptr.read();
     2980          entry.valid          = true;
     2981          entry.is_cnt         = r_llsc_is_cnt.read();
     2982          entry.dirty          = true;
     2983          entry.lock           = true;
     2984          entry.tag                = r_llsc_tag.read();
     2985          entry.owner.srcid    = r_llsc_copy.read();
     2986#if L1_MULTI_CACHE
     2987          entry.owner.cache_id = r_llsc_copy_cache.read();
     2988#endif
     2989          entry.owner.inst     = r_llsc_copy_inst.read();
     2990          entry.count          = r_llsc_count.read();
     2991          entry.ptr            = r_llsc_ptr.read();
    28092992          m_cache_directory.write(set, way, entry);
    28102993
     
    29383121      case SC_UPT_REQ:  // Request the update
    29393122        {
    2940           assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_LLSC) &&
    2941                     "MemCache ERROR : bad HEAP allocation");
     3123          ASSERT((r_alloc_heap_fsm.read() == ALLOC_HEAP_LLSC)
     3124                 ,"MemCache ERROR : bad HEAP allocation");
    29423125          if( !r_llsc_to_init_cmd_multi_req.read() &&
    29433126              !r_llsc_to_init_cmd_brdcast_req.read()  ){
     
    29593142            llsc_to_init_cmd_fifo_inst    = r_llsc_copy_inst.read();
    29603143            llsc_to_init_cmd_fifo_srcid   = r_llsc_copy.read();
     3144#if L1_MULTI_CACHE
     3145            llsc_to_init_cmd_fifo_cache_id= r_llsc_copy_cache.read();
     3146#endif
    29613147            if(r_llsc_count.read() == 1){
    29623148#ifdef LOCK_DEBUG
     
    29783164      case SC_UPDATE:           // send a multi-update request to INIT_CMD fsm
    29793165        {
    2980           assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_LLSC) &&
    2981                     "MemCache ERROR : bad HEAP allocation");
     3166          ASSERT((r_alloc_heap_fsm.read() == ALLOC_HEAP_LLSC)
     3167                 ,"MemCache ERROR : bad HEAP allocation");
    29823168          HeapEntry entry = m_heap_directory.read(r_llsc_ptr.read());
    2983           llsc_to_init_cmd_fifo_inst  = entry.owner.inst;
    2984           llsc_to_init_cmd_fifo_srcid = entry.owner.srcid;
     3169          llsc_to_init_cmd_fifo_srcid    = entry.owner.srcid;
     3170#if L1_MULTI_CACHE
     3171          llsc_to_init_cmd_fifo_cache_id = entry.owner.cache_id;
     3172#endif
     3173          llsc_to_init_cmd_fifo_inst     = entry.owner.inst;
    29853174          llsc_to_init_cmd_fifo_put = true;
    29863175
     
    31063295            entry.count         = 0;
    31073296            entry.owner.srcid   = 0;
     3297#if L1_MULTI_CACHE
     3298            entry.owner.cache_id= 0;
     3299#endif
    31083300            entry.owner.inst    = false;
    31093301            entry.ptr           = 0;
     
    31143306            r_llsc_fsm = SC_INVAL;
    31153307          } else {
    3116             assert(false && "LOCK ERROR in LLSC_FSM, STATE = LLSC_DIR_INVAL");
     3308              ASSERT(false,"LOCK ERROR in LLSC_FSM, STATE = LLSC_DIR_INVAL");
    31173309          }
    31183310
     
    31503342            r_llsc_cpt = 0;
    31513343          } else {
    3152             assert( false && "MEM_CACHE, LLSC FSM : SC_XRAM_SEND state : the request should not have been previously set");
     3344              ASSERT(false,"MEM_CACHE, LLSC FSM : SC_XRAM_SEND state : the request should not have been previously set");
    31533345          }
    31543346          break;
     
    41094301        m_write_to_init_cmd_inst_fifo.put_and_get(write_to_init_cmd_fifo_inst);
    41104302        m_write_to_init_cmd_srcid_fifo.put_and_get(write_to_init_cmd_fifo_srcid);
     4303#if L1_MULTI_CACHE
     4304        m_write_to_init_cmd_cache_id_fifo.put_and_get(write_to_init_cmd_fifo_cache_id);
     4305#endif
    41114306      } else {
    41124307        m_write_to_init_cmd_inst_fifo.simple_put(write_to_init_cmd_fifo_inst);
    41134308        m_write_to_init_cmd_srcid_fifo.simple_put(write_to_init_cmd_fifo_srcid);
     4309#if L1_MULTI_CACHE
     4310        m_write_to_init_cmd_cache_id_fifo.simple_put(write_to_init_cmd_fifo_cache_id);
     4311#endif
    41144312      }
    41154313    } else {
     
    41174315        m_write_to_init_cmd_inst_fifo.simple_get();
    41184316        m_write_to_init_cmd_srcid_fifo.simple_get();
     4317#if L1_MULTI_CACHE
     4318        m_write_to_init_cmd_cache_id_fifo.simple_get();
     4319#endif
    41194320      }
    41204321    }
     
    41274328        m_xram_rsp_to_init_cmd_inst_fifo.put_and_get(xram_rsp_to_init_cmd_fifo_inst);
    41284329        m_xram_rsp_to_init_cmd_srcid_fifo.put_and_get(xram_rsp_to_init_cmd_fifo_srcid);
     4330#if L1_MULTI_CACHE
     4331        m_xram_rsp_to_init_cmd_cache_id_fifo.put_and_get(xram_rsp_to_init_cmd_fifo_cache_id);
     4332#endif
    41294333      } else {
    41304334        m_xram_rsp_to_init_cmd_inst_fifo.simple_put(xram_rsp_to_init_cmd_fifo_inst);
    41314335        m_xram_rsp_to_init_cmd_srcid_fifo.simple_put(xram_rsp_to_init_cmd_fifo_srcid);
     4336#if L1_MULTI_CACHE
     4337        m_xram_rsp_to_init_cmd_cache_id_fifo.simple_put(xram_rsp_to_init_cmd_fifo_cache_id);
     4338#endif
    41324339      }
    41334340    } else {
     
    41354342        m_xram_rsp_to_init_cmd_inst_fifo.simple_get();
    41364343        m_xram_rsp_to_init_cmd_srcid_fifo.simple_get();
     4344#if L1_MULTI_CACHE
     4345        m_xram_rsp_to_init_cmd_cache_id_fifo.simple_get();
     4346#endif
    41374347      }
    41384348    }
     
    41454355        m_llsc_to_init_cmd_inst_fifo.put_and_get(llsc_to_init_cmd_fifo_inst);
    41464356        m_llsc_to_init_cmd_srcid_fifo.put_and_get(llsc_to_init_cmd_fifo_srcid);
     4357#if L1_MULTI_CACHE
     4358        m_llsc_to_init_cmd_cache_id_fifo.put_and_get(llsc_to_init_cmd_fifo_cache_id);
     4359#endif
    41474360      } else {
    4148         m_llsc_to_init_cmd_inst_fifo.simple_put(llsc_to_init_cmd_fifo_inst);
    4149         m_llsc_to_init_cmd_srcid_fifo.simple_put(llsc_to_init_cmd_fifo_srcid);
     4361          m_llsc_to_init_cmd_inst_fifo.simple_put(llsc_to_init_cmd_fifo_inst);
     4362          m_llsc_to_init_cmd_srcid_fifo.simple_put(llsc_to_init_cmd_fifo_srcid);
     4363#if L1_MULTI_CACHE
     4364          m_llsc_to_init_cmd_cache_id_fifo.simple_put(llsc_to_init_cmd_fifo_cache_id);
     4365#endif
    41504366      }
    41514367    } else {
    4152       if ( llsc_to_init_cmd_fifo_get ) {
    4153         m_llsc_to_init_cmd_inst_fifo.simple_get();
    4154         m_llsc_to_init_cmd_srcid_fifo.simple_get();
     4368        if ( llsc_to_init_cmd_fifo_get ) {
     4369            m_llsc_to_init_cmd_inst_fifo.simple_get();
     4370            m_llsc_to_init_cmd_srcid_fifo.simple_get();
     4371#if L1_MULTI_CACHE
     4372            m_llsc_to_init_cmd_cache_id_fifo.simple_get();
     4373#endif
    41554374      }
    41564375    }
     
    41604379    m_cpt_cycles++;
    41614380
    4162   } // end transition()
     4381    } // end transition()
    41634382
    41644383  /////////////////////////////
     
    42974516        break;
    42984517      case TGT_RSP_READ:
     4518          PRINTF("  * <MEM_CACHE.TGT> RSP_READ     : srcid %d, trdid %d, pktid %d\n"
     4519                 ,(uint32_t)r_read_to_tgt_rsp_srcid.read()
     4520                 ,(uint32_t)r_read_to_tgt_rsp_trdid.read()
     4521                 ,(uint32_t)r_read_to_tgt_rsp_pktid.read()
     4522                 );
     4523
    42994524        p_vci_tgt.rspval   = true;
    43004525        p_vci_tgt.rdata    = r_read_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read();
     
    43064531        break;
    43074532      case TGT_RSP_WRITE:
     4533          PRINTF("  * <MEM_CACHE.TGT> RSP_WRITE    : BURP srcid %d, trdid %d, pktid %d\n"
     4534                 ,(uint32_t)r_write_to_tgt_rsp_srcid.read()
     4535                 ,(uint32_t)r_write_to_tgt_rsp_trdid.read()
     4536                 ,(uint32_t)r_write_to_tgt_rsp_pktid.read()
     4537                 );
     4538
    43084539        p_vci_tgt.rspval   = true;
    43094540        p_vci_tgt.rdata    = 0;
     
    43154546        break;
    43164547      case TGT_RSP_CLEANUP:
     4548          PRINTF("  * <MEM_CACHE.TGT> RSP_CLEANUP  : srcid %d, trdid %d, pktid %d\n"
     4549                 ,(uint32_t)r_cleanup_to_tgt_rsp_srcid.read()
     4550                 ,(uint32_t)r_cleanup_to_tgt_rsp_trdid.read()
     4551                 ,(uint32_t)r_cleanup_to_tgt_rsp_pktid.read()
     4552                 );
     4553
    43174554        p_vci_tgt.rspval   = true;
    43184555        p_vci_tgt.rdata    = 0;
     
    43244561        break;
    43254562      case TGT_RSP_LLSC:
     4563          PRINTF("  * <MEM_CACHE.TGT> RSP_LLSC     : srcid %d, trdid %d, pktid %d\n"
     4564                 ,(uint32_t)r_llsc_to_tgt_rsp_srcid.read()
     4565                 ,(uint32_t)r_llsc_to_tgt_rsp_trdid.read()
     4566                 ,(uint32_t)r_llsc_to_tgt_rsp_pktid.read()
     4567                 );
     4568
    43264569        p_vci_tgt.rspval   = true;
    43274570        p_vci_tgt.rdata    = r_llsc_to_tgt_rsp_data.read();
     
    43334576        break;
    43344577      case TGT_RSP_XRAM:
     4578          PRINTF("  * <MEM_CACHE.TGT> RSP_XRAM     : srcid %d, trdid %d, pktid %d\n"
     4579                 ,(uint32_t)r_xram_rsp_to_tgt_rsp_srcid.read()
     4580                 ,(uint32_t)r_xram_rsp_to_tgt_rsp_trdid.read()
     4581                 ,(uint32_t)r_xram_rsp_to_tgt_rsp_pktid.read()
     4582                 );
     4583
    43354584        p_vci_tgt.rspval   = true;
    43364585        p_vci_tgt.rdata    = r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read();
     
    43434592        break;
    43444593      case TGT_RSP_INIT:
     4594          PRINTF("  * <MEM_CACHE.TGT> RSP_INIT     : srcid %d, trdid %d, pktid %d\n"
     4595                 ,(uint32_t)r_init_rsp_to_tgt_rsp_srcid.read()
     4596                 ,(uint32_t)r_init_rsp_to_tgt_rsp_trdid.read()
     4597                 ,(uint32_t)r_init_rsp_to_tgt_rsp_pktid.read()
     4598                 );
     4599
    43454600        p_vci_tgt.rspval   = true;
    43464601        p_vci_tgt.rdata    = 0;
     
    43594614    p_vci_ini.cmd     = vci_param::CMD_WRITE;
    43604615    p_vci_ini.srcid   = m_srcid_ini;
    4361     p_vci_ini.pktid   = 0;
    43624616    p_vci_ini.cons    = true;
    43634617    p_vci_ini.wrap    = false;
     
    43774631        p_vci_ini.plen    = 0;
    43784632        p_vci_ini.trdid   = 0;
     4633        p_vci_ini.pktid   = 0;
    43794634        p_vci_ini.eop     = false;
    43804635        break;
    43814636      case INIT_CMD_INVAL_NLINE:
     4637      {
     4638        PRINTF("  * <MEM_CACHE.INIT_CMD> INVAL_NLINE : trdid %d, pktid %d\n"
     4639               ,(uint32_t)r_xram_rsp_to_init_cmd_trdid.read()
     4640               ,(uint32_t)m_xram_rsp_to_init_cmd_cache_id_fifo.read()
     4641               );
     4642       
    43824643        p_vci_ini.cmdval  = m_xram_rsp_to_init_cmd_inst_fifo.rok();
    43834644        if(m_xram_rsp_to_init_cmd_inst_fifo.rok()){
     
    43924653        p_vci_ini.plen    = 4;
    43934654        p_vci_ini.trdid   = r_xram_rsp_to_init_cmd_trdid.read();
     4655        p_vci_ini.pktid   = m_xram_rsp_to_init_cmd_cache_id_fifo.read();
    43944656        p_vci_ini.eop     = true;
    43954657        break;
     4658      }
    43964659      case INIT_CMD_XRAM_BRDCAST:
    43974660        p_vci_ini.cmdval  = true;
     
    44014664        p_vci_ini.plen    = 4;
    44024665        p_vci_ini.trdid   = r_xram_rsp_to_init_cmd_trdid.read();
     4666        p_vci_ini.pktid   = 0;
    44034667        p_vci_ini.eop     = true;
    44044668        break;
     
    44124676        p_vci_ini.eop     = true;
    44134677        p_vci_ini.trdid   = r_write_to_init_cmd_trdid.read();
     4678        p_vci_ini.pktid   = 0;
    44144679        break;
    44154680      case INIT_CMD_UPDT_NLINE:
     
    44294694        p_vci_ini.eop     = false;
    44304695        p_vci_ini.trdid   = r_write_to_init_cmd_trdid.read();
     4696        p_vci_ini.pktid   = m_write_to_init_cmd_cache_id_fifo.read();
    44314697        break;
    44324698      case INIT_CMD_UPDT_INDEX:
     
    44414707        p_vci_ini.plen    = 4 * (r_write_to_init_cmd_count.read() + 2);
    44424708        p_vci_ini.trdid   = r_write_to_init_cmd_trdid.read();
     4709        p_vci_ini.pktid   = m_write_to_init_cmd_cache_id_fifo.read();
    44434710        p_vci_ini.eop     = false;
    44444711        break;
     
    44564723        p_vci_ini.plen    = 4 * (r_write_to_init_cmd_count.read() + 2);
    44574724        p_vci_ini.trdid   = r_write_to_init_cmd_trdid.read();
     4725        p_vci_ini.pktid   = m_write_to_init_cmd_cache_id_fifo.read();
    44584726        p_vci_ini.eop     = ( r_init_cmd_cpt.read() == (r_write_to_init_cmd_count.read()-1) );
    44594727        break;
     
    44674735        p_vci_ini.eop     = true;
    44684736        p_vci_ini.trdid   = r_llsc_to_init_cmd_trdid.read();
     4737        p_vci_ini.pktid   = 0;
    44694738        break;
    44704739      case INIT_CMD_SC_UPDT_NLINE:
     
    44884757        p_vci_ini.eop     = false;
    44894758        p_vci_ini.trdid   = r_llsc_to_init_cmd_trdid.read();
     4759        p_vci_ini.pktid   = m_llsc_to_init_cmd_cache_id_fifo.read();
    44904760        break;
    44914761      case INIT_CMD_SC_UPDT_INDEX:
     
    45044774        }
    45054775        p_vci_ini.trdid   = r_llsc_to_init_cmd_trdid.read();
     4776        p_vci_ini.pktid   = m_llsc_to_init_cmd_cache_id_fifo.read();
    45064777        p_vci_ini.eop     = false;
    45074778        break;
     
    45164787        p_vci_ini.be      = 0xF;
    45174788        p_vci_ini.trdid   = r_llsc_to_init_cmd_trdid.read();
     4789        p_vci_ini.pktid   = m_llsc_to_init_cmd_cache_id_fifo.read();
    45184790        if(r_llsc_to_init_cmd_is_long.read()){
    45194791            p_vci_ini.plen    = 4 * 4;
     
    45354807        p_vci_ini.plen    = 4 * 4;
    45364808        p_vci_ini.trdid   = r_llsc_to_init_cmd_trdid.read();
     4809        p_vci_ini.pktid   = m_llsc_to_init_cmd_cache_id_fifo.read();
    45374810        p_vci_ini.eop     = true;
    45384811        break;
     
    45674840      case CLEANUP_RSP:
    45684841        {
     4842            PRINTF("  * <MEM_CACHE.CLEANUP_RSP> Respons to %d.%d\n",(uint32_t)r_cleanup_srcid.read(),(uint32_t)r_cleanup_pktid.read());
     4843
    45694844          p_vci_tgt_cleanup.rspval = true;
    45704845          p_vci_tgt_cleanup.rdata  = 0;
Note: See TracChangeset for help on using the changeset viewer.