Changeset 284


Ignore:
Timestamp:
Dec 11, 2012, 6:19:35 PM (11 years ago)
Author:
joannou
Message:

Updated of the vci trdid/rtrdid and pktid/rpktid fields for the direct network.
The pktid values are commented in the components'headers that use them.

  • In the vci_vdspin_*_wrapper components
    • added the transmission of the pktid/rpktid field
  • In the vci_cc_vcache_wrapper_v4
    • updated gen_moore() to transmit a valid pktid
    • updated transition(), RSP_FSM now checks the rpktid
  • In the vci_mem_cache_v4
    • transition(), tests originally performed on trdid now use pktid
    • gen_moore() transmit rpktid
    • !!! THE L1_MULTI_CACHE MECHANISM IS NO LONGER COMPATIBLE !!!
  • In vci_block_device_tsar_v4
    • updated gen_moore function to transmit a valid pktid

Also renamed the "SC" states in "CAS" states in the concerned FSMs on the vci_cc_vcache_wrapper_v4 and the vci_mem_cache_v4

Location:
trunk/modules
Files:
9 edited

Legend:

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

    r260 r284  
    176176    };
    177177
     178    /* transaction type, pktid field */
     179    enum transaction_type_e
     180    {
     181      // b3 unused
     182      // b2 READ / NOT READ
     183      // Si READ
     184      //  b1 DATA / INS
     185      //  b0 UNC / MISS
     186      // Si NOT READ
     187      //  b1 accÚs table llsc type SW / other
     188      //  b2 WRITE/CAS/LL/SC
     189      TYPE_READ_DATA_UNC          = 0x0,
     190      TYPE_READ_DATA_MISS         = 0x1,
     191      TYPE_READ_INS_UNC           = 0x2,
     192      TYPE_READ_INS_MISS          = 0x3,
     193      TYPE_WRITE                  = 0x4,
     194      TYPE_CAS                    = 0x5,
     195      TYPE_LL                     = 0x6,
     196      TYPE_SC                     = 0x7
     197    };
     198
    178199protected:
    179200
  • trunk/modules/vci_block_device_tsar_v4/caba/source/src/vci_block_device_tsar_v4.cpp

    r272 r284  
    486486    p_vci_initiator.srcid  = (sc_dt::sc_uint<vci_param::S>)m_srcid;
    487487    p_vci_initiator.trdid  = 0;
    488     p_vci_initiator.pktid  = 0;
    489488    p_vci_initiator.contig = true;
    490489    p_vci_initiator.cons   = false;
     
    499498        p_vci_initiator.address = (sc_dt::sc_uint<vci_param::N>)r_buf_address.read();
    500499        p_vci_initiator.cmd     = vci_param::CMD_READ;
     500        p_vci_initiator.pktid   = TYPE_READ_DATA_UNC; // or _MISS ?
    501501        p_vci_initiator.wdata   = 0;
    502502        p_vci_initiator.be      = (uint32_t)0xF;
     
    509509        p_vci_initiator.address = (sc_dt::sc_uint<vci_param::N>)r_buf_address.read();
    510510        p_vci_initiator.cmd     = vci_param::CMD_WRITE;
     511        p_vci_initiator.pktid   = TYPE_WRITE;
    511512        p_vci_initiator.wdata   = (uint32_t)r_local_buffer[r_index.read()];
    512513        p_vci_initiator.be      = 0xF;
  • trunk/modules/vci_cc_vcache_wrapper_v4/caba/source/include/vci_cc_vcache_wrapper_v4.h

    r247 r284  
    118118        //handling dirty bit update
    119119        DCACHE_DIRTY_GET_PTE,
    120         DCACHE_DIRTY_SC_WAIT,           
     120        DCACHE_DIRTY_WAIT,           
    121121            // handling processor miss requests
    122122        DCACHE_MISS_VICTIM,
     
    142142        CMD_DATA_UNC,
    143143        CMD_DATA_WRITE,
    144         CMD_DATA_SC,
     144        CMD_DATA_CAS,
    145145    };
    146146
     
    152152        RSP_DATA_UNC,
    153153        RSP_DATA_WRITE,
    154         RSP_DATA_SC,
    155154    };
    156155
     
    173172        TGT_RSP_DCACHE,
    174173    };
     174
     175    /* transaction type, pktid field */
     176    enum transaction_type_e
     177    {
     178        // b3 unused
     179        // b2 READ / NOT READ
     180        // Si READ
     181        //  b1 DATA / INS
     182        //  b0 UNC / MISS
     183        // Si NOT READ
     184        //  b1 accÚs table llsc type SW / other
     185        //  b2 WRITE/CAS/LL/SC
     186        TYPE_READ_DATA_UNC          = 0x0,
     187        TYPE_READ_DATA_MISS         = 0x1,
     188        TYPE_READ_INS_UNC           = 0x2,
     189        TYPE_READ_INS_MISS          = 0x3,
     190        TYPE_WRITE                  = 0x4,
     191        TYPE_CAS                    = 0x5,
     192        TYPE_LL                     = 0x6,
     193        TYPE_SC                     = 0x7
     194    };
     195   
     196    /* SC return values */
     197    enum sc_status_type_e
     198    {
     199        SC_SUCCESS  =   0x00000000,
     200        SC_FAIL     =   0x00000001
     201    };
     202    /*
     203    this is already in vci_param.h
     204    enum {
     205        STORE_COND_ATOMIC = 0,
     206        STORE_COND_NOT_ATOMIC = 1,
     207    };
     208    */
    175209
    176210    // TLB Mode : ITLB / DTLB / ICACHE / DCACHE
  • trunk/modules/vci_cc_vcache_wrapper_v4/caba/source/src/vci_cc_vcache_wrapper_v4.cpp

    r262 r284  
    8989
    9090        "DCACHE_DIRTY_PTE_GET",
    91         "DCACHE_DIRTY_SC_WAIT", 
     91        "DCACHE_DIRTY_WAIT", 
    9292
    9393        "DCACHE_MISS_VICTIM",
     
    112112        "CMD_DATA_UNC",     
    113113        "CMD_DATA_WRITE",
    114         "CMD_DATA_SC",
     114        "CMD_DATA_CAS",
    115115    };
    116116const char *rsp_fsm_state_str[] = {
     
    39953995        r_dcache_vci_sc_old = pte;
    39963996        r_dcache_vci_sc_new = pte | PTE_D_MASK;
    3997         r_dcache_fsm        = DCACHE_DIRTY_SC_WAIT;
     3997        r_dcache_fsm        = DCACHE_DIRTY_WAIT;
    39983998
    39993999#if DEBUG_DCACHE
     
    40104010    }
    40114011    //////////////////////////
    4012     case DCACHE_DIRTY_SC_WAIT:          // wait completion of SC for PTE Dirty bit,
     4012    case DCACHE_DIRTY_WAIT:         // wait completion of CAS for PTE Dirty bit,
    40134013                                    // and return to IDLE state when response is received.
    4014                                     // we don't care if the SC is a failure:
    4015                                     // - if the SC is a success, the coherence mechanism
     4014                                    // we don't care if the CAS is a failure:
     4015                                    // - if the CAS is a success, the coherence mechanism
    40164016                                    //   updates the local copy.
    4017                                     // - if the SC is a failure, we just retry the write.
     4017                                    // - if the CAS is a failure, we just retry the write.
    40184018    {
    40194019        // external coherence request
     
    44194419            else if ( r_dcache_vci_sc_req.read() )
    44204420            {
    4421                 r_vci_cmd_fsm       = CMD_DATA_SC;
     4421                r_vci_cmd_fsm       = CMD_DATA_CAS;
    44224422                r_dcache_vci_sc_req = false;
    44234423                r_vci_cmd_cpt       = 0;
     
    44424442        }
    44434443        /////////////////
    4444         case CMD_DATA_SC:
     4444        case CMD_DATA_CAS:
    44454445        {
    44464446            // The SC VCI command contains two flits
     
    44754475    //
    44764476    // As the VCI_RSP and VCI_CMD are fully desynchronized to support several
    4477     // simultaneous VCI transactions, this FSM uses the VCI TRDID field
     4477    // simultaneous VCI transactions, this FSM uses the VCI RPKTID field
    44784478    // to identify the transactions.
    44794479    //
     
    45004500            r_vci_rsp_cpt = 0;
    45014501
    4502             if ( (p_vci_ini_d.rtrdid.read() >> (vci_param::T-1)) != 0 ) // Write transaction
    4503             {
    4504                 r_vci_rsp_fsm = RSP_DATA_WRITE;
    4505             }
    4506             else if ( p_vci_ini_d.rtrdid.read() == TYPE_INS_MISS )
     4502            if      ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_READ_DATA_UNC  )
     4503            {
     4504                r_vci_rsp_fsm = RSP_DATA_UNC;
     4505            }
     4506            else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_READ_DATA_MISS )
     4507            {
     4508                r_vci_rsp_fsm = RSP_DATA_MISS;
     4509            }
     4510            else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_READ_INS_UNC   )
     4511            {
     4512                r_vci_rsp_fsm = RSP_INS_UNC;
     4513            }
     4514            else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_READ_INS_MISS  )
    45074515            {
    45084516                r_vci_rsp_fsm = RSP_INS_MISS;
    45094517            }
    4510             else if ( p_vci_ini_d.rtrdid.read() == TYPE_INS_UNC )
    4511             {
    4512                 r_vci_rsp_fsm = RSP_INS_UNC;
    4513             }
    4514             else if ( p_vci_ini_d.rtrdid.read() == TYPE_DATA_MISS )
    4515             {
    4516                 r_vci_rsp_fsm = RSP_DATA_MISS;
    4517             }
    4518             else if ( p_vci_ini_d.rtrdid.read() == TYPE_DATA_UNC )
     4518            else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_WRITE          )
     4519            {
     4520                r_vci_rsp_fsm = RSP_DATA_WRITE;
     4521            }
     4522            else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_CAS            )
    45194523            {
    45204524                r_vci_rsp_fsm = RSP_DATA_UNC;
     4525            }
     4526            else if ( (p_vci_ini_d.rpktid.read() & 0x7) ==  TYPE_LL             )
     4527            {
     4528                assert(false and "TODO ! LL NOT IMPLEMENTED YET"); //TODO
     4529                //r_vci_rsp_fsm = RSP_DATA_UNC;
     4530            }
     4531            else if ( (p_vci_ini_d.rpktid.read() & 0x7) == TYPE_SC             )
     4532            {
     4533                assert(false and "TODO ! SC NOT IMPLEMENTED YET"); //TODO
     4534                //r_vci_rsp_fsm = RSP_DATA_UNC;
    45214535            }
    45224536            else
     
    48504864    p_vci_ini_d.pktid  = 0;
    48514865    p_vci_ini_d.srcid  = m_srcid_d;
    4852     p_vci_ini_d.cons   = (r_vci_cmd_fsm.read() == CMD_DATA_SC);
    4853     p_vci_ini_d.contig = not (r_vci_cmd_fsm.read() == CMD_DATA_SC);
     4866    p_vci_ini_d.cons   = (r_vci_cmd_fsm.read() == CMD_DATA_CAS);
     4867    p_vci_ini_d.contig = not (r_vci_cmd_fsm.read() == CMD_DATA_CAS);
    48544868    p_vci_ini_d.wrap   = false;
    48554869    p_vci_ini_d.clen   = 0;
     
    48644878        p_vci_ini_d.be      = 0;
    48654879        p_vci_ini_d.trdid   = 0;
     4880        p_vci_ini_d.pktid   = 0;
    48664881        p_vci_ini_d.plen    = 0;
    48674882        p_vci_ini_d.cmd     = vci_param::CMD_NOP;
     
    48744889        p_vci_ini_d.wdata   = 0;
    48754890        p_vci_ini_d.be      = 0xF;
    4876         p_vci_ini_d.trdid   = TYPE_INS_MISS;
     4891        p_vci_ini_d.trdid   = 0;
     4892        p_vci_ini_d.pktid   = TYPE_READ_INS_MISS;
    48774893        p_vci_ini_d.plen    = m_icache_words<<2;
    48784894        p_vci_ini_d.cmd     = vci_param::CMD_READ;
     
    48854901        p_vci_ini_d.wdata   = 0;
    48864902        p_vci_ini_d.be      = 0xF;
    4887         p_vci_ini_d.trdid   = TYPE_INS_UNC;
     4903        p_vci_ini_d.trdid   = 0;
     4904        p_vci_ini_d.pktid   = TYPE_READ_INS_UNC;
    48884905        p_vci_ini_d.plen    = 4;
    48894906        p_vci_ini_d.cmd     = vci_param::CMD_READ;
     
    48964913        p_vci_ini_d.wdata   = 0;
    48974914        p_vci_ini_d.be      = 0xF;
    4898         p_vci_ini_d.trdid   = TYPE_DATA_MISS;
     4915        p_vci_ini_d.trdid   = 0;
     4916        p_vci_ini_d.pktid   = TYPE_READ_DATA_MISS;
    48994917        p_vci_ini_d.plen    = m_dcache_words << 2;
    49004918        p_vci_ini_d.cmd     = vci_param::CMD_READ;
     
    49074925        p_vci_ini_d.wdata   = 0;
    49084926        p_vci_ini_d.be      = r_dcache_vci_unc_be.read();
    4909         p_vci_ini_d.trdid   = TYPE_DATA_UNC;
     4927        p_vci_ini_d.trdid   = 0;
     4928        p_vci_ini_d.pktid   = TYPE_READ_DATA_UNC;
    49104929        p_vci_ini_d.plen    = 4;
    49114930        p_vci_ini_d.cmd     = vci_param::CMD_READ;
     
    49194938        p_vci_ini_d.be      = r_wbuf.getBe(r_vci_cmd_cpt.read());
    49204939        p_vci_ini_d.trdid   = r_wbuf.getIndex() + (1<<(vci_param::T-1));
     4940        p_vci_ini_d.pktid   = TYPE_WRITE;
    49214941        p_vci_ini_d.plen    = (r_vci_cmd_max.read() - r_vci_cmd_min.read() + 1) << 2;
    49224942        p_vci_ini_d.cmd     = vci_param::CMD_WRITE;
     
    49244944        break;
    49254945
    4926     case CMD_DATA_SC:
     4946    case CMD_DATA_CAS:
    49274947        p_vci_ini_d.cmdval  = true;
    49284948        p_vci_ini_d.address = r_dcache_vci_paddr.read() & ~0x3;
     
    49304950        else                             p_vci_ini_d.wdata = r_dcache_vci_sc_new.read();
    49314951        p_vci_ini_d.be      = 0xF;
    4932         p_vci_ini_d.trdid   = TYPE_DATA_UNC; 
     4952        p_vci_ini_d.trdid   = 0;
     4953        p_vci_ini_d.pktid   = TYPE_CAS;
    49334954        p_vci_ini_d.plen    = 8;
    4934         p_vci_ini_d.cmd     = vci_param::CMD_STORE_COND;
     4955        p_vci_ini_d.cmd     = vci_param::CMD_NOP;
    49354956        p_vci_ini_d.eop     = (r_vci_cmd_cpt.read() == 1);
    49364957        break;     
  • trunk/modules/vci_mem_cache_v4/caba/source/include/mem_cache_directory_v4.h

    r283 r284  
    77#include "arithmetics.h"
    88
     9// !!!
     10// The L1_MULTI_CACHE mechanism does no longer work with the new pktid encoding
     11// of TSAR. Turning the define below to a non null value will cause the memcache
     12// to behave in an unpredicted way.
     13// TODO Either remove the mechanism from the mem cache or update its behaviour.
    914#define L1_MULTI_CACHE 0
     15
    1016//#define RANDOM_EVICTION
    1117
  • trunk/modules/vci_mem_cache_v4/caba/source/include/vci_mem_cache_v4.h

    r283 r284  
    2727 * Maintainers: alain eric.guthmuller@polytechnique.edu
    2828 *              cesar.fuguet-tortolero@lip6.fr
     29 *              alexandre.joannou@lip6.fr
    2930 *
    3031 * Modifications done by Christophe Choichillon on the 7/04/2009:
     
    8081        TGT_CMD_READ,
    8182        TGT_CMD_WRITE,
    82         TGT_CMD_ATOMIC
     83        TGT_CMD_CAS
    8384      };
    8485
     
    8788        TGT_RSP_READ_IDLE,
    8889        TGT_RSP_WRITE_IDLE,
    89         TGT_RSP_SC_IDLE,
     90        TGT_RSP_CAS_IDLE,
    9091        TGT_RSP_XRAM_IDLE,
    9192        TGT_RSP_INIT_IDLE,
     
    9394        TGT_RSP_READ,
    9495        TGT_RSP_WRITE,
    95         TGT_RSP_SC,
     96        TGT_RSP_CAS,
    9697        TGT_RSP_XRAM,
    9798        TGT_RSP_INIT,
     
    109110        INIT_CMD_UPDT_INDEX,
    110111        INIT_CMD_UPDT_DATA,
    111         INIT_CMD_SC_UPDT_IDLE,
    112         INIT_CMD_SC_BRDCAST,
    113         INIT_CMD_SC_UPDT_NLINE,
    114         INIT_CMD_SC_UPDT_INDEX,
    115         INIT_CMD_SC_UPDT_DATA,
    116         INIT_CMD_SC_UPDT_DATA_HIGH
     112        INIT_CMD_CAS_UPDT_IDLE,
     113        INIT_CMD_CAS_BRDCAST,
     114        INIT_CMD_CAS_UPDT_NLINE,
     115        INIT_CMD_CAS_UPDT_INDEX,
     116        INIT_CMD_CAS_UPDT_DATA,
     117        INIT_CMD_CAS_UPDT_DATA_HIGH
    117118      };
    118119
     
    199200        IXR_CMD_READ_IDLE,
    200201        IXR_CMD_WRITE_IDLE,
    201         IXR_CMD_SC_IDLE,
     202        IXR_CMD_CAS_IDLE,
    202203        IXR_CMD_XRAM_IDLE,
    203204        IXR_CMD_READ_NLINE,
    204205        IXR_CMD_WRITE_NLINE,
    205         IXR_CMD_SC_NLINE,
     206        IXR_CMD_CAS_NLINE,
    206207        IXR_CMD_XRAM_DATA
    207208      };
    208209
    209       /* States of the SC fsm */
    210       enum sc_fsm_state_e{
    211         SC_IDLE,
    212         SC_DIR_REQ,
    213         SC_DIR_LOCK,
    214         SC_DIR_HIT_READ,
    215         SC_DIR_HIT_WRITE,
    216         SC_UPT_LOCK,
    217         SC_UPT_HEAP_LOCK,
    218         SC_UPT_REQ,
    219         SC_UPT_NEXT,
    220         SC_BC_TRT_LOCK,
    221         SC_BC_UPT_LOCK,
    222         SC_BC_DIR_INVAL,
    223         SC_BC_CC_SEND,
    224         SC_BC_XRAM_REQ,
    225         SC_RSP_FAIL,
    226         SC_RSP_SUCCESS,
    227         SC_MISS_TRT_LOCK,
    228         SC_MISS_TRT_SET,
    229         SC_MISS_XRAM_REQ,
    230         SC_WAIT
     210      /* States of the CAS fsm */
     211      enum cas_fsm_state_e{
     212        CAS_IDLE,
     213        CAS_DIR_REQ,
     214        CAS_DIR_LOCK,
     215        CAS_DIR_HIT_READ,
     216        CAS_DIR_HIT_WRITE,
     217        CAS_UPT_LOCK,
     218        CAS_UPT_HEAP_LOCK,
     219        CAS_UPT_REQ,
     220        CAS_UPT_NEXT,
     221        CAS_BC_TRT_LOCK,
     222        CAS_BC_UPT_LOCK,
     223        CAS_BC_DIR_INVAL,
     224        CAS_BC_CC_SEND,
     225        CAS_BC_XRAM_REQ,
     226        CAS_RSP_FAIL,
     227        CAS_RSP_SUCCESS,
     228        CAS_MISS_TRT_LOCK,
     229        CAS_MISS_TRT_SET,
     230        CAS_MISS_XRAM_REQ,
     231        CAS_WAIT
    231232      };
    232233
     
    253254        ALLOC_DIR_READ,
    254255        ALLOC_DIR_WRITE,
    255         ALLOC_DIR_SC,
     256        ALLOC_DIR_CAS,
    256257        ALLOC_DIR_CLEANUP,
    257258        ALLOC_DIR_XRAM_RSP
     
    262263        ALLOC_TRT_READ,
    263264        ALLOC_TRT_WRITE,
    264         ALLOC_TRT_SC,
     265        ALLOC_TRT_CAS,
    265266        ALLOC_TRT_XRAM_RSP,
    266267        ALLOC_TRT_IXR_RSP
     
    273274        ALLOC_UPT_INIT_RSP,
    274275        ALLOC_UPT_CLEANUP,
    275         ALLOC_UPT_SC
     276        ALLOC_UPT_CAS
    276277      };
    277278
     
    281282        ALLOC_HEAP_READ,
    282283        ALLOC_HEAP_WRITE,
    283         ALLOC_HEAP_SC,
     284        ALLOC_HEAP_CAS,
    284285        ALLOC_HEAP_CLEANUP,
    285286        ALLOC_HEAP_XRAM_RSP
     287      };
     288
     289      /* transaction type, pktid field */
     290      enum transaction_type_e
     291      {
     292          // b3 unused
     293          // b2 READ / NOT READ
     294          // Si READ
     295          //  b1 DATA / INS
     296          //  b0 UNC / MISS
     297          // Si NOT READ
     298          //  b1 accÚs table llsc type SW / other
     299          //  b2 WRITE/CAS/LL/SC
     300          TYPE_READ_DATA_UNC          = 0x0,
     301          TYPE_READ_DATA_MISS         = 0x1,
     302          TYPE_READ_INS_UNC           = 0x2,
     303          TYPE_READ_INS_MISS          = 0x3,
     304          TYPE_WRITE                  = 0x4,
     305          TYPE_CAS                    = 0x5,
     306          TYPE_LL                     = 0x6,
     307          TYPE_SC                     = 0x7
     308      };
     309
     310      /* SC return values */
     311      enum sc_status_type_e
     312      {
     313          SC_SUCCESS  =   0x00000000,
     314          SC_FAIL     =   0x00000001
    286315      };
    287316
     
    296325      bool         m_debug_read_fsm;
    297326      bool         m_debug_write_fsm;
    298       bool         m_debug_sc_fsm;
     327      bool         m_debug_cas_fsm;
    299328      bool         m_debug_cleanup_fsm;
    300329      bool         m_debug_ixr_cmd_fsm;
     
    326355      uint32_t     m_cpt_ll;            // Number of LL transactions
    327356      uint32_t     m_cpt_sc;            // Number of SC transactions
     357      uint32_t     m_cpt_cas;           // Number of CAS transactions
    328358
    329359      size_t       m_prev_count;
     
    429459      GenericFifo<be_t>      m_cmd_write_be_fifo;
    430460
    431       // Fifo between TGT_CMD fsm and SC fsm
    432       GenericFifo<uint64_t>  m_cmd_sc_addr_fifo;
    433       GenericFifo<bool>      m_cmd_sc_eop_fifo;
    434       GenericFifo<size_t>    m_cmd_sc_srcid_fifo;
    435       GenericFifo<size_t>    m_cmd_sc_trdid_fifo;
    436       GenericFifo<size_t>    m_cmd_sc_pktid_fifo;
    437       GenericFifo<data_t>    m_cmd_sc_wdata_fifo;
     461      // Fifo between TGT_CMD fsm and CAS fsm
     462      GenericFifo<uint64_t>  m_cmd_cas_addr_fifo;
     463      GenericFifo<bool>      m_cmd_cas_eop_fifo;
     464      GenericFifo<size_t>    m_cmd_cas_srcid_fifo;
     465      GenericFifo<size_t>    m_cmd_cas_trdid_fifo;
     466      GenericFifo<size_t>    m_cmd_cas_pktid_fifo;
     467      GenericFifo<data_t>    m_cmd_cas_wdata_fifo;
    438468
    439469      sc_signal<int>         r_tgt_cmd_fsm;
     
    594624
    595625      ///////////////////////////////////////////////////////
    596       // Registers controlled by SC fsm
     626      // Registers controlled by CAS fsm
    597627      ///////////////////////////////////////////////////////
    598628
    599       sc_signal<int>      r_sc_fsm;        // FSM state
    600       sc_signal<data_t>   r_sc_wdata;      // write data word
    601       sc_signal<data_t> * r_sc_rdata;      // read data word
    602       sc_signal<uint32_t> r_sc_lfsr;       // lfsr for random introducing
    603       sc_signal<size_t>   r_sc_cpt;        // size of command
    604       sc_signal<copy_t>   r_sc_copy;       // Srcid of the first copy
    605       sc_signal<copy_t>   r_sc_copy_cache; // Srcid of the first copy
    606       sc_signal<bool>     r_sc_copy_inst;  // Type of the first copy
    607       sc_signal<size_t>   r_sc_count;      // number of copies
    608       sc_signal<size_t>   r_sc_ptr;        // pointer to the heap
    609       sc_signal<size_t>   r_sc_next_ptr;   // next pointer to the heap
    610       sc_signal<bool>     r_sc_is_cnt;     // is_cnt bit (in directory)
    611       sc_signal<bool>     r_sc_dirty;      // dirty bit (in directory)
    612       sc_signal<size_t>   r_sc_way;        // way in directory
    613       sc_signal<size_t>   r_sc_set;        // set in directory
    614       sc_signal<data_t>   r_sc_tag;        // cache line tag (in directory)
    615       sc_signal<size_t>   r_sc_trt_index;  // Transaction Table index
    616       sc_signal<size_t>   r_sc_upt_index;  // Update Table index
    617 
    618       // Buffer between SC fsm and INIT_CMD fsm (XRAM read)
    619       sc_signal<bool>     r_sc_to_ixr_cmd_req;   // valid request
    620       sc_signal<addr_t>   r_sc_to_ixr_cmd_nline; // cache line index
    621       sc_signal<size_t>   r_sc_to_ixr_cmd_trdid; // index in Transaction Table
    622       sc_signal<bool>     r_sc_to_ixr_cmd_write; // write request
    623       sc_signal<data_t> * r_sc_to_ixr_cmd_data;  // cache line data
    624 
    625 
    626       // Buffer between SC fsm and TGT_RSP fsm
    627       sc_signal<bool>     r_sc_to_tgt_rsp_req;   // valid request
    628       sc_signal<data_t>   r_sc_to_tgt_rsp_data;  // read data word
    629       sc_signal<size_t>   r_sc_to_tgt_rsp_srcid; // Transaction srcid
    630       sc_signal<size_t>   r_sc_to_tgt_rsp_trdid; // Transaction trdid
    631       sc_signal<size_t>   r_sc_to_tgt_rsp_pktid; // Transaction pktid
    632 
    633       // Buffer between SC fsm and INIT_CMD fsm (Update/Invalidate L1 caches)
    634       sc_signal<bool>     r_sc_to_init_cmd_multi_req;     // valid request
    635       sc_signal<bool>     r_sc_to_init_cmd_brdcast_req;   // brdcast request
    636       sc_signal<addr_t>   r_sc_to_init_cmd_nline;         // cache line index
    637       sc_signal<size_t>   r_sc_to_init_cmd_trdid;         // index in Update Table
    638       sc_signal<data_t>   r_sc_to_init_cmd_wdata;         // data (one word)
    639       sc_signal<bool>     r_sc_to_init_cmd_is_long;       // it is a 64 bits SC
    640       sc_signal<data_t>   r_sc_to_init_cmd_wdata_high;    // data high (one word)
    641       sc_signal<size_t>   r_sc_to_init_cmd_index;         // index of the word in line
    642       GenericFifo<bool>   m_sc_to_init_cmd_inst_fifo;     // fifo for the L1 type
    643       GenericFifo<size_t> m_sc_to_init_cmd_srcid_fifo;    // fifo for srcids
     629      sc_signal<int>      r_cas_fsm;        // FSM state
     630      sc_signal<data_t>   r_cas_wdata;      // write data word
     631      sc_signal<data_t> * r_cas_rdata;      // read data word
     632      sc_signal<uint32_t> r_cas_lfsr;       // lfsr for random introducing
     633      sc_signal<size_t>   r_cas_cpt;        // size of command
     634      sc_signal<copy_t>   r_cas_copy;       // Srcid of the first copy
     635      sc_signal<copy_t>   r_cas_copy_cache; // Srcid of the first copy
     636      sc_signal<bool>     r_cas_copy_inst;  // Type of the first copy
     637      sc_signal<size_t>   r_cas_count;      // number of copies
     638      sc_signal<size_t>   r_cas_ptr;        // pointer to the heap
     639      sc_signal<size_t>   r_cas_next_ptr;   // next pointer to the heap
     640      sc_signal<bool>     r_cas_is_cnt;     // is_cnt bit (in directory)
     641      sc_signal<bool>     r_cas_dirty;      // dirty bit (in directory)
     642      sc_signal<size_t>   r_cas_way;        // way in directory
     643      sc_signal<size_t>   r_cas_set;        // set in directory
     644      sc_signal<data_t>   r_cas_tag;        // cache line tag (in directory)
     645      sc_signal<size_t>   r_cas_trt_index;  // Transaction Table index
     646      sc_signal<size_t>   r_cas_upt_index;  // Update Table index
     647
     648      // Buffer between CAS fsm and INIT_CMD fsm (XRAM read)
     649      sc_signal<bool>     r_cas_to_ixr_cmd_req;   // valid request
     650      sc_signal<addr_t>   r_cas_to_ixr_cmd_nline; // cache line index
     651      sc_signal<size_t>   r_cas_to_ixr_cmd_trdid; // index in Transaction Table
     652      sc_signal<bool>     r_cas_to_ixr_cmd_write; // write request
     653      sc_signal<data_t> * r_cas_to_ixr_cmd_data;  // cache line data
     654
     655
     656      // Buffer between CAS fsm and TGT_RSP fsm
     657      sc_signal<bool>     r_cas_to_tgt_rsp_req;   // valid request
     658      sc_signal<data_t>   r_cas_to_tgt_rsp_data;  // read data word
     659      sc_signal<size_t>   r_cas_to_tgt_rsp_srcid; // Transaction srcid
     660      sc_signal<size_t>   r_cas_to_tgt_rsp_trdid; // Transaction trdid
     661      sc_signal<size_t>   r_cas_to_tgt_rsp_pktid; // Transaction pktid
     662
     663      // Buffer between CAS fsm and INIT_CMD fsm (Update/Invalidate L1 caches)
     664      sc_signal<bool>     r_cas_to_init_cmd_multi_req;     // valid request
     665      sc_signal<bool>     r_cas_to_init_cmd_brdcast_req;   // brdcast request
     666      sc_signal<addr_t>   r_cas_to_init_cmd_nline;         // cache line index
     667      sc_signal<size_t>   r_cas_to_init_cmd_trdid;         // index in Update Table
     668      sc_signal<data_t>   r_cas_to_init_cmd_wdata;         // data (one word)
     669      sc_signal<bool>     r_cas_to_init_cmd_is_long;       // it is a 64 bits CAS
     670      sc_signal<data_t>   r_cas_to_init_cmd_wdata_high;    // data high (one word)
     671      sc_signal<size_t>   r_cas_to_init_cmd_index;         // index of the word in line
     672      GenericFifo<bool>   m_cas_to_init_cmd_inst_fifo;     // fifo for the L1 type
     673      GenericFifo<size_t> m_cas_to_init_cmd_srcid_fifo;    // fifo for srcids
    644674#if L1_MULTI_CACHE
    645       GenericFifo<size_t> m_sc_to_init_cmd_cache_id_fifo; // fifo for srcids
     675      GenericFifo<size_t> m_cas_to_init_cmd_cache_id_fifo; // fifo for srcids
    646676#endif
    647677
    648       // Buffer between SC fsm and INIT_RSP fsm (Decrement UPT entry)
    649       sc_signal<bool>     r_sc_to_init_rsp_req;       // valid request
    650       sc_signal<size_t>   r_sc_to_init_rsp_upt_index; // index in update table
     678      // Buffer between CAS fsm and INIT_RSP fsm (Decrement UPT entry)
     679      sc_signal<bool>     r_cas_to_init_rsp_req;       // valid request
     680      sc_signal<size_t>   r_cas_to_init_rsp_upt_index; // index in update table
    651681
    652682      ////////////////////////////////////////////////////
  • trunk/modules/vci_mem_cache_v4/caba/source/src/vci_mem_cache_v4.cpp

    r283 r284  
    2727 * Maintainers: alain eric.guthmuller@polytechnique.edu
    2828 *              cesar.fuguet-tortolero@lip6.fr
     29 *              alexandre.joannou@lip6.fr
    2930 */
    3031
     
    4142#define DEBUG_MEMC_READ     1 // detailed trace of READ FSM
    4243#define DEBUG_MEMC_WRITE    1 // detailed trace of WRITE FSM
    43 #define DEBUG_MEMC_SC       1 // detailed trace of SC FSM
     44#define DEBUG_MEMC_CAS      1 // detailed trace of CAS FSM
    4445#define DEBUG_MEMC_IXR_CMD  1 // detailed trace of IXR_RSP FSM
    4546#define DEBUG_MEMC_IXR_RSP  1 // detailed trace of IXR_RSP FSM
     
    5152#define DEBUG_MEMC_CLEANUP  1 // detailed trace of CLEANUP FSM
    5253
    53 #define RANDOMIZE_SC        1
     54#define RANDOMIZE_CAS       1
    5455
    5556namespace soclib { namespace caba {
     
    5960    "TGT_CMD_READ",
    6061    "TGT_CMD_WRITE",
    61     "TGT_CMD_ATOMIC"
     62    "TGT_CMD_CAS"
    6263  };
    6364  const char *tgt_rsp_fsm_str[] = {
    6465    "TGT_RSP_READ_IDLE",
    6566    "TGT_RSP_WRITE_IDLE",
    66     "TGT_RSP_SC_IDLE",
     67    "TGT_RSP_CAS_IDLE",
    6768    "TGT_RSP_XRAM_IDLE",
    6869    "TGT_RSP_INIT_IDLE",
     
    7071    "TGT_RSP_READ",
    7172    "TGT_RSP_WRITE",
    72     "TGT_RSP_SC",
     73    "TGT_RSP_CAS",
    7374    "TGT_RSP_XRAM",
    7475    "TGT_RSP_INIT",
     
    8485    "INIT_CMD_UPDT_INDEX",
    8586    "INIT_CMD_UPDT_DATA",
    86     "INIT_CMD_SC_UPDT_IDLE",
    87     "INIT_CMD_SC_BRDCAST",
    88     "INIT_CMD_SC_UPDT_NLINE",
    89     "INIT_CMD_SC_UPDT_INDEX",
    90     "INIT_CMD_SC_UPDT_DATA",
    91     "INIT_CMD_SC_UPDT_DATA_HIGH"
     87    "INIT_CMD_CAS_UPDT_IDLE",
     88    "INIT_CMD_CAS_BRDCAST",
     89    "INIT_CMD_CAS_UPDT_NLINE",
     90    "INIT_CMD_CAS_UPDT_INDEX",
     91    "INIT_CMD_CAS_UPDT_DATA",
     92    "INIT_CMD_CAS_UPDT_DATA_HIGH"
    9293  };
    9394  const char *init_rsp_fsm_str[] = {
     
    162163    "IXR_CMD_READ_IDLE",
    163164    "IXR_CMD_WRITE_IDLE",
    164     "IXR_CMD_SC_IDLE",
     165    "IXR_CMD_CAS_IDLE",
    165166    "IXR_CMD_XRAM_IDLE",
    166167    "IXR_CMD_READ_NLINE",
    167168    "IXR_CMD_WRITE_NLINE",
    168     "IXR_CMD_SC_NLINE",
     169    "IXR_CMD_CAS_NLINE",
    169170    "IXR_CMD_XRAM_DATA"
    170171  };
    171   const char *sc_fsm_str[] = {
    172     "SC_IDLE",
    173     "SC_DIR_REQ",
    174     "SC_DIR_LOCK",
    175     "SC_DIR_HIT_READ",
    176     "SC_DIR_HIT_WRITE",
    177     "SC_UPT_LOCK",
    178     "SC_UPT_HEAP_LOCK",
    179     "SC_UPT_REQ",
    180     "SC_UPT_NEXT",
    181     "SC_BC_TRT_LOCK",
    182     "SC_BC_UPT_LOCK",
    183     "SC_BC_DIR_INVAL",
    184     "SC_BC_CC_SEND",
    185     "SC_BC_XRAM_REQ",
    186     "SC_RSP_FAIL",
    187     "SC_RSP_SUCCESS",
    188     "SC_MISS_TRT_LOCK",
    189     "SC_MISS_TRT_SET",
    190     "SC_MISS_XRAM_REQ",
    191     "SC_WAIT"
     172  const char *cas_fsm_str[] = {
     173    "CAS_IDLE",
     174    "CAS_DIR_REQ",
     175    "CAS_DIR_LOCK",
     176    "CAS_DIR_HIT_READ",
     177    "CAS_DIR_HIT_WRITE",
     178    "CAS_UPT_LOCK",
     179    "CAS_UPT_HEAP_LOCK",
     180    "CAS_UPT_REQ",
     181    "CAS_UPT_NEXT",
     182    "CAS_BC_TRT_LOCK",
     183    "CAS_BC_UPT_LOCK",
     184    "CAS_BC_DIR_INVAL",
     185    "CAS_BC_CC_SEND",
     186    "CAS_BC_XRAM_REQ",
     187    "CAS_RSP_FAIL",
     188    "CAS_RSP_SUCCESS",
     189    "CAS_MISS_TRT_LOCK",
     190    "CAS_MISS_TRT_SET",
     191    "CAS_MISS_XRAM_REQ",
     192    "CAS_WAIT"
    192193  };
    193194  const char *cleanup_fsm_str[] = {
     
    210211    "ALLOC_DIR_READ",
    211212    "ALLOC_DIR_WRITE",
    212     "ALLOC_DIR_SC",
     213    "ALLOC_DIR_CAS",
    213214    "ALLOC_DIR_CLEANUP",
    214215    "ALLOC_DIR_XRAM_RSP"
     
    217218    "ALLOC_TRT_READ",
    218219    "ALLOC_TRT_WRITE",
    219     "ALLOC_TRT_SC",
     220    "ALLOC_TRT_CAS",
    220221    "ALLOC_TRT_XRAM_RSP",
    221222    "ALLOC_TRT_IXR_RSP"
     
    226227    "ALLOC_UPT_INIT_RSP",
    227228    "ALLOC_UPT_CLEANUP",
    228     "ALLOC_UPT_SC"
     229    "ALLOC_UPT_CAS"
    229230  };
    230231  const char *alloc_heap_fsm_str[] = {
     
    232233    "ALLOC_HEAP_READ",
    233234    "ALLOC_HEAP_WRITE",
    234     "ALLOC_HEAP_SC",
     235    "ALLOC_HEAP_CAS",
    235236    "ALLOC_HEAP_CLEANUP",
    236237    "ALLOC_HEAP_XRAM_RSP"
     
    314315    m_cmd_write_be_fifo("m_cmd_write_be_fifo",8),
    315316
    316     m_cmd_sc_addr_fifo("m_cmd_sc_addr_fifo",4),
    317     m_cmd_sc_eop_fifo("m_cmd_sc_eop_fifo",4),
    318     m_cmd_sc_srcid_fifo("m_cmd_sc_srcid_fifo",4),
    319     m_cmd_sc_trdid_fifo("m_cmd_sc_trdid_fifo",4),
    320     m_cmd_sc_pktid_fifo("m_cmd_sc_pktid_fifo",4),
    321     m_cmd_sc_wdata_fifo("m_cmd_sc_wdata_fifo",4),
     317    m_cmd_cas_addr_fifo("m_cmd_cas_addr_fifo",4),
     318    m_cmd_cas_eop_fifo("m_cmd_cas_eop_fifo",4),
     319    m_cmd_cas_srcid_fifo("m_cmd_cas_srcid_fifo",4),
     320    m_cmd_cas_trdid_fifo("m_cmd_cas_trdid_fifo",4),
     321    m_cmd_cas_pktid_fifo("m_cmd_cas_pktid_fifo",4),
     322    m_cmd_cas_wdata_fifo("m_cmd_cas_wdata_fifo",4),
    322323
    323324    r_tgt_cmd_fsm("r_tgt_cmd_fsm"),
     
    339340    r_cleanup_fsm("r_cleanup_fsm"),
    340341
    341     r_sc_fsm("r_sc_fsm"),
    342 
    343     m_sc_to_init_cmd_inst_fifo("m_sc_to_init_cmd_inst_fifo",8),
    344     m_sc_to_init_cmd_srcid_fifo("m_sc_to_init_cmd_srcid_fifo",8),
     342    r_cas_fsm("r_cas_fsm"),
     343
     344    m_cas_to_init_cmd_inst_fifo("m_cas_to_init_cmd_inst_fifo",8),
     345    m_cas_to_init_cmd_srcid_fifo("m_cas_to_init_cmd_srcid_fifo",8),
    345346#if L1_MULTI_CACHE
    346     m_sc_to_init_cmd_cache_id_fifo("m_sc_to_init_cmd_cache_id_fifo",8),
     347    m_cas_to_init_cmd_cache_id_fifo("m_cas_to_init_cmd_cache_id_fifo",8),
    347348#endif
    348349
     
    443444      r_write_to_ixr_cmd_data     = new sc_signal<data_t>[nwords];
    444445
    445       // Allocation for SC FSM
    446       r_sc_to_ixr_cmd_data        = new sc_signal<data_t>[nwords];
    447       r_sc_rdata                  = new sc_signal<data_t>[2];
     446      // Allocation for CAS FSM
     447      r_cas_to_ixr_cmd_data        = new sc_signal<data_t>[nwords];
     448      r_cas_rdata                  = new sc_signal<data_t>[2];
    448449
    449450
     
    515516              << " | " << read_fsm_str[r_read_fsm]
    516517              << " | " << write_fsm_str[r_write_fsm]
    517               << " | " << sc_fsm_str[r_sc_fsm]
     518              << " | " << cas_fsm_str[r_cas_fsm]
    518519              << " | " << cleanup_fsm_str[r_cleanup_fsm] << std::endl;
    519520    std::cout << "  "  << init_cmd_fsm_str[r_init_cmd_fsm]
     
    549550    << "- CLEANUP RATE         = " << (double) m_cpt_cleanup/m_cpt_cycles << std::endl
    550551    << "- LL RATE              = " << (double) m_cpt_ll/m_cpt_cycles << std::endl
    551     << "- SC RATE              = " << (double) m_cpt_sc/m_cpt_cycles << std::endl;
     552    << "- SC RATE              = " << (double) m_cpt_sc/m_cpt_cycles << std::endl
     553    << "- CAS RATE             = " << (double) m_cpt_cas/m_cpt_cycles << std::endl;
    552554}
    553555
     
    596598    r_read_fsm       = READ_IDLE;
    597599    r_write_fsm      = WRITE_IDLE;
    598     r_sc_fsm         = SC_IDLE;
     600    r_cas_fsm        = CAS_IDLE;
    599601    r_cleanup_fsm    = CLEANUP_IDLE;
    600602    r_alloc_dir_fsm  = ALLOC_DIR_RESET;
     
    613615    m_debug_read_fsm       = false;
    614616    m_debug_write_fsm      = false;
    615     m_debug_sc_fsm         = false;
     617    m_debug_cas_fsm        = false;
    616618    m_debug_cleanup_fsm    = false;
    617619    m_debug_ixr_cmd_fsm    = false;
     
    640642    m_cmd_write_data_fifo.init();
    641643
    642     m_cmd_sc_addr_fifo.init();
    643     m_cmd_sc_srcid_fifo.init();
    644     m_cmd_sc_trdid_fifo.init();
    645     m_cmd_sc_pktid_fifo.init();
    646     m_cmd_sc_wdata_fifo.init();
    647     m_cmd_sc_eop_fifo.init();
     644    m_cmd_cas_addr_fifo.init()  ;
     645    m_cmd_cas_srcid_fifo.init() ;
     646    m_cmd_cas_trdid_fifo.init() ;
     647    m_cmd_cas_pktid_fifo.init() ;
     648    m_cmd_cas_wdata_fifo.init() ;
     649    m_cmd_cas_eop_fifo.init()   ;
    648650
    649651    r_read_to_tgt_rsp_req = false;
     
    662664#endif
    663665
    664     r_cleanup_to_tgt_rsp_req     = false;
    665 
    666     r_init_rsp_to_tgt_rsp_req    = false;
    667 
    668     r_sc_to_tgt_rsp_req          = false;
    669     r_sc_cpt                     = 0;
    670     r_sc_lfsr                    = -1;
    671     r_sc_to_ixr_cmd_req          = false;
    672     r_sc_to_init_cmd_multi_req   = false;
    673     r_sc_to_init_cmd_brdcast_req = false;
    674 
    675     m_sc_to_init_cmd_inst_fifo.init();
    676     m_sc_to_init_cmd_srcid_fifo.init();
     666    r_cleanup_to_tgt_rsp_req      = false;
     667
     668    r_init_rsp_to_tgt_rsp_req     = false;
     669
     670    r_cas_to_tgt_rsp_req          = false;
     671    r_cas_cpt                     = 0    ;
     672    r_cas_lfsr                    = -1   ;
     673    r_cas_to_ixr_cmd_req          = false;
     674    r_cas_to_init_cmd_multi_req   = false;
     675    r_cas_to_init_cmd_brdcast_req = false;
     676
     677    m_cas_to_init_cmd_inst_fifo.init();
     678    m_cas_to_init_cmd_srcid_fifo.init();
    677679#if L1_MULTI_CACHE
    678     m_sc_to_init_cmd_cache_id_fifo.init();
     680    m_cas_to_init_cmd_cache_id_fifo.init();
    679681#endif
    680682
     
    717719    m_cpt_ll            = 0;
    718720    m_cpt_sc            = 0;
     721    m_cpt_cas           = 0;
    719722    m_cpt_trt_full      = 0;
    720723    m_cpt_trt_rb        = 0;
     
    729732  bool    cmd_write_fifo_get = false;
    730733
    731   bool    cmd_sc_fifo_put = false;
    732   bool    cmd_sc_fifo_get = false;
     734  bool    cmd_cas_fifo_put = false;
     735  bool    cmd_cas_fifo_get = false;
    733736
    734737  bool    write_to_init_cmd_fifo_put   = false;
     
    750753#endif
    751754
    752   bool    sc_to_init_cmd_fifo_put   = false;
    753   bool    sc_to_init_cmd_fifo_get   = false;
    754   bool    sc_to_init_cmd_fifo_inst  = false;
    755   size_t  sc_to_init_cmd_fifo_srcid = 0;
     755  bool    cas_to_init_cmd_fifo_put   = false;
     756  bool    cas_to_init_cmd_fifo_get   = false;
     757  bool    cas_to_init_cmd_fifo_inst  = false;
     758  size_t  cas_to_init_cmd_fifo_srcid = 0;
    756759
    757760#if L1_MULTI_CACHE
    758   size_t  sc_to_init_cmd_fifo_cache_id = 0;
     761  size_t  cas_to_init_cmd_fifo_cache_id = 0;
    759762#endif
    760763
     
    766769  m_debug_read_fsm     = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok;
    767770  m_debug_write_fsm    = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok;
    768   m_debug_sc_fsm       = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok;
     771  m_debug_cas_fsm      = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok;
    769772  m_debug_cleanup_fsm  = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok;
    770773  m_debug_ixr_cmd_fsm  = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok;
     
    784787      << " - READ FSM       = " << read_fsm_str[r_read_fsm] << std::endl
    785788      << " - WRITE FSM      = " << write_fsm_str[r_write_fsm] << std::endl
    786       << " - SC FSM         = " << sc_fsm_str[r_sc_fsm] << std::endl
     789      << " - CAS FSM        = " << cas_fsm_str[r_cas_fsm] << std::endl
    787790      << " - CLEANUP FSM    = " << cleanup_fsm_str[r_cleanup_fsm] << std::endl
    788791      << " - IXR_CMD FSM    = " << ixr_cmd_fsm_str[r_ixr_cmd_fsm] << std::endl
     
    801804  // The TGT_CMD_FSM controls the incoming VCI command pakets from the processors
    802805  //
    803   // There is 3 types of accepted commands :
    804   // - READ    : a READ request has a length of 1 VCI cell. It can be a single word
    805   //             or an entire cache line, depending on the PLEN value.
    806   // - WRITE   : a WRITE request has a maximum length of 16 cells, and can only
    807   //             concern words in a same line.
    808   // - SC      : The SC request has a length of 2 cells or 4 cells.
     806  // There are 5 types of accepted commands :
     807  // - READ   : A READ request has a length of 1 VCI cell. It can be a single word
     808  //            or an entire cache line, depending on the PLEN value.
     809  // - WRITE  : A WRITE request has a maximum length of 16 cells, and can only
     810  //            concern words in a same line.
     811  // - CAS    : A CAS request has a length of 2 cells or 4 cells.
     812  // - LL     : An LL request has a length of 1 cell.
     813  // - SC     : An SC request has a length of 2 cells. First cell contains the
     814  //            acces key, second cell the data to write in case of success.
    809815  ////////////////////////////////////////////////////////////////////////////////////
    810816
     
    849855        if ( p_vci_tgt.cmd.read() == vci_param::CMD_READ )
    850856        {
     857          // check that the pktid is either :
     858          // TYPE_READ_DATA_UNC
     859          // TYPE_READ_DATA_MISS
     860          // TYPE_READ_INS_UNC
     861          // TYPE_READ_INS_MISS
     862          // ==> bit2 must be zero with the TSAR encoding
     863          // ==> mask = 0b0100 = 0x4
     864          assert(((p_vci_tgt.pktid.read() & 0x4) == 0x0) &&
     865            "The type specified in the pktid field is incompatible with the READ CMD");
    851866          r_tgt_cmd_fsm = TGT_CMD_READ;
    852867        }
    853868        else if ( p_vci_tgt.cmd.read() == vci_param::CMD_WRITE )
    854869        {
     870          // check that the pktid is TYPE_WRITE
     871          // ==> TYPE_WRITE = X100 with the TSAR encoding
     872          // ==> mask = 0b0111 = 0x7
     873          assert(((p_vci_tgt.pktid.read() & 0x7) == 0x4) &&
     874            "The type specified in the pktid field is incompatible with the WRITE CMD");
    855875          r_tgt_cmd_fsm = TGT_CMD_WRITE;
    856876        }
    857         else if ( p_vci_tgt.cmd.read() == vci_param::CMD_STORE_COND )
    858         {
    859           r_tgt_cmd_fsm = TGT_CMD_ATOMIC;
     877        else if ( p_vci_tgt.cmd.read() == vci_param::CMD_LOCKED_READ )
     878        {
     879          // check that the pktid is TYPE_LL
     880          // ==> TYPE_LL = X110 with the TSAR encoding
     881          // ==> mask = 0b0111 = 0x7
     882          assert(((p_vci_tgt.pktid.read() & 0x7) == 0x6) &&
     883            "The type specified in the pktid field is incompatible with the LL CMD");
     884          assert(false && "TODO : LL not implemented"); //TODO
     885          //r_tgt_cmd_fsm = TGT_CMD_READ;
     886        }
     887        else if ( p_vci_tgt.cmd.read() == vci_param::CMD_NOP )
     888        {
     889          // check that the pktid is either :
     890          // TYPE_CAS
     891          // TYPE_SC
     892          // ==> TYPE_CAS = X101 with the TSAR encoding
     893          // ==> TYPE_SC  = X111 with the TSAR encoding
     894          // ==> mask = 0b0101 = 0x5
     895          assert(((p_vci_tgt.pktid.read() & 0x5) == 0x5 ) &&
     896            "The type specified in the pktid field is incompatible with the NOP CMD");
     897
     898          if(p_vci_tgt.pktid.read() == TYPE_CAS)
     899            r_tgt_cmd_fsm = TGT_CMD_CAS;
     900          else // TYPE_SC
     901            assert(false && "TODO : SC not implemented"); //TODO
     902            //r_tgt_cmd_fsm = TGT_CMD_WRITE;
    860903        }
    861904        else
     
    901944            << " srcid = " << std::dec << p_vci_tgt.srcid.read()
    902945            << " trdid = " << p_vci_tgt.trdid.read()
     946            << " pktid = " << p_vci_tgt.pktid.read()
    903947            << " plen = " << std::dec << p_vci_tgt.plen.read() << std::endl;
    904948        }
     
    922966            << " srcid = " << std::dec << p_vci_tgt.srcid.read()
    923967            << " trdid = " << p_vci_tgt.trdid.read()
     968            << " pktid = " << p_vci_tgt.pktid.read()
    924969            << " wdata = " << std::hex << p_vci_tgt.wdata.read()
    925970            << " be = " << p_vci_tgt.be.read()
     
    933978
    934979    ////////////////////
    935     case TGT_CMD_ATOMIC:
     980    case TGT_CMD_CAS:
    936981      if ( (p_vci_tgt.plen.read() != 8) && (p_vci_tgt.plen.read() != 16) )
    937982      {
    938983        std::cout
    939           << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_ATOMIC state"
     984          << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_CAS state"
    940985          << std::endl
    941           << "illegal format for sc command " << std::endl;
     986          << "illegal format for CAS command " << std::endl;
    942987
    943988        exit(0);
    944989      }
    945990
    946       if ( p_vci_tgt.cmdval && m_cmd_sc_addr_fifo.wok() )
     991      if ( p_vci_tgt.cmdval && m_cmd_cas_addr_fifo.wok() )
    947992      {
    948993
     
    950995        if( m_debug_tgt_cmd_fsm )
    951996        {
    952           std::cout << "  <MEMC " << name() << ".TGT_CMD_ATOMIC> Pushing command into cmd_sc_fifo:"
     997          std::cout << "  <MEMC " << name() << ".TGT_CMD_CAS> Pushing command into cmd_cas_fifo:"
    953998            << " address = " << std::hex << p_vci_tgt.address.read()
    954999            << " srcid = " << std::dec << p_vci_tgt.srcid.read()
    9551000            << " trdid = " << p_vci_tgt.trdid.read()
     1001            << " pktid = " << p_vci_tgt.pktid.read()
    9561002            << " wdata = " << std::hex << p_vci_tgt.wdata.read()
    9571003            << " be = " << p_vci_tgt.be.read()
     
    9591005        }
    9601006#endif
    961         cmd_sc_fifo_put = true;
     1007        cmd_cas_fifo_put = true;
    9621008        if( p_vci_tgt.eop ) r_tgt_cmd_fsm = TGT_CMD_IDLE;
    9631009      }
     
    12021248        r_read_ptr        = entry.ptr; // pointer to the heap
    12031249
    1204         bool cached_read = (m_cmd_read_trdid_fifo.read() & 0x1);
     1250        // check if this is a cached read, this means pktid is either
     1251        // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding
     1252        // TYPE_READ_INS_MISS  0bX011 with TSAR encoding
     1253        bool cached_read = (m_cmd_read_pktid_fifo.read() & 0x1);
    12051254        if(  entry.valid ) // hit
    12061255        {
     
    12561305      {
    12571306        // signals generation
    1258         bool inst_read    = (m_cmd_read_trdid_fifo.read() & 0x2);
    1259         bool cached_read  = (m_cmd_read_trdid_fifo.read() & 0x1);
     1307        // check if this is an instruction read, this means pktid is either
     1308        // TYPE_READ_INS_UNC   0bX010 with TSAR encoding
     1309        // TYPE_READ_INS_MISS  0bX011 with TSAR encoding
     1310        bool inst_read    = (m_cmd_read_pktid_fifo.read() & 0x2);
     1311        // check if this is a cached read, this means pktid is either
     1312        // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding
     1313        // TYPE_READ_INS_MISS  0bX011 with TSAR encoding
     1314        bool cached_read  = (m_cmd_read_pktid_fifo.read() & 0x1);
    12601315        bool is_cnt       = r_read_is_cnt.read();
    12611316
     
    14581513        heap_entry.owner.cache_id = m_cmd_read_pktid_fifo.read();
    14591514#endif
    1460         heap_entry.owner.inst     = (m_cmd_read_trdid_fifo.read() & 0x2);
     1515        heap_entry.owner.inst     = (m_cmd_read_pktid_fifo.read() & 0x2);
    14611516
    14621517        if(r_read_count.read() == 1) // creation of a new linked list
     
    26872742    // The IXR_CMD fsm controls the command packets to the XRAM :
    26882743    // - It sends a single cell VCI read request to the XRAM in case of MISS
    2689     // posted by the READ, WRITE or SC FSMs : the TRDID field contains
     2744    // posted by the READ, WRITE or CAS FSMs : the TRDID field contains
    26902745    // the Transaction Tab index.
    26912746    // The VCI response is a multi-cell packet : the N cells contain
    26922747    // the N data words.
    26932748    // - It sends a multi-cell VCI write when the XRAM_RSP FSM, WRITE FSM
    2694     // or SC FSM request to save a dirty line to the XRAM.
     2749    // or CAS FSM request to save a dirty line to the XRAM.
    26952750    // The VCI response is a single cell packet.
    2696     // This FSM handles requests from the READ, WRITE, SC & XRAM_RSP FSMs
     2751    // This FSM handles requests from the READ, WRITE, CAS & XRAM_RSP FSMs
    26972752    // with a round-robin priority.
    26982753    ////////////////////////////////////////////////////////////////////////
     
    27032758        case IXR_CMD_READ_IDLE:
    27042759        if      ( r_write_to_ixr_cmd_req )     r_ixr_cmd_fsm = IXR_CMD_WRITE_NLINE;
    2705         else if ( r_sc_to_ixr_cmd_req  )       r_ixr_cmd_fsm = IXR_CMD_SC_NLINE;
     2760        else if ( r_cas_to_ixr_cmd_req  )      r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE;
    27062761        else if ( r_xram_rsp_to_ixr_cmd_req  ) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA;
    27072762        else if ( r_read_to_ixr_cmd_req  )     r_ixr_cmd_fsm = IXR_CMD_READ_NLINE;
     
    27092764        ////////////////////////
    27102765        case IXR_CMD_WRITE_IDLE:
    2711         if      ( r_sc_to_ixr_cmd_req  )       r_ixr_cmd_fsm = IXR_CMD_SC_NLINE;
     2766        if      ( r_cas_to_ixr_cmd_req  )      r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE;
    27122767        else if ( r_xram_rsp_to_ixr_cmd_req  ) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA;
    27132768        else if ( r_read_to_ixr_cmd_req  )     r_ixr_cmd_fsm = IXR_CMD_READ_NLINE;
     
    27152770        break;
    27162771        ////////////////////////
    2717         case IXR_CMD_SC_IDLE:
     2772        case IXR_CMD_CAS_IDLE:
    27182773        if      ( r_xram_rsp_to_ixr_cmd_req  ) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA;
    27192774        else if ( r_read_to_ixr_cmd_req  )     r_ixr_cmd_fsm = IXR_CMD_READ_NLINE;
    27202775        else if ( r_write_to_ixr_cmd_req )     r_ixr_cmd_fsm = IXR_CMD_WRITE_NLINE;
    2721         else if ( r_sc_to_ixr_cmd_req  )       r_ixr_cmd_fsm = IXR_CMD_SC_NLINE;
     2776        else if ( r_cas_to_ixr_cmd_req  )      r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE;
    27222777        break;
    27232778        ////////////////////////
     
    27252780        if      ( r_read_to_ixr_cmd_req  )     r_ixr_cmd_fsm = IXR_CMD_READ_NLINE;
    27262781        else if ( r_write_to_ixr_cmd_req )     r_ixr_cmd_fsm = IXR_CMD_WRITE_NLINE;
    2727         else if ( r_sc_to_ixr_cmd_req  )       r_ixr_cmd_fsm = IXR_CMD_SC_NLINE;
     2782        else if ( r_cas_to_ixr_cmd_req  )      r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE;
    27282783        else if ( r_xram_rsp_to_ixr_cmd_req  ) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA;
    27292784        break;
     
    27822837        break;
    27832838        //////////////////////
    2784         case IXR_CMD_SC_NLINE:      // send a put or get command to XRAM
     2839        case IXR_CMD_CAS_NLINE:      // send a put or get command to XRAM
    27852840        if ( p_vci_ixr.cmdack )
    27862841        {
    2787             if( r_sc_to_ixr_cmd_write.read())
     2842            if( r_cas_to_ixr_cmd_write.read())
    27882843            {
    27892844                if ( r_ixr_cmd_cpt.read() == (m_words - 1) )
    27902845                {
    27912846                    r_ixr_cmd_cpt = 0;
    2792                     r_ixr_cmd_fsm = IXR_CMD_SC_IDLE;
    2793                     r_sc_to_ixr_cmd_req = false;
     2847                    r_ixr_cmd_fsm = IXR_CMD_CAS_IDLE;
     2848                    r_cas_to_ixr_cmd_req = false;
    27942849                }
    27952850                else
     
    28012856if( m_debug_ixr_cmd_fsm )
    28022857{
    2803     std::cout << "  <MEMC " << name() << ".IXR_CMD_SC_NLINE> Send a put request to xram" << std::endl;
     2858    std::cout << "  <MEMC " << name() << ".IXR_CMD_CAS_NLINE> Send a put request to xram" << std::endl;
    28042859}
    28052860#endif
     
    28072862            else
    28082863            {
    2809                 r_ixr_cmd_fsm = IXR_CMD_SC_IDLE;
    2810                 r_sc_to_ixr_cmd_req = false;
     2864                r_ixr_cmd_fsm = IXR_CMD_CAS_IDLE;
     2865                r_cas_to_ixr_cmd_req = false;
    28112866
    28122867#if DEBUG_MEMC_IXR_CMD
    28132868if( m_debug_ixr_cmd_fsm )
    28142869{
    2815     std::cout << "  <MEMC " << name() << ".IXR_CMD_SC_NLINE> Send a get request to xram" << std::endl;
     2870    std::cout << "  <MEMC " << name() << ".IXR_CMD_CAS_NLINE> Send a get request to xram" << std::endl;
    28162871}
    28172872#endif
     
    31613216        {
    31623217            // signals generation
    3163             bool inst_read = (r_xram_rsp_trt_buf.trdid & 0x2) && r_xram_rsp_trt_buf.proc_read;
    3164             bool cached_read = (r_xram_rsp_trt_buf.trdid & 0x1) && r_xram_rsp_trt_buf.proc_read;
     3218            // check if this is an instruction read, this means pktid is either
     3219            // TYPE_READ_INS_UNC   0bX010 with TSAR encoding
     3220            // TYPE_READ_INS_MISS  0bX011 with TSAR encoding
     3221            bool inst_read = (r_xram_rsp_trt_buf.pktid & 0x2) && r_xram_rsp_trt_buf.proc_read;
     3222            // check if this is a cached read, this means pktid is either
     3223            // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding
     3224            // TYPE_READ_INS_MISS  0bX011 with TSAR encoding
     3225            bool cached_read = (r_xram_rsp_trt_buf.pktid & 0x1) && r_xram_rsp_trt_buf.proc_read;
     3226
    31653227            // update data
    31663228            size_t set   = r_xram_rsp_victim_set.read();
     
    41864248
    41874249    ////////////////////////////////////////////////////////////////////////////////////
    4188     //    SC FSM
     4250    //    CAS FSM
    41894251    ////////////////////////////////////////////////////////////////////////////////////
    4190     // The SC FSM handles the SC (Store Conditionnal) atomic commands,
     4252    // The CAS FSM handles the CAS (Store Conditionnal) atomic commands,
    41914253    // that are handled as "compare-and-swap instructions.
    41924254    //
     
    42014263    //
    42024264    // It access the directory to check hit / miss.
    4203     // - In case of miss, the SC FSM must register a GET transaction in TRT.
     4265    // - In case of miss, the CAS FSM must register a GET transaction in TRT.
    42044266    // If a read transaction to the XRAM for this line already exists,
    42054267    // or if the transaction table is full, it goes to the WAIT state
    42064268    // to release the locks and try again. When the GET transaction has been
    42074269    // launched, it goes to the WAIT state and try again.
    4208     // The SC request is not consumed in the FIFO until a HIT is obtained.
     4270    // The CAS request is not consumed in the FIFO until a HIT is obtained.
    42094271    // - In case of hit...
    42104272    ///////////////////////////////////////////////////////////////////////////////////
    42114273
    4212     switch ( r_sc_fsm.read() )
     4274    switch ( r_cas_fsm.read() )
    42134275    {
    42144276        /////////////
    4215         case SC_IDLE:     // fill the local rdata buffers
    4216         {
    4217             if( m_cmd_sc_addr_fifo.rok() )
    4218             {
    4219 
    4220 #if DEBUG_MEMC_SC
    4221 if( m_debug_sc_fsm )
     4277        case CAS_IDLE:     // fill the local rdata buffers
     4278        {
     4279            if( m_cmd_cas_addr_fifo.rok() )
     4280            {
     4281
     4282#if DEBUG_MEMC_CAS
     4283if( m_debug_cas_fsm )
    42224284{
    4223     std::cout << "  <MEMC " << name() << ".SC_IDLE> SC command: " << std::hex
    4224               << " srcid = " <<  std::dec << m_cmd_sc_srcid_fifo.read()
    4225               << " addr = " << std::hex << m_cmd_sc_addr_fifo.read()
    4226               << " wdata = " << m_cmd_sc_wdata_fifo.read()
    4227               << " eop = " << std::dec << m_cmd_sc_eop_fifo.read()
    4228               << " cpt  = " << std::dec << r_sc_cpt.read() << std::endl;
     4285    std::cout << "  <MEMC " << name() << ".CAS_IDLE> CAS command: " << std::hex
     4286              << " srcid = " <<  std::dec << m_cmd_cas_srcid_fifo.read()
     4287              << " addr = " << std::hex << m_cmd_cas_addr_fifo.read()
     4288              << " wdata = " << m_cmd_cas_wdata_fifo.read()
     4289              << " eop = " << std::dec << m_cmd_cas_eop_fifo.read()
     4290              << " cpt  = " << std::dec << r_cas_cpt.read() << std::endl;
    42294291}
    42304292#endif
    4231                 if( m_cmd_sc_eop_fifo.read() )
     4293                if( m_cmd_cas_eop_fifo.read() )
    42324294                {
    4233                     m_cpt_sc++;
    4234                     r_sc_fsm = SC_DIR_REQ;
     4295                    m_cpt_cas++;
     4296                    r_cas_fsm = CAS_DIR_REQ;
    42354297                }
    42364298                else  // we keep the last word in the FIFO
    42374299                {
    4238                     cmd_sc_fifo_get = true;
     4300                    cmd_cas_fifo_get = true;
    42394301                }
    42404302                // We fill the two buffers
    4241                 if ( r_sc_cpt.read() < 2 ) // 32 bits access
    4242                     r_sc_rdata[r_sc_cpt.read()] = m_cmd_sc_wdata_fifo.read();
    4243 
    4244                 if((r_sc_cpt.read() == 1) && m_cmd_sc_eop_fifo.read())
    4245                     r_sc_wdata = m_cmd_sc_wdata_fifo.read();
    4246 
    4247                 if( r_sc_cpt.read()>3 ) // more than 4 flits...
     4303                if ( r_cas_cpt.read() < 2 ) // 32 bits access
     4304                    r_cas_rdata[r_cas_cpt.read()] = m_cmd_cas_wdata_fifo.read();
     4305
     4306                if((r_cas_cpt.read() == 1) && m_cmd_cas_eop_fifo.read())
     4307                    r_cas_wdata = m_cmd_cas_wdata_fifo.read();
     4308
     4309                if( r_cas_cpt.read()>3 ) // more than 4 flits...
    42484310                {
    4249                     std::cout << "VCI_MEM_CACHE ERROR in SC_IDLE state : illegal SC command"
     4311                    std::cout << "VCI_MEM_CACHE ERROR in CAS_IDLE state : illegal CAS command"
    42504312                              << std::endl;
    42514313                    exit(0);
    42524314                }
    42534315
    4254                 if ( r_sc_cpt.read()==2 )
    4255                     r_sc_wdata = m_cmd_sc_wdata_fifo.read();
    4256 
    4257                 r_sc_cpt = r_sc_cpt.read()+1;
     4316                if ( r_cas_cpt.read()==2 )
     4317                    r_cas_wdata = m_cmd_cas_wdata_fifo.read();
     4318
     4319                r_cas_cpt = r_cas_cpt.read()+1;
    42584320            }
    42594321            break;
     
    42614323       
    42624324        /////////////////
    4263         case SC_DIR_REQ:
    4264         {
    4265             if( r_alloc_dir_fsm.read() == ALLOC_DIR_SC )
    4266             {
    4267               r_sc_fsm = SC_DIR_LOCK;
    4268             }
    4269 
    4270 #if DEBUG_MEMC_SC
    4271             if( m_debug_sc_fsm )
     4325        case CAS_DIR_REQ:
     4326        {
     4327            if( r_alloc_dir_fsm.read() == ALLOC_DIR_CAS )
     4328            {
     4329              r_cas_fsm = CAS_DIR_LOCK;
     4330            }
     4331
     4332#if DEBUG_MEMC_CAS
     4333            if( m_debug_cas_fsm )
    42724334            {
    42734335              std::cout
    4274                 << "  <MEMC " << name() << ".SC_DIR_REQ> Requesting DIR lock "
     4336                << "  <MEMC " << name() << ".CAS_DIR_REQ> Requesting DIR lock "
    42754337                << std::endl;
    42764338            }
     
    42804342
    42814343        /////////////////
    4282         case SC_DIR_LOCK:  // Read the directory
    4283         {
    4284             if( r_alloc_dir_fsm.read() == ALLOC_DIR_SC )
     4344        case CAS_DIR_LOCK:  // Read the directory
     4345        {
     4346            if( r_alloc_dir_fsm.read() == ALLOC_DIR_CAS )
    42854347            {
    42864348                size_t way = 0;
    4287                 DirectoryEntry entry(m_cache_directory.read(m_cmd_sc_addr_fifo.read(), way));
    4288 
    4289                 r_sc_is_cnt     = entry.is_cnt;
    4290                 r_sc_dirty      = entry.dirty;
    4291                 r_sc_tag        = entry.tag;
    4292                 r_sc_way        = way;
    4293                 r_sc_copy       = entry.owner.srcid;
     4349                DirectoryEntry entry(m_cache_directory.read(m_cmd_cas_addr_fifo.read(), way));
     4350
     4351                r_cas_is_cnt     = entry.is_cnt;
     4352                r_cas_dirty      = entry.dirty;
     4353                r_cas_tag        = entry.tag;
     4354                r_cas_way        = way;
     4355                r_cas_copy       = entry.owner.srcid;
    42944356#if L1_MULTI_CACHE
    4295                 r_sc_copy_cache = entry.owner.cache_id;
    4296 #endif
    4297                 r_sc_copy_inst  = entry.owner.inst;
    4298                 r_sc_ptr        = entry.ptr;
    4299                 r_sc_count      = entry.count;
    4300 
    4301                 if ( entry.valid )  r_sc_fsm = SC_DIR_HIT_READ;
    4302                 else          r_sc_fsm = SC_MISS_TRT_LOCK;
    4303 
    4304 #if DEBUG_MEMC_SC
    4305 if( m_debug_sc_fsm )
     4357                r_cas_copy_cache = entry.owner.cache_id;
     4358#endif
     4359                r_cas_copy_inst  = entry.owner.inst;
     4360                r_cas_ptr        = entry.ptr;
     4361                r_cas_count      = entry.count;
     4362
     4363                if ( entry.valid )  r_cas_fsm = CAS_DIR_HIT_READ;
     4364                else          r_cas_fsm = CAS_MISS_TRT_LOCK;
     4365
     4366#if DEBUG_MEMC_CAS
     4367if( m_debug_cas_fsm )
    43064368{
    4307     std::cout << "  <MEMC " << name() << ".SC_DIR_LOCK> Directory acces"
    4308               << " / address = " << std::hex << m_cmd_sc_addr_fifo.read()
     4369    std::cout << "  <MEMC " << name() << ".CAS_DIR_LOCK> Directory acces"
     4370              << " / address = " << std::hex << m_cmd_cas_addr_fifo.read()
    43094371              << " / hit = " << std::dec << entry.valid
    43104372              << " / count = " << entry.count
     
    43174379              std::cout
    43184380                << "VCI_MEM_CACHE ERROR " << name()
    4319                 << " SC_DIR_LOCK state" << std::endl
     4381                << " CAS_DIR_LOCK state" << std::endl
    43204382                << "Bad DIR allocation"   << std::endl;
    43214383
     
    43264388        }
    43274389        /////////////////////
    4328         case SC_DIR_HIT_READ:  // update directory for lock and dirty bit
     4390        case CAS_DIR_HIT_READ:  // update directory for lock and dirty bit
    43294391                               // and check data change in cache
    43304392        {
    4331             size_t way  = r_sc_way.read();
    4332             size_t set  = m_y[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4333             size_t word = m_x[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
     4393            size_t way  = r_cas_way.read();
     4394            size_t set  = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4395            size_t word = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
    43344396
    43354397            // update directory (lock & dirty bits)
    43364398            DirectoryEntry entry;
    43374399            entry.valid          = true;
    4338             entry.is_cnt         = r_sc_is_cnt.read();
     4400            entry.is_cnt         = r_cas_is_cnt.read();
    43394401            entry.dirty          = true;
    43404402            entry.lock           = true;
    4341             entry.tag          = r_sc_tag.read();
    4342             entry.owner.srcid    = r_sc_copy.read();
     4403            entry.tag          = r_cas_tag.read();
     4404            entry.owner.srcid    = r_cas_copy.read();
    43434405#if L1_MULTI_CACHE
    4344             entry.owner.cache_id = r_sc_copy_cache.read();
    4345 #endif
    4346             entry.owner.inst     = r_sc_copy_inst.read();
    4347             entry.count          = r_sc_count.read();
    4348             entry.ptr            = r_sc_ptr.read();
     4406            entry.owner.cache_id = r_cas_copy_cache.read();
     4407#endif
     4408            entry.owner.inst     = r_cas_copy_inst.read();
     4409            entry.count          = r_cas_count.read();
     4410            entry.ptr            = r_cas_ptr.read();
    43494411
    43504412            m_cache_directory.write(set, way, entry);
    43514413
    43524414            // read data in cache & check data change
    4353             bool ok = ( r_sc_rdata[0].read() == m_cache_data[way][set][word] );
    4354             if ( r_sc_cpt.read()==4 )  // 64 bits SC
    4355                 ok &= ( r_sc_rdata[1] == m_cache_data[way][set][word+1] );
     4415            bool ok = ( r_cas_rdata[0].read() == m_cache_data[way][set][word] );
     4416            if ( r_cas_cpt.read()==4 )  // 64 bits CAS
     4417                ok &= ( r_cas_rdata[1] == m_cache_data[way][set][word+1] );
    43564418
    43574419            // to avoid livelock, force the atomic access to fail pseudo-randomly
    4358             bool forced_fail = ( (r_sc_lfsr % (64) == 0) && RANDOMIZE_SC );
    4359             r_sc_lfsr = (r_sc_lfsr >> 1) ^ ((-(r_sc_lfsr & 1)) & 0xd0000001);
     4420            bool forced_fail = ( (r_cas_lfsr % (64) == 0) && RANDOMIZE_CAS );
     4421            r_cas_lfsr = (r_cas_lfsr >> 1) ^ ((-(r_cas_lfsr & 1)) & 0xd0000001);
    43604422
    43614423            if( ok and not forced_fail )  // no data change
    43624424            {
    4363                 r_sc_fsm = SC_DIR_HIT_WRITE;
     4425                r_cas_fsm = CAS_DIR_HIT_WRITE;
    43644426            }
    43654427            else                            // return failure
    43664428            {
    4367                 r_sc_fsm = SC_RSP_FAIL;
    4368             }
    4369 
    4370 #if DEBUG_MEMC_SC
    4371 if( m_debug_sc_fsm )
     4429                r_cas_fsm = CAS_RSP_FAIL;
     4430            }
     4431
     4432#if DEBUG_MEMC_CAS
     4433if( m_debug_cas_fsm )
    43724434{
    4373     std::cout << "  <MEMC " << name() << ".SC_DIR_HIT_READ> Test if SC success:"
    4374               << " / expected value = " << r_sc_rdata[0].read()
     4435    std::cout << "  <MEMC " << name() << ".CAS_DIR_HIT_READ> Test if CAS success:"
     4436              << " / expected value = " << r_cas_rdata[0].read()
    43754437              << " / actual value = " << m_cache_data[way][set][word]
    43764438              << " / forced_fail = " << forced_fail << std::endl;
     
    43804442        }
    43814443        //////////////////////
    4382         case SC_DIR_HIT_WRITE:    // test if a CC transaction is required
     4444        case CAS_DIR_HIT_WRITE:    // test if a CC transaction is required
    43834445                                    // write data in cache if no CC request
    43844446        {
    43854447            // test coherence request
    4386             if(r_sc_count.read())   // replicated line
    4387             {
    4388                 if ( r_sc_is_cnt.read() )
     4448            if(r_cas_count.read())   // replicated line
     4449            {
     4450                if ( r_cas_is_cnt.read() )
    43894451                {
    4390                     r_sc_fsm = SC_BC_TRT_LOCK;    // broadcast invalidate required
     4452                    r_cas_fsm = CAS_BC_TRT_LOCK;    // broadcast invalidate required
    43914453                }
    4392                 else if( !r_sc_to_init_cmd_multi_req.read() &&
    4393                          !r_sc_to_init_cmd_brdcast_req.read()  )
     4454                else if( !r_cas_to_init_cmd_multi_req.read() &&
     4455                         !r_cas_to_init_cmd_brdcast_req.read()  )
    43944456                {
    4395                     r_sc_fsm = SC_UPT_LOCK;     // multi update required
     4457                    r_cas_fsm = CAS_UPT_LOCK;     // multi update required
    43964458                }
    43974459                else
    43984460                {
    4399                     r_sc_fsm = SC_WAIT;
     4461                    r_cas_fsm = CAS_WAIT;
    44004462                }
    44014463            }
    44024464            else                    // no copies
    44034465            {
    4404                 size_t way  = r_sc_way.read();
    4405                 size_t set  = m_y[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4406                 size_t word = m_x[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
     4466                size_t way  = r_cas_way.read();
     4467                size_t set  = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4468                size_t word = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
    44074469
    44084470                // cache update
    4409                 m_cache_data[way][set][word] = r_sc_wdata.read();
    4410                 if(r_sc_cpt.read()==4)
    4411                     m_cache_data[way][set][word+1] = m_cmd_sc_wdata_fifo.read();
     4471                m_cache_data[way][set][word] = r_cas_wdata.read();
     4472                if(r_cas_cpt.read()==4)
     4473                    m_cache_data[way][set][word+1] = m_cmd_cas_wdata_fifo.read();
    44124474
    44134475                // monitor
    44144476                if ( m_monitor_ok )
    44154477                {
    4416                     vci_addr_t address = m_cmd_sc_addr_fifo.read();
     4478                    vci_addr_t address = m_cmd_cas_addr_fifo.read();
    44174479                char buf[80];
    4418                 snprintf(buf, 80, "SC_DIR_HIT_WRITE srcid %d", m_cmd_sc_srcid_fifo.read());
    4419                     check_monitor( buf, address, r_sc_wdata.read() );
    4420                     if ( r_sc_cpt.read()==4 )
    4421                     check_monitor( buf, address+4, m_cmd_sc_wdata_fifo.read() );
     4480                snprintf(buf, 80, "CAS_DIR_HIT_WRITE srcid %d", m_cmd_cas_srcid_fifo.read());
     4481                    check_monitor( buf, address, r_cas_wdata.read() );
     4482                    if ( r_cas_cpt.read()==4 )
     4483                    check_monitor( buf, address+4, m_cmd_cas_wdata_fifo.read() );
    44224484                }
    4423                 r_sc_fsm = SC_RSP_SUCCESS;
    4424 
    4425 #if DEBUG_MEMC_SC
    4426 if( m_debug_sc_fsm )
     4485                r_cas_fsm = CAS_RSP_SUCCESS;
     4486
     4487#if DEBUG_MEMC_CAS
     4488if( m_debug_cas_fsm )
    44274489{
    4428     std::cout << "  <MEMC " << name() << ".SC_DIR_HIT_WRITE> Update cache:"
     4490    std::cout << "  <MEMC " << name() << ".CAS_DIR_HIT_WRITE> Update cache:"
    44294491              << " way = " << std::dec << way
    44304492              << " / set = " << set
    44314493              << " / word = " << word
    4432               << " / value = " << r_sc_wdata.read()
    4433               << " / count = " << r_sc_count.read() << std::endl;
     4494              << " / value = " << r_cas_wdata.read()
     4495              << " / count = " << r_cas_count.read() << std::endl;
    44344496}
    44354497#endif
     
    44384500        }
    44394501        /////////////////
    4440         case SC_UPT_LOCK:  // try to register the transaction in UPT
     4502        case CAS_UPT_LOCK:  // try to register the transaction in UPT
    44414503                           // and write data in cache if successful registration
    44424504                           // releases locks to retry later if UPT full
    44434505        {
    4444             if ( r_alloc_upt_fsm.read() == ALLOC_UPT_SC )
     4506            if ( r_alloc_upt_fsm.read() == ALLOC_UPT_CAS )
    44454507            {
    44464508                bool        wok        = false;
    44474509                size_t      index      = 0;
    4448                 size_t      srcid      = m_cmd_sc_srcid_fifo.read();
    4449                 size_t      trdid      = m_cmd_sc_trdid_fifo.read();
    4450                 size_t      pktid      = m_cmd_sc_pktid_fifo.read();
    4451                 addr_t      nline      = m_nline[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4452                 size_t      nb_copies  = r_sc_count.read();
     4510                size_t      srcid      = m_cmd_cas_srcid_fifo.read();
     4511                size_t      trdid      = m_cmd_cas_trdid_fifo.read();
     4512                size_t      pktid      = m_cmd_cas_pktid_fifo.read();
     4513                addr_t      nline      = m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4514                size_t      nb_copies  = r_cas_count.read();
    44534515
    44544516                wok = m_update_tab.set(true,  // it's an update transaction
     
    44644526                {
    44654527                    // cache update
    4466                     size_t way  = r_sc_way.read();
    4467                     size_t set  = m_y[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4468                     size_t word = m_x[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4469 
    4470                     m_cache_data[way][set][word] = r_sc_wdata.read();
    4471                     if(r_sc_cpt.read()==4)
    4472                         m_cache_data[way][set][word+1] = m_cmd_sc_wdata_fifo.read();
     4528                    size_t way  = r_cas_way.read();
     4529                    size_t set  = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4530                    size_t word = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4531
     4532                    m_cache_data[way][set][word] = r_cas_wdata.read();
     4533                    if(r_cas_cpt.read()==4)
     4534                        m_cache_data[way][set][word+1] = m_cmd_cas_wdata_fifo.read();
    44734535
    44744536                    // monitor
    44754537                    if ( m_monitor_ok )
    44764538                    {
    4477                         vci_addr_t address = m_cmd_sc_addr_fifo.read();
     4539                        vci_addr_t address = m_cmd_cas_addr_fifo.read();
    44784540                    char buf[80];
    4479                     snprintf(buf, 80, "SC_DIR_HIT_WRITE srcid %d", m_cmd_sc_srcid_fifo.read());
    4480                         check_monitor( buf, address, r_sc_wdata.read() );
    4481                         if ( r_sc_cpt.read()==4 )
    4482                         check_monitor( buf, address+4, m_cmd_sc_wdata_fifo.read() );
     4541                    snprintf(buf, 80, "CAS_DIR_HIT_WRITE srcid %d", m_cmd_cas_srcid_fifo.read());
     4542                        check_monitor( buf, address, r_cas_wdata.read() );
     4543                        if ( r_cas_cpt.read()==4 )
     4544                        check_monitor( buf, address+4, m_cmd_cas_wdata_fifo.read() );
    44834545                    }
    44844546
    4485                     r_sc_upt_index = index;
    4486                     r_sc_fsm = SC_UPT_HEAP_LOCK;
     4547                    r_cas_upt_index = index;
     4548                    r_cas_fsm = CAS_UPT_HEAP_LOCK;
    44874549                }
    44884550                else       //  releases the locks protecting UPT and DIR UPT full
    44894551                {
    4490                     r_sc_fsm = SC_WAIT;
     4552                    r_cas_fsm = CAS_WAIT;
    44914553                }
    44924554
    4493 #if DEBUG_MEMC_SC
    4494 if( m_debug_sc_fsm )
     4555#if DEBUG_MEMC_CAS
     4556if( m_debug_cas_fsm )
    44954557{
    4496     std::cout << "  <MEMC " << name() << ".SC_UPT_LOCK> Register multi-update transaction in UPT"
     4558    std::cout << "  <MEMC " << name() << ".CAS_UPT_LOCK> Register multi-update transaction in UPT"
    44974559              << " / wok = " << wok
    44984560              << " / nline  = " << std::hex << nline
     
    45044566        }
    45054567        /////////////
    4506         case SC_WAIT:   // release all locks and retry from beginning
    4507         {
    4508 
    4509 #if DEBUG_MEMC_SC
    4510 if( m_debug_sc_fsm )
     4568        case CAS_WAIT:   // release all locks and retry from beginning
     4569        {
     4570
     4571#if DEBUG_MEMC_CAS
     4572if( m_debug_cas_fsm )
    45114573{
    4512     std::cout << "  <MEMC " << name() << ".SC_WAIT> Release all locks" << std::endl;
     4574    std::cout << "  <MEMC " << name() << ".CAS_WAIT> Release all locks" << std::endl;
    45134575}
    45144576#endif
    4515             r_sc_fsm = SC_DIR_REQ;
     4577            r_cas_fsm = CAS_DIR_REQ;
    45164578            break;
    45174579        }
    45184580        //////////////////
    4519         case SC_UPT_HEAP_LOCK:  // lock the heap
    4520         {
    4521             if( r_alloc_heap_fsm.read() == ALLOC_HEAP_SC )
    4522             {
    4523 
    4524 #if DEBUG_MEMC_SC
    4525 if( m_debug_sc_fsm )
     4581        case CAS_UPT_HEAP_LOCK:  // lock the heap
     4582        {
     4583            if( r_alloc_heap_fsm.read() == ALLOC_HEAP_CAS )
     4584            {
     4585
     4586#if DEBUG_MEMC_CAS
     4587if( m_debug_cas_fsm )
    45264588{
    4527     std::cout << "  <MEMC " << name() << ".SC_UPT_HEAP_LOCK> Get access to the heap" << std::endl;
     4589    std::cout << "  <MEMC " << name() << ".CAS_UPT_HEAP_LOCK> Get access to the heap" << std::endl;
    45284590}
    45294591#endif
    4530                 r_sc_fsm = SC_UPT_REQ;
     4592                r_cas_fsm = CAS_UPT_REQ;
    45314593            }
    45324594            break;
    45334595        }
    45344596        ////////////////
    4535         case SC_UPT_REQ:  // send a first update request to INIT_CMD FSM
    4536         {
    4537             assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_SC) and
     4597        case CAS_UPT_REQ:  // send a first update request to INIT_CMD FSM
     4598        {
     4599            assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_CAS) and
    45384600                   "VCI_MEM_CACHE ERROR : bad HEAP allocation");
    45394601
    4540             if( !r_sc_to_init_cmd_multi_req.read() && !r_sc_to_init_cmd_brdcast_req.read() )
    4541             {
    4542                 r_sc_to_init_cmd_brdcast_req  = false;
    4543                 r_sc_to_init_cmd_trdid        = r_sc_upt_index.read();
    4544                 r_sc_to_init_cmd_nline        = m_nline[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4545                 r_sc_to_init_cmd_index        = m_x[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4546                 r_sc_to_init_cmd_wdata        = r_sc_wdata.read();
    4547 
    4548                 if(r_sc_cpt.read() == 4)
     4602            if( !r_cas_to_init_cmd_multi_req.read() && !r_cas_to_init_cmd_brdcast_req.read() )
     4603            {
     4604                r_cas_to_init_cmd_brdcast_req  = false;
     4605                r_cas_to_init_cmd_trdid        = r_cas_upt_index.read();
     4606                r_cas_to_init_cmd_nline        = m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4607                r_cas_to_init_cmd_index        = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4608                r_cas_to_init_cmd_wdata        = r_cas_wdata.read();
     4609
     4610                if(r_cas_cpt.read() == 4)
    45494611                {
    4550                     r_sc_to_init_cmd_is_long    = true;
    4551                     r_sc_to_init_cmd_wdata_high = m_cmd_sc_wdata_fifo.read();
     4612                    r_cas_to_init_cmd_is_long    = true;
     4613                    r_cas_to_init_cmd_wdata_high = m_cmd_cas_wdata_fifo.read();
    45524614                }
    45534615                else
    45544616                {
    4555                     r_sc_to_init_cmd_is_long    = false;
    4556                     r_sc_to_init_cmd_wdata_high = 0;
     4617                    r_cas_to_init_cmd_is_long    = false;
     4618                    r_cas_to_init_cmd_wdata_high = 0;
    45574619                }
    45584620
    45594621                // We put the first copy in the fifo
    4560                 sc_to_init_cmd_fifo_put     = true;
    4561                 sc_to_init_cmd_fifo_inst    = r_sc_copy_inst.read();
    4562                 sc_to_init_cmd_fifo_srcid   = r_sc_copy.read();
     4622                cas_to_init_cmd_fifo_put     = true;
     4623                cas_to_init_cmd_fifo_inst    = r_cas_copy_inst.read();
     4624                cas_to_init_cmd_fifo_srcid   = r_cas_copy.read();
    45634625#if L1_MULTI_CACHE
    4564                 sc_to_init_cmd_fifo_cache_id= r_sc_copy_cache.read();
    4565 #endif
    4566                 if(r_sc_count.read() == 1) // one single copy
     4626                cas_to_init_cmd_fifo_cache_id= r_cas_copy_cache.read();
     4627#endif
     4628                if(r_cas_count.read() == 1) // one single copy
    45674629                {
    4568                     r_sc_fsm = SC_IDLE;   // Response will be sent after receiving
     4630                    r_cas_fsm = CAS_IDLE;   // Response will be sent after receiving
    45694631                                            // update responses
    4570                     cmd_sc_fifo_get            = true;
    4571                     r_sc_to_init_cmd_multi_req = true;
    4572                     r_sc_cpt = 0;
     4632                    cmd_cas_fifo_get            = true;
     4633                    r_cas_to_init_cmd_multi_req = true;
     4634                    r_cas_cpt = 0;
    45734635                }
    45744636                else      // several copies
    45754637                {
    4576                     r_sc_fsm = SC_UPT_NEXT;
     4638                    r_cas_fsm = CAS_UPT_NEXT;
    45774639                }
    45784640
    4579 #if DEBUG_MEMC_SC
    4580 if( m_debug_sc_fsm )
     4641#if DEBUG_MEMC_CAS
     4642if( m_debug_cas_fsm )
    45814643{
    4582     std::cout << "  <MEMC " << name() << ".SC_UPT_REQ> Send the first update request to INIT_CMD FSM "
    4583               << " / address = " << std::hex << m_cmd_sc_addr_fifo.read()
    4584               << " / wdata = " << std::hex << r_sc_wdata.read()
    4585               << " / srcid = " << std::dec << r_sc_copy.read()
    4586               << " / inst = " << std::dec << r_sc_copy_inst.read() << std::endl;
     4644    std::cout << "  <MEMC " << name() << ".CAS_UPT_REQ> Send the first update request to INIT_CMD FSM "
     4645              << " / address = " << std::hex << m_cmd_cas_addr_fifo.read()
     4646              << " / wdata = " << std::hex << r_cas_wdata.read()
     4647              << " / srcid = " << std::dec << r_cas_copy.read()
     4648              << " / inst = " << std::dec << r_cas_copy_inst.read() << std::endl;
    45874649}
    45884650#endif
     
    45914653        }
    45924654        /////////////////
    4593         case SC_UPT_NEXT:     // send a multi-update request to INIT_CMD FSM
    4594         {
    4595             assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_SC)
     4655        case CAS_UPT_NEXT:     // send a multi-update request to INIT_CMD FSM
     4656        {
     4657            assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_CAS)
    45964658                 and "VCI_MEM_CACHE ERROR : bad HEAP allocation");
    45974659
    4598             HeapEntry entry = m_heap.read(r_sc_ptr.read());
    4599             sc_to_init_cmd_fifo_srcid    = entry.owner.srcid;
     4660            HeapEntry entry = m_heap.read(r_cas_ptr.read());
     4661            cas_to_init_cmd_fifo_srcid    = entry.owner.srcid;
    46004662#if L1_MULTI_CACHE
    4601             sc_to_init_cmd_fifo_cache_id = entry.owner.cache_id;
    4602 #endif
    4603             sc_to_init_cmd_fifo_inst     = entry.owner.inst;
    4604             sc_to_init_cmd_fifo_put = true;
    4605 
    4606             if( m_sc_to_init_cmd_inst_fifo.wok() ) // request accepted by INIT_CMD FSM
    4607             {
    4608                 r_sc_ptr = entry.next;
    4609                 if( entry.next == r_sc_ptr.read() )  // last copy
     4663            cas_to_init_cmd_fifo_cache_id = entry.owner.cache_id;
     4664#endif
     4665            cas_to_init_cmd_fifo_inst     = entry.owner.inst;
     4666            cas_to_init_cmd_fifo_put = true;
     4667
     4668            if( m_cas_to_init_cmd_inst_fifo.wok() ) // request accepted by INIT_CMD FSM
     4669            {
     4670                r_cas_ptr = entry.next;
     4671                if( entry.next == r_cas_ptr.read() )  // last copy
    46104672                {
    4611                     r_sc_to_init_cmd_multi_req = true;
    4612                     r_sc_fsm = SC_IDLE;   // Response will be sent after receiving
     4673                    r_cas_to_init_cmd_multi_req = true;
     4674                    r_cas_fsm = CAS_IDLE;   // Response will be sent after receiving
    46134675                                            // all update responses
    4614                     cmd_sc_fifo_get = true;
    4615                     r_sc_cpt        = 0;
     4676                    cmd_cas_fifo_get = true;
     4677                    r_cas_cpt        = 0;
    46164678                }
    46174679            }
    46184680
    4619 #if DEBUG_MEMC_SC
    4620 if( m_debug_sc_fsm )
     4681#if DEBUG_MEMC_CAS
     4682if( m_debug_cas_fsm )
    46214683{
    4622     std::cout << "  <MEMC " << name() << ".SC_UPT_NEXT> Send the next update request to INIT_CMD FSM "
    4623               << " / address = " << std::hex << m_cmd_sc_addr_fifo.read()
    4624               << " / wdata = " << std::hex << r_sc_wdata.read()
     4684    std::cout << "  <MEMC " << name() << ".CAS_UPT_NEXT> Send the next update request to INIT_CMD FSM "
     4685              << " / address = " << std::hex << m_cmd_cas_addr_fifo.read()
     4686              << " / wdata = " << std::hex << r_cas_wdata.read()
    46254687              << " / srcid = " << std::dec << entry.owner.srcid
    46264688              << " / inst = " << std::dec << entry.owner.inst << std::endl;
     
    46304692        }
    46314693        /////////////////////
    4632         case SC_BC_TRT_LOCK:      // check the TRT to register a PUT transaction
    4633         {
    4634             if( r_alloc_trt_fsm.read() == ALLOC_TRT_SC )
    4635             {
    4636                 if( !r_sc_to_ixr_cmd_req )  // we can transfer the request to IXR_CMD FSM
     4694        case CAS_BC_TRT_LOCK:      // check the TRT to register a PUT transaction
     4695        {
     4696            if( r_alloc_trt_fsm.read() == ALLOC_TRT_CAS )
     4697            {
     4698                if( !r_cas_to_ixr_cmd_req )  // we can transfer the request to IXR_CMD FSM
    46374699                {
    46384700                    // fill the data buffer
    4639                     size_t way  = r_sc_way.read();
    4640                     size_t set  = m_y[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4641                         size_t word = m_x[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
     4701                    size_t way  = r_cas_way.read();
     4702                    size_t set  = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4703                        size_t word = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
    46424704                    for(size_t i = 0; i<m_words; i++)
    46434705                    {
    46444706                        if (i == word)
    46454707                        {
    4646                             r_sc_to_ixr_cmd_data[i] = r_sc_wdata.read();
     4708                            r_cas_to_ixr_cmd_data[i] = r_cas_wdata.read();
    46474709                        }
    4648                         else if ( (i == word+1) && (r_sc_cpt.read()==4) ) // 64 bit SC
     4710                        else if ( (i == word+1) && (r_cas_cpt.read()==4) ) // 64 bit CAS
    46494711                        {
    4650                             r_sc_to_ixr_cmd_data[i] = m_cmd_sc_wdata_fifo.read();
     4712                            r_cas_to_ixr_cmd_data[i] = m_cmd_cas_wdata_fifo.read();
    46514713                        }
    46524714                        else
    46534715                        {
    4654                             r_sc_to_ixr_cmd_data[i] = m_cache_data[way][set][i];
     4716                            r_cas_to_ixr_cmd_data[i] = m_cache_data[way][set][i];
    46554717                        }
    46564718                    }
     
    46594721                    if ( wok )
    46604722                    {
    4661                         r_sc_trt_index = wok_index;
    4662                         r_sc_fsm       = SC_BC_UPT_LOCK;
     4723                        r_cas_trt_index = wok_index;
     4724                        r_cas_fsm       = CAS_BC_UPT_LOCK;
    46634725                    }
    46644726                    else
    46654727                    {
    4666                         r_sc_fsm       = SC_WAIT;
     4728                        r_cas_fsm       = CAS_WAIT;
    46674729                    }
    46684730                }
    46694731                else
    46704732                {
    4671                     r_sc_fsm = SC_WAIT;
     4733                    r_cas_fsm = CAS_WAIT;
    46724734                }
    46734735            }
     
    46754737        }
    46764738        ///////////////////
    4677         case SC_BC_UPT_LOCK:  // register a broadcast inval transaction in UPT
     4739        case CAS_BC_UPT_LOCK:  // register a broadcast inval transaction in UPT
    46784740                              // write data in cache in case of successful registration
    46794741        {
    4680             if ( r_alloc_upt_fsm.read() == ALLOC_UPT_SC )
     4742            if ( r_alloc_upt_fsm.read() == ALLOC_UPT_CAS )
    46814743            {
    46824744                bool        wok       = false;
    46834745                size_t      index     = 0;
    4684                 size_t      srcid     = m_cmd_sc_srcid_fifo.read();
    4685                 size_t      trdid     = m_cmd_sc_trdid_fifo.read();
    4686                 size_t      pktid     = m_cmd_sc_pktid_fifo.read();
    4687                 addr_t      nline     = m_nline[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4688                 size_t      nb_copies = r_sc_count.read();
     4746                size_t      srcid     = m_cmd_cas_srcid_fifo.read();
     4747                size_t      trdid     = m_cmd_cas_trdid_fifo.read();
     4748                size_t      pktid     = m_cmd_cas_pktid_fifo.read();
     4749                addr_t      nline     = m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4750                size_t      nb_copies = r_cas_count.read();
    46894751
    46904752                // register a broadcast inval transaction in UPT
     
    47024764                {
    47034765                    // cache update
    4704                     size_t way  = r_sc_way.read();
    4705                     size_t set  = m_y[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4706                     size_t word = m_x[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4707 
    4708                     m_cache_data[way][set][word] = r_sc_wdata.read();
    4709                     if(r_sc_cpt.read()==4)
    4710                         m_cache_data[way][set][word+1] = m_cmd_sc_wdata_fifo.read();
     4766                    size_t way  = r_cas_way.read();
     4767                    size_t set  = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4768                    size_t word = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4769
     4770                    m_cache_data[way][set][word] = r_cas_wdata.read();
     4771                    if(r_cas_cpt.read()==4)
     4772                        m_cache_data[way][set][word+1] = m_cmd_cas_wdata_fifo.read();
    47114773
    47124774                    // monitor
    47134775                    if ( m_monitor_ok )
    47144776                    {
    4715                         vci_addr_t address = m_cmd_sc_addr_fifo.read();
     4777                        vci_addr_t address = m_cmd_cas_addr_fifo.read();
    47164778                    char buf[80];
    4717                     snprintf(buf, 80, "SC_DIR_HIT_WRITE srcid %d", m_cmd_sc_srcid_fifo.read());
    4718                         check_monitor( buf, address, r_sc_wdata.read() );
    4719                         if ( r_sc_cpt.read()==4 )
    4720                         check_monitor( buf, address+4, m_cmd_sc_wdata_fifo.read() );
     4779                    snprintf(buf, 80, "CAS_DIR_HIT_WRITE srcid %d", m_cmd_cas_srcid_fifo.read());
     4780                        check_monitor( buf, address, r_cas_wdata.read() );
     4781                        if ( r_cas_cpt.read()==4 )
     4782                        check_monitor( buf, address+4, m_cmd_cas_wdata_fifo.read() );
    47214783                    }
    4722                     r_sc_upt_index = index;
    4723                     r_sc_fsm = SC_BC_DIR_INVAL;
    4724 #if DEBUG_MEMC_SC
    4725 if( m_debug_sc_fsm )
     4784                    r_cas_upt_index = index;
     4785                    r_cas_fsm = CAS_BC_DIR_INVAL;
     4786#if DEBUG_MEMC_CAS
     4787if( m_debug_cas_fsm )
    47264788{
    4727     std::cout << "  <MEMC " << name() << ".SC_BC_UPT_LOCK> Register a broadcast inval transaction in UPT"
     4789    std::cout << "  <MEMC " << name() << ".CAS_BC_UPT_LOCK> Register a broadcast inval transaction in UPT"
    47284790              << " / nline = " << nline
    47294791              << " / count = " << nb_copies
     
    47344796                else      //  releases the lock protecting UPT
    47354797                {
    4736                      r_sc_fsm = SC_WAIT;
     4798                     r_cas_fsm = CAS_WAIT;
    47374799                }
    47384800            }
     
    47404802        }
    47414803        //////////////////
    4742         case SC_BC_DIR_INVAL:  // Register the PUT transaction in TRT, and inval the DIR entry
    4743         {
    4744             if ( (r_alloc_trt_fsm.read() == ALLOC_TRT_SC ) &&
    4745                  (r_alloc_upt_fsm.read() == ALLOC_UPT_SC ) &&
    4746                  (r_alloc_dir_fsm.read() == ALLOC_DIR_SC ))
     4804        case CAS_BC_DIR_INVAL:  // Register the PUT transaction in TRT, and inval the DIR entry
     4805        {
     4806            if ( (r_alloc_trt_fsm.read() == ALLOC_TRT_CAS ) &&
     4807                 (r_alloc_upt_fsm.read() == ALLOC_UPT_CAS ) &&
     4808                 (r_alloc_dir_fsm.read() == ALLOC_DIR_CAS ))
    47474809            {
    47484810                // set TRT
    4749                 m_transaction_tab.set(r_sc_trt_index.read(),
     4811                m_transaction_tab.set(r_cas_trt_index.read(),
    47504812                                      false,    // PUT request to XRAM
    4751                                       m_nline[(vci_addr_t)(m_cmd_sc_addr_fifo.read())],
     4813                                      m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())],
    47524814                                      0,
    47534815                                      0,
     
    47734835                entry.owner.inst    = false;
    47744836                entry.ptr           = 0;
    4775                 size_t set          = m_y[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4776                 size_t way          = r_sc_way.read();
     4837                size_t set          = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4838                size_t way          = r_cas_way.read();
    47774839                m_cache_directory.write(set, way, entry);
    47784840
    4779                 r_sc_fsm = SC_BC_CC_SEND;
    4780 
    4781 #if DEBUG_MEMC_SC
    4782 if( m_debug_sc_fsm )
     4841                r_cas_fsm = CAS_BC_CC_SEND;
     4842
     4843#if DEBUG_MEMC_CAS
     4844if( m_debug_cas_fsm )
    47834845{
    4784     std::cout << "  <MEMC " << name() << ".SC_BC_DIR_INVAL> Register the PUT in TRT and invalidate DIR entry"
    4785               << " / nline = " << std::hex << m_nline[(vci_addr_t)(m_cmd_sc_addr_fifo.read())]
     4846    std::cout << "  <MEMC " << name() << ".CAS_BC_DIR_INVAL> Register the PUT in TRT and invalidate DIR entry"
     4847              << " / nline = " << std::hex << m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]
    47864848              << " / set = " << std::dec << set << " / way = " << way << std::endl;
    47874849}
     
    47904852            else
    47914853            {
    4792                 assert(false and "LOCK ERROR in SC_FSM, STATE = SC_BC_DIR_INVAL");
     4854                assert(false and "LOCK ERROR in CAS_FSM, STATE = CAS_BC_DIR_INVAL");
    47934855            }
    47944856            break;
    47954857        }
    47964858        ///////////////////
    4797         case SC_BC_CC_SEND:  // Request the broadcast inval to INIT_CMD FSM
    4798         {
    4799             if ( !r_sc_to_init_cmd_multi_req.read() &&
    4800                  !r_sc_to_init_cmd_brdcast_req.read())
    4801             {
    4802                 r_sc_to_init_cmd_multi_req    = false;
    4803                 r_sc_to_init_cmd_brdcast_req  = true;
    4804                 r_sc_to_init_cmd_trdid        = r_sc_upt_index.read();
    4805                 r_sc_to_init_cmd_nline        = m_nline[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4806                 r_sc_to_init_cmd_index        = 0;
    4807                 r_sc_to_init_cmd_wdata        = 0;
    4808 
    4809                 r_sc_fsm = SC_BC_XRAM_REQ;
     4859        case CAS_BC_CC_SEND:  // Request the broadcast inval to INIT_CMD FSM
     4860        {
     4861            if ( !r_cas_to_init_cmd_multi_req.read() &&
     4862                 !r_cas_to_init_cmd_brdcast_req.read())
     4863            {
     4864                r_cas_to_init_cmd_multi_req    = false;
     4865                r_cas_to_init_cmd_brdcast_req  = true;
     4866                r_cas_to_init_cmd_trdid        = r_cas_upt_index.read();
     4867                r_cas_to_init_cmd_nline        = m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4868                r_cas_to_init_cmd_index        = 0;
     4869                r_cas_to_init_cmd_wdata        = 0;
     4870
     4871                r_cas_fsm = CAS_BC_XRAM_REQ;
    48104872            }
    48114873            break;
    48124874        }
    48134875        ////////////////////
    4814         case SC_BC_XRAM_REQ: // request the IXR FSM to start a put transaction
    4815         {
    4816             if ( !r_sc_to_ixr_cmd_req )
    4817             {
    4818                 r_sc_to_ixr_cmd_req     = true;
    4819                 r_sc_to_ixr_cmd_write   = true;
    4820                 r_sc_to_ixr_cmd_nline   = m_nline[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];
    4821                 r_sc_to_ixr_cmd_trdid   = r_sc_trt_index.read();
    4822                 r_sc_fsm                = SC_IDLE;
    4823                 cmd_sc_fifo_get         = true;
    4824                 r_sc_cpt                = 0;
    4825 
    4826 #if DEBUG_MEMC_SC
    4827 if( m_debug_sc_fsm )
     4876        case CAS_BC_XRAM_REQ: // request the IXR FSM to start a put transaction
     4877        {
     4878            if ( !r_cas_to_ixr_cmd_req )
     4879            {
     4880                r_cas_to_ixr_cmd_req     = true;
     4881                r_cas_to_ixr_cmd_write   = true;
     4882                r_cas_to_ixr_cmd_nline   = m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())];
     4883                r_cas_to_ixr_cmd_trdid   = r_cas_trt_index.read();
     4884                r_cas_fsm                = CAS_IDLE;
     4885                cmd_cas_fifo_get         = true;
     4886                r_cas_cpt                = 0;
     4887
     4888#if DEBUG_MEMC_CAS
     4889if( m_debug_cas_fsm )
    48284890{
    4829     std::cout << "  <MEMC " << name() << ".SC_BC_XRAM_REQ> Request a PUT transaction to IXR_CMD FSM" << std::hex
    4830               << " / nline = " << m_nline[(vci_addr_t)m_cmd_sc_addr_fifo.read()]
    4831               << " / trt_index = " << r_sc_trt_index.read() << std::endl;
     4891    std::cout << "  <MEMC " << name() << ".CAS_BC_XRAM_REQ> Request a PUT transaction to IXR_CMD FSM" << std::hex
     4892              << " / nline = " << m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()]
     4893              << " / trt_index = " << r_cas_trt_index.read() << std::endl;
    48324894}
    48334895#endif
     
    48354897            else
    48364898            {
    4837                std::cout << "MEM_CACHE, SC_BC_XRAM_REQ state : request should not have been previously set"
     4899               std::cout << "MEM_CACHE, CAS_BC_XRAM_REQ state : request should not have been previously set"
    48384900                         << std::endl;
    48394901            }
     
    48414903        }
    48424904        /////////////////
    4843         case SC_RSP_FAIL:  // request TGT_RSP FSM to send a failure response
    4844         {
    4845             if( !r_sc_to_tgt_rsp_req )
    4846             {
    4847                 cmd_sc_fifo_get     = true;
    4848                 r_sc_cpt              = 0;
    4849                 r_sc_to_tgt_rsp_req = true;
    4850                 r_sc_to_tgt_rsp_data  = 1;
    4851                 r_sc_to_tgt_rsp_srcid = m_cmd_sc_srcid_fifo.read();
    4852                 r_sc_to_tgt_rsp_trdid = m_cmd_sc_trdid_fifo.read();
    4853                 r_sc_to_tgt_rsp_pktid = m_cmd_sc_pktid_fifo.read();
    4854                 r_sc_fsm              = SC_IDLE;
    4855 
    4856 #if DEBUG_MEMC_SC
    4857 if( m_debug_sc_fsm )
     4905        case CAS_RSP_FAIL:  // request TGT_RSP FSM to send a failure response
     4906        {
     4907            if( !r_cas_to_tgt_rsp_req )
     4908            {
     4909                cmd_cas_fifo_get     = true;
     4910                r_cas_cpt              = 0;
     4911                r_cas_to_tgt_rsp_req = true;
     4912                r_cas_to_tgt_rsp_data  = 1;
     4913                r_cas_to_tgt_rsp_srcid = m_cmd_cas_srcid_fifo.read();
     4914                r_cas_to_tgt_rsp_trdid = m_cmd_cas_trdid_fifo.read();
     4915                r_cas_to_tgt_rsp_pktid = m_cmd_cas_pktid_fifo.read();
     4916                r_cas_fsm              = CAS_IDLE;
     4917
     4918#if DEBUG_MEMC_CAS
     4919if( m_debug_cas_fsm )
    48584920{
    4859     std::cout << "  <MEMC " << name() << ".SC_RSP_FAIL> Request TGT_RSP to send a failure response" << std::endl;
     4921    std::cout << "  <MEMC " << name() << ".CAS_RSP_FAIL> Request TGT_RSP to send a failure response" << std::endl;
    48604922}
    48614923#endif
     
    48644926        }
    48654927        ////////////////////
    4866         case SC_RSP_SUCCESS:  // request TGT_RSP FSM to send a success response
    4867         {
    4868             if( !r_sc_to_tgt_rsp_req )
    4869             {
    4870                 cmd_sc_fifo_get       = true;
    4871                 r_sc_cpt              = 0;
    4872                 r_sc_to_tgt_rsp_req = true;
    4873                 r_sc_to_tgt_rsp_data  = 0;
    4874                 r_sc_to_tgt_rsp_srcid = m_cmd_sc_srcid_fifo.read();
    4875                 r_sc_to_tgt_rsp_trdid = m_cmd_sc_trdid_fifo.read();
    4876                 r_sc_to_tgt_rsp_pktid = m_cmd_sc_pktid_fifo.read();
    4877                 r_sc_fsm              = SC_IDLE;
    4878 
    4879 #if DEBUG_MEMC_SC
    4880 if( m_debug_sc_fsm )
     4928        case CAS_RSP_SUCCESS:  // request TGT_RSP FSM to send a success response
     4929        {
     4930            if( !r_cas_to_tgt_rsp_req )
     4931            {
     4932                cmd_cas_fifo_get       = true;
     4933                r_cas_cpt              = 0;
     4934                r_cas_to_tgt_rsp_req = true;
     4935                r_cas_to_tgt_rsp_data  = 0;
     4936                r_cas_to_tgt_rsp_srcid = m_cmd_cas_srcid_fifo.read();
     4937                r_cas_to_tgt_rsp_trdid = m_cmd_cas_trdid_fifo.read();
     4938                r_cas_to_tgt_rsp_pktid = m_cmd_cas_pktid_fifo.read();
     4939                r_cas_fsm              = CAS_IDLE;
     4940
     4941#if DEBUG_MEMC_CAS
     4942if( m_debug_cas_fsm )
    48814943{
    4882     std::cout << "  <MEMC " << name() << ".SC_RSP_SUCCESS> Request TGT_RSP to send a success response" << std::endl;
     4944    std::cout << "  <MEMC " << name() << ".CAS_RSP_SUCCESS> Request TGT_RSP to send a success response" << std::endl;
    48834945}
    48844946#endif
     
    48874949        }
    48884950        /////////////////////
    4889         case SC_MISS_TRT_LOCK:         // cache miss : request access to transaction Table
    4890         {
    4891             if( r_alloc_trt_fsm.read() == ALLOC_TRT_SC )
     4951        case CAS_MISS_TRT_LOCK:         // cache miss : request access to transaction Table
     4952        {
     4953            if( r_alloc_trt_fsm.read() == ALLOC_TRT_CAS )
    48924954            {
    48934955                size_t   index = 0;
    48944956                bool hit_read = m_transaction_tab.hit_read(
    4895                                   m_nline[(vci_addr_t)m_cmd_sc_addr_fifo.read()],index);
     4957                                  m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()],index);
    48964958                bool hit_write = m_transaction_tab.hit_write(
    4897                                    m_nline[(vci_addr_t)m_cmd_sc_addr_fifo.read()]);
     4959                                   m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()]);
    48984960                bool wok = !m_transaction_tab.full(index);
    48994961
    4900 #if DEBUG_MEMC_SC
    4901 if( m_debug_sc_fsm )
     4962#if DEBUG_MEMC_CAS
     4963if( m_debug_cas_fsm )
    49024964{
    4903     std::cout << "  <MEMC " << name() << ".SC_MISS_TRT_LOCK> Check TRT state"
     4965    std::cout << "  <MEMC " << name() << ".CAS_MISS_TRT_LOCK> Check TRT state"
    49044966              << " / hit_read = "  << hit_read
    49054967              << " / hit_write = " << hit_write
     
    49114973                if ( hit_read || !wok || hit_write ) // missing line already requested or no space in TRT
    49124974                {
    4913                     r_sc_fsm = SC_WAIT;
     4975                    r_cas_fsm = CAS_WAIT;
    49144976                }
    49154977                else
    49164978                {
    4917                     r_sc_trt_index = index;
    4918                     r_sc_fsm       = SC_MISS_TRT_SET;
     4979                    r_cas_trt_index = index;
     4980                    r_cas_fsm       = CAS_MISS_TRT_SET;
    49194981                }
    49204982            }
     
    49224984        }
    49234985        ////////////////////
    4924         case SC_MISS_TRT_SET: // register the GET transaction in TRT
    4925         {
    4926             if( r_alloc_trt_fsm.read() == ALLOC_TRT_SC )
     4986        case CAS_MISS_TRT_SET: // register the GET transaction in TRT
     4987        {
     4988            if( r_alloc_trt_fsm.read() == ALLOC_TRT_CAS )
    49274989            {
    49284990                std::vector<be_t> be_vector;
     
    49364998                }
    49374999
    4938                 m_transaction_tab.set(r_sc_trt_index.read(),
     5000                m_transaction_tab.set(r_cas_trt_index.read(),
    49395001                                      true,   // read request
    4940                                       m_nline[(vci_addr_t)m_cmd_sc_addr_fifo.read()],
    4941                                       m_cmd_sc_srcid_fifo.read(),
    4942                                       m_cmd_sc_trdid_fifo.read(),
    4943                                       m_cmd_sc_pktid_fifo.read(),
     5002                                      m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()],
     5003                                      m_cmd_cas_srcid_fifo.read(),
     5004                                      m_cmd_cas_trdid_fifo.read(),
     5005                                      m_cmd_cas_pktid_fifo.read(),
    49445006                                      false,    // write request from processor
    49455007                                      0,
     
    49475009                                      be_vector,
    49485010                                      data_vector);
    4949                 r_sc_fsm = SC_MISS_XRAM_REQ;
    4950 
    4951 #if DEBUG_MEMC_SC
    4952 if( m_debug_sc_fsm )
     5011                r_cas_fsm = CAS_MISS_XRAM_REQ;
     5012
     5013#if DEBUG_MEMC_CAS
     5014if( m_debug_cas_fsm )
    49535015{
    4954     std::cout << "  <MEMC " << name() << ".SC_MISS_TRT_SET> Register a GET transaction in TRT" << std::hex
    4955               << " / nline = " << m_nline[(vci_addr_t)m_cmd_sc_addr_fifo.read()]
    4956               << " / trt_index = " << r_sc_trt_index.read() << std::endl;
     5016    std::cout << "  <MEMC " << name() << ".CAS_MISS_TRT_SET> Register a GET transaction in TRT" << std::hex
     5017              << " / nline = " << m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()]
     5018              << " / trt_index = " << r_cas_trt_index.read() << std::endl;
    49575019}
    49585020#endif
     
    49615023        }
    49625024        //////////////////////
    4963         case SC_MISS_XRAM_REQ:  // request the IXR_CMD FSM to fetch the missing line
    4964         {
    4965             if ( !r_sc_to_ixr_cmd_req )
    4966             {
    4967                 r_sc_to_ixr_cmd_req        = true;
    4968                 r_sc_to_ixr_cmd_write      = false;
    4969                 r_sc_to_ixr_cmd_trdid      = r_sc_trt_index.read();
    4970                 r_sc_to_ixr_cmd_nline      = m_nline[(vci_addr_t)m_cmd_sc_addr_fifo.read()];
    4971                 r_sc_fsm                   = SC_WAIT;
    4972 
    4973 #if DEBUG_MEMC_SC
    4974 if( m_debug_sc_fsm )
     5025        case CAS_MISS_XRAM_REQ:  // request the IXR_CMD FSM to fetch the missing line
     5026        {
     5027            if ( !r_cas_to_ixr_cmd_req )
     5028            {
     5029                r_cas_to_ixr_cmd_req        = true;
     5030                r_cas_to_ixr_cmd_write      = false;
     5031                r_cas_to_ixr_cmd_trdid      = r_cas_trt_index.read();
     5032                r_cas_to_ixr_cmd_nline      = m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()];
     5033                r_cas_fsm                   = CAS_WAIT;
     5034
     5035#if DEBUG_MEMC_CAS
     5036if( m_debug_cas_fsm )
    49755037{
    4976     std::cout << "  <MEMC " << name() << ".SC_MISS_XRAM_REQ> Request a GET transaction to IXR_CMD FSM" << std::hex
    4977               << " / nline = " << m_nline[(vci_addr_t)m_cmd_sc_addr_fifo.read()]
    4978               << " / trt_index = " << r_sc_trt_index.read() << std::endl;
     5038    std::cout << "  <MEMC " << name() << ".CAS_MISS_XRAM_REQ> Request a GET transaction to IXR_CMD FSM" << std::hex
     5039              << " / nline = " << m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()]
     5040              << " / trt_index = " << r_cas_trt_index.read() << std::endl;
    49795041}
    49805042#endif
     
    49825044            break;
    49835045        }
    4984     } // end switch r_sc_fsm
     5046    } // end switch r_cas_fsm
    49855047
    49865048
     
    49925054    //
    49935055    // It implements a round-robin priority between the three possible client FSMs
    4994     // XRAM_RSP, WRITE and SC. Each FSM can request two types of services:
     5056    // XRAM_RSP, WRITE and CAS. Each FSM can request two types of services:
    49955057    // - r_xram_rsp_to_init_cmd_multi_req : multi-inval
    49965058    //   r_xram_rsp_to_init_cmd_brdcast_req : broadcast-inval
    49975059    // - r_write_to_init_cmd_multi_req : multi-update
    49985060    //   r_write_to_init_cmd_brdcast_req : broadcast-inval
    4999     // - r_sc_to_init_cmd_multi_req : multi-update
    5000     //   r_sc_to_init_cmd_brdcast_req : broadcast-inval
     5061    // - r_cas_to_init_cmd_multi_req : multi-update
     5062    //   r_cas_to_init_cmd_brdcast_req : broadcast-inval
    50015063    //
    50025064    // An inval request is a single cell VCI write command containing the
     
    50355097                m_cpt_inval++;
    50365098            }
    5037             else if ( m_sc_to_init_cmd_inst_fifo.rok() ||
    5038                       r_sc_to_init_cmd_multi_req.read()  )
    5039             {
    5040                 r_init_cmd_fsm = INIT_CMD_SC_UPDT_NLINE;
     5099            else if ( m_cas_to_init_cmd_inst_fifo.rok() ||
     5100                      r_cas_to_init_cmd_multi_req.read()  )
     5101            {
     5102                r_init_cmd_fsm = INIT_CMD_CAS_UPDT_NLINE;
    50415103                m_cpt_update++;
    50425104            }
    5043             else if( r_sc_to_init_cmd_brdcast_req.read() )
    5044             {
    5045                 r_init_cmd_fsm = INIT_CMD_SC_BRDCAST;
     5105            else if( r_cas_to_init_cmd_brdcast_req.read() )
     5106            {
     5107                r_init_cmd_fsm = INIT_CMD_CAS_BRDCAST;
    50465108                m_cpt_inval++;
    50475109            }
     
    50625124                m_cpt_inval++;
    50635125            }
    5064             else if ( m_sc_to_init_cmd_inst_fifo.rok() ||
    5065                       r_sc_to_init_cmd_multi_req.read()  )
    5066             {
    5067                 r_init_cmd_fsm = INIT_CMD_SC_UPDT_NLINE;
     5126            else if ( m_cas_to_init_cmd_inst_fifo.rok() ||
     5127                      r_cas_to_init_cmd_multi_req.read()  )
     5128            {
     5129                r_init_cmd_fsm = INIT_CMD_CAS_UPDT_NLINE;
    50685130                m_cpt_update++;
    50695131            }
    5070             else if( r_sc_to_init_cmd_brdcast_req.read() )
    5071             {
    5072                 r_init_cmd_fsm = INIT_CMD_SC_BRDCAST;
     5132            else if( r_cas_to_init_cmd_brdcast_req.read() )
     5133            {
     5134                r_init_cmd_fsm = INIT_CMD_CAS_BRDCAST;
    50735135                m_cpt_inval++;
    50745136            }
     
    50875149        }
    50885150        //////////////////////////
    5089         case INIT_CMD_SC_UPDT_IDLE: // SC FSM has highest priority
    5090         {
    5091             if ( m_sc_to_init_cmd_inst_fifo.rok() ||
    5092                  r_sc_to_init_cmd_multi_req.read()  )
    5093             {
    5094                 r_init_cmd_fsm = INIT_CMD_SC_UPDT_NLINE;
     5151        case INIT_CMD_CAS_UPDT_IDLE: // CAS FSM has highest priority
     5152        {
     5153            if ( m_cas_to_init_cmd_inst_fifo.rok() ||
     5154                 r_cas_to_init_cmd_multi_req.read()  )
     5155            {
     5156                r_init_cmd_fsm = INIT_CMD_CAS_UPDT_NLINE;
    50955157                m_cpt_update++;
    50965158            }
    5097             else if( r_sc_to_init_cmd_brdcast_req.read() )
    5098             {
    5099                 r_init_cmd_fsm = INIT_CMD_SC_BRDCAST;
     5159            else if( r_cas_to_init_cmd_brdcast_req.read() )
     5160            {
     5161                r_init_cmd_fsm = INIT_CMD_CAS_BRDCAST;
    51005162                m_cpt_inval++;
    51015163            }
     
    52175279        }
    52185280        /////////////////////////
    5219         case INIT_CMD_SC_BRDCAST: // send a broadcast-inval (from SC FSM)
     5281        case INIT_CMD_CAS_BRDCAST: // send a broadcast-inval (from CAS FSM)
    52205282        {
    52215283            if( p_vci_ini.cmdack )
    52225284            {
    52235285                m_cpt_inval_brdcast++;
    5224                 r_sc_to_init_cmd_brdcast_req = false;
    5225                 r_init_cmd_fsm = INIT_CMD_SC_UPDT_IDLE;
     5286                r_cas_to_init_cmd_brdcast_req = false;
     5287                r_init_cmd_fsm = INIT_CMD_CAS_UPDT_IDLE;
    52265288            }
    52275289            break;
    52285290        }
    52295291        ////////////////////////////
    5230         case INIT_CMD_SC_UPDT_NLINE:   // send nline for a multi-update (from SC FSM)
    5231         {
    5232             if ( m_sc_to_init_cmd_inst_fifo.rok() )
     5292        case INIT_CMD_CAS_UPDT_NLINE:   // send nline for a multi-update (from CAS FSM)
     5293        {
     5294            if ( m_cas_to_init_cmd_inst_fifo.rok() )
    52335295            {
    52345296                if ( p_vci_ini.cmdack )
    52355297                {
    52365298                    m_cpt_update_mult++;
    5237                     r_init_cmd_fsm = INIT_CMD_SC_UPDT_INDEX;
     5299                    r_init_cmd_fsm = INIT_CMD_CAS_UPDT_INDEX;
    52385300                }
    52395301            }
    52405302            else
    52415303            {
    5242                 if( r_sc_to_init_cmd_multi_req.read() ) r_sc_to_init_cmd_multi_req = false;
    5243                 r_init_cmd_fsm = INIT_CMD_SC_UPDT_IDLE;
     5304                if( r_cas_to_init_cmd_multi_req.read() ) r_cas_to_init_cmd_multi_req = false;
     5305                r_init_cmd_fsm = INIT_CMD_CAS_UPDT_IDLE;
    52445306            }
    52455307            break;
    52465308        }
    52475309        ////////////////////////////
    5248         case INIT_CMD_SC_UPDT_INDEX:  // send word index for a multi-update (from SC FSM)
    5249         {
    5250             if ( p_vci_ini.cmdack )  r_init_cmd_fsm = INIT_CMD_SC_UPDT_DATA;
     5310        case INIT_CMD_CAS_UPDT_INDEX:  // send word index for a multi-update (from CAS FSM)
     5311        {
     5312            if ( p_vci_ini.cmdack )  r_init_cmd_fsm = INIT_CMD_CAS_UPDT_DATA;
    52515313            break;
    52525314        }
    52535315        ///////////////////////////
    5254         case INIT_CMD_SC_UPDT_DATA:  // send first data for a multi-update (from SC FSM)
     5316        case INIT_CMD_CAS_UPDT_DATA:  // send first data for a multi-update (from CAS FSM)
    52555317        {
    52565318            if ( p_vci_ini.cmdack )
    52575319            {
    5258                 if ( r_sc_to_init_cmd_is_long.read() )
     5320                if ( r_cas_to_init_cmd_is_long.read() )
    52595321                {
    5260                     r_init_cmd_fsm = INIT_CMD_SC_UPDT_DATA_HIGH;
     5322                    r_init_cmd_fsm = INIT_CMD_CAS_UPDT_DATA_HIGH;
    52615323                }
    52625324                else
    52635325                {
    5264                     sc_to_init_cmd_fifo_get = true;
    5265                     r_init_cmd_fsm = INIT_CMD_SC_UPDT_NLINE;
     5326                    cas_to_init_cmd_fifo_get = true;
     5327                    r_init_cmd_fsm = INIT_CMD_CAS_UPDT_NLINE;
    52665328                }
    52675329            }
     
    52695331        }
    52705332        ////////////////////////
    5271         case INIT_CMD_SC_UPDT_DATA_HIGH:  // send second data for a multi-update (from SC FSM)
     5333        case INIT_CMD_CAS_UPDT_DATA_HIGH:  // send second data for a multi-update (from CAS FSM)
    52725334        {
    52735335            if ( p_vci_ini.cmdack )
    52745336            {
    5275                 sc_to_init_cmd_fifo_get = true;
    5276                 r_init_cmd_fsm = INIT_CMD_SC_UPDT_NLINE;
     5337                cas_to_init_cmd_fifo_get = true;
     5338                r_init_cmd_fsm = INIT_CMD_CAS_UPDT_NLINE;
    52775339            }
    52785340            break;
     
    52875349    // - r_read_to_tgt_rsp_req
    52885350    // - r_write_to_tgt_rsp_req
    5289     // - r_sc_to_tgt_rsp_req
     5351    // - r_cas_to_tgt_rsp_req
    52905352    // - r_cleanup_to_tgt_rsp_req
    52915353    // - r_xram_rsp_to_tgt_rsp_req
    52925354    // - r_init_rsp_to_tgt_rsp_req
    5293     // The  ordering is :  read > write > sc > xram > init > cleanup
     5355    // The  ordering is :  read > write > cas > xram > init > cleanup
    52945356    /////////////////////////////////////////////////////////////////////
    52955357
     
    53005362        {
    53015363          if      ( r_write_to_tgt_rsp_req    ) r_tgt_rsp_fsm = TGT_RSP_WRITE;
    5302           else if ( r_sc_to_tgt_rsp_req     ) r_tgt_rsp_fsm = TGT_RSP_SC;
     5364          else if ( r_cas_to_tgt_rsp_req      ) r_tgt_rsp_fsm = TGT_RSP_CAS  ;
    53035365          else if ( r_xram_rsp_to_tgt_rsp_req )
    53045366          {
     
    53065368            r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read();
    53075369          }
    5308           else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT;
     5370          else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT   ;
    53095371          else if ( r_cleanup_to_tgt_rsp_req  ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP;
    53105372          else if ( r_read_to_tgt_rsp_req     )
     
    53165378        }
    53175379        ////////////////////////
    5318         case TGT_RSP_WRITE_IDLE:  // sc requests have the highest priority
    5319         {
    5320           if      ( r_sc_to_tgt_rsp_req     ) r_tgt_rsp_fsm = TGT_RSP_SC;
     5380        case TGT_RSP_WRITE_IDLE:  // cas requests have the highest priority
     5381        {
     5382          if      ( r_cas_to_tgt_rsp_req      ) r_tgt_rsp_fsm = TGT_RSP_CAS;
    53215383          else if ( r_xram_rsp_to_tgt_rsp_req )
    53225384          {
     
    53245386            r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read();
    53255387          }
    5326           else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT;
     5388          else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT   ;
    53275389          else if ( r_cleanup_to_tgt_rsp_req  ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP;
    53285390          else if ( r_read_to_tgt_rsp_req     )
     
    53365398        }
    53375399        ///////////////////////
    5338         case TGT_RSP_SC_IDLE:   // xram_rsp requests have the highest priority
     5400        case TGT_RSP_CAS_IDLE:   // xram_rsp requests have the highest priority
    53395401        {
    53405402          if ( r_xram_rsp_to_tgt_rsp_req )
     
    53435405            r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read();
    53445406          }
    5345           else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT;
     5407          else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT   ;
     5408          else if ( r_cleanup_to_tgt_rsp_req  ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP;
     5409          else if ( r_read_to_tgt_rsp_req     )
     5410          {
     5411            r_tgt_rsp_fsm = TGT_RSP_READ;
     5412            r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read();
     5413          }
     5414          else if ( r_write_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_WRITE;
     5415          else if ( r_cas_to_tgt_rsp_req   ) r_tgt_rsp_fsm = TGT_RSP_CAS  ;
     5416          break;
     5417        }
     5418        ///////////////////////
     5419        case TGT_RSP_XRAM_IDLE:   // init requests have the highest priority
     5420        {
     5421
     5422          if      ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT   ;
    53465423          else if ( r_cleanup_to_tgt_rsp_req  ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP;
    53475424          else if ( r_read_to_tgt_rsp_req     )
     
    53515428          }
    53525429          else if ( r_write_to_tgt_rsp_req    ) r_tgt_rsp_fsm = TGT_RSP_WRITE;
    5353           else if ( r_sc_to_tgt_rsp_req     ) r_tgt_rsp_fsm = TGT_RSP_SC;
    5354           break;
    5355         }
    5356         ///////////////////////
    5357         case TGT_RSP_XRAM_IDLE:   // init requests have the highest priority
    5358         {
    5359 
    5360           if      ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT;
    5361           else if ( r_cleanup_to_tgt_rsp_req  ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP;
    5362           else if ( r_read_to_tgt_rsp_req     )
    5363           {
    5364             r_tgt_rsp_fsm = TGT_RSP_READ;
    5365             r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read();
    5366           }
    5367           else if ( r_write_to_tgt_rsp_req    ) r_tgt_rsp_fsm = TGT_RSP_WRITE;
    5368           else if ( r_sc_to_tgt_rsp_req     ) r_tgt_rsp_fsm = TGT_RSP_SC;
     5430          else if ( r_cas_to_tgt_rsp_req      ) r_tgt_rsp_fsm = TGT_RSP_CAS  ;
    53695431          else if ( r_xram_rsp_to_tgt_rsp_req )
    53705432          {
     
    53845446          }
    53855447          else if ( r_write_to_tgt_rsp_req    ) r_tgt_rsp_fsm = TGT_RSP_WRITE;
    5386           else if ( r_sc_to_tgt_rsp_req     ) r_tgt_rsp_fsm = TGT_RSP_SC;
     5448          else if ( r_cas_to_tgt_rsp_req      ) r_tgt_rsp_fsm = TGT_RSP_CAS  ;
    53875449          else if ( r_xram_rsp_to_tgt_rsp_req )
    53885450          {
     
    54025464          }
    54035465          else if ( r_write_to_tgt_rsp_req    ) r_tgt_rsp_fsm = TGT_RSP_WRITE;
    5404           else if ( r_sc_to_tgt_rsp_req     ) r_tgt_rsp_fsm = TGT_RSP_SC;
     5466          else if ( r_cas_to_tgt_rsp_req      ) r_tgt_rsp_fsm = TGT_RSP_CAS  ;
    54055467          else if ( r_xram_rsp_to_tgt_rsp_req )
    54065468          {
     
    54085470            r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read();
    54095471          }
    5410           else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT;
     5472          else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT   ;
    54115473          else if ( r_cleanup_to_tgt_rsp_req  ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP;
    54125474          break;
     
    54245486              << " / rsrcid = " << std::dec << r_read_to_tgt_rsp_srcid.read()
    54255487              << " / rtrdid = " << r_read_to_tgt_rsp_trdid.read()
     5488              << " / rpktid = " << r_read_to_tgt_rsp_pktid.read()
    54265489              << " / rdata = " << std::hex << r_read_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read()
    54275490              << " / cpt = " << std::dec << r_tgt_rsp_cpt.read() << std::endl;
     
    54515514    std::cout << "  <MEMC " << name() << ".TGT_RSP_WRITE> Write response"
    54525515              << " / rsrcid = " << std::dec << r_write_to_tgt_rsp_srcid.read()
    5453               << " / rtrdid = " << r_write_to_tgt_rsp_trdid.read() << std::endl;
     5516              << " / rtrdid = " << r_write_to_tgt_rsp_trdid.read()
     5517              << " / rpktid = " << r_write_to_tgt_rsp_pktid.read() << std::endl;
    54545518}
    54555519#endif
     
    54705534    std::cout << "  <MEMC " << name() << ".TGT_RSP_CLEANUP> Cleanup response"
    54715535              << " / rsrcid = " << std::dec << r_cleanup_to_tgt_rsp_srcid.read()
    5472               << " / rtrdid = " << r_cleanup_to_tgt_rsp_trdid.read() << std::endl;
     5536              << " / rtrdid = " << r_cleanup_to_tgt_rsp_trdid.read()
     5537              << " / rpktid = " << r_cleanup_to_tgt_rsp_pktid.read() << std::endl;
    54735538}
    54745539#endif
     
    54795544        }
    54805545        //////////////////
    5481         case TGT_RSP_SC:    // send one atomic word response
     5546        case TGT_RSP_CAS:    // send one atomic word response
    54825547        {
    54835548            if ( p_vci_tgt.rspack )
     
    54875552if( m_debug_tgt_rsp_fsm )
    54885553{
    5489     std::cout << "  <MEMC " << name() << ".TGT_RSP_SC> SC response"
    5490               << " / rsrcid = " << std::dec << r_sc_to_tgt_rsp_srcid.read()
    5491               << " / rtrdid = " << r_sc_to_tgt_rsp_trdid.read() << std::endl;
     5554    std::cout << "  <MEMC " << name() << ".TGT_RSP_CAS> CAS response"
     5555              << " / rsrcid = " << std::dec << r_cas_to_tgt_rsp_srcid.read()
     5556              << " / rtrdid = " << r_cas_to_tgt_rsp_trdid.read()
     5557              << " / rpktid = " << r_cas_to_tgt_rsp_pktid.read() << std::endl;
    54925558}
    54935559#endif
    5494                 r_tgt_rsp_fsm = TGT_RSP_SC_IDLE;
    5495                 r_sc_to_tgt_rsp_req = false;
     5560                r_tgt_rsp_fsm = TGT_RSP_CAS_IDLE;
     5561                r_cas_to_tgt_rsp_req = false;
    54965562            }
    54975563            break;
     
    55105576              << " / rsrcid = " << std::dec << r_xram_rsp_to_tgt_rsp_srcid.read()
    55115577              << " / rtrdid = " << r_xram_rsp_to_tgt_rsp_trdid.read()
     5578              << " / rpktid = " << r_xram_rsp_to_tgt_rsp_pktid.read()
    55125579              << " / rdata = " << std::hex << r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read()
    55135580              << " / cpt = " << std::dec << r_tgt_rsp_cpt.read() << std::endl;
     
    55395606    std::cout << "  <MEMC " << name() << ".TGT_RSP_INIT> Write response after coherence transaction"
    55405607              << " / rsrcid = " << std::dec << r_init_rsp_to_tgt_rsp_srcid.read()
    5541               << " / rtrdid = " << r_init_rsp_to_tgt_rsp_trdid.read() << std::endl;
     5608              << " / rtrdid = " << r_init_rsp_to_tgt_rsp_trdid.read()
     5609              << " / rpktid = " << r_init_rsp_to_tgt_rsp_pktid.read() << std::endl;
    55425610}
    55435611#endif
     
    55795647            r_alloc_upt_fsm = ALLOC_UPT_CLEANUP;
    55805648
    5581           else if (( r_sc_fsm.read() == SC_UPT_LOCK    ) ||
    5582                    ( r_sc_fsm.read() == SC_BC_UPT_LOCK ))
    5583             r_alloc_upt_fsm = ALLOC_UPT_SC;
     5649          else if (( r_cas_fsm.read() == CAS_UPT_LOCK    ) ||
     5650                   ( r_cas_fsm.read() == CAS_BC_UPT_LOCK ))
     5651            r_alloc_upt_fsm = ALLOC_UPT_CAS;
    55845652        }
    55855653        break;
     
    55965664            r_alloc_upt_fsm = ALLOC_UPT_CLEANUP;
    55975665
    5598           else if (( r_sc_fsm.read() == SC_UPT_LOCK    ) ||
    5599                    ( r_sc_fsm.read() == SC_BC_UPT_LOCK ))
    5600             r_alloc_upt_fsm = ALLOC_UPT_SC;
     5666          else if (( r_cas_fsm.read() == CAS_UPT_LOCK    ) ||
     5667                   ( r_cas_fsm.read() == CAS_BC_UPT_LOCK ))
     5668            r_alloc_upt_fsm = ALLOC_UPT_CAS;
    56015669
    56025670          else if ( r_init_rsp_fsm.read() == INIT_RSP_UPT_LOCK )
     
    56125680            r_alloc_upt_fsm = ALLOC_UPT_CLEANUP;
    56135681
    5614           else if (( r_sc_fsm.read() == SC_UPT_LOCK    ) ||
    5615                    ( r_sc_fsm.read() == SC_BC_UPT_LOCK ))
    5616             r_alloc_upt_fsm = ALLOC_UPT_SC;
     5682          else if (( r_cas_fsm.read() == CAS_UPT_LOCK    ) ||
     5683                   ( r_cas_fsm.read() == CAS_BC_UPT_LOCK ))
     5684            r_alloc_upt_fsm = ALLOC_UPT_CAS;
    56175685
    56185686          else if ( r_init_rsp_fsm.read() == INIT_RSP_UPT_LOCK )
     
    56295697        if(r_cleanup_fsm.read() != CLEANUP_UPT_LOCK )
    56305698        {
    5631           if (( r_sc_fsm.read() == SC_UPT_LOCK    ) ||
    5632               ( r_sc_fsm.read() == SC_BC_UPT_LOCK ))
    5633             r_alloc_upt_fsm = ALLOC_UPT_SC;
     5699          if (( r_cas_fsm.read() == CAS_UPT_LOCK    ) ||
     5700              ( r_cas_fsm.read() == CAS_BC_UPT_LOCK ))
     5701            r_alloc_upt_fsm = ALLOC_UPT_CAS;
    56345702
    56355703          else if ( r_init_rsp_fsm.read() == INIT_RSP_UPT_LOCK )
     
    56465714
    56475715        //////////////////////////
    5648       case ALLOC_UPT_SC:
    5649         if (( r_sc_fsm.read() != SC_UPT_LOCK    ) &&
    5650             ( r_sc_fsm.read() != SC_BC_UPT_LOCK ))
     5716      case ALLOC_UPT_CAS:
     5717        if (( r_cas_fsm.read() != CAS_UPT_LOCK    ) &&
     5718            ( r_cas_fsm.read() != CAS_BC_UPT_LOCK ))
    56515719        {
    56525720          if ( r_init_rsp_fsm.read() == INIT_RSP_UPT_LOCK )
     
    56725740    // The ALLOC_DIR FSM allocates the access to the directory and
    56735741    // the data cache with a round robin priority between 5 user FSMs :
    5674     // The cyclic ordering is READ > WRITE > SC > CLEANUP > XRAM_RSP
     5742    // The cyclic ordering is READ > WRITE > CAS > CLEANUP > XRAM_RSP
    56755743    // The ressource is always allocated.
    56765744    /////////////////////////////////////////////////////////////////////////////////////
     
    57045772            r_alloc_dir_fsm = ALLOC_DIR_WRITE;
    57055773
    5706           else if (r_sc_fsm.read() == SC_DIR_REQ)
    5707             r_alloc_dir_fsm = ALLOC_DIR_SC;
     5774          else if (r_cas_fsm.read() == CAS_DIR_REQ)
     5775            r_alloc_dir_fsm = ALLOC_DIR_CAS;
    57085776
    57095777          else if (r_cleanup_fsm.read() == CLEANUP_DIR_REQ )
     
    57335801             ( r_alloc_trt_fsm.read()  == ALLOC_TRT_WRITE     )))
    57345802        {
    5735           if ( r_sc_fsm.read() == SC_DIR_REQ )
    5736             r_alloc_dir_fsm = ALLOC_DIR_SC;
     5803          if ( r_cas_fsm.read() == CAS_DIR_REQ )
     5804            r_alloc_dir_fsm = ALLOC_DIR_CAS;
    57375805
    57385806          else if ( r_cleanup_fsm.read() == CLEANUP_DIR_REQ )
     
    57485816
    57495817        ////////////////////
    5750         case ALLOC_DIR_SC:
    5751         if ((( r_sc_fsm.read()         != SC_DIR_REQ       )  &&
    5752              ( r_sc_fsm.read()         != SC_DIR_LOCK      )  &&
    5753              ( r_sc_fsm.read()         != SC_DIR_HIT_READ  )  &&
    5754              ( r_sc_fsm.read()         != SC_DIR_HIT_WRITE )  &&
    5755              ( r_sc_fsm.read()         != SC_BC_TRT_LOCK   )  &&
    5756              ( r_sc_fsm.read()         != SC_BC_UPT_LOCK   )  &&
    5757              ( r_sc_fsm.read()         != SC_MISS_TRT_LOCK )  &&
    5758              ( r_sc_fsm.read()         != SC_UPT_LOCK      )  &&
    5759              ( r_sc_fsm.read()         != SC_UPT_HEAP_LOCK ))
     5818        case ALLOC_DIR_CAS:
     5819        if ((( r_cas_fsm.read()        != CAS_DIR_REQ       )  &&
     5820             ( r_cas_fsm.read()        != CAS_DIR_LOCK      )  &&
     5821             ( r_cas_fsm.read()        != CAS_DIR_HIT_READ  )  &&
     5822             ( r_cas_fsm.read()        != CAS_DIR_HIT_WRITE )  &&
     5823             ( r_cas_fsm.read()        != CAS_BC_TRT_LOCK   )  &&
     5824             ( r_cas_fsm.read()        != CAS_BC_UPT_LOCK   )  &&
     5825             ( r_cas_fsm.read()        != CAS_MISS_TRT_LOCK )  &&
     5826             ( r_cas_fsm.read()        != CAS_UPT_LOCK      )  &&
     5827             ( r_cas_fsm.read()        != CAS_UPT_HEAP_LOCK ))
    57605828            ||
    5761             (( r_sc_fsm.read()         == SC_UPT_HEAP_LOCK )  &&
    5762              ( r_alloc_heap_fsm.read() == ALLOC_HEAP_SC    ))
     5829            (( r_cas_fsm.read()        == CAS_UPT_HEAP_LOCK )  &&
     5830             ( r_alloc_heap_fsm.read() == ALLOC_HEAP_CAS    ))
    57635831            ||
    5764             (( r_sc_fsm.read()         == SC_MISS_TRT_LOCK )  &&
    5765              ( r_alloc_trt_fsm.read()  == ALLOC_TRT_SC     )))
     5832            (( r_cas_fsm.read()        == CAS_MISS_TRT_LOCK )  &&
     5833             ( r_alloc_trt_fsm.read()  == ALLOC_TRT_CAS     )))
    57665834        {
    57675835          if ( r_cleanup_fsm.read() == CLEANUP_DIR_REQ )
     
    57955863            r_alloc_dir_fsm = ALLOC_DIR_WRITE;
    57965864
    5797           else if ( r_sc_fsm.read() == SC_DIR_REQ )
    5798             r_alloc_dir_fsm = ALLOC_DIR_SC;
     5865          else if ( r_cas_fsm.read() == CAS_DIR_REQ )
     5866            r_alloc_dir_fsm = ALLOC_DIR_CAS;
    57995867        }
    58005868        break;
     
    58125880            r_alloc_dir_fsm = ALLOC_DIR_WRITE;
    58135881
    5814           else if ( r_sc_fsm.read() == SC_DIR_REQ )
    5815             r_alloc_dir_fsm = ALLOC_DIR_SC;
     5882          else if ( r_cas_fsm.read() == CAS_DIR_REQ )
     5883            r_alloc_dir_fsm = ALLOC_DIR_CAS;
    58165884
    58175885          else if ( r_cleanup_fsm.read() == CLEANUP_DIR_REQ )
     
    58275895    // The ALLOC_TRT fsm allocates the access to the Transaction Table (write buffer)
    58285896    // with a round robin priority between 4 user FSMs :
    5829     // The cyclic priority is READ > WRITE > SC > XRAM_RSP
     5897    // The cyclic priority is READ > WRITE > CAS > XRAM_RSP
    58305898    // The ressource is always allocated.
    58315899    ///////////////////////////////////////////////////////////////////////////////////
     
    58415909            r_alloc_trt_fsm = ALLOC_TRT_WRITE;
    58425910
    5843           else if (( r_sc_fsm.read() == SC_MISS_TRT_LOCK ) ||
    5844                    ( r_sc_fsm.read() == SC_BC_TRT_LOCK   ))
    5845             r_alloc_trt_fsm = ALLOC_TRT_SC;
     5911          else if (( r_cas_fsm.read() == CAS_MISS_TRT_LOCK ) ||
     5912                   ( r_cas_fsm.read() == CAS_BC_TRT_LOCK   ))
     5913            r_alloc_trt_fsm = ALLOC_TRT_CAS;
    58465914
    58475915          else if (( r_xram_rsp_fsm.read()  == XRAM_RSP_DIR_LOCK  ) &&
     
    58615929            ( r_write_fsm.read() != WRITE_BC_UPT_LOCK   ))
    58625930        {
    5863           if (( r_sc_fsm.read() == SC_MISS_TRT_LOCK ) ||
    5864               ( r_sc_fsm.read() == SC_BC_TRT_LOCK   ))
    5865             r_alloc_trt_fsm = ALLOC_TRT_SC;
     5931          if (( r_cas_fsm.read() == CAS_MISS_TRT_LOCK ) ||
     5932              ( r_cas_fsm.read() == CAS_BC_TRT_LOCK   ))
     5933            r_alloc_trt_fsm = ALLOC_TRT_CAS;
    58665934
    58675935          else if (( r_xram_rsp_fsm.read()  == XRAM_RSP_DIR_LOCK  ) &&
     
    58795947
    58805948      ////////////////////
    5881       case ALLOC_TRT_SC:
    5882         if (( r_sc_fsm.read() != SC_MISS_TRT_LOCK ) &&
    5883             ( r_sc_fsm.read() != SC_BC_TRT_LOCK   ) &&
    5884             ( r_sc_fsm.read() != SC_BC_UPT_LOCK   ))
     5949      case ALLOC_TRT_CAS:
     5950        if (( r_cas_fsm.read() != CAS_MISS_TRT_LOCK ) &&
     5951            ( r_cas_fsm.read() != CAS_BC_TRT_LOCK   ) &&
     5952            ( r_cas_fsm.read() != CAS_BC_UPT_LOCK   ))
    58855953        {
    58865954          if (( r_xram_rsp_fsm.read()  == XRAM_RSP_DIR_LOCK  ) &&
     
    59205988            r_alloc_trt_fsm = ALLOC_TRT_WRITE;
    59215989
    5922           else if (( r_sc_fsm.read() == SC_MISS_TRT_LOCK ) ||
    5923                    ( r_sc_fsm.read() == SC_BC_TRT_LOCK   ))
    5924             r_alloc_trt_fsm = ALLOC_TRT_SC;
     5990          else if (( r_cas_fsm.read() == CAS_MISS_TRT_LOCK ) ||
     5991                   ( r_cas_fsm.read() == CAS_BC_TRT_LOCK   ))
     5992            r_alloc_trt_fsm = ALLOC_TRT_CAS;
    59255993        }
    59265994        break;
     
    59386006            r_alloc_trt_fsm = ALLOC_TRT_WRITE;
    59396007
    5940           else if (( r_sc_fsm.read() == SC_MISS_TRT_LOCK ) ||
    5941                    ( r_sc_fsm.read() == SC_BC_TRT_LOCK   ))
    5942             r_alloc_trt_fsm = ALLOC_TRT_SC;
     6008          else if (( r_cas_fsm.read() == CAS_MISS_TRT_LOCK ) ||
     6009                   ( r_cas_fsm.read() == CAS_BC_TRT_LOCK   ))
     6010            r_alloc_trt_fsm = ALLOC_TRT_CAS;
    59436011
    59446012          else if (( r_xram_rsp_fsm.read()  == XRAM_RSP_DIR_LOCK  ) &&
     
    59556023    // The ALLOC_HEAP FSM allocates the access to the heap
    59566024    // with a round robin priority between 5 user FSMs :
    5957     // The cyclic ordering is READ > WRITE > SC > CLEANUP > XRAM_RSP
     6025    // The cyclic ordering is READ > WRITE > CAS > CLEANUP > XRAM_RSP
    59586026    // The ressource is always allocated.
    59596027    /////////////////////////////////////////////////////////////////////////////////////
     
    59836051            r_alloc_heap_fsm = ALLOC_HEAP_WRITE;
    59846052
    5985           else if ( r_sc_fsm.read() == SC_UPT_HEAP_LOCK )
    5986             r_alloc_heap_fsm = ALLOC_HEAP_SC;
     6053          else if ( r_cas_fsm.read() == CAS_UPT_HEAP_LOCK )
     6054            r_alloc_heap_fsm = ALLOC_HEAP_CAS;
    59876055
    59886056          else if ( r_cleanup_fsm.read() == CLEANUP_HEAP_REQ )
     
    60006068            ( r_write_fsm.read() != WRITE_UPT_NEXT      ))
    60016069        {
    6002           if ( r_sc_fsm.read() == SC_UPT_HEAP_LOCK )
    6003             r_alloc_heap_fsm = ALLOC_HEAP_SC;
     6070          if ( r_cas_fsm.read() == CAS_UPT_HEAP_LOCK )
     6071            r_alloc_heap_fsm = ALLOC_HEAP_CAS;
    60046072
    60056073          else if ( r_cleanup_fsm.read() == CLEANUP_HEAP_REQ )
     
    60156083
    60166084        ////////////////////
    6017         case ALLOC_HEAP_SC:
    6018         if (( r_sc_fsm.read() != SC_UPT_HEAP_LOCK ) &&
    6019             ( r_sc_fsm.read() != SC_UPT_REQ       ) &&
    6020             ( r_sc_fsm.read() != SC_UPT_NEXT      ))
     6085        case ALLOC_HEAP_CAS:
     6086        if (( r_cas_fsm.read() != CAS_UPT_HEAP_LOCK ) &&
     6087            ( r_cas_fsm.read() != CAS_UPT_REQ       ) &&
     6088            ( r_cas_fsm.read() != CAS_UPT_NEXT      ))
    60216089        {
    60226090          if ( r_cleanup_fsm.read() == CLEANUP_HEAP_REQ )
     
    60506118            r_alloc_heap_fsm = ALLOC_HEAP_WRITE;
    60516119
    6052           else if ( r_sc_fsm.read() == SC_UPT_HEAP_LOCK )
    6053             r_alloc_heap_fsm = ALLOC_HEAP_SC;
     6120          else if ( r_cas_fsm.read() == CAS_UPT_HEAP_LOCK )
     6121            r_alloc_heap_fsm = ALLOC_HEAP_CAS;
    60546122        }
    60556123        break;
     
    60666134            r_alloc_heap_fsm = ALLOC_HEAP_WRITE;
    60676135
    6068           else if ( r_sc_fsm.read() == SC_UPT_HEAP_LOCK )
    6069             r_alloc_heap_fsm = ALLOC_HEAP_SC;
     6136          else if ( r_cas_fsm.read() == CAS_UPT_HEAP_LOCK )
     6137            r_alloc_heap_fsm = ALLOC_HEAP_CAS;
    60706138
    60716139          else if ( r_cleanup_fsm.read() == CLEANUP_HEAP_REQ )
     
    61396207    }
    61406208    ////////////////////////////////////////////////////////////////////////////////////
    6141     //    TGT_CMD to SC FIFO
     6209    //    TGT_CMD to CAS FIFO
    61426210    ////////////////////////////////////////////////////////////////////////////////////
    61436211
    6144     if ( cmd_sc_fifo_put ) {
    6145       if ( cmd_sc_fifo_get ) {
    6146         m_cmd_sc_addr_fifo.put_and_get((addr_t)(p_vci_tgt.address.read()));
    6147         m_cmd_sc_eop_fifo.put_and_get(p_vci_tgt.eop.read());
    6148         m_cmd_sc_srcid_fifo.put_and_get(p_vci_tgt.srcid.read());
    6149         m_cmd_sc_trdid_fifo.put_and_get(p_vci_tgt.trdid.read());
    6150         m_cmd_sc_pktid_fifo.put_and_get(p_vci_tgt.pktid.read());
    6151         m_cmd_sc_wdata_fifo.put_and_get(p_vci_tgt.wdata.read());
     6212    if ( cmd_cas_fifo_put ) {
     6213      if ( cmd_cas_fifo_get ) {
     6214        m_cmd_cas_addr_fifo.put_and_get((addr_t)(p_vci_tgt.address.read()));
     6215        m_cmd_cas_eop_fifo.put_and_get(p_vci_tgt.eop.read());
     6216        m_cmd_cas_srcid_fifo.put_and_get(p_vci_tgt.srcid.read());
     6217        m_cmd_cas_trdid_fifo.put_and_get(p_vci_tgt.trdid.read());
     6218        m_cmd_cas_pktid_fifo.put_and_get(p_vci_tgt.pktid.read());
     6219        m_cmd_cas_wdata_fifo.put_and_get(p_vci_tgt.wdata.read());
    61526220      } else {
    6153         m_cmd_sc_addr_fifo.simple_put((addr_t)(p_vci_tgt.address.read()));
    6154         m_cmd_sc_eop_fifo.simple_put(p_vci_tgt.eop.read());
    6155         m_cmd_sc_srcid_fifo.simple_put(p_vci_tgt.srcid.read());
    6156         m_cmd_sc_trdid_fifo.simple_put(p_vci_tgt.trdid.read());
    6157         m_cmd_sc_pktid_fifo.simple_put(p_vci_tgt.pktid.read());
    6158         m_cmd_sc_wdata_fifo.simple_put(p_vci_tgt.wdata.read());
     6221        m_cmd_cas_addr_fifo.simple_put((addr_t)(p_vci_tgt.address.read()));
     6222        m_cmd_cas_eop_fifo.simple_put(p_vci_tgt.eop.read());
     6223        m_cmd_cas_srcid_fifo.simple_put(p_vci_tgt.srcid.read());
     6224        m_cmd_cas_trdid_fifo.simple_put(p_vci_tgt.trdid.read());
     6225        m_cmd_cas_pktid_fifo.simple_put(p_vci_tgt.pktid.read());
     6226        m_cmd_cas_wdata_fifo.simple_put(p_vci_tgt.wdata.read());
    61596227      }
    61606228    } else {
    6161       if ( cmd_sc_fifo_get ) {
    6162         m_cmd_sc_addr_fifo.simple_get();
    6163         m_cmd_sc_eop_fifo.simple_get();
    6164         m_cmd_sc_srcid_fifo.simple_get();
    6165         m_cmd_sc_trdid_fifo.simple_get();
    6166         m_cmd_sc_pktid_fifo.simple_get();
    6167         m_cmd_sc_wdata_fifo.simple_get();
     6229      if ( cmd_cas_fifo_get ) {
     6230        m_cmd_cas_addr_fifo.simple_get();
     6231        m_cmd_cas_eop_fifo.simple_get();
     6232        m_cmd_cas_srcid_fifo.simple_get();
     6233        m_cmd_cas_trdid_fifo.simple_get();
     6234        m_cmd_cas_pktid_fifo.simple_get();
     6235        m_cmd_cas_wdata_fifo.simple_get();
    61686236      }
    61696237    }
     
    62236291    }
    62246292    ////////////////////////////////////////////////////////////////////////////////////
    6225     //    SC to INIT_CMD FIFO
     6293    //    CAS to INIT_CMD FIFO
    62266294    ////////////////////////////////////////////////////////////////////////////////////
    62276295
    6228     if ( sc_to_init_cmd_fifo_put ) {
    6229       if ( sc_to_init_cmd_fifo_get ) {
    6230         m_sc_to_init_cmd_inst_fifo.put_and_get(sc_to_init_cmd_fifo_inst);
    6231         m_sc_to_init_cmd_srcid_fifo.put_and_get(sc_to_init_cmd_fifo_srcid);
     6296    if ( cas_to_init_cmd_fifo_put ) {
     6297      if ( cas_to_init_cmd_fifo_get ) {
     6298        m_cas_to_init_cmd_inst_fifo.put_and_get(cas_to_init_cmd_fifo_inst);
     6299        m_cas_to_init_cmd_srcid_fifo.put_and_get(cas_to_init_cmd_fifo_srcid);
    62326300#if L1_MULTI_CACHE
    6233         m_sc_to_init_cmd_cache_id_fifo.put_and_get(sc_to_init_cmd_fifo_cache_id);
     6301        m_cas_to_init_cmd_cache_id_fifo.put_and_get(cas_to_init_cmd_fifo_cache_id);
    62346302#endif
    62356303      } else {
    6236           m_sc_to_init_cmd_inst_fifo.simple_put(sc_to_init_cmd_fifo_inst);
    6237           m_sc_to_init_cmd_srcid_fifo.simple_put(sc_to_init_cmd_fifo_srcid);
     6304          m_cas_to_init_cmd_inst_fifo.simple_put(cas_to_init_cmd_fifo_inst);
     6305          m_cas_to_init_cmd_srcid_fifo.simple_put(cas_to_init_cmd_fifo_srcid);
    62386306#if L1_MULTI_CACHE
    6239           m_sc_to_init_cmd_cache_id_fifo.simple_put(sc_to_init_cmd_fifo_cache_id);
     6307          m_cas_to_init_cmd_cache_id_fifo.simple_put(cas_to_init_cmd_fifo_cache_id);
    62406308#endif
    62416309      }
    62426310    } else {
    6243         if ( sc_to_init_cmd_fifo_get ) {
    6244             m_sc_to_init_cmd_inst_fifo.simple_get();
    6245             m_sc_to_init_cmd_srcid_fifo.simple_get();
     6311        if ( cas_to_init_cmd_fifo_get ) {
     6312            m_cas_to_init_cmd_inst_fifo.simple_get();
     6313            m_cas_to_init_cmd_srcid_fifo.simple_get();
    62466314#if L1_MULTI_CACHE
    6247             m_sc_to_init_cmd_cache_id_fifo.simple_get();
     6315            m_cas_to_init_cmd_cache_id_fifo.simple_get();
    62486316#endif
    62496317      }
     
    62806348      p_vci_ixr.eop     = true;
    62816349    }
    6282     else if ( r_ixr_cmd_fsm.read() == IXR_CMD_SC_NLINE ) {
    6283       if(r_sc_to_ixr_cmd_write.read()){
     6350    else if ( r_ixr_cmd_fsm.read() == IXR_CMD_CAS_NLINE ) {
     6351      if(r_cas_to_ixr_cmd_write.read()){
    62846352        p_vci_ixr.cmd     = vci_param::CMD_WRITE;
    62856353        p_vci_ixr.cmdval  = true;
    6286         p_vci_ixr.address = (addr_t)((r_sc_to_ixr_cmd_nline.read()*m_words+r_ixr_cmd_cpt.read())*4);
     6354        p_vci_ixr.address = (addr_t)((r_cas_to_ixr_cmd_nline.read()*m_words+r_ixr_cmd_cpt.read())*4);
    62876355        p_vci_ixr.plen    = m_words*4;
    6288         p_vci_ixr.wdata   = r_sc_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read();
    6289         p_vci_ixr.trdid   = r_sc_to_ixr_cmd_trdid.read();
     6356        p_vci_ixr.wdata   = r_cas_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read();
     6357        p_vci_ixr.trdid   = r_cas_to_ixr_cmd_trdid.read();
    62906358        p_vci_ixr.eop     = (r_ixr_cmd_cpt == (m_words-1));
    62916359      } else {
    62926360        p_vci_ixr.cmd     = vci_param::CMD_READ;
    62936361        p_vci_ixr.cmdval  = true;
    6294         p_vci_ixr.address = (addr_t)(r_sc_to_ixr_cmd_nline.read()*m_words*4);
     6362        p_vci_ixr.address = (addr_t)(r_cas_to_ixr_cmd_nline.read()*m_words*4);
    62956363        p_vci_ixr.plen    = m_words*4;
    62966364        p_vci_ixr.wdata   = 0x00000000;
    6297         p_vci_ixr.trdid   = r_sc_to_ixr_cmd_trdid.read();
     6365        p_vci_ixr.trdid   = r_cas_to_ixr_cmd_trdid.read();
    62986366        p_vci_ixr.eop     = true;
    62996367      }
     
    63586426        p_vci_tgt.cmdack  = m_cmd_write_addr_fifo.wok();
    63596427        break;
    6360       case TGT_CMD_ATOMIC:
    6361         p_vci_tgt.cmdack  = m_cmd_sc_addr_fifo.wok();
     6428      case TGT_CMD_CAS:
     6429        p_vci_tgt.cmdack  = m_cmd_cas_addr_fifo.wok();
    63626430        break;
    63636431      default:
    6364         p_vci_tgt.cmdack = false;
     6432        p_vci_tgt.cmdack  = false;
    63656433        break;
    63666434    }
     
    63736441      case TGT_RSP_READ_IDLE:
    63746442      case TGT_RSP_WRITE_IDLE:
    6375       case TGT_RSP_SC_IDLE:
     6443      case TGT_RSP_CAS_IDLE:
    63766444      case TGT_RSP_XRAM_IDLE:
    63776445      case TGT_RSP_INIT_IDLE:
     
    64096477        p_vci_tgt.rtrdid   = r_cleanup_to_tgt_rsp_trdid.read();
    64106478        p_vci_tgt.rpktid   = r_cleanup_to_tgt_rsp_pktid.read();
    6411         p_vci_tgt.rerror   = 0; // Can be a SC rsp
     6479        p_vci_tgt.rerror   = 0; // Can be a CAS rsp
    64126480        p_vci_tgt.reop     = true;
    64136481        break;
    6414       case TGT_RSP_SC:
     6482      case TGT_RSP_CAS:
    64156483        p_vci_tgt.rspval   = true;
    6416         p_vci_tgt.rdata    = r_sc_to_tgt_rsp_data.read();
    6417         p_vci_tgt.rsrcid   = r_sc_to_tgt_rsp_srcid.read();
    6418         p_vci_tgt.rtrdid   = r_sc_to_tgt_rsp_trdid.read();
    6419         p_vci_tgt.rpktid   = r_sc_to_tgt_rsp_pktid.read();
     6484        p_vci_tgt.rdata    = r_cas_to_tgt_rsp_data.read();
     6485        p_vci_tgt.rsrcid   = r_cas_to_tgt_rsp_srcid.read();
     6486        p_vci_tgt.rtrdid   = r_cas_to_tgt_rsp_trdid.read();
     6487        p_vci_tgt.rpktid   = r_cas_to_tgt_rsp_pktid.read();
    64206488        p_vci_tgt.rerror   = 0;
    64216489        p_vci_tgt.reop     = true;
     
    64386506        p_vci_tgt.rtrdid   = r_init_rsp_to_tgt_rsp_trdid.read();
    64396507        p_vci_tgt.rpktid   = r_init_rsp_to_tgt_rsp_pktid.read();
    6440         p_vci_tgt.rerror   = 0; // Can be a SC rsp
     6508        p_vci_tgt.rerror   = 0; // Can be a CAS rsp
    64416509        p_vci_tgt.reop     = true;
    64426510        break;
     
    64606528      case INIT_CMD_UPDT_IDLE:
    64616529      case INIT_CMD_INVAL_IDLE:
    6462       case INIT_CMD_SC_UPDT_IDLE:
     6530      case INIT_CMD_CAS_UPDT_IDLE:
    64636531        p_vci_ini.cmdval  = false;
    64646532        p_vci_ini.address = 0;
     
    65786646        break;
    65796647
    6580       case INIT_CMD_SC_BRDCAST:
     6648      case INIT_CMD_CAS_BRDCAST:
    65816649        p_vci_ini.cmdval  = true;
    65826650        p_vci_ini.address = m_broadcast_address;
    6583         p_vci_ini.wdata   = (addr_t)r_sc_to_init_cmd_nline.read();
    6584         p_vci_ini.be      = ((r_sc_to_init_cmd_nline.read() >> 32) & 0x3);
     6651        p_vci_ini.wdata   = (addr_t)r_cas_to_init_cmd_nline.read();
     6652        p_vci_ini.be      = ((r_cas_to_init_cmd_nline.read() >> 32) & 0x3);
    65856653        p_vci_ini.plen    = 4 ;
    65866654        p_vci_ini.eop     = true;
    6587         p_vci_ini.trdid   = r_sc_to_init_cmd_trdid.read();
     6655        p_vci_ini.trdid   = r_cas_to_init_cmd_trdid.read();
    65886656        p_vci_ini.pktid   = 0;
    65896657        break;
    6590       case INIT_CMD_SC_UPDT_NLINE:
     6658      case INIT_CMD_CAS_UPDT_NLINE:
    65916659        vci_ini_address = (vci_addr_t)
    6592             m_sc_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);
    6593 
    6594         p_vci_ini.cmdval  = m_sc_to_init_cmd_inst_fifo.rok();
    6595         if(m_sc_to_init_cmd_inst_fifo.rok()){
    6596           if( m_sc_to_init_cmd_inst_fifo.read() ) {
     6660            m_cas_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);
     6661
     6662        p_vci_ini.cmdval  = m_cas_to_init_cmd_inst_fifo.rok();
     6663        if(m_cas_to_init_cmd_inst_fifo.rok()){
     6664          if( m_cas_to_init_cmd_inst_fifo.read() ) {
    65976665            p_vci_ini.address = (addr_t)(vci_ini_address + 12);
    65986666          } else {
     
    66026670          p_vci_ini.address = 0;
    66036671        }
    6604         p_vci_ini.wdata   = (uint32_t)r_sc_to_init_cmd_nline.read();
    6605         p_vci_ini.be      = ((r_sc_to_init_cmd_nline.read() >> 32 ) & 0x3);
    6606         if(r_sc_to_init_cmd_is_long.read()){
     6672        p_vci_ini.wdata   = (uint32_t)r_cas_to_init_cmd_nline.read();
     6673        p_vci_ini.be      = ((r_cas_to_init_cmd_nline.read() >> 32 ) & 0x3);
     6674        if(r_cas_to_init_cmd_is_long.read()){
    66076675            p_vci_ini.plen    = 4 * 4;
    66086676        } else {
     
    66106678        }
    66116679        p_vci_ini.eop     = false;
    6612         p_vci_ini.trdid   = r_sc_to_init_cmd_trdid.read();
     6680        p_vci_ini.trdid   = r_cas_to_init_cmd_trdid.read();
    66136681#if L1_MULTI_CACHE
    6614         p_vci_ini.pktid   = m_sc_to_init_cmd_cache_id_fifo.read();
     6682        p_vci_ini.pktid   = m_cas_to_init_cmd_cache_id_fifo.read();
    66156683#endif
    66166684        break;
    6617       case INIT_CMD_SC_UPDT_INDEX:
     6685      case INIT_CMD_CAS_UPDT_INDEX:
    66186686        vci_ini_address = (vci_addr_t)
    6619             m_sc_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);
     6687            m_cas_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);
    66206688
    66216689        p_vci_ini.cmdval  = true;
    6622         if( m_sc_to_init_cmd_inst_fifo.read() ) {
     6690        if( m_cas_to_init_cmd_inst_fifo.read() ) {
    66236691          p_vci_ini.address = (addr_t)(vci_ini_address + 12);
    66246692        } else {
    66256693          p_vci_ini.address = (addr_t)(vci_ini_address + 8);
    66266694        }
    6627         p_vci_ini.wdata   = r_sc_to_init_cmd_index.read();
     6695        p_vci_ini.wdata   = r_cas_to_init_cmd_index.read();
    66286696        p_vci_ini.be      = 0xF;
    6629         if(r_sc_to_init_cmd_is_long.read()){
     6697        if(r_cas_to_init_cmd_is_long.read()){
    66306698            p_vci_ini.plen    = 4 * 4;
    66316699        } else {
    66326700            p_vci_ini.plen    = 4 * 3;
    66336701        }
    6634         p_vci_ini.trdid   = r_sc_to_init_cmd_trdid.read();
     6702        p_vci_ini.trdid   = r_cas_to_init_cmd_trdid.read();
    66356703#if L1_MULTI_CACHE
    6636         p_vci_ini.pktid   = m_sc_to_init_cmd_cache_id_fifo.read();
     6704        p_vci_ini.pktid   = m_cas_to_init_cmd_cache_id_fifo.read();
    66376705#endif
    66386706        p_vci_ini.eop     = false;
    66396707        break;
    6640       case INIT_CMD_SC_UPDT_DATA:
     6708      case INIT_CMD_CAS_UPDT_DATA:
    66416709        vci_ini_address = (vci_addr_t)
    6642             m_sc_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);
     6710            m_cas_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);
    66436711
    66446712        p_vci_ini.cmdval  = true;
    6645         if( m_sc_to_init_cmd_inst_fifo.read() ) {
     6713        if( m_cas_to_init_cmd_inst_fifo.read() ) {
    66466714          p_vci_ini.address = (addr_t)(vci_ini_address + 12);
    66476715        } else {
    66486716          p_vci_ini.address = (addr_t)(vci_ini_address + 8);
    66496717        }
    6650         p_vci_ini.wdata   = r_sc_to_init_cmd_wdata.read();
     6718        p_vci_ini.wdata   = r_cas_to_init_cmd_wdata.read();
    66516719        p_vci_ini.be      = 0xF;
    6652         p_vci_ini.trdid   = r_sc_to_init_cmd_trdid.read();
     6720        p_vci_ini.trdid   = r_cas_to_init_cmd_trdid.read();
    66536721#if L1_MULTI_CACHE
    6654         p_vci_ini.pktid   = m_sc_to_init_cmd_cache_id_fifo.read();
    6655 #endif
    6656         if(r_sc_to_init_cmd_is_long.read()){
     6722        p_vci_ini.pktid   = m_cas_to_init_cmd_cache_id_fifo.read();
     6723#endif
     6724        if(r_cas_to_init_cmd_is_long.read()){
    66576725            p_vci_ini.plen    = 4 * 4;
    66586726            p_vci_ini.eop     = false;
     
    66626730        }
    66636731        break;
    6664       case INIT_CMD_SC_UPDT_DATA_HIGH:
     6732      case INIT_CMD_CAS_UPDT_DATA_HIGH:
    66656733        vci_ini_address = (vci_addr_t)
    6666             m_sc_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);
     6734            m_cas_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);
    66676735
    66686736        p_vci_ini.cmdval  = true;
    6669         if( m_sc_to_init_cmd_inst_fifo.read() ) {
     6737        if( m_cas_to_init_cmd_inst_fifo.read() ) {
    66706738          p_vci_ini.address = (addr_t)(vci_ini_address + 12);
    66716739        } else {
    66726740          p_vci_ini.address = (addr_t)(vci_ini_address + 8);
    66736741        }
    6674         p_vci_ini.wdata   = r_sc_to_init_cmd_wdata_high.read();
     6742        p_vci_ini.wdata   = r_cas_to_init_cmd_wdata_high.read();
    66756743        p_vci_ini.be      = 0xF;
    66766744        p_vci_ini.plen    = 4 * 4;
    6677         p_vci_ini.trdid   = r_sc_to_init_cmd_trdid.read();
     6745        p_vci_ini.trdid   = r_cas_to_init_cmd_trdid.read();
    66786746#if L1_MULTI_CACHE
    6679         p_vci_ini.pktid   = m_sc_to_init_cmd_cache_id_fifo.read();
     6747        p_vci_ini.pktid   = m_cas_to_init_cmd_cache_id_fifo.read();
    66806748#endif
    66816749        p_vci_ini.eop     = true;
  • trunk/modules/vci_vdspin_initiator_wrapper/caba/source/src/vci_vdspin_initiator_wrapper.cpp

    r186 r284  
    55  *
    66  * SOCLIB_LGPL_HEADER_BEGIN
    7   * 
     7  *
    88  * This file is part of SoCLib, GNU LGPLv2.1.
    9   * 
     9  *
    1010  * SoCLib is free software; you can redistribute it and/or modify it
    1111  * under the terms of the GNU Lesser General Public License as published
    1212  * by the Free Software Foundation; version 2.1 of the License.
    13   * 
     13  *
    1414  * SoCLib is distributed in the hope that it will be useful, but
    1515  * WITHOUT ANY WARRANTY; without even the implied warranty of
    1616  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1717  * Lesser General Public License for more details.
    18   * 
     18  *
    1919  * You should have received a copy of the GNU Lesser General Public
    2020  * License along with SoCLib; if not, write to the Free Software
    2121  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    2222  * 02110-1301 USA
    23   * 
     23  *
    2424  * SOCLIB_LGPL_HEADER_END
    2525  */
     
    3232
    3333//////////////////////////////////////////////////////////:////////////////////////////////
    34 tmpl(/**/)::VciVdspinInitiatorWrapper(sc_module_name                    name,
    35                                       size_t                            cmd_fifo_depth,
    36                                       size_t                            rsp_fifo_depth)
    37                : soclib::caba::BaseModule(name),
     34tmpl(/**/)::VciVdspinInitiatorWrapper(sc_module_name             name,
     35                      size_t                cmd_fifo_depth,
     36                      size_t                rsp_fifo_depth)
     37           : soclib::caba::BaseModule(name),
    3838                 p_clk("p_clk"),
    3939                 p_resetn("p_resetn"),
     
    4343                 r_cmd_fsm("r_cmd_fsm"),
    4444                 r_rsp_fsm("r_rsp_fsm"),
    45                  r_fifo_cmd("r_fifo_cmd", cmd_fifo_depth),
    46                  r_fifo_rsp("r_fifo_rsp", rsp_fifo_depth)
    47     {
    48         SC_METHOD (transition);
    49         dont_initialize();
    50         sensitive << p_clk.pos();
    51         SC_METHOD (genMoore);
    52         dont_initialize();
    53         sensitive  << p_clk.neg();
    54 
    55         assert( (dspin_cmd_width == 40) && "The DSPIN CMD flit width must have 40 bits");
    56         assert( (dspin_rsp_width == 33) && "The DSPIN RSP flit width must have 33 bits");
    57         assert( (vci_param::N    <= 40) && "The VCI ADDRESS field cannot have more than 40 bits");
    58         assert( (vci_param::B    == 4) && "The VCI DATA filds must have 32 bits");
    59         assert( (vci_param::K    == 8) && "The VCI PLEN field cannot have more than 8 bits");
    60         assert( (vci_param::S    <= 14) && "The VCI SRCID field cannot have more than 8 bits");
    61         assert( (vci_param::T    <= 8) && "The VCI TRDID field cannot have more than 8 bits");
    62         assert( (vci_param::E    == 2) && "The VCI RERROR field cannot have more than 2 bits");
    63 
    64     } //  end constructor
     45             r_fifo_cmd("r_fifo_cmd", cmd_fifo_depth),
     46             r_fifo_rsp("r_fifo_rsp", rsp_fifo_depth)
     47{
     48    SC_METHOD (transition);
     49    dont_initialize();
     50    sensitive << p_clk.pos();
     51    SC_METHOD (genMoore);
     52    dont_initialize();
     53    sensitive  << p_clk.neg();
     54
     55    assert( (dspin_cmd_width == 40) && "The DSPIN CMD flit width must have 40 bits");
     56    assert( (dspin_rsp_width == 33) && "The DSPIN RSP flit width must have 33 bits");
     57    assert( (vci_param::N    <= 40) && "The VCI ADDRESS field cannot have more than 40 bits");
     58    assert( (vci_param::B    == 4) && "The VCI DATA filds must have 32 bits");
     59    assert( (vci_param::K    == 8) && "The VCI PLEN field cannot have more than 8 bits");
     60    assert( (vci_param::S    <= 14) && "The VCI SRCID field cannot have more than 8 bits");
     61    assert( (vci_param::T    <= 8) && "The VCI TRDID field cannot have more than 8 bits");
     62    assert( (vci_param::E    == 2) && "The VCI RERROR field cannot have more than 2 bits");
     63
     64} //  end constructor
    6565
    6666/////////////////////////
    6767tmpl(void)::transition()
    6868{
    69         sc_uint<dspin_cmd_width>        cmd_fifo_data;
    70         bool                            cmd_fifo_write;
    71         bool                            cmd_fifo_read;
    72 
    73         sc_uint<dspin_rsp_width>        rsp_fifo_data;
    74         bool                            rsp_fifo_write;
    75         bool                            rsp_fifo_read;
    76 
    77         if (p_resetn == false)
    78         {
    79             r_fifo_cmd.init();
    80             r_fifo_rsp.init();
    81             r_cmd_fsm = CMD_IDLE;
    82             r_rsp_fsm = RSP_IDLE;
    83             return;
    84         } // end reset
    85 
    86         /////////////////////////////////////////////////////////////
    87         // VCI command packet to DSPIN command packet
    88         // The VCI packet is analysed, translated,
    89         // and the DSPIN packet is stored in the fifo_cmd
    90         /////////////////////////////////////////////////////////////
    91         // - A N flits VCI write command packet is translated
    92         //   to a N+2 flits DSPIN command.
    93         // - A single flit VCI read command packet is translated
    94         //   to a 2 flits DSPIN command.
    95         // - A single flit VCI broadcast packet is translated to
    96         //   a 2 flits DSPIN command.
    97         // A DSPIN flit is written in the fifo_cmd in all states
    98         // but a VCI flit is consumed only in the CMD_READ,
    99         // CMD_BROACAST,  and CMD_WDATA states.
    100         //////////////////////////////////////////////////////////////
    101 
    102         // cmd_fifo_read
    103         cmd_fifo_read = p_dspin_out.read.read();
    104 
    105         // r_cmd_fsm, cmd_fifo_write and cmd_fifo_data
    106         cmd_fifo_write = false;         // default value
    107 
    108         switch(r_cmd_fsm) {
    109             case CMD_IDLE:              // write first DSPIN flit into fifo_cmd
    110             {
    111                 if( p_vci.cmdval && r_fifo_cmd.wok() )
    112                 {
    113                     cmd_fifo_write = true;
     69    sc_uint<dspin_cmd_width>    cmd_fifo_data;
     70    bool                cmd_fifo_write;
     71    bool                cmd_fifo_read;
     72
     73    sc_uint<dspin_rsp_width>    rsp_fifo_data;
     74    bool                rsp_fifo_write;
     75    bool                rsp_fifo_read;
     76
     77    if (p_resetn == false)
     78        {
     79        r_fifo_cmd.init();
     80        r_fifo_rsp.init();
     81        r_cmd_fsm = CMD_IDLE;
     82        r_rsp_fsm = RSP_IDLE;
     83        return;
     84    } // end reset
     85
     86    /////////////////////////////////////////////////////////////
     87    // VCI command packet to DSPIN command packet
     88    // The VCI packet is analysed, translated,
     89    // and the DSPIN packet is stored in the fifo_cmd
     90    /////////////////////////////////////////////////////////////
     91    // - A N flits VCI write command packet is translated
     92    //   to a N+2 flits DSPIN command.
     93    // - A single flit VCI read command packet is translated
     94    //   to a 2 flits DSPIN command.
     95    // - A single flit VCI broadcast packet is translated to
     96    //   a 2 flits DSPIN command.
     97    // A DSPIN flit is written in the fifo_cmd in all states
     98    // but a VCI flit is consumed only in the CMD_READ,
     99    // CMD_BROACAST,  and CMD_WDATA states.
     100    //////////////////////////////////////////////////////////////
     101
     102    // cmd_fifo_read
     103    cmd_fifo_read = p_dspin_out.read.read();
     104
     105    // r_cmd_fsm, cmd_fifo_write and cmd_fifo_data
     106    cmd_fifo_write = false;        // default value
     107
     108    switch(r_cmd_fsm) {
     109        case CMD_IDLE:        // write first DSPIN flit into fifo_cmd
     110            {
     111                if( p_vci.cmdval && r_fifo_cmd.wok() )
     112                {
     113                    cmd_fifo_write = true;
    114114                    sc_uint<dspin_cmd_width> address = (sc_uint<dspin_cmd_width>)p_vci.address.read();
    115115                    sc_uint<dspin_cmd_width> srcid   = (sc_uint<dspin_cmd_width>)p_vci.srcid.read();
     
    121121
    122122                    if ( vci_param::N == 40 ) address = address >> 1;
    123                     else                      address = address << (39 - vci_param::N);             
    124 
    125                     if ( is_broadcast ) // VCI broacast command
     123                    else                      address = address << (39 - vci_param::N);
     124
     125                    if ( is_broadcast )    // VCI broacast command
    126126                    {
    127127                        r_cmd_fsm     = CMD_BROADCAST;
    128128                        cmd_fifo_data = (address      & 0x7FFFF80000LL) |
    129                                         ((srcid << 5) & 0x000007FFE0LL) | 
    130                                         ((trdid << 1) & 0x000000001ELL) | 
    131                                                         0x0000000001LL;         
    132                     }
    133                     else if (is_read )                  // VCI READ  command
    134                     {
    135                         r_cmd_fsm     = CMD_READ;
     129                                        ((srcid << 5) & 0x000007FFE0LL) |
     130                                        ((trdid << 1) & 0x000000001ELL) |
     131                                                        0x0000000001LL;
     132                    }
     133                    else if (is_read )            // VCI READ  command
     134                    {
     135                        r_cmd_fsm     = CMD_READ;
    136136                        cmd_fifo_data = address & 0x7FFFFFFFFELL;
    137                     }
    138                     else                                // VCI WRITE command
    139                     {
    140                         r_cmd_fsm     = CMD_WRITE;
     137                    }
     138                    else                 // VCI WRITE command
     139                    {
     140                        r_cmd_fsm     = CMD_WRITE;
    141141                        cmd_fifo_data = address & 0x7FFFFFFFFELL;
    142                     }
    143                 }
    144                 break;
    145             }
    146             case CMD_BROADCAST:         // write second DSPIN flit in case of broadcast
    147             {   
    148                 if( p_vci.cmdval && r_fifo_cmd.wok() )
     142                    }
     143                }
     144         break;
     145        }
     146        case CMD_BROADCAST:        // write second DSPIN flit in case of broadcast
     147            {
     148                if( p_vci.cmdval && r_fifo_cmd.wok() )
    149149                {
    150150                    cmd_fifo_write   = true;
    151151                    sc_uint<dspin_cmd_width> data = (sc_uint<dspin_cmd_width>)p_vci.wdata.read();
    152152                    sc_uint<dspin_cmd_width> be   = (sc_uint<dspin_cmd_width>)p_vci.be.read();
    153                     cmd_fifo_data    = (data       & 0x00FFFFFFFFLL) | 
     153                    cmd_fifo_data    = (data       & 0x00FFFFFFFFLL) |
    154154                                       ((be << 32) & 0x0300000000LL) |
    155                                                      0x8000000000LL; 
     155                                                     0x8000000000LL;
    156156                    r_cmd_fsm = CMD_IDLE;
    157157                }
    158158                break;
    159159            }
    160             case CMD_READ:      // write second DSPIN flit in case of read/write
     160            case CMD_READ:    // write second DSPIN flit in case of read/write
    161161            case CMD_WRITE:
    162162            {
    163                 if( p_vci.cmdval && r_fifo_cmd.wok() )
    164                 {
    165                     cmd_fifo_write      = true;
     163                if( p_vci.cmdval && r_fifo_cmd.wok() )
     164                {
     165                    cmd_fifo_write      = true;
    166166                    sc_uint<dspin_cmd_width> srcid   = (sc_uint<dspin_cmd_width>)p_vci.srcid.read();
     167                    sc_uint<dspin_cmd_width> pktid   = (sc_uint<dspin_cmd_width>)p_vci.pktid.read();
    167168                    sc_uint<dspin_cmd_width> trdid   = (sc_uint<dspin_cmd_width>)p_vci.trdid.read();
    168169                    sc_uint<dspin_cmd_width> cmd     = (sc_uint<dspin_cmd_width>)p_vci.cmd.read();
    169170                    sc_uint<dspin_cmd_width> plen    = (sc_uint<dspin_cmd_width>)p_vci.plen.read();
    170171                    sc_uint<dspin_cmd_width> be      = (sc_uint<dspin_cmd_width>)p_vci.be.read();
    171                     cmd_fifo_data       = ((be    << 1 ) & 0x000000001ELL) |
    172                                           ((trdid << 5 ) & 0x0000001FE0LL) |
    173                                           ((plen  << 13) & 0x00001FE000LL) |
    174                                           ((cmd   << 23) & 0x0001800000LL) |
    175                                           ((srcid << 25) & 0x7FFE000000LL) ;
     172                    cmd_fifo_data                    = ((be    << 1 ) & 0x000000001ELL) |
     173                                                       ((pktid << 5 ) & 0x00000001E0LL) |
     174                                                       ((trdid << 9 ) & 0x0000001E00LL) |
     175                                                       ((plen  << 13) & 0x00001FE000LL) |
     176                                                       ((cmd   << 23) & 0x0001800000LL) |
     177                                                       ((srcid << 25) & 0x7FFE000000LL) ;
    176178                    if ( p_vci.contig.read() ) cmd_fifo_data = cmd_fifo_data | 0x0000400000LL ;
    177179                    if ( p_vci.cons.read()   ) cmd_fifo_data = cmd_fifo_data | 0x0000200000LL ;
     
    182184                        cmd_fifo_data = cmd_fifo_data    | 0x8000000000LL ;
    183185                    }
    184                     else                        // write command
     186                    else            // write command
    185187                    {
    186188                        r_cmd_fsm = CMD_WDATA;
    187189                    }
    188                 }
    189                 break;
    190             }
    191             case CMD_WDATA:
    192             {
    193                 if( p_vci.cmdval && r_fifo_cmd.wok() )
    194                 {
    195                     cmd_fifo_write = true;
     190        }
     191        break;
     192            }
     193        case CMD_WDATA:
     194            {
     195                if( p_vci.cmdval && r_fifo_cmd.wok() )
     196                {
     197                    cmd_fifo_write = true;
    196198                    sc_uint<dspin_cmd_width> data = (sc_uint<dspin_cmd_width>)p_vci.wdata.read();
    197199                    sc_uint<dspin_cmd_width> be   = (sc_uint<dspin_cmd_width>)p_vci.be.read();
    198                     cmd_fifo_data    = (data       & 0x00FFFFFFFFLL) |
    199                                        ((be << 32) & 0x0F00000000LL) ;
    200                                        
     200                    cmd_fifo_data                 = (data       & 0x00FFFFFFFFLL) |
     201                                                    ((be << 32) & 0x0F00000000LL) ;
     202
    201203                    if ( p_vci.eop.read() )
    202204                    {
     
    204206                        r_cmd_fsm = CMD_IDLE;
    205207                    }
    206                 }               
     208                }
    207209                break;
    208210            }
    209         } // end switch r_cmd_fsm
    210        
    211         // fifo_cmd
    212         if((cmd_fifo_write == true)  && (cmd_fifo_read == false)) { r_fifo_cmd.simple_put(cmd_fifo_data); }
    213         if((cmd_fifo_write == true)  && (cmd_fifo_read == true))  { r_fifo_cmd.put_and_get(cmd_fifo_data); }
    214         if((cmd_fifo_write == false) && (cmd_fifo_read == true))  { r_fifo_cmd.simple_get(); }
    215 
    216         //////////////////////////////////////////////////////////////
    217         // DSPIN response packet to VCI response packet
    218         // The DSPIN packet is stored in the fifo_rsp
    219         // The FIFO output is analysed and translated to a VCI packet
    220         //////////////////////////////////////////////////////////////
    221         // - A N+1 flits DSPIN read response packet is translated
    222         //   to a N flits VCI response.
    223         // - A single flit DSPIN write response packet is translated
    224         //   to a single flit VCI response.
    225         // A valid DSPIN flit in the fifo_rsp is always consumed   
    226         // in the CMD_IDLE state, but no VCI flit is transmitted.
    227         // The VCI flits are sent in the RSP_READ & RSP_WRITE states.
    228         //////////////////////////////////////////////////////////////
    229 
    230         // rsp_fifo_write, rsp_fifo_data
    231         rsp_fifo_write = p_dspin_in.write.read();
    232         rsp_fifo_data  = p_dspin_in.data.read();
    233 
    234         // r_rsp_fsm, rsp_fifo_read
    235         rsp_fifo_read = false;          // default value
    236 
    237         switch(r_rsp_fsm) {
    238             case RSP_IDLE:
    239             {
    240                 if( r_fifo_rsp.rok() )
    241                 {
    242                     rsp_fifo_read = true;
     211    } // end switch r_cmd_fsm
     212
     213    // fifo_cmd
     214    if((cmd_fifo_write == true)  && (cmd_fifo_read == false)) { r_fifo_cmd.simple_put(cmd_fifo_data); }
     215    if((cmd_fifo_write == true)  && (cmd_fifo_read == true))  { r_fifo_cmd.put_and_get(cmd_fifo_data); }
     216    if((cmd_fifo_write == false) && (cmd_fifo_read == true))  { r_fifo_cmd.simple_get(); }
     217
     218    //////////////////////////////////////////////////////////////
     219    // DSPIN response packet to VCI response packet
     220    // The DSPIN packet is stored in the fifo_rsp
     221    // The FIFO output is analysed and translated to a VCI packet
     222    //////////////////////////////////////////////////////////////
     223    // - A N+1 flits DSPIN read response packet is translated
     224    //   to a N flits VCI response.
     225    // - A single flit DSPIN write response packet is translated
     226    //   to a single flit VCI response.
     227    // A valid DSPIN flit in the fifo_rsp is always consumed
     228    // in the CMD_IDLE state, but no VCI flit is transmitted.
     229    // The VCI flits are sent in the RSP_READ & RSP_WRITE states.
     230    //////////////////////////////////////////////////////////////
     231
     232    // rsp_fifo_write, rsp_fifo_data
     233    rsp_fifo_write = p_dspin_in.write.read();
     234    rsp_fifo_data  = p_dspin_in.data.read();
     235
     236    // r_rsp_fsm, rsp_fifo_read
     237        rsp_fifo_read = false;        // default value
     238
     239    switch(r_rsp_fsm) {
     240        case RSP_IDLE:
     241            {
     242        if( r_fifo_rsp.rok() )
     243                {
     244            rsp_fifo_read = true;
    243245                    r_rsp_buf = r_fifo_rsp.read();
    244246                    if ( (r_fifo_rsp.read() & 0x000020000LL) == 0 )  r_rsp_fsm = RSP_READ;
    245                     else                                             r_rsp_fsm = RSP_WRITE;
    246                 }
    247                 break;
    248             }
    249             case RSP_READ:             
    250             {
    251                 if( r_fifo_rsp.rok() && p_vci.rspack.read() )
    252                 {
    253                     rsp_fifo_read = true;
     247                    else                              r_rsp_fsm = RSP_WRITE;
     248        }
     249        break;
     250            }
     251        case RSP_READ:
     252        {
     253        if( r_fifo_rsp.rok() && p_vci.rspack.read() )
     254                {
     255            rsp_fifo_read = true;
    254256                    if ( (r_fifo_rsp.read() & 0x100000000LL) ) r_rsp_fsm = RSP_IDLE;
    255                 }
    256                 break;
     257        }
     258        break;
    257259            }
    258260            case RSP_WRITE:
     
    260262                if ( p_vci.rspack.read() ) r_rsp_fsm = RSP_IDLE;
    261263            }
    262         } // end switch r_rsp_fsm
    263 
    264         // fifo_rsp
    265         if((rsp_fifo_write == true)  && (rsp_fifo_read == false)) { r_fifo_rsp.simple_put(rsp_fifo_data); }
    266         if((rsp_fifo_write == true)  && (rsp_fifo_read == true))  { r_fifo_rsp.put_and_get(rsp_fifo_data); }
    267         if((rsp_fifo_write == false) && (rsp_fifo_read == true))  { r_fifo_rsp.simple_get(); }
     264    } // end switch r_rsp_fsm
     265
     266    // fifo_rsp
     267    if((rsp_fifo_write == true)  && (rsp_fifo_read == false)) { r_fifo_rsp.simple_put(rsp_fifo_data); }
     268    if((rsp_fifo_write == true)  && (rsp_fifo_read == true))  { r_fifo_rsp.put_and_get(rsp_fifo_data); }
     269    if((rsp_fifo_write == false) && (rsp_fifo_read == true))  { r_fifo_rsp.simple_get(); }
    268270
    269271}; // end transition
     
    272274tmpl(void)::genMoore()
    273275{
    274         // VCI CMD interface
    275         if ( ( r_cmd_fsm.read() == CMD_IDLE ) || ( r_cmd_fsm.read() == CMD_WRITE ) ) 
    276         {
    277             p_vci.cmdack = false; 
    278         }
    279         else
     276    // VCI CMD interface
     277        if ( ( r_cmd_fsm.read() == CMD_IDLE ) || ( r_cmd_fsm.read() == CMD_WRITE ) )
     278        {
     279            p_vci.cmdack = false;
     280        }
     281    else
    280282        {
    281283            p_vci.cmdack = r_fifo_cmd.wok();
    282284        }
    283285
    284         // VCI RSP interface
    285         if ( r_rsp_fsm.read() == RSP_IDLE )
     286    // VCI RSP interface
     287    if ( r_rsp_fsm.read() == RSP_IDLE )
    286288        {
    287289            p_vci.rspval = false;
     
    290292        {
    291293            p_vci.rspval = true;
    292             p_vci.rdata  = 0;
     294            p_vci.rdata  = 0;
    293295            p_vci.rsrcid = (sc_uint<vci_param::S>)((r_rsp_buf.read() & 0x0FFFC0000LL) >> 18);
    294             p_vci.rtrdid = (sc_uint<vci_param::T>)((r_rsp_buf.read() & 0x00000FF00LL) >> 8);
    295             p_vci.rpktid = 0;
     296            p_vci.rpktid = (sc_uint<vci_param::T>)((r_rsp_buf.read() & 0x000000F00LL) >> 8);
     297            p_vci.rtrdid = (sc_uint<vci_param::P>)((r_rsp_buf.read() & 0x00000F000LL) >> 12);
    296298            p_vci.rerror = (sc_uint<vci_param::E>)((r_rsp_buf.read() & 0x000030000LL) >> 16);
    297299            p_vci.reop   = true;
     
    302304            p_vci.rdata  = (sc_uint<8*vci_param::B>)(r_fifo_rsp.read() & 0x0FFFFFFFFLL);
    303305            p_vci.rsrcid = (sc_uint<vci_param::S>)((r_rsp_buf.read()   & 0x0FFFC0000LL) >> 18);
    304             p_vci.rtrdid = (sc_uint<vci_param::T>)((r_rsp_buf.read()   & 0x00000FF00LL) >> 8);
    305             p_vci.rpktid = 0;
     306            p_vci.rpktid = (sc_uint<vci_param::T>)((r_rsp_buf.read()   & 0x000000F00LL) >> 8);
     307            p_vci.rtrdid = (sc_uint<vci_param::P>)((r_rsp_buf.read()   & 0x00000F000LL) >> 12);
    306308            p_vci.rerror = (sc_uint<vci_param::E>)((r_rsp_buf.read()   & 0x000030000LL) >> 16);
    307             p_vci.reop   = ((r_fifo_rsp.read() & 0x100000000LL) == 0x100000000LL); 
    308         }
    309 
    310         // DSPIN_OUT interface
    311         p_dspin_out.write = r_fifo_cmd.rok();
    312         p_dspin_out.data  = r_fifo_cmd.read();
    313 
    314         // DSPIN_IN interface
    315         p_dspin_in.read = r_fifo_rsp.wok();
     309            p_vci.reop   = ((r_fifo_rsp.read() & 0x100000000LL) == 0x100000000LL);
     310        }
     311
     312        // DSPIN_OUT interface
     313        p_dspin_out.write = r_fifo_cmd.rok();
     314        p_dspin_out.data  = r_fifo_cmd.read();
     315
     316        // DSPIN_IN interface
     317        p_dspin_in.read  = r_fifo_rsp.wok();
    316318
    317319}; // end genMoore
     
    334336
    335337    std::cout << name() << " : " << cmd_str[r_cmd_fsm.read()]
    336                         << " | " << rsp_str[r_rsp_fsm.read()] 
     338                        << " | " << rsp_str[r_rsp_fsm.read()]
    337339                        << " | fifo_cmd = " << r_fifo_cmd.filled_status()
    338340                        << " | fifo_rsp = " << r_fifo_rsp.filled_status()
  • trunk/modules/vci_vdspin_target_wrapper/caba/source/src/vci_vdspin_target_wrapper.cpp

    r185 r284  
    55  *
    66  * SOCLIB_LGPL_HEADER_BEGIN
    7   * 
     7  *
    88  * This file is part of SoCLib, GNU LGPLv2.1.
    9   * 
     9  *
    1010  * SoCLib is free software; you can redistribute it and/or modify it
    1111  * under the terms of the GNU Lesser General Public License as published
    1212  * by the Free Software Foundation; version 2.1 of the License.
    13   * 
     13  *
    1414  * SoCLib is distributed in the hope that it will be useful, but
    1515  * WITHOUT ANY WARRANTY; without even the implied warranty of
    1616  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1717  * Lesser General Public License for more details.
    18   * 
     18  *
    1919  * You should have received a copy of the GNU Lesser General Public
    2020  * License along with SoCLib; if not, write to the Free Software
    2121  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    2222  * 02110-1301 USA
    23   * 
     23  *
    2424  * SOCLIB_LGPL_HEADER_END
    2525  */
     
    3434
    3535//////////////////////////////////////////////////////////:////////////////////////////////
    36 tmpl(/**/)::VciVdspinTargetWrapper(sc_module_name                       name,
    37                                    size_t                               cmd_fifo_depth,
    38                                    size_t                               rsp_fifo_depth)
    39                : soclib::caba::BaseModule(name),
     36tmpl(/**/)::VciVdspinTargetWrapper(sc_module_name             name,
     37                        size_t                cmd_fifo_depth,
     38                   size_t                rsp_fifo_depth)
     39           : soclib::caba::BaseModule(name),
    4040                 p_clk("p_clk"),
    4141                 p_resetn("p_resetn"),
     
    4545                 r_cmd_fsm("r_cmd_fsm"),
    4646                 r_rsp_fsm("r_rsp_fsm"),
    47                  r_fifo_cmd("r_fifo_cmd", cmd_fifo_depth),
    48                  r_fifo_rsp("r_fifo_rsp", rsp_fifo_depth)
     47             r_fifo_cmd("r_fifo_cmd", cmd_fifo_depth),
     48             r_fifo_rsp("r_fifo_rsp", rsp_fifo_depth)
    4949    {
    50         SC_METHOD (transition);
    51         dont_initialize();
    52         sensitive << p_clk.pos();
    53         SC_METHOD (genMoore);
    54         dont_initialize();
    55         sensitive  << p_clk.neg();
     50    SC_METHOD (transition);
     51    dont_initialize();
     52    sensitive << p_clk.pos();
     53    SC_METHOD (genMoore);
     54    dont_initialize();
     55    sensitive  << p_clk.neg();
    5656
    5757        assert( (dspin_cmd_width == 40) && "The DSPIN CMD flit width must have 40 bits");
    5858        assert( (dspin_rsp_width == 33) && "The DSPIN RSP flit width must have 33 bits");
    59         assert( (vci_param::N    <= 40) && "The VCI ADDRESS field cannot have more than 40 bits"); 
     59        assert( (vci_param::N    <= 40) && "The VCI ADDRESS field cannot have more than 40 bits");
    6060        assert( (vci_param::B    == 4) && "The VCI DATA filds must have 32 bits");
    6161        assert( (vci_param::K    == 8) && "The VCI PLEN field cannot have more than 8 bits");
     
    6969tmpl(void)::transition()
    7070{
    71         sc_uint<dspin_cmd_width>                cmd_fifo_data;
    72         bool                                    cmd_fifo_write;
    73         bool                                    cmd_fifo_read;
    74 
    75         sc_uint<dspin_rsp_width>                rsp_fifo_data;
    76         bool                                    rsp_fifo_write;
    77         bool                                    rsp_fifo_read;
    78 
    79         if (p_resetn == false)
    80         {
    81             r_fifo_cmd.init();
    82             r_fifo_rsp.init();
    83             r_cmd_fsm = CMD_IDLE;
    84             r_rsp_fsm = RSP_IDLE;
    85             return;
    86         } // end reset
    87 
    88         /////////////////////////////////////////////////////////////
    89         // VCI response packet to DSPIN response packet.
    90         // The VCI packet is analysed, translated,
    91         // and the DSPIN packet is stored in the fifo_rsp
    92         /////////////////////////////////////////////////////////////
    93         // - A single flit VCI write response packet is translated
    94         //   to a single flit DSPIN response.
    95         // - A N flits VCI read response packet is translated
    96         //   to a N+1 flits DSPIN response
    97         // In the RSP_IDLE state, the first DSPIN flit is written
    98         // in fifo_rsp , but no VCI flit is consumed. The VCI flits
    99         // are consumed in the RSP_READ or RSP_WRITE states.
    100         //////////////////////////////////////////////////////////////
    101 
    102         // rsp_fifo_read
    103         rsp_fifo_read = p_dspin_out.read.read();
    104 
    105         // r_rsp_fsm, rsp_fifo_write and rsp_fifo_data
    106         rsp_fifo_write = false;         // default value
    107 
    108         switch(r_rsp_fsm) {
    109             case RSP_IDLE:              // write first DSPIN flit into rsp_fifo
    110             {
    111                 if( p_vci.rspval && r_fifo_rsp.wok() )
     71    sc_uint<dspin_cmd_width>        cmd_fifo_data;
     72    bool                    cmd_fifo_write;
     73    bool                    cmd_fifo_read;
     74
     75    sc_uint<dspin_rsp_width>        rsp_fifo_data;
     76    bool                    rsp_fifo_write;
     77    bool                    rsp_fifo_read;
     78
     79    if (p_resetn == false)
     80        {
     81        r_fifo_cmd.init();
     82        r_fifo_rsp.init();
     83        r_cmd_fsm = CMD_IDLE;
     84        r_rsp_fsm = RSP_IDLE;
     85        return;
     86    } // end reset
     87
     88    /////////////////////////////////////////////////////////////
     89    // VCI response packet to DSPIN response packet.
     90    // The VCI packet is analysed, translated,
     91    // and the DSPIN packet is stored in the fifo_rsp
     92    /////////////////////////////////////////////////////////////
     93    // - A single flit VCI write response packet is translated
     94    //   to a single flit DSPIN response.
     95    // - A N flits VCI read response packet is translated
     96    //   to a N+1 flits DSPIN response
     97    // In the RSP_IDLE state, the first DSPIN flit is written
     98    // in fifo_rsp , but no VCI flit is consumed. The VCI flits
     99    // are consumed in the RSP_READ or RSP_WRITE states.
     100    //////////////////////////////////////////////////////////////
     101
     102    // rsp_fifo_read
     103    rsp_fifo_read = p_dspin_out.read.read();
     104
     105    // r_rsp_fsm, rsp_fifo_write and rsp_fifo_data
     106        rsp_fifo_write = false;        // default value
     107
     108    switch(r_rsp_fsm) {
     109        case RSP_IDLE:        // write first DSPIN flit into rsp_fifo
     110            {
     111                if( p_vci.rspval && r_fifo_rsp.wok() )
    112112                {
    113113                    bool is_read = ( (p_vci.rerror.read() & 0x2) == 0);
    114114
    115                     rsp_fifo_write = true;
     115                    rsp_fifo_write = true;
    116116                    rsp_fifo_data = (((sc_uint<dspin_rsp_width>)p_vci.rsrcid.read()) << 18) |
    117117                                    (((sc_uint<dspin_rsp_width>)p_vci.rerror.read()) << 16) |
    118                                     (((sc_uint<dspin_rsp_width>)p_vci.rtrdid.read()) << 8);
    119                     if ( is_read )
     118                                    (((sc_uint<dspin_rsp_width>)p_vci.rtrdid.read()) << 12) |
     119                                    (((sc_uint<dspin_rsp_width>)p_vci.rpktid.read()) << 8);
     120                    if ( is_read )
    120121                    {
    121122                        r_rsp_fsm = RSP_READ;
     
    126127                        r_rsp_fsm = RSP_WRITE;
    127128                    }
    128                 }
    129                 break;
    130             }
    131             case RSP_READ:              // write DSPIN data flit in case of read
    132             {   
     129                }
     130                break;
     131            }
     132        case RSP_READ:        // write DSPIN data flit in case of read
     133            {
    133134                if( p_vci.rspval && r_fifo_rsp.wok() )
    134135                {
    135136                    rsp_fifo_write   = true;
    136137                    rsp_fifo_data = ((sc_uint<dspin_rsp_width>)p_vci.rdata.read());
    137                     if ( p_vci.reop ) 
     138                    if ( p_vci.reop )
    138139                    {
    139140                        rsp_fifo_data = rsp_fifo_data | 0x100000000LL;
     
    149150                break;
    150151            }
    151         } // end switch r_cmd_fsm
    152        
    153         // fifo_rsp
    154         if((rsp_fifo_write == true)  && (rsp_fifo_read == false)) { r_fifo_rsp.simple_put(rsp_fifo_data); }
    155         if((rsp_fifo_write == true)  && (rsp_fifo_read == true))  { r_fifo_rsp.put_and_get(rsp_fifo_data); }
    156         if((rsp_fifo_write == false) && (rsp_fifo_read == true))  { r_fifo_rsp.simple_get(); }
     152    } // end switch r_cmd_fsm
     153
     154    // fifo_rsp
     155    if((rsp_fifo_write == true)  && (rsp_fifo_read == false)) { r_fifo_rsp.simple_put(rsp_fifo_data); }
     156    if((rsp_fifo_write == true)  && (rsp_fifo_read == true))  { r_fifo_rsp.put_and_get(rsp_fifo_data); }
     157    if((rsp_fifo_write == false) && (rsp_fifo_read == true))  { r_fifo_rsp.simple_get(); }
    157158
    158159        //////////////////////////////////////////////////////////////
    159         // DSPIN command packet to VCI command packet
    160         // The DSPIN packet is stored in the fifo_rsp
    161         // The FIFO output is analysed and translated to a VCI packet
     160    // DSPIN command packet to VCI command packet
     161    // The DSPIN packet is stored in the fifo_rsp
     162    // The FIFO output is analysed and translated to a VCI packet
    162163        //////////////////////////////////////////////////////////////
    163164        // - A 2 flits DSPIN broadcast command is translated
     
    166167        //   to a 1 flit VCI read command.
    167168        // - A N+2 flits DSPIN write command is translated
    168         //   to a N flits VCI write command. 
    169         // The VCI flits are sent in the CMD_READ, CMD_WDATA 
    170         // & CMD_BROADCAST states. 
     169        //   to a N flits VCI write command.
     170        // The VCI flits are sent in the CMD_READ, CMD_WDATA
     171        // & CMD_BROADCAST states.
    171172        // The r_cmd_buf0 et r_cmd_buf1 buffers are used to store
    172173        // the two first DSPIN flits (in case of write).
    173174        //////////////////////////////////////////////////////////////
    174175
    175         // cmd_fifo_write, cmd_fifo_data
    176         cmd_fifo_write = p_dspin_in.write.read();
    177         cmd_fifo_data  = p_dspin_in.data.read();
    178 
    179         // r_cmd_fsm, cmd_fifo_read
    180         cmd_fifo_read = false;          // default value
    181 
    182         switch(r_cmd_fsm) {
    183             case CMD_IDLE:
    184             {
    185                 if( r_fifo_cmd.rok() )
     176    // cmd_fifo_write, cmd_fifo_data
     177    cmd_fifo_write = p_dspin_in.write.read();
     178    cmd_fifo_data  = p_dspin_in.data.read();
     179
     180    // r_cmd_fsm, cmd_fifo_read
     181        cmd_fifo_read = false;         // default value
     182
     183    switch(r_cmd_fsm) {
     184        case CMD_IDLE:
     185            {
     186        if( r_fifo_cmd.rok() )
    186187                {
    187188                    bool is_broadcast = ( (r_fifo_cmd.read() & 0x1) == 0x1);
    188189
    189                     cmd_fifo_read = true;
    190                     r_cmd_buf0    = r_fifo_cmd.read();          // save address
     190            cmd_fifo_read = true;
     191                    r_cmd_buf0    = r_fifo_cmd.read();         // save address
    191192                    if ( is_broadcast ) r_cmd_fsm = CMD_BROADCAST;
    192                     else                r_cmd_fsm = CMD_RW;
    193                 }
    194                 break;
    195             }
    196             case CMD_BROADCAST:
    197             {
    198                 if( r_fifo_cmd.rok() && p_vci.cmdack )
     193                    else        r_cmd_fsm = CMD_RW;
     194        }
     195        break;
     196            }
     197        case CMD_BROADCAST:
     198        {
     199        if( r_fifo_cmd.rok() && p_vci.cmdack )
    199200                {
    200201                    cmd_fifo_read = true;
     
    205206            case CMD_RW:
    206207            {
    207                 if( r_fifo_cmd.rok() )
    208                 {
    209                     cmd_fifo_read = true;
    210                     r_cmd_buf1 = r_fifo_cmd.read();             // save command parameters
     208        if( r_fifo_cmd.rok() )
     209                {
     210                    cmd_fifo_read = true;
     211                    r_cmd_buf1 = r_fifo_cmd.read();        // save command parameters
    211212                    // read command if EOP
    212213                    if ( (r_fifo_cmd.read() & 0x8000000000LL) )   r_cmd_fsm = CMD_READ;
    213                     else                                          r_cmd_fsm = CMD_WDATA;
     214                    else                      r_cmd_fsm = CMD_WDATA;
    214215                    r_flit_count = 0;
    215                 }
    216                 break;
     216        }
     217        break;
    217218            }
    218219            case CMD_READ:
     
    223224            case CMD_WDATA:
    224225            {
    225                 if( r_fifo_cmd.rok() && p_vci.cmdack.read() )
    226                 {
    227                     if ( (r_cmd_buf1.read() & 0x0000200000LL) == 0 )    r_flit_count = r_flit_count + 1;
    228                     cmd_fifo_read = true;
    229                     if ( (r_fifo_cmd.read() & 0x8000000000LL) )         r_cmd_fsm = CMD_IDLE;
    230                 }
    231                 break;
    232             }
    233         } // end switch r_cmd_fsm
    234 
    235         // fifo_cmd
    236         if((cmd_fifo_write == true)  && (cmd_fifo_read == false)) { r_fifo_cmd.simple_put(cmd_fifo_data); }
    237         if((cmd_fifo_write == true)  && (cmd_fifo_read == true))  { r_fifo_cmd.put_and_get(cmd_fifo_data); }
    238         if((cmd_fifo_write == false) && (cmd_fifo_read == true))  { r_fifo_cmd.simple_get(); }
     226        if( r_fifo_cmd.rok() && p_vci.cmdack.read() )
     227                {
     228                    if ( (r_cmd_buf1.read() & 0x0000200000LL) == 0 )     r_flit_count = r_flit_count + 1;
     229                    cmd_fifo_read = true;
     230                    if ( (r_fifo_cmd.read() & 0x8000000000LL) )     r_cmd_fsm = CMD_IDLE;
     231        }
     232                break;
     233            }
     234    } // end switch r_cmd_fsm
     235
     236    // fifo_cmd
     237    if((cmd_fifo_write == true)  && (cmd_fifo_read == false)) { r_fifo_cmd.simple_put(cmd_fifo_data); }
     238    if((cmd_fifo_write == true)  && (cmd_fifo_read == true))  { r_fifo_cmd.put_and_get(cmd_fifo_data); }
     239    if((cmd_fifo_write == false) && (cmd_fifo_read == true))  { r_fifo_cmd.simple_get(); }
    239240
    240241}; // end transition
     
    243244tmpl(void)::genMoore()
    244245{
    245         // VCI RSP interface
    246         if ( r_rsp_fsm.read() == RSP_IDLE )     p_vci.rspack = false;
    247         else                                    p_vci.rspack = r_fifo_rsp.wok();
    248 
    249         // VCI CMD interface
    250         if ( (r_cmd_fsm.read() == CMD_IDLE) || (r_cmd_fsm.read() == CMD_RW) )
     246    // VCI RSP interface
     247        if ( r_rsp_fsm.read() == RSP_IDLE )    p_vci.rspack = false;
     248    else                                       p_vci.rspack = r_fifo_rsp.wok();
     249
     250    // VCI CMD interface
     251    if ( (r_cmd_fsm.read() == CMD_IDLE) || (r_cmd_fsm.read() == CMD_RW) )
    251252        {
    252253            p_vci.cmdval = false;
    253254        }
    254         else if ( r_cmd_fsm.read() == CMD_BROADCAST )   // VCI CMD broadcast
     255        else if ( r_cmd_fsm.read() == CMD_BROADCAST )    // VCI CMD broadcast
    255256        {
    256257            if ( r_fifo_cmd.rok() )
     
    258259                sc_uint<dspin_cmd_width>  minmax = r_cmd_buf0.read() & 0x7FFFF80000LL;
    259260                if ( vci_param::N == 40 ) minmax = (minmax << 1);
    260                 else                      minmax = (minmax >> (39 - vci_param::N) );
     261                else              minmax = (minmax >> (39 - vci_param::N) );
    261262                p_vci.cmdval  = true;
    262                 p_vci.address = (sc_uint<vci_param::N>)minmax | 0x3;
     263                p_vci.address = (sc_uint<vci_param::N>)minmax | 0x3;
    263264                p_vci.cmd     = vci_param::CMD_WRITE;
    264265                p_vci.wdata   = (sc_uint<8*vci_param::B>)(r_fifo_cmd.read() & 0x00FFFFFFFFLL);
     
    266267                p_vci.srcid   = (sc_uint<vci_param::S>)((r_cmd_buf0.read()  & 0x000007FFE0LL) >> 5);
    267268                p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf0.read()  & 0x000000001ELL) >> 1);
    268                 p_vci.pktid   = 0;
     269                p_vci.pktid   = 0;
    269270                p_vci.plen    = vci_param::B;
    270271                p_vci.contig  = true;
     
    274275            else
    275276            {
    276                 p_vci.cmdval = false;
    277             }
    278         }
    279         else if ( r_cmd_fsm.read() == CMD_READ )        // VCI CMD read
    280         {           
     277                p_vci.cmdval = false;
     278            }
     279        }
     280        else if ( r_cmd_fsm.read() == CMD_READ )    // VCI CMD read
     281        {
    281282            sc_uint<vci_param::N> address;
    282283            if ( vci_param::N == 40 ) address = (r_cmd_buf0.read() << 1);
    283             else                      address = (r_cmd_buf0.read() >> (39 - vci_param::N) ); 
     284            else                      address = (r_cmd_buf0.read() >> (39 - vci_param::N) );
    284285            p_vci.cmdval  = true;
    285             p_vci.address = address;
     286            p_vci.address = address;
    286287            p_vci.cmd     = (sc_uint<2>)((r_cmd_buf1.read()            & 0x0001800000LL) >> 23);
    287             p_vci.wdata   = 0;
     288            p_vci.wdata   = 0;
    288289            p_vci.be      = (sc_uint<vci_param::B>)((r_cmd_buf1.read() & 0x000000001ELL) >> 1);
    289290            p_vci.srcid   = (sc_uint<vci_param::S>)((r_cmd_buf1.read() & 0x7FFE000000LL) >> 25);
    290             p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf1.read() & 0x0000001FE0LL) >> 5);
    291             p_vci.pktid   = 0;
     291            p_vci.pktid   = (sc_uint<vci_param::P>)((r_cmd_buf1.read() & 0x00000001E0LL) >> 5);
     292            p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf1.read() & 0x0000001E00LL) >> 9);
    292293            p_vci.plen    = (sc_uint<vci_param::K>)((r_cmd_buf1.read() & 0x00001FE000LL) >> 13);
    293294            p_vci.contig  = ((r_cmd_buf1.read() & 0x0000400000LL) != 0);
    294295            p_vci.cons    = ((r_cmd_buf1.read() & 0x0000200000LL) != 0);
    295296            p_vci.eop     = true;
    296         }
    297         else if ( r_cmd_fsm.read() == CMD_WDATA )       // VCI write command
    298         {
    299             if ( r_fifo_cmd.rok() ) 
     297    }
     298        else if ( r_cmd_fsm.read() == CMD_WDATA )    // VCI write command
     299        {
     300            if ( r_fifo_cmd.rok() )
    300301            {
    301302                sc_uint<vci_param::N> address;
    302303                if ( vci_param::N == 40 ) address = (r_cmd_buf0.read() << 1);
    303                 else                      address = (r_cmd_buf0.read() >> (39 - vci_param::N) ); 
     304                else                      address = (r_cmd_buf0.read() >> (39 - vci_param::N) );
    304305                p_vci.cmdval  = true;
    305                 p_vci.address = address + (r_flit_count.read()*vci_param::B);
    306                 p_vci.cmd     = (sc_uint<2>)((r_cmd_buf1.read()              & 0x0001800000LL) >> 23);
    307                 p_vci.wdata   = (sc_uint<8*vci_param::B>)(r_fifo_cmd.read() & 0x00FFFFFFFFLL);
    308                 p_vci.be      = (sc_uint<vci_param::B>)((r_fifo_cmd.read()   & 0x0F00000000LL) >> 32);
    309                 p_vci.srcid   = (sc_uint<vci_param::S>)((r_cmd_buf1.read()   & 0x7FFE000000LL) >> 25);
    310                 p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf1.read()   & 0x0000001FE0LL) >> 5);
    311                 p_vci.pktid   = 0;
    312                 p_vci.plen    = (sc_uint<vci_param::K>)((r_cmd_buf1.read() & 0x00001FE000LL) >> 13);
     306                p_vci.address = address + (r_flit_count.read()*vci_param::B);
     307                p_vci.cmd     = (sc_uint<2>)((r_cmd_buf1.read()             & 0x0001800000LL) >> 23);
     308                p_vci.wdata   = (sc_uint<8*vci_param::B>)(r_fifo_cmd.read() & 0x00FFFFFFFFLL);
     309                p_vci.be      = (sc_uint<vci_param::B>)((r_fifo_cmd.read()  & 0x0F00000000LL) >> 32);
     310                p_vci.srcid   = (sc_uint<vci_param::S>)((r_cmd_buf1.read()  & 0x7FFE000000LL) >> 25);
     311                p_vci.pktid   = (sc_uint<vci_param::P>)((r_cmd_buf1.read()  & 0x00000001E0LL) >> 5);
     312                p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf1.read()  & 0x0000001E00LL) >> 9);
     313                p_vci.plen    = (sc_uint<vci_param::K>)((r_cmd_buf1.read()  & 0x00001FE000LL) >> 13);
    313314                p_vci.contig  = ((r_cmd_buf1.read() & 0x0000400000LL) != 0);
    314315                p_vci.cons    = ((r_cmd_buf1.read() & 0x0000200000LL) != 0);
    315                 p_vci.eop     = ((r_fifo_cmd.read() & 0x8000000000LL) == 0x8000000000LL);
     316                p_vci.eop     = ((r_fifo_cmd.read() & 0x8000000000LL) == 0x8000000000LL);
    316317            }
    317318            else
    318319            {
    319                 p_vci.cmdval = false;
    320             }
    321         }
    322 
    323         // DSPIN_OUT interface
    324         p_dspin_out.write = r_fifo_rsp.rok();
    325         p_dspin_out.data  = r_fifo_rsp.read();
    326 
    327         // DSPIN_IN interface
    328         p_dspin_in.read = r_fifo_cmd.wok();
     320                p_vci.cmdval = false;
     321            }
     322        }
     323
     324    // DSPIN_OUT interface
     325    p_dspin_out.write = r_fifo_rsp.rok();
     326    p_dspin_out.data  = r_fifo_rsp.read();
     327
     328    // DSPIN_IN interface
     329    p_dspin_in.read = r_fifo_cmd.wok();
    329330
    330331}; // end genMoore
     
    346347    };
    347348    std::cout << name() << " : " << cmd_str[r_cmd_fsm.read()]
    348                         << " | " << rsp_str[r_rsp_fsm.read()] 
     349                        << " | " << rsp_str[r_rsp_fsm.read()]
    349350                        << " | fifo_cmd = " << r_fifo_cmd.filled_status()
    350351                        << " | fifo_rsp = " << r_fifo_rsp.filled_status()
    351                         << std::endl;
     352                        << std::endl;
    352353}
    353354
Note: See TracChangeset for help on using the changeset viewer.