Changeset 395 for trunk


Ignore:
Timestamp:
May 28, 2013, 9:56:06 AM (11 years ago)
Author:
alain
Message:

ntroducing support for 40 bits physical addresses.

Location:
trunk/modules/vci_mem_cache/caba
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_mem_cache/caba/metadata/vci_mem_cache.sd

    r385 r395  
    5555            parameter.Int   ( 'heap_size' ),
    5656        ],
    57 
    58         extensions = [
    59             'dsx:get_ident='
    60             'vci_ini_index:p_vci_ini:mtc,'
    61             'vci_tgt_index_cleanup:p_vci_tgt_cleanup:mtc,'
    62             'vci_tgt_index:p_vci_tgt:mtp,'
    63             'vci_ixr_index:p_vci_ixr:mtx',
    64             'dsx:addressable=vci_tgt_index,vci_tgt_index_cleanup',
    65         ],
    6657)
  • trunk/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h

    r385 r395  
    5252#include "dspin_dhccp_param.h"
    5353
    54 #define TRANSACTION_TAB_LINES 4 // Number of lines in the transaction tab
    55 #define UPDATE_TAB_LINES      4 // Number of lines in the update tab
     54#define TRT_ENTRIES      4      // Number of entries in TRT
     55#define UPT_ENTRIES      4      // Number of entries in UPT
     56#define HEAP_ENTRIES     1024   // Number of entries in HEAP
    5657
    5758namespace soclib {  namespace caba {
     59
    5860  using namespace sc_core;
    5961
     
    8385
    8486      /* States of the TGT_RSP fsm */
    85       enum tgt_rsp_fsm_state_e{
     87      enum tgt_rsp_fsm_state_e
     88      {
    8689        TGT_RSP_READ_IDLE,
    8790        TGT_RSP_WRITE_IDLE,
     
    99102
    100103      /* States of the DSPIN_TGT fsm */
    101       enum cc_receive_fsm_state_e{
     104      enum cc_receive_fsm_state_e
     105      {
    102106        CC_RECEIVE_IDLE,
    103107        CC_RECEIVE_CLEANUP,
     
    106110
    107111      /* States of the CC_SEND fsm */
    108       enum cc_send_fsm_state_e{
     112      enum cc_send_fsm_state_e
     113      {
    109114        CC_SEND_XRAM_RSP_IDLE,
    110115        CC_SEND_WRITE_IDLE,
     
    130135
    131136      /* States of the MULTI_ACK fsm */
    132       enum multi_ack_fsm_state_e{
     137      enum multi_ack_fsm_state_e
     138      {
    133139        MULTI_ACK_IDLE,
    134140        MULTI_ACK_UPT_LOCK,
     
    138144
    139145      /* States of the READ fsm */
    140       enum read_fsm_state_e{
     146      enum read_fsm_state_e
     147      {
    141148        READ_IDLE,
    142149        READ_DIR_REQ,
     
    155162
    156163      /* States of the WRITE fsm */
    157       enum write_fsm_state_e{
     164      enum write_fsm_state_e
     165      {
    158166        WRITE_IDLE,
    159167        WRITE_NEXT,
     
    181189
    182190      /* States of the IXR_RSP fsm */
    183       enum ixr_rsp_fsm_state_e{
     191      enum ixr_rsp_fsm_state_e
     192      {
    184193        IXR_RSP_IDLE,
    185194        IXR_RSP_ACK,
     
    189198
    190199      /* States of the XRAM_RSP fsm */
    191       enum xram_rsp_fsm_state_e{
     200      enum xram_rsp_fsm_state_e
     201      {
    192202        XRAM_RSP_IDLE,
    193203        XRAM_RSP_TRT_COPY,
     
    208218
    209219      /* States of the IXR_CMD fsm */
    210       enum ixr_cmd_fsm_state_e{
     220      enum ixr_cmd_fsm_state_e
     221      {
    211222        IXR_CMD_READ_IDLE,
    212223        IXR_CMD_WRITE_IDLE,
    213224        IXR_CMD_CAS_IDLE,
    214225        IXR_CMD_XRAM_IDLE,
    215         IXR_CMD_READ_NLINE,
    216         IXR_CMD_WRITE_NLINE,
    217         IXR_CMD_CAS_NLINE,
    218         IXR_CMD_XRAM_DATA
     226        IXR_CMD_READ,
     227        IXR_CMD_WRITE,
     228        IXR_CMD_CAS,
     229        IXR_CMD_XRAM
    219230      };
    220231
    221232      /* States of the CAS fsm */
    222       enum cas_fsm_state_e{
     233      enum cas_fsm_state_e
     234      {
    223235        CAS_IDLE,
    224236        CAS_DIR_REQ,
     
    245257
    246258      /* States of the CLEANUP fsm */
    247       enum cleanup_fsm_state_e{
     259      enum cleanup_fsm_state_e
     260      {
    248261        CLEANUP_IDLE,
    249262        CLEANUP_GET_NLINE,
     
    264277
    265278      /* States of the ALLOC_DIR fsm */
    266       enum alloc_dir_fsm_state_e{
     279      enum alloc_dir_fsm_state_e
     280      {
    267281        ALLOC_DIR_RESET,
    268282        ALLOC_DIR_READ,
     
    274288
    275289      /* States of the ALLOC_TRT fsm */
    276       enum alloc_trt_fsm_state_e{
     290      enum alloc_trt_fsm_state_e
     291      {
    277292        ALLOC_TRT_READ,
    278293        ALLOC_TRT_WRITE,
     
    283298
    284299      /* States of the ALLOC_UPT fsm */
    285       enum alloc_upt_fsm_state_e{
     300      enum alloc_upt_fsm_state_e
     301      {
    286302        ALLOC_UPT_WRITE,
    287303        ALLOC_UPT_XRAM_RSP,
     
    292308
    293309      /* States of the ALLOC_HEAP fsm */
    294       enum alloc_heap_fsm_state_e{
     310      enum alloc_heap_fsm_state_e
     311      {
    295312        ALLOC_HEAP_RESET,
    296313        ALLOC_HEAP_READ,
     
    386403      VciMemCache(
    387404          sc_module_name name,                                // Instance Name
    388           const soclib::common::MappingTable &mtp,            // Mapping table for direct network
    389           const soclib::common::MappingTable &mtx,            // Mapping table for external network
     405          const soclib::common::MappingTable &mtp,            // Mapping table direct network
     406          const soclib::common::MappingTable &mtx,            // Mapping table external network
    390407          const soclib::common::IntTab       &srcid_x,        // global index on external network
    391408          const soclib::common::IntTab       &tgtid_d,        // global index on direct network
     
    395412          const size_t                       nwords,          // Number of words per line
    396413          const size_t                       max_copies,      // max number of copies in heap
    397           const size_t                       heap_size=1024,  // number of heap entries
    398           const size_t                       trt_lines=TRANSACTION_TAB_LINES,
    399           const size_t                       upt_lines=UPDATE_TAB_LINES,       
     414          const size_t                       heap_size=HEAP_ENTRIES,
     415          const size_t                       trt_lines=TRT_ENTRIES,
     416          const size_t                       upt_lines=UPT_ENTRIES,     
    400417          const size_t                       debug_start_cycle=0,
    401418          const bool                         debug_ok=false );
     
    449466
    450467      // broadcast address
    451       uint32_t                                                m_broadcast_address;
     468      uint32_t                           m_broadcast_boundaries;
    452469
    453470      //////////////////////////////////////////////////
  • trunk/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r391 r395  
    2626* SOCLIB_LGPL_HEADER_END
    2727*
    28 * Maintainers: alain eric.guthmuller@polytechnique.edu
     28* Maintainers: alain.greiner@lip6.fr
     29*              eric.guthmuller@polytechnique.edu
    2930*              cesar.fuguet-tortolero@lip6.fr
    3031*              alexandre.joannou@lip6.fr
     
    5556#define RANDOMIZE_CAS        1
    5657
    57 namespace soclib
    58 {
    59 namespace caba
    60 {
     58namespace soclib { namespace caba {
    6159
    6260const char *tgt_cmd_fsm_str[] =
     
    190188  "IXR_CMD_CAS_IDLE",
    191189  "IXR_CMD_XRAM_IDLE",
    192   "IXR_CMD_READ_NLINE",
    193   "IXR_CMD_WRITE_NLINE",
    194   "IXR_CMD_CAS_NLINE",
    195   "IXR_CMD_XRAM_DATA"
     190  "IXR_CMD_READ",
     191  "IXR_CMD_WRITE",
     192  "IXR_CMD_CAS",
     193  "IXR_CMD_XRAM"
    196194};
    197195const char *cas_fsm_str[] =
     
    341339    // XMIN(5 bits) / XMAX(5 bits) / YMIN(5 bits) / YMAX(5 bits)
    342340    //   0b00000    /   0b11111    /   0b00000    /   0b11111
    343     m_broadcast_address(0x7C1F),
     341    m_broadcast_boundaries(0x7C1F),
    344342
    345343    //  FIFOs
     
    514512      (addr < m_monitor_base + m_monitor_length))
    515513  {
    516     if ( read ) std::cout << " MEMC Read Monitor ";
    517     else        std::cout << " MEMC Write Monitor ";
     514    if ( read ) std::cout << " Monitor MEMC Read ";
     515    else        std::cout << " Monitor MEMC Write ";
    518516    std::cout << buf
    519               << " Address = " << std::hex << addr
     517              << " / Address = " << std::hex << addr
    520518              << " / Data = " << data
    521519              << " at cycle " << std::dec << m_cpt_cycles << std::endl;
     
    528526{
    529527  DirectoryEntry entry = m_cache_directory.read_neutral(addr);
     528
    530529  if((entry.count != m_debug_previous_count) or
    531530      (entry.valid != m_debug_previous_hit))
    532531  {
    533     std::cout << " MEMC " << name()
    534               << " cache change at cycle " << std::dec << m_cpt_cycles
     532    std::cout << "Monitor MEMC " << name()
     533              << " at cycle " << std::dec << m_cpt_cycles
    535534              << " for address " << std::hex << addr
    536535              << " / HIT = " << entry.valid
     
    546545{
    547546  std::cout << "MEMC " << name() << std::endl;
    548   std::cout << "  "  << tgt_cmd_fsm_str[r_tgt_cmd_fsm]
    549             << " | " << tgt_rsp_fsm_str[r_tgt_rsp_fsm]
    550             << " | " << read_fsm_str[r_read_fsm]
    551             << " | " << write_fsm_str[r_write_fsm]
    552             << " | " << cas_fsm_str[r_cas_fsm]
    553             << " | " << cleanup_fsm_str[r_cleanup_fsm] << std::endl;
    554   std::cout << "  "  << cc_send_fsm_str[r_cc_send_fsm]
    555             << " | " << cc_receive_fsm_str[r_cc_receive_fsm]
    556             << " | " << multi_ack_fsm_str[r_multi_ack_fsm]
    557             << " | " << ixr_cmd_fsm_str[r_ixr_cmd_fsm]
    558             << " | " << ixr_rsp_fsm_str[r_ixr_rsp_fsm]
     547  std::cout << "  "  << tgt_cmd_fsm_str[r_tgt_cmd_fsm.read()]
     548            << " | " << tgt_rsp_fsm_str[r_tgt_rsp_fsm.read()]
     549            << " | " << read_fsm_str[r_read_fsm.read()]
     550            << " | " << write_fsm_str[r_write_fsm.read()]
     551            << " | " << cas_fsm_str[r_cas_fsm.read()]
     552            << " | " << cleanup_fsm_str[r_cleanup_fsm.read()] << std::endl;
     553  std::cout << "  "  << cc_send_fsm_str[r_cc_send_fsm.read()]
     554            << " | " << cc_receive_fsm_str[r_cc_receive_fsm.read()]
     555            << " | " << multi_ack_fsm_str[r_multi_ack_fsm.read()]
     556            << " | " << ixr_cmd_fsm_str[r_ixr_cmd_fsm.read()]
     557            << " | " << ixr_rsp_fsm_str[r_ixr_rsp_fsm.read()]
    559558            << " | " << xram_rsp_fsm_str[r_xram_rsp_fsm] << std::endl;
    560 
    561   //m_llsc_table.print_trace();
    562 
     559  std::cout << "  "  << alloc_dir_fsm_str[r_alloc_dir_fsm.read()]
     560            << " | " << alloc_trt_fsm_str[r_alloc_trt_fsm.read()]
     561            << " | " << alloc_upt_fsm_str[r_alloc_upt_fsm.read()]
     562            << " | " << alloc_heap_fsm_str[r_alloc_heap_fsm.read()] << std::endl;
    563563}
    564564
     
    13091309  switch(r_read_fsm.read())
    13101310  {
    1311       ///////////////
     1311    ///////////////
    13121312    case READ_IDLE:
    13131313      // waiting a read request
     
    13171317
    13181318#if DEBUG_MEMC_READ
    1319         if(m_debug_read_fsm)
    1320         {
    1321           std::cout << "  <MEMC " << name() << " READ_IDLE> Read request:"
    1322                     << " srcid = " << std::dec << m_cmd_read_srcid_fifo.read()
    1323                     << " / address = " << std::hex << m_cmd_read_addr_fifo.read()
    1324                     << " / pktid = " << std::hex << m_cmd_read_pktid_fifo.read()
    1325                     << " / nwords = " << std::dec << m_cmd_read_length_fifo.read() << std::endl;
    1326         }
     1319if(m_debug_read_fsm)
     1320std::cout << "  <MEMC " << name() << " READ_IDLE> Read request:"
     1321          << " srcid = " << std::dec << m_cmd_read_srcid_fifo.read()
     1322          << " / address = " << std::hex << m_cmd_read_addr_fifo.read()
     1323          << " / pktid = " << std::hex << m_cmd_read_pktid_fifo.read()
     1324          << " / nwords = " << std::dec << m_cmd_read_length_fifo.read() << std::endl;
    13271325#endif
    13281326        r_read_fsm = READ_DIR_REQ;
     
    13411339
    13421340#if DEBUG_MEMC_READ
    1343       if(m_debug_read_fsm)
    1344       {
    1345         std::cout
    1346             << "  <MEMC " << name() << " READ_DIR_REQ> Requesting DIR lock "
    1347             << std::endl;
    1348       }
     1341if(m_debug_read_fsm)
     1342std::cout << "  <MEMC " << name() << " READ_DIR_REQ> Requesting DIR lock " << std::endl;
    13491343#endif
    13501344      break;
     
    14001394
    14011395#if DEBUG_MEMC_READ
    1402         if(m_debug_read_fsm)
    1403         {
    1404           std::cout
    1405               << "  <MEMC " << name() << " READ_DIR_LOCK> Accessing directory: "
    1406               << " address = " << std::hex << m_cmd_read_addr_fifo.read()
    1407               << " / hit = " << std::dec << entry.valid
    1408               << " / count = " <<std::dec << entry.count
    1409               << " / is_cnt = " << entry.is_cnt << std::endl;
    1410           if((m_cmd_read_pktid_fifo.read() & 0x7) == TYPE_LL)
    1411           {
    1412             std::cout
    1413                 << "  <MEMC " << name() << " READ_DIR_LOCK> global_llsc_table LL access" << std::endl;
    1414           }
    1415         }
     1396if(m_debug_read_fsm)
     1397{
     1398std::cout << "  <MEMC " << name() << " READ_DIR_LOCK> Accessing directory: "
     1399          << " address = " << std::hex << m_cmd_read_addr_fifo.read()
     1400          << " / hit = " << std::dec << entry.valid
     1401          << " / count = " <<std::dec << entry.count
     1402          << " / is_cnt = " << entry.is_cnt;
     1403if((m_cmd_read_pktid_fifo.read() & 0x7) == TYPE_LL) std::cout << " / LL access" << std::endl;
     1404else                                                std::cout << std::endl;
     1405}
    14161406#endif
    14171407      }
    14181408      else
    14191409      {
    1420         std::cout
    1421             << "VCI_MEM_CACHE ERROR " << name()
    1422             << " READ_DIR_LOCK state" << std::endl
    1423             << "Bad DIR allocation"   << std::endl;
    1424 
     1410        std::cout << "VCI_MEM_CACHE ERROR " << name() << " READ_DIR_LOCK state"
     1411                  << "Bad DIR allocation"   << std::endl;
    14251412        exit(0);
    14261413      }
     
    14391426      if(r_alloc_dir_fsm.read() == ALLOC_DIR_READ)
    14401427      {
    1441         // signals generation
    14421428        // check if this is an instruction read, this means pktid is either
    14431429        // TYPE_READ_INS_UNC   0bX010 with TSAR encoding
     
    14961482
    14971483#if DEBUG_MEMC_READ
    1498         if(m_debug_read_fsm)
    1499         {
    1500           std::cout
    1501               << "  <MEMC " << name() << " READ_DIR_HIT> Update directory entry:"
    1502               << " addr = " << std::hex << m_cmd_read_addr_fifo.read()
    1503               << " / set = " << std::dec << set
    1504               << " / way = " << way
    1505               << " / owner_id = " << entry.owner.srcid
    1506               << " / owner_ins = " << entry.owner.inst
    1507               << " / count = " << entry.count
    1508               << " / is_cnt = " << entry.is_cnt << std::endl;
    1509         }
     1484if(m_debug_read_fsm)
     1485std::cout << "  <MEMC " << name() << " READ_DIR_HIT> Update directory entry:"
     1486          << " addr = " << std::hex << m_cmd_read_addr_fifo.read()
     1487          << " / set = " << std::dec << set
     1488          << " / way = " << way
     1489          << " / owner_id = " << entry.owner.srcid
     1490          << " / owner_ins = " << entry.owner.inst
     1491          << " / count = " << entry.count
     1492          << " / is_cnt = " << entry.is_cnt << std::endl;
    15101493#endif
    15111494
     
    15261509    }
    15271510
     1511    ///////////////////
     1512    case READ_HEAP_REQ:    // Get the lock to the HEAP directory
     1513    {
     1514      if(r_alloc_heap_fsm.read() == ALLOC_HEAP_READ)
     1515      {
     1516        r_read_fsm = READ_HEAP_LOCK;
     1517      }
     1518
     1519#if DEBUG_MEMC_READ
     1520if(m_debug_read_fsm)
     1521std::cout << "  <MEMC " << name() << " READ_HEAP_REQ>"
     1522          << " Requesting HEAP lock " << std::endl;
     1523#endif
     1524      break;
     1525    }
     1526
    15281527    ////////////////////
    1529     case READ_HEAP_REQ:
    1530       // Get the lock to the HEAP directory
    1531     {
    1532       if(r_alloc_heap_fsm.read() == ALLOC_HEAP_READ)
    1533       {
    1534         r_read_fsm = READ_HEAP_LOCK;
    1535       }
    1536 
    1537 #if DEBUG_MEMC_READ
    1538       if(m_debug_read_fsm)
    1539       {
    1540         std::cout
    1541             << "  <MEMC " << name() << " READ_HEAP_REQ> Requesting HEAP lock "
    1542             << std::endl;
    1543       }
    1544 #endif
    1545       break;
    1546     }
    1547 
    1548     ////////////////////
    1549     case READ_HEAP_LOCK:
    1550       // read data in cache, update the directory
    1551       // and prepare the HEAP update
     1528    case READ_HEAP_LOCK:   // read data in cache, update the directory
     1529                           // and prepare the HEAP update
    15521530    {
    15531531      if(r_alloc_heap_fsm.read() == ALLOC_HEAP_READ)
     
    16271605
    16281606#if DEBUG_MEMC_READ
    1629         if(m_debug_read_fsm)
    1630         {
    1631           std::cout << "  <MEMC " << name() << " READ_HEAP_LOCK> Update directory:"
    1632                     << " tag = " << std::hex << entry.tag
    1633                     << " set = " << std::dec << set
    1634                     << " way = " << way
    1635                     << " count = " << entry.count
    1636                     << " is_cnt = " << entry.is_cnt << std::endl;
    1637         }
     1607if(m_debug_read_fsm)
     1608std::cout << "  <MEMC " << name() << " READ_HEAP_LOCK> Update directory:"
     1609          << " tag = " << std::hex << entry.tag
     1610          << " set = " << std::dec << set
     1611          << " way = " << way
     1612          << " count = " << entry.count
     1613          << " is_cnt = " << entry.is_cnt << std::endl;
    16381614#endif
    16391615      }
    16401616      else
    16411617      {
    1642         std::cout
    1643             << "VCI_MEM_CACHE ERROR " << name()
    1644             << " READ_HEAP_LOCK state" << std::endl
    1645             << "Bad HEAP allocation"   << std::endl;
    1646 
     1618        std::cout << "VCI_MEM_CACHE ERROR " << name() << " READ_HEAP_LOCK"
     1619                  << "Bad HEAP allocation"   << std::endl;
    16471620        exit(0);
    16481621      }
    1649 
    1650       break;
    1651     }
    1652 
     1622      break;
     1623    }
    16531624    /////////////////////
    1654     case READ_HEAP_WRITE:       // add a entry in the heap
     1625    case READ_HEAP_WRITE:       // add an entry in the heap
    16551626    {
    16561627      if(r_alloc_heap_fsm.read() == ALLOC_HEAP_READ)
     
    16781649
    16791650#if DEBUG_MEMC_READ
    1680         if(m_debug_read_fsm)
    1681         {
    1682           std::cout
    1683               << "  <MEMC " << name() << " READ_HEAP_WRITE> Add an entry in the heap:"
    1684               << " owner_id = " << heap_entry.owner.srcid
    1685               << " owner_ins = " << heap_entry.owner.inst << std::endl;
    1686         }
     1651if(m_debug_read_fsm)
     1652std::cout << "  <MEMC " << name() << " READ_HEAP_WRITE> Add an entry in the heap:"
     1653          << " owner_id = " << heap_entry.owner.srcid
     1654          << " owner_ins = " << heap_entry.owner.inst << std::endl;
    16871655#endif
    16881656      }
    16891657      else
    16901658      {
    1691         std::cout
    1692             << "VCI_MEM_CACHE ERROR " << name()
    1693             << " READ_HEAP_WRITE state" << std::endl
    1694             << "Bad HEAP allocation" << std::endl;
    1695 
     1659        std::cout << "VCI_MEM_CACHE ERROR " << name() << " READ_HEAP_WRITE"
     1660                  << "Bad HEAP allocation" << std::endl;
    16961661        exit(0);
    16971662      }
    16981663      break;
    16991664    }
    1700 
    17011665    /////////////////////
    17021666    case READ_HEAP_ERASE:
     
    17171681      else
    17181682      {
    1719         std::cout
    1720             << "VCI_MEM_CACHE ERROR " << name()
    1721             << " READ_HEAP_ERASE state" << std::endl
    1722             << "Bad HEAP allocation" << std::endl;
    1723 
     1683        std::cout << "VCI_MEM_CACHE ERROR " << name() << " READ_HEAP_ERASE"
     1684                  << "Bad HEAP allocation" << std::endl;
    17241685        exit(0);
    17251686      }
     
    17531714      else
    17541715      {
    1755         std::cout << "VCI_MEM_CACHE ERROR " << name()
    1756                   << " READ_HEAP_LAST state" << std::endl;
    1757         std::cout << "Bad HEAP allocation" << std::endl;
     1716        std::cout << "VCI_MEM_CACHE ERROR " << name() << " READ_HEAP_LAST"
     1717                  << "Bad HEAP allocation" << std::endl;
    17581718        exit(0);
    17591719      }
    17601720      break;
    17611721    }
    1762 
    17631722    //////////////
    17641723    case READ_RSP:    //  request the TGT_RSP FSM to return data
     
    17781737
    17791738#if DEBUG_MEMC_READ
    1780         if(m_debug_read_fsm)
    1781         {
    1782           std::cout << "  <MEMC " << name() << " READ_RSP> Request the TGT_RSP FSM to return data:"
    1783                     << " rsrcid = " << std::dec << m_cmd_read_srcid_fifo.read()
    1784                     << " / address = " << std::hex << m_cmd_read_addr_fifo.read()
    1785                     << " / nwords = " << std::dec << m_cmd_read_length_fifo.read() << std::endl;
    1786         }
    1787 #endif
    1788       }
    1789       break;
    1790     }
    1791 
     1739if(m_debug_read_fsm)
     1740std::cout << "  <MEMC " << name() << " READ_RSP> Request TGT_RSP FSM to return data:"
     1741          << " rsrcid = " << std::dec << m_cmd_read_srcid_fifo.read()
     1742          << " / address = " << std::hex << m_cmd_read_addr_fifo.read()
     1743          << " / nwords = " << std::dec << m_cmd_read_length_fifo.read() << std::endl;
     1744#endif
     1745      }
     1746      break;
     1747    }
    17921748    ///////////////////
    17931749    case READ_TRT_LOCK: // read miss : check the Transaction Table
     
    18151771
    18161772#if DEBUG_MEMC_READ
    1817         if(m_debug_read_fsm)
    1818         {
    1819           std::cout << "  <MEMC " << name() << " READ_TRT_LOCK> Check TRT:"
    1820                     << " hit_read = " << hit_read
    1821                     << " / hit_write = " << hit_write
    1822                     << " / full = " << !wok << std::endl;
    1823         }
     1773if(m_debug_read_fsm)
     1774std::cout << "  <MEMC " << name() << " READ_TRT_LOCK> Check TRT:"
     1775          << " hit_read = " << hit_read
     1776          << " / hit_write = " << hit_write
     1777          << " / full = " << !wok << std::endl;
    18241778#endif
    18251779      }
     
    18451799                              r_read_ll_key.read());
    18461800#if DEBUG_MEMC_READ
    1847         if(m_debug_read_fsm)
    1848         {
    1849           std::cout << "  <MEMC " << name() << " READ_TRT_SET> Write in Transaction Table: " << std::hex
    1850                     << " address = " << std::hex << m_cmd_read_addr_fifo.read()
    1851                     << " / srcid = " << std::dec << m_cmd_read_srcid_fifo.read()
    1852                     << std::endl;
    1853         }
     1801if(m_debug_read_fsm)
     1802std::cout << "  <MEMC " << name() << " READ_TRT_SET> Write in Transaction Table:"
     1803          << " address = " << std::hex << m_cmd_read_addr_fifo.read()
     1804          << " / srcid = " << std::dec << m_cmd_read_srcid_fifo.read() << std::endl;
    18541805#endif
    18551806        r_read_fsm = READ_TRT_REQ;
     
    18591810
    18601811    //////////////////
    1861     case READ_TRT_REQ:
    1862     {
    1863       // consume the read request in the FIFO,
    1864       // and send it to the ixr_cmd_fsm
    1865 
     1812    case READ_TRT_REQ:   // consume the read request in FIFO and send it to IXR_CMD_FSM
     1813    {
    18661814      if(not r_read_to_ixr_cmd_req)
    18671815      {
     
    18731821
    18741822#if DEBUG_MEMC_READ
    1875         if(m_debug_read_fsm)
    1876         {
    1877           std::cout
    1878               << "  <MEMC " << name() << " READ_TRT_REQ> Request GET transaction for address "
    1879               << std::hex << m_cmd_read_addr_fifo.read() << std::endl;
    1880         }
     1823if(m_debug_read_fsm)
     1824std::cout << "  <MEMC " << name() << " READ_TRT_REQ> Request GET transaction for address "
     1825          << std::hex << m_cmd_read_addr_fifo.read() << std::endl;
    18811826#endif
    18821827      }
     
    29212866  ///////////////////////////////////////////////////////////////////////
    29222867  // The IXR_CMD fsm controls the command packets to the XRAM :
    2923   // It handles requests from the READ, WRITE, CAS & XRAM_RSP FSMs
     2868  // It handles requests from the READ, WRITE, CAS, XRAM_RSP FSMs
    29242869  // with a round-robin priority.
    29252870  //
    2926   // - It sends a single cell VCI read request to the XRAM in case of MISS
     2871  // - It sends a single flit VCI read request to the XRAM in case of MISS
    29272872  // posted by the READ, WRITE or CAS FSMs : the TRDID field contains
    29282873  // the Transaction Tab index.
    2929   // The VCI response is a multi-cell packet : the N cells contain
     2874  // The VCI response is a multi-flit packet : the N cells contain
    29302875  // the N data words.
    29312876  //
    2932   // - It sends a multi-cell VCI write when the XRAM_RSP FSM, WRITE FSM
     2877  // - It sends a multi-flit VCI write when the XRAM_RSP FSM, WRITE FSM
    29332878  // or CAS FSM request to save a dirty line to the XRAM.
    2934   // The VCI response is a single cell packet.
     2879  // The VCI response is a single flit packet.
    29352880  ////////////////////////////////////////////////////////////////////////
    29362881
    29372882  switch(r_ixr_cmd_fsm.read())
    29382883  {
    2939       ////////////////////////
     2884    ////////////////////////
    29402885    case IXR_CMD_READ_IDLE:
    2941       if     (r_write_to_ixr_cmd_req)    r_ixr_cmd_fsm = IXR_CMD_WRITE_NLINE;
    2942       else if(r_cas_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE;
    2943       else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA;
    2944       else if(r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ_NLINE;
    2945       break;
    2946       ////////////////////////
     2886    {
     2887      if     (r_write_to_ixr_cmd_req)    r_ixr_cmd_fsm = IXR_CMD_WRITE;
     2888      else if(r_cas_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_CAS;
     2889      else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM;
     2890      else if(r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ;
     2891      break;
     2892    }
     2893    ////////////////////////
    29472894    case IXR_CMD_WRITE_IDLE:
    2948       if(r_cas_to_ixr_cmd_req)           r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE;
    2949       else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA;
    2950       else if(r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ_NLINE;
    2951       else if(r_write_to_ixr_cmd_req)    r_ixr_cmd_fsm = IXR_CMD_WRITE_NLINE;
    2952       break;
    2953       ////////////////////////
     2895    {
     2896      if     (r_cas_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_CAS;
     2897      else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM;
     2898      else if(r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ;
     2899      else if(r_write_to_ixr_cmd_req)    r_ixr_cmd_fsm = IXR_CMD_WRITE;
     2900      break;
     2901    }
     2902    ////////////////////////
    29542903    case IXR_CMD_CAS_IDLE:
    2955       if(r_xram_rsp_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA;
    2956       else if(r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ_NLINE;
    2957       else if(r_write_to_ixr_cmd_req)    r_ixr_cmd_fsm = IXR_CMD_WRITE_NLINE;
    2958       else if(r_cas_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE;
    2959       break;
    2960       ////////////////////////
     2904    {
     2905      if     (r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM;
     2906      else if(r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ;
     2907      else if(r_write_to_ixr_cmd_req)    r_ixr_cmd_fsm = IXR_CMD_WRITE;
     2908      else if(r_cas_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_CAS;
     2909      break;
     2910    }
     2911    ////////////////////////
    29612912    case IXR_CMD_XRAM_IDLE:
    2962       if(r_read_to_ixr_cmd_req)          r_ixr_cmd_fsm = IXR_CMD_READ_NLINE;
    2963       else if(r_write_to_ixr_cmd_req)    r_ixr_cmd_fsm = IXR_CMD_WRITE_NLINE;
    2964       else if(r_cas_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE;
    2965       else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA;
    2966       break;
    2967       /////////////////////////       // send a get request to XRAM
    2968     case IXR_CMD_READ_NLINE:
     2913    {
     2914      if     (r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ;
     2915      else if(r_write_to_ixr_cmd_req)    r_ixr_cmd_fsm = IXR_CMD_WRITE;
     2916      else if(r_cas_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_CAS;
     2917      else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM;
     2918      break;
     2919    }
     2920    //////////////////       // send a get from READ FSM
     2921    case IXR_CMD_READ:
     2922    {
    29692923      if(p_vci_ixr.cmdack)
    29702924      {
     
    29742928#if DEBUG_MEMC_IXR_CMD
    29752929if(m_debug_ixr_cmd_fsm)
    2976 {
    2977     std::cout << "  <MEMC " << name()
    2978               << " IXR_CMD_READ_NLINE> Send a get request to xram" << std::endl;
    2979 }
    2980 #endif
    2981       }
    2982       break;
    2983       //////////////////////////
    2984     case IXR_CMD_WRITE_NLINE:     // send a put or get command to XRAM
     2930std::cout << "  <MEMC " << name() << " IXR_CMD_READ>"
     2931          << " Send a get request to xram / address = " << std::hex
     2932          << (addr_t)(r_read_to_ixr_cmd_nline.read()*m_words*4) << std::endl;
     2933#endif
     2934      }
     2935      break;
     2936    }
     2937    ///////////////////
     2938    case IXR_CMD_WRITE:     // send a put or get from WRITE FSM
     2939    {
    29852940      if(p_vci_ixr.cmdack)
    29862941      {
     
    30002955#if DEBUG_MEMC_IXR_CMD
    30012956if(m_debug_ixr_cmd_fsm)
    3002 {
    3003     std::cout << "  <MEMC " << name()
    3004               << " IXR_CMD_WRITE_NLINE> Send a put request to xram" << std::endl;
    3005 }
     2957std::cout << "  <MEMC " << name() << " IXR_CMD_WRITE>"
     2958          << " Send a put request to xram / address = " << std::hex
     2959          << (addr_t)((r_write_to_ixr_cmd_nline.read() * m_words +
     2960                      r_ixr_cmd_cpt.read()) * 4 ) << std::endl;
    30062961#endif
    30072962        }
     
    30132968#if DEBUG_MEMC_IXR_CMD
    30142969if(m_debug_ixr_cmd_fsm)
    3015 {
    3016     std::cout << "  <MEMC " << name()
    3017               << " IXR_CMD_WRITE_NLINE> Send a get request to xram" << std::endl;
    3018 }
    3019 #endif
    3020         }
    3021       }
    3022       break;
    3023       //////////////////////
    3024     case IXR_CMD_CAS_NLINE:      // send a put or get command to XRAM
     2970std::cout << "  <MEMC " << name() << " IXR_CMD_WRITE>"
     2971          << " Send a get request to xram / address = " << std::hex
     2972          << (addr_t)(r_write_to_ixr_cmd_nline.read()*m_words*4) << std::endl;
     2973#endif
     2974        }
     2975      }
     2976      break;
     2977    }
     2978    /////////////////
     2979    case IXR_CMD_CAS:      // send a put or get command from CAS FSM
     2980    {
    30252981      if(p_vci_ixr.cmdack)
    30262982      {
     
    30402996#if DEBUG_MEMC_IXR_CMD
    30412997if(m_debug_ixr_cmd_fsm)
    3042 {
    3043     std::cout << "  <MEMC " << name()
    3044               << " IXR_CMD_CAS_NLINE> Send a put request to xram" << std::endl;
    3045 }
     2998std::cout << "  <MEMC " << name() << " IXR_CMD_CAS>"
     2999          << " Send a put request to xram / address = " << std::hex
     3000          << (addr_t)( (r_cas_to_ixr_cmd_nline.read() * m_words +
     3001                      r_ixr_cmd_cpt.read()) * 4 ) << std::endl;
    30463002#endif
    30473003        }
     
    30533009#if DEBUG_MEMC_IXR_CMD
    30543010if(m_debug_ixr_cmd_fsm)
    3055 {
    3056     std::cout << "  <MEMC " << name()
    3057               << " IXR_CMD_CAS_NLINE> Send a get request to xram" << std::endl;
    3058 }
    3059 #endif
    3060         }
    3061       }
    3062       break;
    3063       ////////////////////////
    3064     case IXR_CMD_XRAM_DATA:     // send a put command to XRAM
     3011std::cout << "  <MEMC " << name() << " IXR_CMD_CAS>"
     3012          << " Send a get request to xram / address = " << std::hex
     3013          << (addr_t)(r_cas_to_ixr_cmd_nline.read()*m_words*4) << std::endl;
     3014#endif
     3015        }
     3016      }
     3017      break;
     3018    }
     3019    //////////////////
     3020    case IXR_CMD_XRAM:     // send a put from XRAM_RSP FSM
     3021    {
    30653022      if(p_vci_ixr.cmdack)
    30663023      {
     
    30783035#if DEBUG_MEMC_IXR_CMD
    30793036if(m_debug_ixr_cmd_fsm)
    3080 {
    3081     std::cout << "  <MEMC " << name()
    3082               << " IXR_CMD_XRAM_DATA> Send a put request to xram" << std::endl;
    3083 }
    3084 #endif
    3085       }
    3086       break;
     3037std::cout << "  <MEMC " << name() << " IXR_CMD_XRAM>"
     3038          << " Send a put request to xram / address = " << std::hex
     3039          << (addr_t)( (r_xram_rsp_to_ixr_cmd_nline.read() * m_words +
     3040                       r_ixr_cmd_cpt.read()) * 4 ) << std::endl;
     3041#endif
     3042      }
     3043      break;
     3044    }
    30873045
    30883046  } // end switch r_ixr_cmd_fsm
     
    32253183  //
    32263184  // When a response is available, the corresponding TRT entry
    3227   // must be copied in a local buffer to be written in the cache.
     3185  // is copied in a local buffer to be written in the cache.
    32283186  // The FSM takes the lock protecting the TRT, and the lock protecting the DIR.
    32293187  // It selects a cache slot and writes the line in the cache.
     
    32393197  switch(r_xram_rsp_fsm.read())
    32403198  {
    3241       ///////////////////
    3242     case XRAM_RSP_IDLE: // scan the XRAM responses to get the TRT index (round robin)
     3199    ///////////////////
     3200    case XRAM_RSP_IDLE: // scan the XRAM responses / select a TRT index (round robin)
    32433201    {
    32443202      size_t ptr   = r_xram_rsp_trt_index.read();
     
    32463204      for(size_t i=0 ; i<lines ; i++)
    32473205      {
    3248         size_t index= (i+ptr+1) %lines;
     3206        size_t index = (i+ptr+1) %lines;
    32493207        if(r_ixr_rsp_to_xram_rsp_rok[index])
    32503208        {
     
    32543212
    32553213#if DEBUG_MEMC_XRAM_RSP
    3256           if(m_debug_xram_rsp_fsm)
    3257           {
    3258             std::cout << "  <MEMC " << name() << " XRAM_RSP_IDLE> Available cache line in TRT:"
    3259                       << " index = " << std::dec << index << std::endl;
    3260           }
     3214if(m_debug_xram_rsp_fsm)
     3215std::cout << "  <MEMC " << name() << " XRAM_RSP_IDLE>"
     3216          << " Available cache line in TRT:"
     3217          << " index = " << std::dec << index << std::endl;
    32613218#endif
    32623219          break;
     
    32663223    }
    32673224    ///////////////////////
    3268     case XRAM_RSP_DIR_LOCK:
    3269       // Takes the lock on the directory
    3270       // Takes the lock on TRT
    3271       // Copy the TRT entry in a local buffer
     3225    case XRAM_RSP_DIR_LOCK: // Takes the DIR lock and the TRT lock
     3226                            // Copy the TRT entry in a local buffer
    32723227    {
    32733228      if((r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP) &&
     
    32763231        // copy the TRT entry in the r_xram_rsp_trt_buf local buffer
    32773232        size_t  index = r_xram_rsp_trt_index.read();
    3278 
    3279         TransactionTabEntry trt_entry(m_trt.read(index));
    3280         r_xram_rsp_trt_buf.copy(trt_entry);  // TRT entry local buffer
     3233        r_xram_rsp_trt_buf.copy( m_trt.read(index) ); 
    32813234
    32823235        r_xram_rsp_fsm = XRAM_RSP_TRT_COPY;
     3236
     3237//        TransactionTabEntry trt_entry(m_trt.read(index));
     3238//        r_xram_rsp_trt_buf.copy(trt_entry);           // TRT entry local buffer
    32833239
    32843240#if DEBUG_MEMC_XRAM_RSP
    32853241if(m_debug_xram_rsp_fsm)
    3286 {
    3287     std::cout << "  <MEMC " << name()
    3288               << " XRAM_RSP_DIR_LOCK> Get access to directory" << std::endl;
    3289 }
     3242std::cout << "  <MEMC " << name() << " XRAM_RSP_DIR_LOCK>"
     3243          << " Get access to DIR and TRT" << std::endl;
    32903244#endif
    32913245      }
     
    32933247    }
    32943248    ///////////////////////
    3295     case XRAM_RSP_TRT_COPY:
    3296       // Select a victim cache line
    3297     {
    3298       if((r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP))
     3249    case XRAM_RSP_TRT_COPY: // Select a victim cache line
     3250                            // and copy it in a local buffer
     3251    {
     3252      if ( (r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP) and
     3253           (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP) )
    32993254      {
    33003255        // selects & extracts a victim line from cache
     
    33103265
    33113266        r_xram_rsp_victim_copy      = victim.owner.srcid;
     3267
    33123268#if L1_MULTI_CACHE
    33133269        r_xram_rsp_victim_copy_cache= victim.owner.cache_id;
     
    33333289
    33343290#if DEBUG_MEMC_XRAM_RSP
    3335         if(m_debug_xram_rsp_fsm)
    3336         {
    3337           std::cout << "  <MEMC " << name() << " XRAM_RSP_TRT_COPY> Select a slot: "
    3338                     << " way = " << std::dec << way
    3339                     << " / set = " << set
    3340                     << " / inval_required = " << inval << std::endl;
    3341         }
     3291if(m_debug_xram_rsp_fsm)
     3292std::cout << "  <MEMC " << name() << " XRAM_RSP_TRT_COPY>"
     3293          << " Select a slot: "
     3294          << " way = " << std::dec << way
     3295          << " / set = " << set
     3296          << " / inval_required = " << inval << std::endl;
    33423297#endif
    33433298      }
    33443299      else
    33453300      {
    3346         std::cout << "VCI_MEM_CACHE ERROR "     << name()
    3347                   << " XRAM_RSP_TRT_COPY state" << std::endl
    3348                   << "bad TRT allocation"       << std::endl;
    3349 
     3301        std::cout << "VCI_MEM_CACHE ERROR " << name() << " XRAM_RSP_TRT_COPY"
     3302                  << " bad TRT or DIR allocation" << std::endl;
    33503303        exit(0);
    33513304      }
     
    33533306    }
    33543307    /////////////////////////
    3355     case XRAM_RSP_INVAL_LOCK: // check a possible pending inval
     3308    case XRAM_RSP_INVAL_LOCK: // Take the UPT lock to check a possible pending inval
    33563309    {
    33573310      if(r_alloc_upt_fsm == ALLOC_UPT_XRAM_RSP)
    33583311      {
    3359         size_t index;
    3360         if(m_upt.search_inval(r_xram_rsp_trt_buf.nline, index))
     3312        size_t index = 0;
     3313        if(m_upt.search_inval(r_xram_rsp_trt_buf.nline, index))  // pending inval
    33613314        {
    33623315          r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT;
    33633316
    33643317#if DEBUG_MEMC_XRAM_RSP
    3365           if(m_debug_xram_rsp_fsm)
    3366           {
    3367             std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL_LOCK> Get acces to UPT,"
    3368                       << " but an invalidation is already registered at this address" << std::endl;
    3369             m_upt.print();
    3370           }
    3371 #endif
    3372 
    3373         }
    3374         else if(m_upt.is_full() && r_xram_rsp_victim_inval.read())
     3318if(m_debug_xram_rsp_fsm)
     3319std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL_LOCK>"
     3320          << " Get acces to UPT, but line invalidation registered"
     3321          << " / nline = " << std::hex << r_xram_rsp_trt_buf.nline
     3322          << " / index = " << std::dec << index << std::endl;
     3323#endif
     3324
     3325        }
     3326        else if(m_upt.is_full() && r_xram_rsp_victim_inval.read()) // UPT full
    33753327        {
    33763328          r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT;
    33773329
    33783330#if DEBUG_MEMC_XRAM_RSP
    3379           if(m_debug_xram_rsp_fsm)
    3380           {
    3381             std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL_LOCK> Get acces to UPT,"
    3382                       << " but the table is full" << std::endl;
    3383             m_upt.print();
    3384           }
     3331if(m_debug_xram_rsp_fsm)
     3332std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL_LOCK>"
     3333          << " Get acces to UPT, but inval required and UPT full" << std::endl;
    33853334#endif
    33863335        }
     
    33903339
    33913340#if DEBUG_MEMC_XRAM_RSP
    3392           if(m_debug_xram_rsp_fsm)
    3393           {
    3394             std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL_LOCK> Get acces to UPT" << std::endl;
    3395           }
     3341if(m_debug_xram_rsp_fsm)
     3342std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL_LOCK>"
     3343          << " Get acces to UPT" << std::endl;
    33963344#endif
    33973345        }
     
    34003348    }
    34013349    /////////////////////////
    3402     case XRAM_RSP_INVAL_WAIT: // returns to DIR_LOCK to retry
    3403     {
     3350    case XRAM_RSP_INVAL_WAIT: // release all locks and returns to DIR_LOCK to retry
     3351    {
     3352
     3353#if DEBUG_MEMC_XRAM_RSP
     3354if(m_debug_xram_rsp_fsm)
     3355std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL_WAIT>"
     3356          << " Release all locks and retry" << std::endl;
     3357#endif
    34043358      r_xram_rsp_fsm = XRAM_RSP_DIR_LOCK;
    34053359      break;
     
    34073361    ///////////////////////
    34083362    case XRAM_RSP_DIR_UPDT:   // updates the cache (both data & directory)
    3409       // and possibly set an inval request in UPT
    3410     {
    3411       // signals generation
     3363                              // and possibly set an inval request in UPT
     3364    {
    34123365      // check if this is an instruction read, this means pktid is either
    34133366      // TYPE_READ_INS_UNC   0bX010 with TSAR encoding
    34143367      // TYPE_READ_INS_MISS  0bX011 with TSAR encoding
    34153368      bool inst_read = (r_xram_rsp_trt_buf.pktid & 0x2) && r_xram_rsp_trt_buf.proc_read;
     3369
    34163370      // check if this is a cached read, this means pktid is either
    34173371      // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding
     
    34193373      bool cached_read = (r_xram_rsp_trt_buf.pktid & 0x1) && r_xram_rsp_trt_buf.proc_read;
    34203374
    3421       // update data
     3375      bool dirty = false;
     3376
     3377      // update cache data
    34223378      size_t set   = r_xram_rsp_victim_set.read();
    34233379      size_t way   = r_xram_rsp_victim_way.read();
     
    34263382        m_cache_data.write(way, set, word, r_xram_rsp_trt_buf.wdata[word]);
    34273383
     3384        dirty = dirty || (r_xram_rsp_trt_buf.wdata_be[word] != 0);
     3385
    34283386        if(m_monitor_ok)
    34293387        {
     
    34323390        }
    34333391      }
    3434       // compute dirty
    3435       bool dirty = false;
    3436       for(size_t i=0; i<m_words; i++) dirty = dirty || (r_xram_rsp_trt_buf.wdata_be[i] != 0);
    3437       // update directory
     3392
     3393      // update cache directory
    34383394      DirectoryEntry entry;
    34393395      entry.valid   = true;
     
    34633419      m_cache_directory.write(set, way, entry);
    34643420
     3421      // request an invalidattion request in UPT for victim line
    34653422      if(r_xram_rsp_victim_inval.read())
    34663423      {
    3467         bool   brdcast    = r_xram_rsp_victim_is_cnt.read();
    3468         size_t index    = 0;
    3469         size_t count_copies   = r_xram_rsp_victim_count.read();
     3424        bool   broadcast    = r_xram_rsp_victim_is_cnt.read();
     3425        size_t index        = 0;
     3426        size_t count_copies = r_xram_rsp_victim_count.read();
    34703427
    34713428        bool   wok = m_upt.set(false,      // it's an inval transaction
    3472                                       brdcast,  // set brdcast bit
    3473                                       false,    // it does not need a response
    3474                                       0,    // srcid
    3475                                       0,    // trdid
    3476                                       0,    // pktid
    3477                                       r_xram_rsp_victim_nline.read(),
    3478                                       count_copies,
    3479                                       index);
     3429                               broadcast,  // set broadcast bit
     3430                               false,      // it does not need a response
     3431                               0,          // srcid
     3432                               0,          // trdid
     3433                               0,          // pktid
     3434                               r_xram_rsp_victim_nline.read(),
     3435                               count_copies,
     3436                               index);
     3437
    34803438        r_xram_rsp_upt_index = index;
    34813439
    34823440        if(!wok)
    34833441        {
    3484           std::cout << "VCI_MEM_CACHE ERROR " << name() << " XRAM_RSP_HEAP_LAST state" << std::endl;
    3485           std::cout << "an update_tab entry was free but write is unsuccessful" << std::endl;
     3442          std::cout << "VCI_MEM_CACHE ERROR " << name() << " XRAM_RSP_DIR_UPDT"
     3443                    << " update_tab entry free but write unsuccessful" << std::endl;
    34863444          exit(0);
    34873445        }
     
    34893447
    34903448#if DEBUG_MEMC_XRAM_RSP
    3491       if(m_debug_xram_rsp_fsm)
    3492       {
    3493         std::cout << "  <MEMC " << name() << " XRAM_RSP_DIR_UPDT> Directory update: "
    3494                   << " way = " << std::dec << way
    3495                   << " / set = " << set
    3496                   << " / owner_id = " << entry.owner.srcid
    3497                   << " / owner_ins = " << entry.owner.inst
    3498                   << " / count = " << entry.count
    3499                   << " / is_cnt = " << entry.is_cnt << std::endl;
    3500         if(r_xram_rsp_victim_inval.read())
    3501           std::cout << "                           Invalidation request for victim line "
    3502                     << std::hex << r_xram_rsp_victim_nline.read()
    3503                     << " / broadcast = " << r_xram_rsp_victim_is_cnt.read() << std::endl;
    3504       }
    3505 #endif
    3506 
    3507       // If the victim is not dirty, we don't need another XRAM  put transaction,
    3508       // and we canwe erase the TRT entry
     3449if(m_debug_xram_rsp_fsm)
     3450{
     3451std::cout << "  <MEMC " << name() << " XRAM_RSP_DIR_UPDT>"
     3452          << " Cache update: "
     3453          << " way = " << std::dec << way
     3454          << " / set = " << set
     3455          << " / owner_id = " << entry.owner.srcid
     3456          << " / owner_ins = " << entry.owner.inst
     3457          << " / count = " << entry.count
     3458          << " / is_cnt = " << entry.is_cnt << std::endl;
     3459if(r_xram_rsp_victim_inval.read())
     3460std::cout << "                           Invalidation request for victim line "
     3461          << std::hex << r_xram_rsp_victim_nline.read()
     3462          << " / broadcast = " << r_xram_rsp_victim_is_cnt.read() << std::endl;
     3463}
     3464#endif
     3465
     3466      // If the victim is not dirty, we don't need another XRAM put transaction,
     3467      // and we can erase the TRT entry
    35093468      if(!r_xram_rsp_victim_dirty.read())  m_trt.erase(r_xram_rsp_trt_index.read());
    35103469
    35113470      // Next state
    35123471      if(r_xram_rsp_victim_dirty.read())       r_xram_rsp_fsm = XRAM_RSP_TRT_DIRTY;
    3513       else if(r_xram_rsp_trt_buf.proc_read)       r_xram_rsp_fsm = XRAM_RSP_DIR_RSP;
    3514       else if(r_xram_rsp_victim_inval.read())       r_xram_rsp_fsm = XRAM_RSP_INVAL;
    3515       else                                            r_xram_rsp_fsm = XRAM_RSP_IDLE;
     3472      else if(r_xram_rsp_trt_buf.proc_read)    r_xram_rsp_fsm = XRAM_RSP_DIR_RSP;
     3473      else if(r_xram_rsp_victim_inval.read())  r_xram_rsp_fsm = XRAM_RSP_INVAL;
     3474      else                                     r_xram_rsp_fsm = XRAM_RSP_IDLE;
    35163475      break;
    35173476    }
    35183477    ////////////////////////
    3519     case XRAM_RSP_TRT_DIRTY:  // set the TRT entry (write to XRAM) if the victim is dirty
     3478    case XRAM_RSP_TRT_DIRTY:  // set the TRT entry (PUT to XRAM) if the victim is dirty
    35203479    {
    35213480      if(r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP)
     
    35343493
    35353494#if DEBUG_MEMC_XRAM_RSP
    3536         if(m_debug_xram_rsp_fsm)
    3537         {
    3538           std::cout << "  <MEMC " << name() << " XRAM_RSP_TRT_DIRTY> Set TRT entry for the put transaction:"
    3539                     << " dirty victim line = " << r_xram_rsp_victim_nline.read() << std::endl;
    3540         }
    3541 #endif
    3542         if(r_xram_rsp_trt_buf.proc_read)       r_xram_rsp_fsm = XRAM_RSP_DIR_RSP;
    3543         else if(r_xram_rsp_victim_inval.read())       r_xram_rsp_fsm = XRAM_RSP_INVAL;
    3544         else                                            r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY;
     3495if(m_debug_xram_rsp_fsm)
     3496std::cout << "  <MEMC " << name() << " XRAM_RSP_TRT_DIRTY>"
     3497          << " Set TRT entry for the put transaction"
     3498          << " / dirty victim line = " << r_xram_rsp_victim_nline.read() << std::endl;
     3499#endif
     3500        if(r_xram_rsp_trt_buf.proc_read)         r_xram_rsp_fsm = XRAM_RSP_DIR_RSP;
     3501        else if(r_xram_rsp_victim_inval.read())  r_xram_rsp_fsm = XRAM_RSP_INVAL;
     3502        else                                     r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY;
    35453503      }
    35463504      break;
     
    35543512        r_xram_rsp_to_tgt_rsp_trdid = r_xram_rsp_trt_buf.trdid;
    35553513        r_xram_rsp_to_tgt_rsp_pktid = r_xram_rsp_trt_buf.pktid;
    3556         for(size_t i=0; i < m_words; i++) r_xram_rsp_to_tgt_rsp_data[i] = r_xram_rsp_trt_buf.wdata[i];
     3514        for(size_t i=0; i < m_words; i++)
     3515        {
     3516            r_xram_rsp_to_tgt_rsp_data[i] = r_xram_rsp_trt_buf.wdata[i];
     3517        }
    35573518        r_xram_rsp_to_tgt_rsp_word   = r_xram_rsp_trt_buf.word_index;
    35583519        r_xram_rsp_to_tgt_rsp_length = r_xram_rsp_trt_buf.read_length;
     
    35613522        r_xram_rsp_to_tgt_rsp_req    = true;
    35623523
    3563         if(r_xram_rsp_victim_inval) r_xram_rsp_fsm = XRAM_RSP_INVAL;
     3524        if(r_xram_rsp_victim_inval)      r_xram_rsp_fsm = XRAM_RSP_INVAL;
    35643525        else if(r_xram_rsp_victim_dirty) r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY;
    3565         else                                r_xram_rsp_fsm = XRAM_RSP_IDLE;
    3566 
     3526        else                             r_xram_rsp_fsm = XRAM_RSP_IDLE;
    35673527
    35683528#if DEBUG_MEMC_XRAM_RSP
    3569         if(m_debug_xram_rsp_fsm)
    3570         {
    3571           std::cout << "  <MEMC " << name() << " XRAM_RSP_DIR_RSP> Request the TGT_RSP FSM to return data:"
    3572                     << " rsrcid = " << std::dec << r_xram_rsp_trt_buf.srcid
    3573                     << " / address = " << std::hex << r_xram_rsp_trt_buf.nline*m_words*4
    3574                     << " / nwords = " << std::dec << r_xram_rsp_trt_buf.read_length << std::endl;
    3575         }
     3529if(m_debug_xram_rsp_fsm)
     3530std::cout << "  <MEMC " << name() << " XRAM_RSP_DIR_RSP>"
     3531          << " Request the TGT_RSP FSM to return data:"
     3532          << " rsrcid = " << std::dec << r_xram_rsp_trt_buf.srcid
     3533          << " / address = " << std::hex << r_xram_rsp_trt_buf.nline*m_words*4
     3534          << " / nwords = " << std::dec << r_xram_rsp_trt_buf.read_length << std::endl;
    35763535#endif
    35773536      }
     
    36013560
    36023561        if(r_xram_rsp_victim_dirty)  r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY;
    3603         else if(not_last_multi_req)    r_xram_rsp_fsm = XRAM_RSP_HEAP_REQ;
    3604         else                            r_xram_rsp_fsm = XRAM_RSP_IDLE;
     3562        else if(not_last_multi_req)  r_xram_rsp_fsm = XRAM_RSP_HEAP_REQ;
     3563        else                         r_xram_rsp_fsm = XRAM_RSP_IDLE;
    36053564
    36063565#if DEBUG_MEMC_XRAM_RSP
    3607         if(m_debug_xram_rsp_fsm)
    3608         {
    3609           std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL> Send an inval request to CC_SEND FSM:"
    3610                     << " victim line = " << r_xram_rsp_victim_nline.read() << std::endl;
    3611         }
     3566if(m_debug_xram_rsp_fsm)
     3567std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL>"
     3568          << " Send an inval request to CC_SEND FSM"
     3569          << " / victim line = " << r_xram_rsp_victim_nline.read() << std::endl;
    36123570#endif
    36133571      }
     
    36223580        r_xram_rsp_to_ixr_cmd_nline = r_xram_rsp_victim_nline.read();
    36233581        r_xram_rsp_to_ixr_cmd_trdid = r_xram_rsp_trt_index.read();
    3624         for(size_t i=0; i<m_words ; i++) r_xram_rsp_to_ixr_cmd_data[i] = r_xram_rsp_victim_data[i];
     3582        for(size_t i=0; i<m_words ; i++)
     3583        {
     3584            r_xram_rsp_to_ixr_cmd_data[i] = r_xram_rsp_victim_data[i];
     3585        }
    36253586        m_cpt_write_dirty++;
    36263587
    36273588        bool multi_req = !r_xram_rsp_victim_is_cnt.read() && r_xram_rsp_victim_inval.read();
    36283589        bool not_last_multi_req = multi_req && (r_xram_rsp_victim_count.read() != 1);
     3590
    36293591        if(not_last_multi_req)   r_xram_rsp_fsm = XRAM_RSP_HEAP_REQ;
    3630         else                        r_xram_rsp_fsm = XRAM_RSP_IDLE;
     3592        else                     r_xram_rsp_fsm = XRAM_RSP_IDLE;
    36313593
    36323594#if DEBUG_MEMC_XRAM_RSP
    3633         if(m_debug_xram_rsp_fsm)
    3634         {
    3635           std::cout << "  <MEMC " << name() << " XRAM_RSP_WRITE_DIRTY> Send the put request to IXR_CMD FSM:"
    3636                     << " victim line = " << r_xram_rsp_victim_nline.read() << std::endl;
    3637         }
    3638 #endif
    3639       }
    3640       break;
    3641     }
    3642 
     3595if(m_debug_xram_rsp_fsm)
     3596std::cout << "  <MEMC " << name() << " XRAM_RSP_WRITE_DIRTY>"
     3597          << " Send the put request to IXR_CMD FSM"
     3598          << " / victim line = " << r_xram_rsp_victim_nline.read() << std::endl;
     3599#endif
     3600      }
     3601      break;
     3602    }
    36433603    /////////////////////////
    3644     case XRAM_RSP_HEAP_REQ:
    3645       // Get the lock to the HEAP directory
     3604    case XRAM_RSP_HEAP_REQ:    // Get the lock to the HEAP
    36463605    {
    36473606      if(r_alloc_heap_fsm.read() == ALLOC_HEAP_XRAM_RSP)
     
    36513610
    36523611#if DEBUG_MEMC_XRAM_RSP
    3653       if(m_debug_xram_rsp_fsm)
    3654       {
    3655         std::cout
    3656             << "  <MEMC " << name() << " XRAM_RSP_HEAP_REQ> Requesting HEAP lock "
    3657             << std::endl;
    3658       }
    3659 #endif
    3660       break;
    3661     }
    3662 
     3612if(m_debug_xram_rsp_fsm)
     3613std::cout << "  <MEMC " << name() << " XRAM_RSP_HEAP_REQ>"
     3614          << " Requesting HEAP lock" << std::endl;
     3615#endif
     3616      break;
     3617    }
    36633618    /////////////////////////
    3664     case XRAM_RSP_HEAP_ERASE: // erase the list of copies and sent invalidations
     3619    case XRAM_RSP_HEAP_ERASE: // erase the copies and send invalidations
    36653620    {
    36663621      if(r_alloc_heap_fsm.read() == ALLOC_HEAP_XRAM_RSP)
     
    36933648
    36943649#if DEBUG_MEMC_XRAM_RSP
    3695         if(m_debug_xram_rsp_fsm)
    3696         {
    3697           std::cout << "  <MEMC " << name() << " XRAM_RSP_HEAP_ERASE> Erase the list of copies:"
    3698                     << " srcid = " << std::dec << entry.owner.srcid
    3699                     << " / inst = " << std::dec << entry.owner.inst << std::endl;
    3700         }
     3650if(m_debug_xram_rsp_fsm)
     3651std::cout << "  <MEMC " << name() << " XRAM_RSP_HEAP_ERASE>"
     3652          << " Erase copy:"
     3653          << " srcid = " << std::dec << entry.owner.srcid
     3654          << " / inst = " << std::dec << entry.owner.inst << std::endl;
    37013655#endif
    37023656      }
     
    37043658    }
    37053659    /////////////////////////
    3706     case XRAM_RSP_HEAP_LAST:  // last member of the list
     3660    case XRAM_RSP_HEAP_LAST:  // last copy
    37073661    {
    37083662      if(r_alloc_heap_fsm.read() != ALLOC_HEAP_XRAM_RSP)
    37093663      {
    3710         std::cout << "VCI_MEM_CACHE ERROR " << name() << " XRAM_RSP_HEAP_LAST state" << std::endl;
    3711         std::cout << "bad HEAP allocation" << std::endl;
     3664        std::cout << "VCI_MEM_CACHE ERROR " << name() << " XRAM_RSP_HEAP_LAST"
     3665                   << " bad HEAP allocation" << std::endl;
    37123666        exit(0);
    37133667      }
     
    37363690
    37373691#if DEBUG_MEMC_XRAM_RSP
    3738       if(m_debug_xram_rsp_fsm)
    3739       {
    3740         std::cout << "  <MEMC " << name() << " XRAM_RSP_HEAP_LAST> Heap housekeeping" << std::endl;
    3741       }
     3692if(m_debug_xram_rsp_fsm)
     3693std::cout << "  <MEMC " << name() << " XRAM_RSP_HEAP_LAST>"
     3694          << " Heap housekeeping" << std::endl;
    37423695#endif
    37433696      break;
     
    37503703      // Next state
    37513704      if(r_xram_rsp_trt_buf.proc_read) r_xram_rsp_fsm = XRAM_RSP_ERROR_RSP;
    3752       else                                 r_xram_rsp_fsm = XRAM_RSP_IDLE;
     3705      else                             r_xram_rsp_fsm = XRAM_RSP_IDLE;
    37533706
    37543707#if DEBUG_MEMC_XRAM_RSP
    3755       if(m_debug_xram_rsp_fsm)
    3756       {
    3757         std::cout << "  <MEMC " << name() << " XRAM_RSP_ERROR_ERASE> Error reported by XRAM / erase the TRT entry" << std::endl;
    3758       }
     3708if(m_debug_xram_rsp_fsm)
     3709std::cout << "  <MEMC " << name() << " XRAM_RSP_ERROR_ERASE>"
     3710          << " Error reported by XRAM / erase the TRT entry" << std::endl;
    37593711#endif
    37603712      break;
     
    37633715    case XRAM_RSP_ERROR_RSP:     // Request an error response to TGT_RSP FSM
    37643716    {
    3765       if(!r_xram_rsp_to_tgt_rsp_req.read())
     3717      if(!r_xram_rsp_to_tgt_rsp_req.read()) 
    37663718      {
    37673719        r_xram_rsp_to_tgt_rsp_srcid  = r_xram_rsp_trt_buf.srcid;
    37683720        r_xram_rsp_to_tgt_rsp_trdid  = r_xram_rsp_trt_buf.trdid;
    37693721        r_xram_rsp_to_tgt_rsp_pktid  = r_xram_rsp_trt_buf.pktid;
    3770         for(size_t i=0; i < m_words; i++) r_xram_rsp_to_tgt_rsp_data[i] = r_xram_rsp_trt_buf.wdata[i];
     3722        for(size_t i=0; i < m_words; i++)
     3723        {
     3724            r_xram_rsp_to_tgt_rsp_data[i] = r_xram_rsp_trt_buf.wdata[i];
     3725        }
    37713726        r_xram_rsp_to_tgt_rsp_word   = r_xram_rsp_trt_buf.word_index;
    37723727        r_xram_rsp_to_tgt_rsp_length = r_xram_rsp_trt_buf.read_length;
     
    37773732
    37783733#if DEBUG_MEMC_XRAM_RSP
    3779         if(m_debug_xram_rsp_fsm)
    3780         {
    3781           std::cout << "  <MEMC " << name() << " XRAM_RSP_ERROR_RSP> Request a response error to TGT_RSP FSM:"
    3782                     << " srcid = " << std::dec << r_xram_rsp_trt_buf.srcid << std::endl;
    3783         }
     3734if(m_debug_xram_rsp_fsm)
     3735    std::cout << "  <MEMC " << name()
     3736              << " XRAM_RSP_ERROR_RSP> Request a response error to TGT_RSP FSM:"
     3737              << " srcid = " << std::dec << r_xram_rsp_trt_buf.srcid << std::endl;
    37843738#endif
    37853739      }
     
    51515105      break;
    51525106    }
    5153     ///////////////////
     5107    /////////////////////
    51545108    case CAS_BC_UPT_LOCK:  // register a broadcast inval transaction in UPT
    5155       // write data in cache in case of successful registration
     5109                           // write data in cache in case of successful registration
    51565110    {
    51575111      if(r_alloc_upt_fsm.read() == ALLOC_UPT_CAS)
     
    65256479  switch(r_alloc_dir_fsm.read())
    65266480  {
    6527     case ALLOC_DIR_RESET:
    6528       // Initializes the directory one SET each cycle. All the WAYS of a SET are
    6529       // initialize in parallel
     6481    case ALLOC_DIR_RESET: // Initializes the directory one SET per cycle.
     6482                          // All the WAYS of a SET initialized in parallel
    65306483
    65316484      r_alloc_dir_reset_cpt.write(r_alloc_dir_reset_cpt.read() + 1);
     
    65346487      {
    65356488        m_cache_directory.init();
    6536 
    65376489        r_alloc_dir_fsm = ALLOC_DIR_READ;
    65386490      }
    65396491      break;
    65406492
    6541       ////////////////////
     6493    ////////////////////
    65426494    case ALLOC_DIR_READ:
    65436495      if(((r_read_fsm.read()        != READ_DIR_REQ)   &&
     
    66826634  switch(r_alloc_trt_fsm.read())
    66836635  {
    6684       ////////////////////
     6636    ////////////////////
    66856637    case ALLOC_TRT_READ:
    66866638      if(r_read_fsm.read() != READ_TRT_LOCK)
     
    67046656      break;
    67056657
    6706       /////////////////////
     6658    /////////////////////
    67076659    case ALLOC_TRT_WRITE:
    67086660      if((r_write_fsm.read() != WRITE_MISS_TRT_LOCK) &&
     
    67276679      break;
    67286680
    6729       ////////////////////
     6681    ////////////////////
    67306682    case ALLOC_TRT_CAS:
    67316683      if((r_cas_fsm.read() != CAS_MISS_TRT_LOCK) &&
     
    67506702      break;
    67516703
    6752       ////////////////////////
     6704    ////////////////////////
    67536705    case ALLOC_TRT_XRAM_RSP:
    67546706      if(((r_xram_rsp_fsm.read()  != XRAM_RSP_DIR_LOCK)  ||
     
    67756727      break;
    67766728
    6777       ////////////////////////
     6729    ////////////////////////
    67786730    case ALLOC_TRT_IXR_RSP:
    67796731      if((r_ixr_rsp_fsm.read() != IXR_RSP_TRT_ERASE) &&
     
    72107162  p_vci_ixr.plen    = 64;
    72117163
    7212   if(r_ixr_cmd_fsm.read() == IXR_CMD_READ_NLINE)
     7164  if(r_ixr_cmd_fsm.read() == IXR_CMD_READ)
    72137165  {
    72147166    p_vci_ixr.cmd       = vci_param_ext::CMD_READ;
     
    72197171    p_vci_ixr.eop       = true;
    72207172  }
    7221   else if(r_ixr_cmd_fsm.read() == IXR_CMD_CAS_NLINE)
     7173  else if(r_ixr_cmd_fsm.read() == IXR_CMD_CAS)
    72227174  {
    72237175    if(r_cas_to_ixr_cmd_write.read())
     
    72427194    }
    72437195  }
    7244   else if(r_ixr_cmd_fsm.read() == IXR_CMD_WRITE_NLINE)
     7196  else if(r_ixr_cmd_fsm.read() == IXR_CMD_WRITE)
    72457197  {
    72467198    if(r_write_to_ixr_cmd_write.read())
     
    72657217    }
    72667218  }
    7267   else if(r_ixr_cmd_fsm.read() == IXR_CMD_XRAM_DATA)
     7219  else if(r_ixr_cmd_fsm.read() == IXR_CMD_XRAM)
    72687220  {
    72697221    p_vci_ixr.cmd       = vci_param_ext::CMD_WRITE;
     
    75837535        DspinDhccpParam::dspin_set(
    75847536            flit,
    7585             m_broadcast_address,
     7537            m_broadcast_boundaries,
    75867538            DspinDhccpParam::BROADCAST_BOX);
    75877539
Note: See TracChangeset for help on using the changeset viewer.