Changeset 479 for branches/ODCCP/modules


Ignore:
Timestamp:
Jul 29, 2013, 11:31:38 AM (11 years ago)
Author:
devigne
Message:

Merge with the lastest version of Trunk
Modification in vci_mem_cache : Using TRT's wdata field for
put request to ixr_cmd (just for INCLUSIVE mode)

Location:
branches/ODCCP/modules
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/ODCCP/modules/vci_cc_vcache_wrapper

  • branches/ODCCP/modules/vci_cc_vcache_wrapper/caba/metadata/vci_cc_vcache_wrapper.sd

    r421 r479  
    3737            ports = [
    3838            Port('caba:vci_initiator', 'p_vci'),
    39             Port('caba:dspin_input', 'p_dspin_in',
     39            Port('caba:dspin_input', 'p_dspin_m2p',
    4040                  dspin_data_size = parameter.Reference('dspin_in_width')),
    41             Port('caba:dspin_output', 'p_dspin_out',
     41            Port('caba:dspin_output', 'p_dspin_p2m',
    4242                  dspin_data_size = parameter.Reference('dspin_out_width')),
     43            Port('caba:dspin_input', 'p_dspin_clack',
     44                  dspin_data_size = parameter.Reference('dspin_in_width')),
    4345                Port('caba:bit_in','p_irq', parameter.Constant('n_irq')),
    4446                Port('caba:bit_in', 'p_resetn', auto = 'resetn'),
  • branches/ODCCP/modules/vci_cc_vcache_wrapper/caba/source/include/vci_cc_vcache_wrapper.h

    r460 r479  
    8989        // handling coherence requests
    9090        ICACHE_CC_CHECK,
     91        ICACHE_CC_UPDT,
    9192        ICACHE_CC_INVAL,
    92         ICACHE_CC_UPDT,
    93         ICACHE_CC_BROADCAST,
    94         ICACHE_CC_SEND_WAIT,
    9593    };
    9694
     
    141139        // handling coherence requests
    142140        DCACHE_CC_CHECK,
     141        DCACHE_CC_UPDT,
     142        DCACHE_CC_INVAL,
    143143        DCACHE_CC_INVAL_DATA,
    144         DCACHE_CC_INVAL,
    145         DCACHE_CC_UPDT,
    146         DCACHE_CC_BROADCAST,
    147         DCACHE_CC_SEND_WAIT,
    148144        // handling TLB inval (after a coherence or XTN request)
    149145        DCACHE_INVAL_TLB_SCAN,
     
    177173    {
    178174        CC_RECEIVE_IDLE,
    179         CC_RECEIVE_CLACK,
    180175        CC_RECEIVE_BRDCAST_HEADER,
    181176        CC_RECEIVE_BRDCAST_NLINE,
    182         CC_RECEIVE_INVAL_HEADER,
    183         CC_RECEIVE_INVAL_NLINE,
    184         CC_RECEIVE_UPDT_HEADER,
    185         CC_RECEIVE_UPDT_NLINE,
    186         CC_RECEIVE_UPDT_DATA,
     177        CC_RECEIVE_INS_INVAL_HEADER,
     178        CC_RECEIVE_INS_INVAL_NLINE,
     179        CC_RECEIVE_INS_UPDT_HEADER,
     180        CC_RECEIVE_INS_UPDT_NLINE,
     181        CC_RECEIVE_INS_UPDT_DATA,
     182        CC_RECEIVE_DATA_INVAL_HEADER,
     183        CC_RECEIVE_DATA_INVAL_NLINE,
     184        CC_RECEIVE_DATA_UPDT_HEADER,
     185        CC_RECEIVE_DATA_UPDT_NLINE,
     186        CC_RECEIVE_DATA_UPDT_DATA,
    187187    };
    188188
     
    301301
    302302public:
    303     sc_in<bool>                                 p_clk;
    304     sc_in<bool>                                 p_resetn;
    305     sc_in<bool>                                 p_irq[iss_t::n_irq];
    306     soclib::caba::VciInitiator<vci_param>       p_vci;
    307     soclib::caba::DspinInput <dspin_in_width>   p_dspin_in;
    308     soclib::caba::DspinOutput<dspin_out_width>  p_dspin_out;
     303    sc_in<bool>                                p_clk;
     304    sc_in<bool>                                p_resetn;
     305    sc_in<bool>                                p_irq[iss_t::n_irq];
     306    soclib::caba::VciInitiator<vci_param>      p_vci;
     307    soclib::caba::DspinInput<dspin_in_width>   p_dspin_m2p;
     308    soclib::caba::DspinOutput<dspin_out_width> p_dspin_p2m;
     309    soclib::caba::DspinInput<dspin_in_width>   p_dspin_clack;
    309310
    310311private:
     
    387388    sc_signal<bool>         r_icache_cc_need_write;     // activate the cache for writing
    388389
     390    // coherence clack handling
     391    sc_signal<bool>         r_icache_clack_req;         // clack request
     392    sc_signal<size_t>       r_icache_clack_way;             // clack way
     393    sc_signal<size_t>       r_icache_clack_set;             // clack set
     394
    389395    // icache flush handling
    390396    sc_signal<size_t>       r_icache_flush_count;           // slot counter used for cache flush
     
    459465    sc_signal<size_t>       r_dcache_cc_word;               // word counter for cc update
    460466    sc_signal<bool>         r_dcache_cc_need_write;     // activate the cache for writing
     467
     468    // coherence clack handling
     469    sc_signal<bool>         r_dcache_clack_req;         // clack request
     470    sc_signal<size_t>       r_dcache_clack_way;             // clack way
     471    sc_signal<size_t>       r_dcache_clack_set;             // clack set
    461472
    462473    // dcache flush handling
     
    586597    sc_signal<paddr_t>      r_cc_receive_dcache_nline;      // cache line physical address
    587598
     599    ///////////////////////////////////
     600    //  DSPIN CLACK INTERFACE REGISTER
     601    ///////////////////////////////////
     602    sc_signal<bool>         r_dspin_clack_req;
     603    sc_signal<uint64_t>     r_dspin_clack_flit;
     604   
    588605    //////////////////////////////////////////////////////////////////
    589606    // processor, write buffer, caches , TLBs
  • branches/ODCCP/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp

    r460 r479  
    6565
    6666        "ICACHE_CC_CHECK",
     67        "ICACHE_CC_UPDT",
    6768        "ICACHE_CC_INVAL",
    68         "ICACHE_CC_UPDT",
    69         "ICACHE_CC_BROADCAST",
    70         "ICACHE_CC_SEND_WAIT",
    7169    };
    7270
     
    116114
    117115        "DCACHE_CC_CHECK",
     116        "DCACHE_CC_UPDT",
     117        "DCACHE_CC_INVAL",
    118118        "DCACHE_CC_INVAL_DATA",
    119         "DCACHE_CC_INVAL",
    120         "DCACHE_CC_UPDT",
    121         "DCACHE_CC_BROADCAST",
    122         "DCACHE_CC_SEND_WAIT",
    123119
    124120        "DCACHE_INVAL_TLB_SCAN",
     
    167163const char *cc_receive_fsm_state_str[] = {
    168164        "CC_RECEIVE_IDLE",
    169         "CC_RECEIVE_CLACK",
    170165        "CC_RECEIVE_BRDCAST_HEADER",
    171166        "CC_RECEIVE_BRDCAST_NLINE",
    172         "CC_RECEIVE_INVAL_HEADER",
    173         "CC_RECEIVE_INVAL_NLINE",
    174         "CC_RECEIVE_UPDT_HEADER",
    175         "CC_RECEIVE_UPDT_NLINE",
    176         "CC_RECEIVE_UPDT_DATA",
     167        "CC_RECEIVE_INS_INVAL_HEADER",
     168        "CC_RECEIVE_INS_INVAL_NLINE",
     169        "CC_RECEIVE_INS_UPDT_HEADER",
     170        "CC_RECEIVE_INS_UPDT_NLINE",
     171        "CC_RECEIVE_INS_UPDT_DATA",
     172        "CC_RECEIVE_DATA_INVAL_HEADER",
     173        "CC_RECEIVE_DATA_INVAL_NLINE",
     174        "CC_RECEIVE_DATA_UPDT_HEADER",
     175        "CC_RECEIVE_DATA_UPDT_NLINE",
     176        "CC_RECEIVE_DATA_UPDT_DATA",
    177177    };
    178178
     
    224224      p_resetn("p_resetn"),
    225225      p_vci("p_vci"),
    226       p_dspin_in("p_dspin_in"),
    227       p_dspin_out("p_dspin_out"),
     226      p_dspin_m2p("p_dspin_m2p"),
     227      p_dspin_p2m("p_dspin_p2m"),
     228      p_dspin_clack("p_dspin_clack"),
    228229
    229230      m_cacheability_table( mtd.getCacheabilityTable() ),
     
    792793        r_icache_cc_send_req       = false;
    793794
     795        r_icache_clack_req         = false;
     796
    794797        // No pending write in pipeline
    795798        r_dcache_wbuf_req          = false;
     
    812815        r_dcache_cc_send_req       = false;
    813816
     817        r_dcache_clack_req         = false;
     818
    814819        // No request from CC_RECEIVE FSM to ICACHE/DCACHE FSMs
    815820        r_cc_receive_icache_req    = false;
     
    826831        r_icache_miss_inval        = false;
    827832        r_dcache_miss_inval        = false;
     833
     834        r_dspin_clack_req          = false;
    828835
    829836        // No signalisation  of errors
     
    10771084                        // 5/ uncacheable read miss                     => ICACHE_UNC_REQ
    10781085    {
     1086        // coherence clack interrupt
     1087        if ( r_icache_clack_req.read() )
     1088        {
     1089            r_icache_fsm = ICACHE_CC_CHECK;
     1090            r_icache_fsm_save = r_icache_fsm.read();
     1091            break;
     1092        }
     1093
    10791094        // coherence interrupt
    10801095        if ( r_cc_receive_icache_req.read())
     
    13061321                            // external coherence request are accepted in this state.
    13071322    {
     1323        // coherence clack interrupt
     1324        if ( r_icache_clack_req.read() )
     1325        {
     1326            r_icache_fsm = ICACHE_CC_CHECK;
     1327            r_icache_fsm_save = r_icache_fsm.read();
     1328            break;
     1329        }
     1330
    13081331        // coherence interrupt
    13091332        if ( r_cc_receive_icache_req.read() )
     
    13501373                                        // A cleanup request is generated for each valid line
    13511374    {
     1375        // coherence clack interrupt
     1376        if ( r_icache_clack_req.read() )
     1377        {
     1378            r_icache_fsm = ICACHE_CC_CHECK;
     1379            r_icache_fsm_save = r_icache_fsm.read();
     1380            break;
     1381        }
     1382
    13521383        // coherence request (from CC_RECEIVE FSM)
    13531384        if ( r_cc_receive_icache_req.read() )
     
    15481579    {
    15491580        if (m_ireq.valid) m_cost_ins_miss_frz++;
     1581
     1582        // coherence clack interrupt
     1583        if ( r_icache_clack_req.read() )
     1584        {
     1585            r_icache_fsm = ICACHE_CC_CHECK;
     1586            r_icache_fsm_save = r_icache_fsm.read();
     1587            break;
     1588        }
    15501589
    15511590        // coherence interrupt
     
    16381677        if (m_ireq.valid) m_cost_ins_miss_frz++;
    16391678
     1679        // coherence clack interrupt
     1680        if ( r_icache_clack_req.read() )
     1681        {
     1682            r_icache_fsm = ICACHE_CC_CHECK;
     1683            r_icache_fsm_save = r_icache_fsm.read();
     1684            break;
     1685        }
     1686
    16401687        // coherence interrupt
    16411688        if ( r_cc_receive_icache_req.read() )
     
    17091756        if ( m_ireq.valid ) m_cost_ins_miss_frz++;
    17101757
     1758        // coherence clack interrupt
     1759        if ( r_icache_clack_req.read() )
     1760        {
     1761            r_icache_fsm = ICACHE_CC_CHECK;
     1762            r_icache_fsm_save = r_icache_fsm.read();
     1763            break;
     1764        }
     1765
    17111766        // coherence interrupt
    17121767        if ( r_cc_receive_icache_req.read() )
     
    17801835    case ICACHE_UNC_WAIT:       // waiting a response to an uncacheable read from VCI_RSP FSM
    17811836    {
     1837        // coherence clack interrupt
     1838        if ( r_icache_clack_req.read() )
     1839        {
     1840            r_icache_fsm = ICACHE_CC_CHECK;
     1841            r_icache_fsm_save = r_icache_fsm.read();
     1842            break;
     1843        }
     1844
    17821845        // coherence interrupt
    17831846        if ( r_cc_receive_icache_req.read() )
     
    18201883        paddr_t  mask  = ~((m_icache_words<<2)-1);
    18211884
    1822         if (r_cc_receive_icache_type.read() == CC_TYPE_CLACK)
    1823                                 // We switch the directory slot to EMPTY state
    1824                             // and reset r_icache_miss_clack if the cleanup ack
    1825                             // is matching a pending miss
    1826         {
    1827 
    1828             if ( m_ireq.valid ) m_cost_ins_miss_frz++;
    1829 
    1830 #ifdef INSTRUMENTATION
    1831 m_cpt_icache_dir_write++;
    1832 #endif
    1833             r_icache.write_dir( 0,
    1834                                 r_cc_receive_icache_way.read(),
    1835                                 r_cc_receive_icache_set.read(),
    1836                                 CACHE_SLOT_STATE_EMPTY);
    1837 
    1838             if ( (r_icache_miss_set.read() == r_cc_receive_icache_set.read()) and
    1839                  (r_icache_miss_way.read() == r_cc_receive_icache_way.read()) )
    1840                     r_icache_miss_clack = false;
    1841 
    1842             r_icache_fsm = r_icache_fsm_save.read() ;
    1843             r_cc_receive_icache_req = false;
    1844 
    1845 #if DEBUG_ICACHE
    1846 if ( m_debug_activated )
    1847 {
    1848     std::cout << "  <PROC " << name()
    1849     << " ICACHE_CC_CHECK>  CC_TYPE_CLACK slot returns to empty state"
    1850     << " set = " << r_cc_receive_icache_set.read()
    1851     << " / way = " << r_cc_receive_icache_way.read() << std::endl;
    1852 }
    1853 #endif
    1854         }
    1855         else if( ((r_icache_fsm_save.read() == ICACHE_MISS_SELECT) or
    1856                  (r_icache_fsm_save.read() == ICACHE_MISS_WAIT) or
    1857                  (r_icache_fsm_save.read() == ICACHE_MISS_DIR_UPDT)) and
    1858                  ((r_icache_vci_paddr.read() & mask) == (paddr & mask)) ) // matching
     1885
     1886        // Match between MISS address and CC address
     1887        // note: In the same cycle we can handle a CLACK and a MISS match
     1888        // because the CLACK access the directory but the MISS match dont.
     1889        if (r_cc_receive_icache_req.read() and
     1890          ((r_icache_fsm_save.read() == ICACHE_MISS_SELECT  )  or
     1891           (r_icache_fsm_save.read() == ICACHE_MISS_WAIT    )  or
     1892           (r_icache_fsm_save.read() == ICACHE_MISS_DIR_UPDT)) and
     1893          ((r_icache_vci_paddr.read() & mask) == (paddr & mask)) ) // matching
    18591894        {
    18601895            // signaling the matching
     
    18671902                r_icache_fsm        = ICACHE_CC_UPDT;
    18681903                r_icache_cc_word    = r_cc_receive_word_idx.read();
     1904
    18691905                // just pop the fifo , don't write in icache
    18701906                r_icache_cc_need_write = false;
     
    18851921#endif
    18861922        }
    1887         else                                                                                        // no match
    1888         {
    1889             int         state = 0;
    1890             size_t          way = 0;
    1891             size_t          set = 0;
    1892             size_t          word = 0;
     1923
     1924        // CLACK handler
     1925        // We switch the directory slot to EMPTY state
     1926        // and reset r_icache_miss_clack if the cleanup ack
     1927        // is matching a pending miss.
     1928        if ( r_icache_clack_req.read() )
     1929        {
     1930
     1931            if ( m_ireq.valid ) m_cost_ins_miss_frz++;
    18931932
    18941933#ifdef INSTRUMENTATION
    1895 m_cpt_icache_dir_read++;
    1896 #endif
    1897             r_icache.read_dir(paddr,
    1898                               &state,
    1899                               &way,
    1900                               &set,
    1901                               &word);
    1902 
    1903             r_icache_cc_way = way;
    1904             r_icache_cc_set = set;
    1905 
    1906             if ( state == CACHE_SLOT_STATE_VALID_CC)            // hit
    1907             {
    1908                 // need to update the cache state
    1909                 r_icache_cc_need_write = true;
    1910                 if (r_cc_receive_icache_type.read() == CC_TYPE_UPDT)  // hit update
    1911                 {
    1912                     r_icache_fsm          = ICACHE_CC_UPDT;
    1913                     r_icache_cc_word      = r_cc_receive_word_idx.read();
    1914                 }
    1915                 else if (r_cc_receive_icache_type.read() == CC_TYPE_INVAL)   // hit inval
    1916                 {
    1917                     r_icache_fsm          = ICACHE_CC_INVAL;
    1918                 }
    1919                 else if (r_cc_receive_icache_type.read() == CC_TYPE_BRDCAST)  // hit broadcast
    1920                 {
    1921                     r_icache_fsm          = ICACHE_CC_BROADCAST;
    1922                 }
    1923             }
    1924             else                                      // miss
    1925             {
    1926                 // multicast acknowledgement required in case of update
    1927                 if(r_cc_receive_icache_type.read() == CC_TYPE_UPDT)
    1928                 {
    1929                     r_icache_fsm          = ICACHE_CC_UPDT;
    1930                     r_icache_cc_word      = r_cc_receive_word_idx.read();
    1931                     // just pop the fifo , don't write in icache
    1932                     r_icache_cc_need_write = false;
    1933                 }
    1934                 else // No response needed
    1935                 {
    1936                     r_cc_receive_icache_req = false;
    1937                     r_icache_fsm          = r_icache_fsm_save.read();
    1938                 }
    1939             }
    1940         }
    1941         break;
    1942     }
    1943     /////////////////////
    1944     case ICACHE_CC_INVAL:       // hit inval : switch slot to EMPTY state
    1945     {
     1934m_cpt_icache_dir_write++;
     1935#endif
     1936            r_icache.write_dir( 0,
     1937                                r_icache_clack_way.read(),
     1938                                r_icache_clack_set.read(),
     1939                                CACHE_SLOT_STATE_EMPTY);
     1940
     1941            if ( (r_icache_miss_set.read() == r_icache_clack_set.read()) and
     1942                 (r_icache_miss_way.read() == r_icache_clack_way.read()) )
     1943            {
     1944                r_icache_miss_clack = false;
     1945            }
     1946
     1947            r_icache_clack_req = false;
     1948
     1949            // return to cc_save state if no pending CC request
     1950            if ( not r_cc_receive_icache_req.read() )
     1951                r_icache_fsm = r_icache_fsm_save.read();
    19461952
    19471953#if DEBUG_ICACHE
     
    19491955{
    19501956    std::cout << "  <PROC " << name()
    1951               << " ICACHE_//CC_INVAL> slot returns to empty state"
    1952               << " set = " << r_icache_cc_set.read()
    1953               << " / way = " << r_icache_cc_way.read() << std::endl;
     1957        << " ICACHE_CC_CHECK>  CC_TYPE_CLACK slot returns to empty state"
     1958        << " set = " << r_icache_clack_set.read()
     1959        << " / way = " << r_icache_clack_way.read() << std::endl;
    19541960}
    19551961#endif
     1962
     1963            break;
     1964        }
     1965
     1966        // wait if pending request to CC_SEND. This way if there are pending
     1967        // CLACK they can be treated in this state and then a deadlock
     1968        // situation is avoided
     1969        if ( r_icache_cc_send_req.read() ) break;
     1970
     1971        // CC request handler
     1972
     1973        int             state = 0;
     1974        size_t      way = 0;
     1975        size_t      set = 0;
     1976        size_t      word = 0;
    19561977
    19571978#ifdef INSTRUMENTATION
    19581979m_cpt_icache_dir_read++;
    19591980#endif
    1960 
    1961             if (r_icache_cc_need_write.read())
    1962             {
    1963                 r_icache.write_dir( 0,
    1964                         r_icache_cc_way.read(),
    1965                         r_icache_cc_set.read(),
    1966                         CACHE_SLOT_STATE_EMPTY );
    1967                 // no need to write in the cache anymore
     1981        r_icache.read_dir(paddr,
     1982                          &state,
     1983                          &way,
     1984                          &set,
     1985                          &word);
     1986
     1987        r_icache_cc_way = way;
     1988        r_icache_cc_set = set;
     1989
     1990        if ( state == CACHE_SLOT_STATE_VALID_CC)            // hit
     1991        {
     1992            // need to update the cache state
     1993            if (r_cc_receive_icache_type.read() == CC_TYPE_UPDT)  // hit update
     1994            {
     1995                r_icache_cc_need_write = true;
     1996                r_icache_fsm           = ICACHE_CC_UPDT;
     1997                r_icache_cc_word       = r_cc_receive_word_idx.read();
     1998            }
     1999            else if ( r_cc_receive_icache_type.read() == CC_TYPE_INVAL ) // hit inval
     2000            {
     2001                r_icache_fsm           = ICACHE_CC_INVAL;
     2002            }
     2003        }
     2004        else                                      // miss
     2005        {
     2006            // multicast acknowledgement required in case of update
     2007            if(r_cc_receive_icache_type.read() == CC_TYPE_UPDT)
     2008            {
     2009                r_icache_fsm           = ICACHE_CC_UPDT;
     2010                r_icache_cc_word       = r_cc_receive_word_idx.read();
     2011
     2012                // just pop the fifo , don't write in icache
    19682013                r_icache_cc_need_write = false;
    19692014            }
    1970         // multicast acknowledgement
    1971         // send a request to cc_send_fsm
    1972         if(not r_icache_cc_send_req.read()) // cc_send is available
    1973         {
    1974             // coherence request completed
    1975             r_cc_receive_icache_req = false;
    1976             // request multicast acknowledgement
    1977             r_icache_cc_send_req = true;
    1978             r_icache_cc_send_nline = r_cc_receive_icache_nline.read();
    1979             r_icache_cc_send_updt_tab_idx = r_cc_receive_icache_updt_tab_idx.read();
    1980             r_icache_cc_send_type = CC_TYPE_MULTI_ACK;
    1981 
    1982             r_icache_fsm          = r_icache_fsm_save.read();
    1983         }
    1984         //else wait for previous cc_send request to be sent
     2015            else // No response needed
     2016            {
     2017                r_cc_receive_icache_req = false;
     2018                r_icache_fsm            = r_icache_fsm_save.read();
     2019            }
     2020        }
     2021        break;
     2022    }
     2023    /////////////////////
     2024    case ICACHE_CC_INVAL:       // hit inval : switch slot to ZOMBI state
     2025    {
     2026        assert (not r_icache_cc_send_req.read() &&
     2027                "ERROR in ICACHE_CC_INVAL: the r_icache_cc_send_req "
     2028                "must not be set");
     2029
     2030#ifdef INSTRUMENTATION
     2031m_cpt_icache_dir_read++;
     2032#endif
     2033
     2034        // Switch slot state to ZOMBI and send CLEANUP command
     2035        r_icache.write_dir( 0,
     2036                            r_icache_cc_way.read(),
     2037                            r_icache_cc_set.read(),
     2038                            CACHE_SLOT_STATE_ZOMBI );
     2039
     2040        // coherence request completed
     2041        r_icache_cc_send_req   = true;
     2042        r_icache_cc_send_nline = r_cc_receive_icache_nline.read();
     2043        r_icache_cc_send_way   = r_icache_cc_way.read();
     2044        r_icache_cc_send_type  = CC_TYPE_CLEANUP;
     2045
     2046        r_icache_fsm           = r_icache_fsm_save.read();
     2047
     2048#if DEBUG_ICACHE
     2049if ( m_debug_activated )
     2050{
     2051std::cout << "  <PROC " << name()
     2052          << " ICACHE_CC_INVAL> slot returns to ZOMBI state"
     2053          << " set = " << r_icache_cc_set.read()
     2054          << " / way = " << r_icache_cc_way.read() << std::endl;
     2055}
     2056#endif
     2057
    19852058        break;
    19862059    }
     
    19882061    case ICACHE_CC_UPDT:        // hit update : write one word per cycle
    19892062    {
     2063        assert (not r_icache_cc_send_req.read() &&
     2064                "ERROR in ICACHE_CC_UPDT: the r_icache_cc_send_req "
     2065                "must not be set");
     2066
     2067        if ( not r_cc_receive_updt_fifo_be.rok() ) break;
     2068
     2069
     2070        size_t  word  = r_icache_cc_word.read();
     2071        size_t  way   = r_icache_cc_way.read();
     2072        size_t  set   = r_icache_cc_set.read();
     2073
     2074        if (r_icache_cc_need_write.read())
     2075        {
     2076            r_icache.write( way,
     2077                            set,
     2078                            word,
     2079                            r_cc_receive_updt_fifo_data.read(),
     2080                            r_cc_receive_updt_fifo_be.read() );
     2081
     2082            r_icache_cc_word = word+1;
     2083
     2084#ifdef INSTRUMENTATION
     2085m_cpt_icache_data_write++;
     2086#endif
    19902087
    19912088#if DEBUG_ICACHE
     
    19992096}
    20002097#endif
    2001 
    2002 #ifdef INSTRUMENTATION
    2003 m_cpt_icache_data_write++;
    2004 #endif
    2005         size_t  word  = r_icache_cc_word.read();
    2006         size_t  way   = r_icache_cc_way.read();
    2007         size_t  set   = r_icache_cc_set.read();
    2008 
    2009         if (r_cc_receive_updt_fifo_be.rok())
    2010         {
    2011             if (r_icache_cc_need_write.read())
    2012             {
    2013                 r_icache.write( way,
    2014                                 set,
    2015                                 word,
    2016                                 r_cc_receive_updt_fifo_data.read(),
    2017                                 r_cc_receive_updt_fifo_be.read() );
    2018 
    2019                 r_icache_cc_word = word+1;
    2020             }
    2021             if ( r_cc_receive_updt_fifo_eop.read() )    // last word
    2022             {
     2098        }
     2099
     2100        if ( r_cc_receive_updt_fifo_eop.read() )        // last word
     2101        {
    20232102                // no need to write in the cache anymore
    2024                 r_icache_cc_need_write = false;
    2025                 // wait to send a request to cc_send_fsm
    2026                 if(not r_icache_cc_send_req.read()) // cc_send is available
    2027                 {
    2028                     //consume last flit
    2029                     cc_receive_updt_fifo_get  = true;
    2030                     // coherence request completed
    2031                     r_cc_receive_icache_req = false;
    2032                     // request multicast acknowledgement
    2033                     r_icache_cc_send_req = true;
    2034                     r_icache_cc_send_nline = r_cc_receive_icache_nline.read();
    2035                     r_icache_cc_send_updt_tab_idx = r_cc_receive_icache_updt_tab_idx.read();
    2036                     r_icache_cc_send_type = CC_TYPE_MULTI_ACK;
    2037 
    2038                     r_icache_fsm          = r_icache_fsm_save.read();
    2039                 }
    2040             }
    2041             else
    2042             {
    2043                 //consume fifo if not eop
    2044                 cc_receive_updt_fifo_get  = true;
    2045             }
    2046         }
     2103            r_icache_cc_need_write        = false;
     2104
     2105            // coherence request completed
     2106            r_cc_receive_icache_req       = false;
     2107
     2108            // request multicast acknowledgement
     2109            r_icache_cc_send_req          = true;
     2110            r_icache_cc_send_nline        = r_cc_receive_icache_nline.read();
     2111            r_icache_cc_send_updt_tab_idx = r_cc_receive_icache_updt_tab_idx.read();
     2112            r_icache_cc_send_type         = CC_TYPE_MULTI_ACK;
     2113
     2114            r_icache_fsm                  = r_icache_fsm_save.read();
     2115        }
     2116        //consume fifo if not eop
     2117        cc_receive_updt_fifo_get  = true;
     2118
    20472119        break;
    20482120    }
    2049     /////////////////////////
    2050     case ICACHE_CC_BROADCAST:  // hit broadcast : switch slot to ZOMBI state
    2051                                // and request a cleanup
    2052     {
    2053 
    2054 #if DEBUG_ICACHE
    2055 if ( m_debug_activated )
    2056 {
    2057     std::cout << "  <PROC " << name()
    2058               << " ICACHE_CC_BROADCAST > Slot goes to zombi state "
    2059               << " set = " << r_icache_cc_set.read()
    2060               << " / way = " << r_icache_cc_way.read() << std::endl;
    2061 }
    2062 #endif
    2063 
    2064 #ifdef INSTRUMENTATION
    2065 m_cpt_icache_dir_write++;
    2066 #endif
    2067        if (r_icache_cc_need_write.read())
    2068        {
    2069             r_icache.write_dir( r_icache_cc_way.read(),
    2070                                 r_icache_cc_set.read(),
    2071                                 CACHE_SLOT_STATE_ZOMBI );
    2072                 // no need to write in the cache anymore
    2073             r_icache_cc_need_write = false;
    2074         }
    2075 
    2076         // cleanup
    2077         // send a request to cc_send_fsm
    2078         if(not r_icache_cc_send_req.read()) // cc_send is available
    2079         {
    2080             // coherence request completed
    2081             r_cc_receive_icache_req = false;
    2082             // request cleanup
    2083             r_icache_cc_send_req = true;
    2084             r_icache_cc_send_nline = r_cc_receive_icache_nline.read();
    2085             r_icache_cc_send_way   = r_icache_cc_way.read();
    2086             r_icache_cc_send_type  = CC_TYPE_CLEANUP;
    2087 
    2088             r_icache_fsm          = r_icache_fsm_save.read();
    2089         }
    2090         //else wait for previous cc_send request to be sent
    2091         break;
    2092     }
     2121
    20932122    } // end switch r_icache_fsm
    20942123
     
    23712400        }
    23722401
     2402        // coherence clack request (from DSPIN CLACK)
     2403        else if ( r_dcache_clack_req.read() )
     2404        {
     2405            r_dcache_fsm = DCACHE_CC_CHECK;
     2406            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     2407        }
    23732408        // coherence request (from CC_RECEIVE FSM)
    23742409        else if ( r_cc_receive_dcache_req.read() )
     
    30673102    case DCACHE_TLB_PTE1_GET:   // try to read a PT1 entry in dcache
    30683103    {
     3104        // coherence clack request (from DSPIN CLACK)
     3105        if ( r_dcache_clack_req.read() )
     3106        {
     3107            r_dcache_fsm = DCACHE_CC_CHECK;
     3108            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3109            break;
     3110        }
     3111
    30693112        // coherence request (from CC_RECEIVE FSM)
    30703113        if ( r_cc_receive_dcache_req.read() )
     
    33663409    case DCACHE_TLB_PTE2_GET:   // Try to get a PTE2 (64 bits) in the dcache
    33673410    {
     3411        // coherence clack request (from DSPIN CLACK)
     3412        if ( r_dcache_clack_req.read() )
     3413        {
     3414            r_dcache_fsm = DCACHE_CC_CHECK;
     3415            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3416            break;
     3417        }
     3418
    33683419        // coherence request (from CC_RECEIVE FSM)
    33693420        if ( r_cc_receive_dcache_req.read() )
     
    36653716
    36663717    {
     3718        // coherence clack request (from DSPIN CLACK)
     3719        if ( r_dcache_clack_req.read() )
     3720        {
     3721            r_dcache_fsm = DCACHE_CC_CHECK;
     3722            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3723            break;
     3724        }
     3725
    36673726        // coherence request (from CC_RECEIVE FSM)
    36683727        if ( r_cc_receive_dcache_req.read() )
     
    37363795                                // as there is a risk of dead-lock
    37373796    {
     3797        // coherence clack request (from DSPIN CLACK)
     3798        if ( r_dcache_clack_req.read() )
     3799        {
     3800            r_dcache_fsm = DCACHE_CC_CHECK;
     3801            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3802            break;
     3803        }
     3804
    37383805        // coherence request (from CC_RECEIVE FSM)
    37393806        if ( r_cc_receive_dcache_req.read() )
     
    37413808            r_dcache_fsm = DCACHE_CC_CHECK;
    37423809            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3810            break;
    37433811        }
    37443812
     
    37573825                                    // and because it can exist a simultaneous ITLB miss
    37583826    {
     3827        // coherence clack request (from DSPIN CLACK)
     3828        if ( r_dcache_clack_req.read() )
     3829        {
     3830            r_dcache_fsm = DCACHE_CC_CHECK;
     3831            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3832            break;
     3833        }
     3834
    37593835        // coherence request (from CC_RECEIVE FSM)
    37603836        if ( r_cc_receive_dcache_req.read() )
     
    37923868                                // returns to IDLE and flush TLBs when last slot
    37933869    {
     3870        // coherence clack request (from DSPIN CLACK)
     3871        if ( r_dcache_clack_req.read() )
     3872        {
     3873            r_dcache_fsm = DCACHE_CC_CHECK;
     3874            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     3875            break;
     3876        }
     3877
    37943878        // coherence request (from CC_RECEIVE FSM)
    37953879        if ( r_cc_receive_dcache_req.read() )
     
    38953979            r_dcache_xtn_flush_addr_data = r_dcache_xtn_flush_addr_data.read() + 4;
    38963980
    3897             cleanup_data_updt_fifo_dcache_get   = false;
    38983981            cleanup_data_updt_fifo_dcache_put   = true;
    38993982            cleanup_data_updt_fifo_dcache_data  = rdata;
     
    41584241            r_dcache_xtn_data_addr = r_dcache_xtn_data_addr.read() + 4;
    41594242
    4160             cleanup_data_updt_fifo_dcache_get   = false;
    41614243            cleanup_data_updt_fifo_dcache_put   = true;
    41624244            cleanup_data_updt_fifo_dcache_data  = rdata;
     
    41934275    {
    41944276        if ( m_dreq.valid) m_cost_data_miss_frz++;
     4277
     4278        // coherence clack request (from DSPIN CLACK)
     4279        if ( r_dcache_clack_req.read() )
     4280        {
     4281            r_dcache_fsm = DCACHE_CC_CHECK;
     4282            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4283            break;
     4284        }
    41954285
    41964286        // coherence request (from CC_RECEIVE FSM)
     
    42474337                            r_dcache_fsm = DCACHE_MISS_DATA;
    42484338                            m_cpt_data_cleanup_dirty ++;
    4249                            
     4339
    42504340                            /*STATS DIRTY*/
    42514341                            for (size_t w = 0; w < m_dcache_words; w++)
     
    42944384        size_t set;
    42954385        size_t word;
    4296 
    42974386        r_dcache.read_neutral(r_dcache_miss_data_addr,
    42984387                              &rdata,
     
    43004389                              &set,
    43014390                              &word);
     4391
    43024392        if(r_cc_send_data_fifo.wok())
    43034393        {
    43044394            r_dcache_miss_data_addr = r_dcache_miss_data_addr.read() + 4;
    43054395
    4306             cleanup_data_updt_fifo_dcache_get   = false;
    43074396            cleanup_data_updt_fifo_dcache_put   = true;
    43084397            cleanup_data_updt_fifo_dcache_data  = rdata;
     
    43144403                r_dcache_fsm = DCACHE_MISS_CLEAN;
    43154404            }
     4405#if DEBUG_DCACHE
     4406if ( m_debug_activated )
     4407{
     4408    std::cout << "  <PROC " << name()
     4409              << " DCACHE_MISS_DATA>:" << std::hex
     4410              << " / DATA  = "   << rdata
     4411              << " / WORD  = "   << word
     4412              << " / PADDR = " << std::hex << r_dcache_miss_data_addr.read() << std::endl;
     4413}
     4414#endif
    43164415        }
    43174416        break;
     
    43704469    {
    43714470        if ( m_dreq.valid) m_cost_data_miss_frz++;
     4471
     4472        // coherence clack request (from DSPIN CLACK)
     4473        if ( r_dcache_clack_req.read() )
     4474        {
     4475            r_dcache_fsm = DCACHE_CC_CHECK;
     4476            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4477            break;
     4478        }
    43724479
    43734480        // coherence request (from CC_RECEIVE FSM)
     
    44864593        if ( m_dreq.valid) m_cost_data_miss_frz++;
    44874594
     4595        // coherence clack request (from DSPIN CLACK)
     4596        if ( r_dcache_clack_req.read() )
     4597        {
     4598            r_dcache_fsm = DCACHE_CC_CHECK;
     4599            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4600            break;
     4601        }
     4602
    44884603        // coherence request (from CC_RECEIVE FSM)
    44894604        if ( r_cc_receive_dcache_req.read() )
     
    45924707    case DCACHE_UNC_WAIT:  // waiting a response to an uncacheable read
    45934708    {
     4709        // coherence clack request (from DSPIN CLACK)
     4710        if ( r_dcache_clack_req.read() )
     4711        {
     4712            r_dcache_fsm = DCACHE_CC_CHECK;
     4713            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4714            break;
     4715        }
     4716
    45944717        // coherence request (from CC_RECEIVE FSM)
    45954718        if ( r_cc_receive_dcache_req.read() )
     
    46294752    case DCACHE_LL_WAIT:    // waiting VCI response to a LL transaction
    46304753    {
     4754        // coherence clack request (from DSPIN CLACK)
     4755        if ( r_dcache_clack_req.read() )
     4756        {
     4757            r_dcache_fsm = DCACHE_CC_CHECK;
     4758            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4759            break;
     4760        }
     4761
    46314762        // coherence request (from CC_RECEIVE FSM)
    46324763        if ( r_cc_receive_dcache_req.read() )
     
    46754806    case DCACHE_SC_WAIT:        // waiting VCI response to a SC transaction
    46764807    {
     4808        // coherence clack request (from DSPIN CLACK)
     4809        if ( r_dcache_clack_req.read() )
     4810        {
     4811            r_dcache_fsm = DCACHE_CC_CHECK;
     4812            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4813            break;
     4814        }
     4815
    46774816        // coherence request (from CC_RECEIVE FSM)
    46784817        if ( r_cc_receive_dcache_req.read() )
     
    47144853        size_t   way;
    47154854        size_t   set;
    4716         size_t   word;  // unused
     4855        size_t   word; // unused
    47174856        int      state;
    47184857
     
    47674906                                    // - if the CAS is a failure, we just retry the write.
    47684907    {
     4908        // coherence clack request (from DSPIN CLACK)
     4909        if ( r_dcache_clack_req.read() )
     4910        {
     4911            r_dcache_fsm = DCACHE_CC_CHECK;
     4912            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4913            break;
     4914        }
     4915
    47694916        // coherence request (from CC_RECEIVE FSM)
    47704917        if ( r_cc_receive_dcache_req.read() )
     
    47754922        }
    47764923
    4777         if ( r_vci_rsp_data_error.read() )      // bus error
     4924        if ( r_vci_rsp_data_error.read() )      // bus error
    47784925        {
    47794926            std::cout << "BUS ERROR in DCACHE_DIRTY_WAIT state" << std::endl;
     
    47814928            exit(0);
    47824929        }
    4783         else if ( r_vci_rsp_fifo_dcache.rok() ) // response available
     4930        else if ( r_vci_rsp_fifo_dcache.rok() ) // response available
    47844931        {
    47854932            vci_rsp_fifo_dcache_get = true;
     
    48254972#endif
    48264973
    4827         if (r_cc_receive_dcache_type.read() == CC_TYPE_CLACK)
    4828                             // We switch the directory slot to EMPTY state
    4829                             // and reset r_icache_miss_clack if the cleanup ack
    4830                             // is matching a pending miss.
    4831         {
    4832 
    4833             if ( m_dreq.valid ) m_cost_data_miss_frz++;
    4834 
    4835 #ifdef INSTRUMENTATION
    4836 m_cpt_dcache_dir_write++;
    4837 #endif
    4838             r_dcache.write_dir( 0,
    4839                                 r_cc_receive_dcache_way.read(),
    4840                                 r_cc_receive_dcache_set.read(),
    4841                                 CACHE_SLOT_STATE_EMPTY);
    4842            
    4843             /*STATS DIRTY*/
    4844             for (size_t word = 0; word < m_dcache_words; word++)
    4845             {
    4846                 dirty_stats[(r_cc_receive_dcache_way * m_dcache_sets + r_cc_receive_dcache_set) * m_dcache_words + word] = false;
    4847             }
    4848 
    4849            
    4850             if ( (r_dcache_miss_set.read() == r_cc_receive_dcache_set.read()) and
    4851                  (r_dcache_miss_way.read() == r_cc_receive_dcache_way.read()) )
    4852                   r_dcache_miss_clack = false;
    4853 
    4854             r_dcache_fsm = r_dcache_fsm_cc_save.read() ;
    4855             r_cc_receive_dcache_req = false;
    4856 #if DEBUG_DCACHE
    4857 if ( m_debug_activated )
    4858 {
    4859     std::cout << "  <PROC " << name()
    4860               << " DCACHE_CC_CHECK> CC_TYPE_CLACK Switch slot to EMPTY state"
    4861               << " set = " << r_cc_receive_dcache_set.read()
    4862               << " / way = " << r_cc_receive_dcache_way.read() << std::endl;
    4863 }
    4864 #endif
    4865         }
    4866         else if( ((r_dcache_fsm_cc_save == DCACHE_MISS_SELECT) or
    4867                   (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) or
    4868                   (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT)) and
    4869                   ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) ) // matching
     4974       
     4975        // Match between MISS address and CC address
     4976        // note: In the same cycle we can handle a CLACK and a MISS match
     4977        // because the CLACK access the directory but the MISS match dont.
     4978        if (r_cc_receive_dcache_req.read() and
     4979          ((r_dcache_fsm_cc_save == DCACHE_MISS_SELECT  )  or
     4980           (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT    )  or
     4981           (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT)) and
     4982          ((r_dcache_vci_paddr.read() & mask) == (paddr & mask))) // matching
    48704983        {
    48714984            // signaling matching
     
    48784991                r_dcache_fsm        = DCACHE_CC_UPDT;
    48794992                r_dcache_cc_word    = r_cc_receive_word_idx.read();
     4993
    48804994                // just pop the fifo , don't write in icache
    48814995                r_dcache_cc_need_write = false;
     
    48854999            {
    48865000                r_cc_receive_dcache_req = false;
    4887                 r_dcache_fsm          = r_dcache_fsm_cc_save.read();
     5001                r_dcache_fsm            = r_dcache_fsm_cc_save.read();
    48885002            }
    48895003
     
    48965010}
    48975011#endif
    4898 
    4899         }
    4900         else                                                    // no match
    4901             {
    4902             int        state = 0;
    4903             size_t         way = 0;
    4904             size_t         set = 0;
    4905             size_t         word = 0;
     5012        }
     5013
     5014        // CLACK handler
     5015        // We switch the directory slot to EMPTY state and reset
     5016        // r_dcache_miss_clack if the cleanup ack is matching a pending miss.
     5017        if ( r_dcache_clack_req.read() )
     5018        {
     5019            if ( m_dreq.valid ) m_cost_data_miss_frz++;
     5020
     5021#ifdef INSTRUMENTATION
     5022m_cpt_dcache_dir_write++;
     5023#endif
     5024            r_dcache.write_dir( 0,
     5025                                r_dcache_clack_way.read(),
     5026                                r_dcache_clack_set.read(),
     5027                                CACHE_SLOT_STATE_EMPTY);
     5028            /*STATS DIRTY*/
     5029            for (size_t word = 0; word < m_dcache_words; word++)
     5030            {
     5031                dirty_stats[(r_cc_receive_dcache_way * m_dcache_sets + r_cc_receive_dcache_set) * m_dcache_words + word] = false;
     5032            }
     5033
     5034            if ( (r_dcache_miss_set.read() == r_dcache_clack_set.read()) and
     5035                 (r_dcache_miss_way.read() == r_dcache_clack_way.read()) )
     5036            {
     5037                  r_dcache_miss_clack = false;
     5038            }
     5039
     5040            r_dcache_clack_req = false;
     5041
     5042            // return to cc_save state if no pending CC request
     5043            if ( not r_cc_receive_dcache_req.read() )
     5044            {
     5045                r_dcache_fsm = r_dcache_fsm_cc_save.read() ;
     5046            }
     5047
     5048#if DEBUG_DCACHE
     5049if ( m_debug_activated )
     5050{
     5051    std::cout << "  <PROC " << name()
     5052              << " DCACHE_CC_CHECK> CC_TYPE_CLACK Switch slot to EMPTY state"
     5053              << " set = " << r_dcache_clack_set.read()
     5054              << " / way = " << r_dcache_clack_way.read() << std::endl;
     5055}
     5056#endif
     5057            break;
     5058        }
     5059
     5060        // wait if pending request to CC_SEND. This way if there are pending
     5061        // CLACK they can be treated in this state and then a deadlock
     5062        // situation is avoided
     5063        if ( r_dcache_cc_send_req.read() ) break;
     5064
     5065        // CC request handler
     5066       
     5067        int    state = 0;
     5068        size_t way   = 0;
     5069        size_t set   = 0;
     5070        size_t word  = 0;
    49065071
    49075072#ifdef INSTRUMENTATION
    49085073m_cpt_dcache_dir_read++;
    49095074#endif
    4910             r_dcache.read_dir( paddr,
    4911                                &state,
    4912                                &way,
    4913                                &set,
    4914                                &word ); // unused
    4915 
    4916             r_dcache_cc_way = way;
    4917             r_dcache_cc_set = set;
    4918             /*ODCCP*/
    4919             if ((state == CACHE_SLOT_STATE_VALID_CC) or (state == CACHE_SLOT_STATE_VALID_NCC))             // hit
    4920             {
    4921                 // need to update the cache state
    4922                 r_dcache_cleanup_ncc = false;
    4923                 r_dcache_cc_need_write = true;
    4924                 if (r_cc_receive_dcache_type.read() == CC_TYPE_UPDT)  // hit update
     5075        r_dcache.read_dir( paddr,
     5076                           &state,
     5077                           &way,
     5078                           &set,
     5079                           &word ); // unused
     5080
     5081        r_dcache_cc_way = way;
     5082        r_dcache_cc_set = set;
     5083        /*ODCCP*/
     5084        if ((state == CACHE_SLOT_STATE_VALID_CC) or (state == CACHE_SLOT_STATE_VALID_NCC))             // hit
     5085        {
     5086            r_dcache_cleanup_ncc = false;
     5087            r_dcache_cc_need_write = true;
     5088            if (r_cc_receive_dcache_type.read() == CC_TYPE_UPDT)  // hit update
     5089            {
     5090                    /*ODCCP*/ // we can't receive a CC_UPDT on a NCC line
     5091                if (state == CACHE_SLOT_STATE_VALID_NCC)
     5092                    std::cout << "DCACHE_CC_CHECK : IMPOSSIBLE NCC STATE FOR CC_UPDT at cycle " << m_cpt_total_cycles << std::endl;
     5093                assert((state != CACHE_SLOT_STATE_VALID_NCC) and "DCACHE_CC_CHECK : IMPOSSIBLE NCC STATE FOR CC_UPDT");
     5094                   
     5095                r_dcache_fsm          = DCACHE_CC_UPDT;
     5096                r_dcache_cc_word      = r_cc_receive_word_idx.read();
     5097            }
     5098            else if (r_cc_receive_dcache_type.read() == CC_TYPE_INVAL)   // hit inval
     5099            {
     5100                if ( (state == CACHE_SLOT_STATE_VALID_NCC) )
    49255101                {
    4926                     /*ODCCP*/ // we can't receive a CC_UPDT on a NCC line
    4927                     if (state == CACHE_SLOT_STATE_VALID_NCC)
    4928                         std::cout << "DCACHE_CC_CHECK : IMPOSSIBLE NCC STATE FOR CC_UPDT at cycle " << m_cpt_total_cycles << std::endl;
    4929                     assert((state != CACHE_SLOT_STATE_VALID_NCC) and "DCACHE_CC_CHECK : IMPOSSIBLE NCC STATE FOR CC_UPDT");
    4930                    
    4931                     r_dcache_fsm          = DCACHE_CC_UPDT;
    4932                     r_dcache_cc_word      = r_cc_receive_word_idx.read();
     5102                    if (r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_DATA_DIRTY)
     5103                        m_cpt_data_cleanup_dirty ++;
     5104                    r_dcache_cc_state           = state;
     5105                    r_dcache_cc_inval_addr      = (paddr &~0x3F);
     5106                    r_dcache_cc_inval_data_cpt  = 0;
    49335107                }
    4934                 else if (r_cc_receive_dcache_type.read() == CC_TYPE_INVAL)   // hit inval
     5108                else
    49355109                {
    4936                     if ( (state == CACHE_SLOT_STATE_VALID_NCC) )
    4937                     {
    4938                         if (r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_DATA_DIRTY)
    4939                             m_cpt_data_cleanup_dirty ++;
    4940                         r_dcache_cc_state           = state;
    4941                         r_dcache_cc_inval_addr      = (paddr &~0x3F);
    4942                         r_dcache_cc_inval_data_cpt  = 0;
    4943                     }
    4944                     else
    4945                     {
    4946                         r_dcache_cc_state           = state;
    4947                         r_dcache_cc_inval_addr      = (paddr &~0x3F);
    4948                     }
    4949                     r_dcache_fsm                = DCACHE_CC_INVAL;
     5110                    r_dcache_cc_state           = state;
     5111                    r_dcache_cc_inval_addr      = (paddr &~0x3F);
    49505112                }
    4951                 else if ( r_cc_receive_dcache_type.read() == CC_TYPE_BRDCAST)  // hit broadcast
    4952                 {
    4953                     assert((state != CACHE_SLOT_STATE_VALID_NCC) and "DCACHE_CC_CHECK : IMPOSSIBLE NCC STATE FOR CC_BROADCAST");
    4954                     r_dcache_fsm          = DCACHE_CC_BROADCAST;
    4955                 }
    4956             }
    4957             else                                      // miss
    4958             {
    4959                 // multicast acknowledgement required in case of update
    4960                 if(r_cc_receive_dcache_type.read() == CC_TYPE_UPDT)
    4961                 {
    4962                     r_dcache_fsm          = DCACHE_CC_UPDT;
    4963                     r_dcache_cc_word      = r_cc_receive_word_idx.read();
    4964                     // just pop the fifo , don't write in icache
    4965                     r_dcache_cc_need_write = false;
    4966                 }
    4967                 else // No response needed
    4968                 {
    4969                     r_cc_receive_dcache_req = false;
    4970                     r_dcache_fsm          = r_dcache_fsm_cc_save.read();
    4971                 }
    4972             }
     5113                r_dcache_fsm                = DCACHE_CC_INVAL;
     5114            }
     5115        }
     5116        else                                  // miss
     5117        {
     5118            // multicast acknowledgement required in case of update
     5119            if(r_cc_receive_dcache_type.read() == CC_TYPE_UPDT)
     5120            {
     5121                r_dcache_fsm           = DCACHE_CC_UPDT;
     5122                r_dcache_cc_word       = r_cc_receive_word_idx.read();
     5123
     5124                // just pop the fifo , don't write in icache
     5125                r_dcache_cc_need_write = false;
     5126            }
     5127            else // No response needed
     5128            {
     5129                r_cc_receive_dcache_req = false;
     5130                r_dcache_fsm            = r_dcache_fsm_cc_save.read();
     5131            }
     5132        }
    49735133
    49745134#if DEBUG_DCACHE
     
    49825142}
    49835143#endif
     5144
     5145        break;
     5146    }
     5147    /////////////////////
     5148    case DCACHE_CC_INVAL: // hit inval: switch slot to ZOMBI state and send a
     5149                          // CLEANUP after possible invalidation of copies in
     5150                          // TLBs
     5151    {
     5152        size_t way    = r_dcache_cc_way.read();
     5153        size_t set    = r_dcache_cc_set.read();
     5154        int      state  = r_dcache_cc_state.read();
     5155        if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB )
     5156        {
     5157            r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY;
     5158            r_dcache_tlb_inval_line  = r_cc_receive_dcache_nline.read();
     5159            r_dcache_tlb_inval_set   = 0;
     5160            r_dcache_fsm_scan_save   = r_dcache_fsm.read();
     5161            r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
     5162            break;
     5163        }
     5164        if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD )
     5165        {
     5166            r_itlb.reset();
     5167            r_dtlb.reset();
     5168            r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY;
     5169
     5170#if DEBUG_DCACHE
     5171if ( m_debug_activated )
     5172{
     5173    std::cout << "  <PROC " << name()
     5174    << " DCACHE_CC_INVAL> Flush DTLB & ITLB" << std::endl;
     5175}
     5176#endif
     5177        }
     5178
     5179
     5180        if ( state == CACHE_SLOT_STATE_VALID_CC )
     5181        {
     5182            // Switch slot state to ZOMBI and send CLEANUP command
     5183            r_dcache.write_dir( way,
     5184                                set,
     5185                                CACHE_SLOT_STATE_ZOMBI );
     5186#if DEBUG_DCACHE
     5187if ( m_debug_activated )
     5188{
     5189    std::cout << "  <PROC " << name()
     5190    << " DCACHE_CC_INVAL> Switch slot valid CC to ZOMBI state:" << std::dec
     5191    << " / WAY = " << way
     5192    << " / SET = " << set << std::endl;
     5193}
     5194#endif
     5195        }
     5196
     5197        assert (not r_dcache_cc_send_req.read() &&
     5198                "ERROR in DCACHE_CC_INVAL: the r_dcache_cc_send_req "
     5199                "must not be set");
     5200
     5201        // coherence request completed
     5202        r_cc_receive_dcache_req = false;
     5203        r_dcache_cc_send_req    = true;
     5204        r_dcache_cc_send_nline  = r_cc_receive_dcache_nline.read();
     5205        r_dcache_cc_send_way    = way;
     5206        r_dcache_cc_send_type   = CC_TYPE_CLEANUP;
     5207        r_dcache_fsm            = r_dcache_fsm_cc_save.read();
     5208           
     5209        if ( (state == CACHE_SLOT_STATE_VALID_NCC) )
     5210        {
     5211            r_dcache_cleanup_ncc = true;
     5212               
     5213            if (r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_DATA_DIRTY)
     5214            {
     5215                r_dcache_cc_cleanup_updt_data = true;
     5216                r_dcache_fsm = DCACHE_CC_INVAL_DATA;
     5217                   
     5218                    /*STATS DIRTY*/
     5219                    for (size_t w = 0; w < m_dcache_words; w++)
     5220                    {
     5221                       if(dirty_stats[(way * m_dcache_sets + set) * m_dcache_words + w] == true)
     5222                           m_cpt_words_dirty++;
     5223                    }
     5224            }
     5225            else
     5226            {
     5227                r_dcache_cc_cleanup_updt_data = false;
     5228                r_dcache.write_dir( way,
     5229                                    set,
     5230                                    CACHE_SLOT_STATE_ZOMBI );
     5231                r_dcache_fsm = r_dcache_fsm_cc_save.read();
     5232            }
    49845233        }
    49855234        break;
     
    50015250            r_dcache_cc_inval_addr = r_dcache_cc_inval_addr.read() + 4;
    50025251
    5003             cleanup_data_updt_fifo_dcache_get   = false;
    50045252            cleanup_data_updt_fifo_dcache_put   = true;
    50055253            cleanup_data_updt_fifo_dcache_data  = rdata;
     
    50265274        break;
    50275275    }
    5028     /////////////////////
    5029     case DCACHE_CC_INVAL:       // hit inval: switch slot to EMPTY state,
     5276    ///////////////////
     5277    case DCACHE_CC_UPDT:        // hit update: write one word per cycle,
    50305278                                // after possible invalidation of copies in TLBs
    50315279    {
    5032         size_t   way    = r_dcache_cc_way.read();
    5033         size_t   set    = r_dcache_cc_set.read();
    5034         int      state  = r_dcache_cc_state.read();
    5035         if (r_dcache_cc_need_write.read())
    5036         {
    5037             if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB )
    5038             {
    5039                 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY;
    5040                 r_dcache_tlb_inval_line  = r_cc_receive_dcache_nline.read();
    5041                 r_dcache_tlb_inval_set   = 0;
    5042                 r_dcache_fsm_scan_save   = r_dcache_fsm.read();
    5043                 r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
    5044                 break;
    5045             }
    5046             else
    5047             {
    5048                 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD )
    5049                 {
    5050                     r_itlb.reset();
    5051                     r_dtlb.reset();
    5052                     r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY;
    5053 
    5054 #if DEBUG_DCACHE
    5055                     if ( m_debug_activated )
    5056                     {
    5057                         std::cout << "  <PROC " << name()
    5058                             << " DCACHE_CC_INVAL> Flush DTLB & ITLB" << std::endl;
    5059                     }
    5060 #endif
    5061                 }
    5062 
    5063                 if ( state == CACHE_SLOT_STATE_VALID_CC )
    5064                 {
    5065                     r_dcache.write_dir( 0,
    5066                             way,
    5067                             set,
    5068                             CACHE_SLOT_STATE_EMPTY );
    5069 #if DEBUG_DCACHE
    5070                     if ( m_debug_activated )
    5071                     {
    5072                         std::cout << "  <PROC " << name()
    5073 
    5074                             << " DCACHE_CC_INVAL> Switch slot to EMPTY state:" << std::dec
    5075                             << " / WAY = " << way
    5076                             << " / SET = " << set << std::endl;
    5077                     }
    5078 #endif
    5079                 }
    5080                 r_dcache_cc_need_write = false;
    5081 
    5082             }
    5083         }
    5084 
    5085         // multicast acknowledgement
    5086         // send a request to cc_send_fsm
    5087         if(not r_dcache_cc_send_req.read()) // cc_send is available
    5088         {
    5089 
    5090             // coherence request completed
    5091             r_cc_receive_dcache_req = false;
    5092             r_dcache_cc_send_req = true;
    5093             r_dcache_cc_send_nline = r_cc_receive_dcache_nline.read();
    5094 
    5095            
    5096             if ( (state == CACHE_SLOT_STATE_VALID_NCC) )
    5097             {
    5098                 r_dcache_cleanup_ncc = true;
    5099                 r_dcache_cc_send_type = CC_TYPE_CLEANUP;
    5100                 r_dcache_cc_send_way = way;
    5101                
    5102                 if (r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_DATA_DIRTY)
    5103                 {
    5104                     r_dcache_cc_cleanup_updt_data = true;
    5105                     r_dcache_fsm = DCACHE_CC_INVAL_DATA;
    5106                    
    5107                     /*STATS DIRTY*/
    5108                     for (size_t w = 0; w < m_dcache_words; w++)
    5109                     {
    5110                        if(dirty_stats[(way * m_dcache_sets + set) * m_dcache_words + w] == true)
    5111                            m_cpt_words_dirty++;
    5112                     }
    5113                 }
    5114                 else
    5115                 {
    5116                     r_dcache_cc_cleanup_updt_data = false;
    5117                     r_dcache.write_dir( way,
    5118                                         set,
    5119                                         CACHE_SLOT_STATE_ZOMBI );
    5120                     r_dcache_fsm = r_dcache_fsm_cc_save.read();
    5121                 }
    5122             }
    5123             else
    5124             {
    5125                 // request multicast acknowledgement
    5126                 r_dcache_cc_send_updt_tab_idx = r_cc_receive_dcache_updt_tab_idx.read();
    5127                 r_dcache_cc_send_type = CC_TYPE_MULTI_ACK;
    5128                 r_dcache_fsm = r_dcache_fsm_cc_save.read();
    5129             }
    5130         }
    5131         //else wait for previous cc_send request to be sent
    5132         break;
    5133     }
    5134     ///////////////////
    5135     case DCACHE_CC_UPDT:        // hit update: write one word per cycle,
    5136                                 // after possible invalidation of copies in TLBs
    5137     {
    5138         size_t   word       = r_dcache_cc_word.read();
    5139         size_t   way        = r_dcache_cc_way.read();
    5140         size_t   set        = r_dcache_cc_set.read();
    5141 
    5142         if (r_cc_receive_updt_fifo_be.rok())
    5143         {
    5144             if (r_dcache_cc_need_write.read())
    5145             {
    5146                 // selective TLB inval
    5147                 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB )
    5148                 {
    5149                     r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY;
    5150                     r_dcache_tlb_inval_line  = r_cc_receive_dcache_nline.read();
    5151                     r_dcache_tlb_inval_set   = 0;
    5152                     r_dcache_fsm_scan_save   = r_dcache_fsm.read();
    5153                     r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
    5154                     break;
    5155                 }
    5156                 // TLB flush
    5157                 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD )
    5158                 {
    5159                     r_itlb.reset();
    5160                     r_dtlb.reset();
    5161                     r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY;
     5280        size_t word       = r_dcache_cc_word.read();
     5281        size_t way        = r_dcache_cc_way.read();
     5282        size_t set        = r_dcache_cc_set.read();
     5283
     5284        // selective TLB inval
     5285        if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB )
     5286        {
     5287            r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY;
     5288            r_dcache_tlb_inval_line  = r_cc_receive_dcache_nline.read();
     5289            r_dcache_tlb_inval_set   = 0;
     5290            r_dcache_fsm_scan_save   = r_dcache_fsm.read();
     5291            r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
     5292            break;
     5293        }
     5294        // TLB flush
     5295        if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD )
     5296        {
     5297            r_itlb.reset();
     5298            r_dtlb.reset();
     5299            r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY;
    51625300
    51635301#if DEBUG_DCACHE
     
    51655303{
    51665304    std::cout << "  <PROC " << name()
    5167               << " DCACHE_CC_UPDT> Flush DTLB & ITLB" << std::endl;
     5305    << " DCACHE_CC_UPDT> Flush DTLB & ITLB" << std::endl;
    51685306}
    51695307#endif
    5170                 }
    5171 
     5308        }
     5309
     5310        assert (not r_dcache_cc_send_req.read() &&
     5311                "ERROR in DCACHE_CC_INVAL: the r_dcache_cc_send_req "
     5312                "must not be set");
     5313       
     5314        if ( not r_cc_receive_updt_fifo_be.rok() ) break;
     5315
     5316        if (r_dcache_cc_need_write.read())
     5317        {
     5318       
    51725319#ifdef INSTRUMENTATION
    51735320m_cpt_dcache_data_write++;
    51745321#endif
    5175                 r_dcache.write( way,
    5176                                 set,
    5177                                 word,
    5178                                 r_cc_receive_updt_fifo_data.read(),
    5179                                 r_cc_receive_updt_fifo_be.read() );
    5180 
    5181                 r_dcache_cc_word = word + 1;
     5322            r_dcache.write( way,
     5323                            set,
     5324                            word,
     5325                            r_cc_receive_updt_fifo_data.read(),
     5326                            r_cc_receive_updt_fifo_be.read() );
     5327
     5328            r_dcache_cc_word = word + 1;
    51825329
    51835330#if DEBUG_DCACHE
     
    51925339}
    51935340#endif
    5194             }
    5195 
    5196             if ( r_cc_receive_updt_fifo_eop.read() )    // last word
    5197             {
    5198                 // no need to write in the cache anymore
    5199                 r_dcache_cc_need_write = false;
    5200 
    5201                 // wait to send a request to cc_send_fsm
    5202                 if(not r_dcache_cc_send_req.read())
    5203                 // cc_send is available
    5204                 {
    5205                     //consume last fifo flit if eop and request to cc_send possible
    5206                     cc_receive_updt_fifo_get  = true;
    5207 
    5208                     // coherence request completed
    5209                     r_cc_receive_dcache_req = false;
    5210 
    5211                     // request multicast acknowledgement
    5212                     r_dcache_cc_send_req = true;
    5213                     r_dcache_cc_send_nline = r_cc_receive_dcache_nline.read();
    5214                     r_dcache_cc_send_updt_tab_idx = r_cc_receive_dcache_updt_tab_idx.read();
    5215                     r_dcache_cc_send_type = CC_TYPE_MULTI_ACK;
    5216 
    5217                     r_dcache_fsm          = r_dcache_fsm_cc_save.read();
    5218                 }
    5219             }
    5220             else
    5221             {
    5222                 //consume fifo if not eop
    5223                 cc_receive_updt_fifo_get  = true;
    5224             }
    5225         }
    5226         break;
    5227     }
    5228     /////////////////////////
    5229     case DCACHE_CC_BROADCAST:   // hit broadcast : switch state to ZOMBI state
    5230                                 // and request a cleanup, after possible
    5231                                 // invalidation of copies in TLBs
    5232     {
    5233         size_t   way   = r_dcache_cc_way.read();
    5234         size_t   set   = r_dcache_cc_set.read();
    5235         paddr_t  nline = r_cc_receive_dcache_nline.read();
    5236 
    5237         if (r_dcache_cc_need_write.read())
    5238         {
    5239             // selective TLB inval
    5240             if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_IN_TLB )
    5241             {
    5242                 r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY;
    5243                 r_dcache_tlb_inval_line  = nline;
    5244                 r_dcache_tlb_inval_set   = 0;
    5245                 r_dcache_fsm_scan_save   = r_dcache_fsm.read();
    5246                 r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
    5247                 break;
    5248             }
    5249             else
    5250             {
    5251                 // TLB flush
    5252                 if ( r_dcache_content_state[way*m_dcache_sets+set] == LINE_CACHE_CONTAINS_PTD )
    5253                 {
    5254                     r_itlb.reset();
    5255                     r_dtlb.reset();
    5256                     r_dcache_content_state[way*m_dcache_sets+set] = LINE_CACHE_DATA_NOT_DIRTY;
    5257 
    5258 #if DEBUG_DCACHE
    5259                     if ( m_debug_activated )
    5260                     {
    5261                         std::cout << "  <PROC " << name()
    5262                             << " DCACHE_CC_BROADCAST> Flush DTLB & ITLB" << std::endl;
    5263                     }
    5264 #endif
    5265                 }
    5266 
    5267 #ifdef INSTRUMENTATION
    5268                 m_cpt_dcache_dir_write++;
    5269 #endif
    5270                 r_dcache.write_dir( way,
    5271                         set,
    5272                         CACHE_SLOT_STATE_ZOMBI );
    5273 
    5274                 r_dcache_cc_need_write = false;
    5275 #if DEBUG_DCACHE
    5276                 if ( m_debug_activated )
    5277                 {
    5278                     std::cout << "  <PROC " << name()
    5279                         << " DCACHE_CC_BROADCAST > Slot goes to ZOMBI state "
    5280                         << " SET = " << set
    5281                         << " / WAY = " << way << std::endl;
    5282                 }
    5283 #endif
    5284             }
    5285         }
    5286         // cleanup
    5287         // send a request to cc_send_fsm
    5288         if(not r_dcache_cc_send_req.read()) // cc_send is available
    5289         {
     5341        }
     5342
     5343        if ( r_cc_receive_updt_fifo_eop.read() )  // last word
     5344        {
     5345            // no need to write in the cache anymore
     5346            r_dcache_cc_need_write = false;
     5347
    52905348            // coherence request completed
    52915349            r_cc_receive_dcache_req = false;
    5292             // request cleanup
    5293             r_dcache_cc_send_req = true;
    5294             r_dcache_cc_send_nline = r_cc_receive_dcache_nline.read();
    5295             r_dcache_cc_send_way   = r_dcache_cc_way.read();
    5296             r_dcache_cc_send_type  = CC_TYPE_CLEANUP;
    5297 
    5298             r_dcache_fsm          = r_dcache_fsm_cc_save.read();
    5299         }
    5300         //else wait for previous cc_send request to be sent
     5350
     5351            // request multicast acknowledgement
     5352            r_dcache_cc_send_req          = true;
     5353            r_dcache_cc_send_nline        = r_cc_receive_dcache_nline.read();
     5354            r_dcache_cc_send_updt_tab_idx = r_cc_receive_dcache_updt_tab_idx.read();
     5355            r_dcache_cc_send_type         = CC_TYPE_MULTI_ACK;
     5356
     5357            r_dcache_fsm                  = r_dcache_fsm_cc_save.read();
     5358        }
     5359
     5360        //consume fifo if not eop
     5361        cc_receive_updt_fifo_get  = true;
     5362
    53015363        break;
    53025364    }
     
    56895751                    if ( r_vci_rsp_fifo_icache.wok() )
    56905752                    {
    5691                         assert( (r_vci_rsp_cpt.read() < m_icache_words) and
    5692                         "The VCI response packet for instruction miss is too long" );
    5693 
     5753                        if ( r_vci_rsp_cpt.read() >= m_icache_words )
     5754                        {
     5755                            std::cout << "ERROR in VCI_CC_VCACHE " << name()
     5756                                      << " VCI response packet too long "
     5757                                      << " for instruction miss" << std::endl;
     5758                            exit(0);
     5759                        }
    56945760                        r_vci_rsp_cpt                 = r_vci_rsp_cpt.read() + 1;
    56955761                        vci_rsp_fifo_icache_put       = true,
     
    56975763                        if ( p_vci.reop.read() )
    56985764                        {
    5699                             assert( (r_vci_rsp_cpt.read() == m_icache_words - 1) and
    5700                             "The VCI response packet for instruction miss is too short");
    5701 
     5765                            if ( r_vci_rsp_cpt.read() != (m_icache_words - 1) )
     5766                            {
     5767                                std::cout << "ERROR in VCI_CC_VCACHE " << name()
     5768                                          << " VCI response packet too short"
     5769                                          << " for instruction miss" << std::endl;
     5770                                exit(0);
     5771                            }
    57025772                            r_vci_rsp_fsm    = RSP_IDLE;
    57035773                        }
     
    59025972        {
    59035973            // wait for the first flit to be consumed
    5904             if (p_dspin_out.read.read())
     5974            if (p_dspin_p2m.read.read())
    59055975                r_cc_send_fsm = CC_SEND_CLEANUP_2;
    59065976
     
    59115981        {
    59125982            // wait for the second flit to be consumed
    5913             if (p_dspin_out.read.read())
     5983            if (p_dspin_p2m.read.read())
    59145984            {
    59155985                /*ODCCP*/ // If there is a cleanup with data and dcache active request we send other flits contained data
     
    59336003        case CC_SEND_CLEANUP_DATA_UPDT: /*ODCCP*/ // we send the data values of line cache into [m_dcache_words] flits
    59346004        {
    5935             if (p_dspin_out.read.read())
     6005            if (p_dspin_p2m.read.read())
    59366006            {
    59376007                if(r_cc_send_data_fifo.rok())
     
    59566026        {
    59576027            // wait for the flit to be consumed
    5958             if(p_dspin_out.read.read())
     6028            if(p_dspin_p2m.read.read())
    59596029            {
    59606030                if(r_cc_send_last_client.read() == 0) // dcache active request
     
    59706040
    59716041    ///////////////////////////////////////////////////////////////////////////////
    5972     //   C_RECEIVE  FSM
     6042    //  CC_RECEIVE  FSM
    59736043    // This FSM receive all coherence packets on a DSPIN40 port.
    5974     // There is 7 packet types:
     6044    // There is 5 packet types:
    59756045    // - CC_DATA_INVAL : DCACHE invalidate request
    59766046    // - CC_DATA_UPDT  : DCACHE update request (multi-words)
     
    59786048    // - CC_INST_UPDT  : ICACHE update request (multi-words)
    59796049    // - CC_BROADCAST  : Broadcast invalidate request (both DCACHE & ICACHE)
    5980     // - CC_DATA_CLACK : DCACHE cleanup acknowledge
    5981     // - CC_INST_CLACK : ICACHE cleanup acknowledge
    59826050    //////////////////////////////////////////////////////////////////////////////
    59836051    switch( r_cc_receive_fsm.read() )
     
    59876055        {
    59886056            // a coherence request has arrived
    5989             if (p_dspin_in.write.read())
     6057            if (p_dspin_m2p.write.read())
    59906058            {
    59916059                // initialize dspin received data
    5992                 uint64_t receive_data = p_dspin_in.data.read();
     6060                uint64_t receive_data = p_dspin_m2p.data.read();
    59936061                // initialize coherence packet type
    59946062                uint64_t receive_type = DspinDhccpParam::dspin_get(receive_data,
    5995                                             DspinDhccpParam::FROM_MC_TYPE);
    5996                 // initialize data/ins flip_flop (0 data / 1 ins)
    5997                 r_cc_receive_data_ins = (bool)(receive_type & 0x1);
     6063                                            DspinDhccpParam::M2P_TYPE);
    59986064                // test for a broadcast
    5999                 if (DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::FROM_MC_BC))
     6065                if (DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::M2P_BC))
    60006066                {
    60016067                    r_cc_receive_fsm = CC_RECEIVE_BRDCAST_HEADER;
    60026068                }
    6003                 // test for a CLACK
    6004                 else if ((receive_type == DspinDhccpParam::TYPE_CLEANUP_ACK_DATA) or
    6005                          (receive_type == DspinDhccpParam::TYPE_CLEANUP_ACK_INST))
     6069                // test for a multi updt
     6070                else if (receive_type == DspinDhccpParam::TYPE_MULTI_UPDT_DATA)
    60066071                {
    6007                     r_cc_receive_fsm = CC_RECEIVE_CLACK;
     6072                    r_cc_receive_fsm = CC_RECEIVE_DATA_UPDT_HEADER;
    60086073                }
    6009                 // test for a multi updt
    6010                 else if ((receive_type == DspinDhccpParam::TYPE_MULTI_UPDT_DATA) or
    6011                          (receive_type == DspinDhccpParam::TYPE_MULTI_UPDT_INST))
     6074                else if (receive_type == DspinDhccpParam::TYPE_MULTI_UPDT_INST)
    60126075                {
    6013                     r_cc_receive_fsm = CC_RECEIVE_UPDT_HEADER;
     6076                    r_cc_receive_fsm = CC_RECEIVE_INS_UPDT_HEADER;
    60146077                }
    60156078                // test for a multi inval
     6079                else if (receive_type == DspinDhccpParam::TYPE_MULTI_INVAL_DATA)
     6080                {
     6081                    r_cc_receive_fsm = CC_RECEIVE_DATA_INVAL_HEADER;
     6082                }
    60166083                else
    60176084                {
    6018                     r_cc_receive_fsm = CC_RECEIVE_INVAL_HEADER;
     6085                    r_cc_receive_fsm = CC_RECEIVE_INS_INVAL_HEADER;
    60196086                }
    60206087            }
    6021             break;
    6022         }
    6023         //////////////////////
    6024         case CC_RECEIVE_CLACK:
    6025         {
    6026             // initialize dspin received data
    6027             uint64_t receive_data = p_dspin_in.data.read();
    6028 
    6029             // for data CLACK, wait for dcache to take the request
    6030             if ((r_cc_receive_data_ins.read() == 0) and
    6031                     not r_cc_receive_dcache_req.read())
    6032             {
    6033                 // request dcache to handle the CLACK
    6034                 r_cc_receive_dcache_req  = true;
    6035                 r_cc_receive_dcache_set  = DspinDhccpParam::dspin_get(receive_data,
    6036                                            DspinDhccpParam::CLEANUP_ACK_SET) &
    6037                                            ((1ULL<<(uint32_log2(m_dcache_sets)))-1);
    6038                 r_cc_receive_dcache_way  = DspinDhccpParam::dspin_get(receive_data,
    6039                                            DspinDhccpParam::CLEANUP_ACK_WAY) &
    6040                                            ((1ULL<<(uint32_log2(m_dcache_ways)))-1);
    6041                 r_cc_receive_dcache_type = CC_TYPE_CLACK;
    6042                 // get back to idle state
    6043                 r_cc_receive_fsm = CC_RECEIVE_IDLE;
    6044                 break;
    6045             }
    6046             // for ins CLACK, wait for icache to take the request
    6047             if ((r_cc_receive_data_ins.read() == 1) and
    6048                    not (r_cc_receive_icache_req.read()))
    6049             {
    6050                 // request icache to handle the CLACK
    6051                 r_cc_receive_icache_req  = true;
    6052                 r_cc_receive_icache_set  = DspinDhccpParam::dspin_get(receive_data,
    6053                                            DspinDhccpParam::CLEANUP_ACK_SET) &
    6054                                            ((1ULL<<(uint32_log2(m_icache_sets)))-1);
    6055                 r_cc_receive_icache_way  = DspinDhccpParam::dspin_get(receive_data,
    6056                                            DspinDhccpParam::CLEANUP_ACK_WAY) &
    6057                                            ((1ULL<<(uint32_log2(m_icache_ways)))-1);
    6058                 r_cc_receive_icache_type = CC_TYPE_CLACK;
    6059                 // get back to idle state
    6060                 r_cc_receive_fsm = CC_RECEIVE_IDLE;
    6061                 break;
    6062             }
    6063             // keep waiting for the correct cache to accept the request
    60646088            break;
    60656089        }
     
    60756099        {
    60766100            // initialize dspin received data
    6077             uint64_t receive_data = p_dspin_in.data.read();
     6101            uint64_t receive_data = p_dspin_m2p.data.read();
    60786102            // wait for both dcache and icache to take the request
    60796103            // TODO maybe we need to wait for both only to leave the state, but
     
    60826106            if (not (r_cc_receive_icache_req.read()) and
    60836107                not (r_cc_receive_dcache_req.read()) and
    6084                 (p_dspin_in.write.read()))
     6108                (p_dspin_m2p.write.read()))
    60856109            {
    60866110                // request dcache to handle the BROADCAST
    6087                 r_cc_receive_dcache_req  = true;
     6111                r_cc_receive_dcache_req = true;
    60886112                r_cc_receive_dcache_nline  = DspinDhccpParam::dspin_get(receive_data,
    60896113                                             DspinDhccpParam::BROADCAST_NLINE);
    6090                 r_cc_receive_dcache_type = CC_TYPE_BRDCAST;
     6114                r_cc_receive_dcache_type = CC_TYPE_INVAL;
    60916115                // request icache to handle the BROADCAST
    6092                 r_cc_receive_icache_req  = true;
     6116                r_cc_receive_icache_req = true;
    60936117                r_cc_receive_icache_nline  = DspinDhccpParam::dspin_get(receive_data,
    60946118                                             DspinDhccpParam::BROADCAST_NLINE);
    6095                 r_cc_receive_icache_type = CC_TYPE_BRDCAST;
     6119                r_cc_receive_icache_type = CC_TYPE_INVAL;
    60966120                // get back to idle state
    60976121                r_cc_receive_fsm = CC_RECEIVE_IDLE;
     
    61026126        }
    61036127        /////////////////////////////
    6104         case CC_RECEIVE_INVAL_HEADER:
     6128        case CC_RECEIVE_DATA_INVAL_HEADER:
    61056129        {
    61066130            // sample updt tab index in the HEADER, then skip to second flit
    6107             uint64_t receive_data = p_dspin_in.data.read();
     6131            r_cc_receive_fsm = CC_RECEIVE_DATA_INVAL_NLINE;
     6132            break;
     6133        }
     6134        /////////////////////////////
     6135        case CC_RECEIVE_INS_INVAL_HEADER:
     6136        {
     6137            // sample updt tab index in the HEADER, then skip to second flit
     6138            r_cc_receive_fsm = CC_RECEIVE_INS_INVAL_NLINE;
     6139            break;
     6140        }
     6141        ////////////////////////////
     6142        case CC_RECEIVE_DATA_INVAL_NLINE:
     6143        {
     6144            // sample nline in the second flit
     6145            uint64_t receive_data = p_dspin_m2p.data.read();
    61086146            // for data INVAL, wait for dcache to take the request
    6109             if ((r_cc_receive_data_ins.read() == 0) and
    6110                  not (r_cc_receive_dcache_req.read()))
    6111             {
    6112                 r_cc_receive_dcache_updt_tab_idx = DspinDhccpParam::dspin_get(receive_data,
    6113                                                    DspinDhccpParam::MULTI_INVAL_UPDT_INDEX);
    6114                 r_cc_receive_fsm = CC_RECEIVE_INVAL_NLINE;
    6115                 break;
    6116             }
    6117             // for ins INVAL, wait for icache to take the request
    6118             if ((r_cc_receive_data_ins.read() == 1) and
    6119                  not (r_cc_receive_icache_req.read()))
    6120             {
    6121                 r_cc_receive_icache_updt_tab_idx = DspinDhccpParam::dspin_get(receive_data,
    6122                                                    DspinDhccpParam::MULTI_INVAL_UPDT_INDEX);
    6123                 r_cc_receive_fsm = CC_RECEIVE_INVAL_NLINE;
    6124                 break;
    6125             }
    6126             // keep waiting for the correct cache to accept the request
    6127             break;
    6128         }
    6129         ////////////////////////////
    6130         case CC_RECEIVE_INVAL_NLINE:
    6131         {
    6132             // sample nline in the second flit
    6133             uint64_t receive_data = p_dspin_in.data.read();
    6134             // for data INVAL, wait for dcache to take the request
    6135             if ( (r_cc_receive_data_ins.read() == 0) and
    6136                  not (r_cc_receive_dcache_req.read()) and
    6137                  (p_dspin_in.write.read()) )
     6147            if (p_dspin_m2p.write.read() and not r_cc_receive_dcache_req.read())
    61386148            {
    61396149                // request dcache to handle the INVAL
    6140                 r_cc_receive_dcache_req  = true;
    6141                 r_cc_receive_dcache_nline  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_INVAL_NLINE);
     6150                r_cc_receive_dcache_req = true;
     6151                r_cc_receive_dcache_nline = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_INVAL_NLINE);
    61426152                r_cc_receive_dcache_type = CC_TYPE_INVAL;
    61436153                // get back to idle state
     
    61456155                break;
    61466156            }
     6157            break;
     6158        }
     6159        //////////////////////////////
     6160        case CC_RECEIVE_INS_INVAL_NLINE:
     6161        {
     6162            // sample nline in the second flit
     6163            uint64_t receive_data = p_dspin_m2p.data.read();
    61476164            // for ins INVAL, wait for icache to take the request
    6148             if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read()) and (p_dspin_in.write.read()))
     6165            if (p_dspin_m2p.write.read() and not r_cc_receive_icache_req.read())
    61496166            {
    61506167                // request icache to handle the INVAL
    6151                 r_cc_receive_icache_req  = true;
    6152                 r_cc_receive_icache_nline  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_INVAL_NLINE);
     6168                r_cc_receive_icache_req = true;
     6169                r_cc_receive_icache_nline = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_INVAL_NLINE);
    61536170                r_cc_receive_icache_type = CC_TYPE_INVAL;
    61546171                // get back to idle state
     
    61566173                break;
    61576174            }
    6158             // we should never get there
    6159             assert ( false && "ERROR in CC_VCACHE : CC_RECEIVE_INVAL_NLINE\n");
     6175            break;
    61606176        }
    61616177        ////////////////////////////
    6162         case CC_RECEIVE_UPDT_HEADER:
     6178        case CC_RECEIVE_DATA_UPDT_HEADER:
    61636179        {
    61646180            // sample updt tab index in the HEADER, than skip to second flit
    6165             uint64_t receive_data = p_dspin_in.data.read();
     6181            uint64_t receive_data = p_dspin_m2p.data.read();
    61666182            // for data INVAL, wait for dcache to take the request and fifo to
    61676183            // be empty
    6168             if ((r_cc_receive_data_ins.read() == 0) and not r_cc_receive_dcache_req.read() and r_cc_receive_updt_fifo_be.empty())
     6184            if (not r_cc_receive_dcache_req.read())
    61696185            {
    61706186                r_cc_receive_dcache_updt_tab_idx  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_UPDT_INDEX);
    6171                 r_cc_receive_fsm = CC_RECEIVE_UPDT_NLINE;
     6187                r_cc_receive_fsm = CC_RECEIVE_DATA_UPDT_NLINE;
    61726188                break;
    61736189            }
     6190            break;
     6191        }
     6192        ////////////////////////////
     6193        case CC_RECEIVE_INS_UPDT_HEADER:
     6194        {
     6195            // sample updt tab index in the HEADER, than skip to second flit
     6196            uint64_t receive_data = p_dspin_m2p.data.read();
    61746197            // for ins INVAL, wait for icache to take the request and fifo to be
    61756198            // empty
    6176             if ((r_cc_receive_data_ins.read() == 1) and not r_cc_receive_icache_req.read() and r_cc_receive_updt_fifo_be.empty())
     6199            if (not r_cc_receive_icache_req.read())
    61776200            {
    61786201                r_cc_receive_icache_updt_tab_idx  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_UPDT_INDEX);
    6179                 r_cc_receive_fsm = CC_RECEIVE_UPDT_NLINE;
     6202                r_cc_receive_fsm = CC_RECEIVE_INS_UPDT_NLINE;
    61806203                break;
    61816204            }
     
    61846207        }
    61856208        ///////////////////////////
    6186         case CC_RECEIVE_UPDT_NLINE:
     6209        case CC_RECEIVE_DATA_UPDT_NLINE:
    61876210        {
    61886211            // sample nline and word index in the second flit
    6189             uint64_t receive_data = p_dspin_in.data.read();
     6212            uint64_t receive_data = p_dspin_m2p.data.read();
    61906213            // for data INVAL, wait for dcache to take the request and fifo to
    61916214            // be empty
    6192             if ( (r_cc_receive_data_ins.read() == 0) and
    6193                  not (r_cc_receive_dcache_req.read()) and
    6194                  r_cc_receive_updt_fifo_be.empty() and
    6195                  (p_dspin_in.write.read()) )
    6196             {
     6215            if ( r_cc_receive_updt_fifo_be.empty() and
     6216                 p_dspin_m2p.write.read() )
     6217            {
     6218                r_cc_receive_dcache_req = true;
    61976219                r_cc_receive_dcache_nline  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_NLINE);
    61986220                r_cc_receive_word_idx  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_WORD_INDEX);
    61996221                r_cc_receive_dcache_type = CC_TYPE_UPDT;
    62006222                // get back to idle state
    6201                 r_cc_receive_fsm = CC_RECEIVE_UPDT_DATA;
     6223                r_cc_receive_fsm = CC_RECEIVE_DATA_UPDT_DATA;
    62026224                break;
    62036225            }
     6226            break;
     6227        }
     6228        ////////////////////////////
     6229        case CC_RECEIVE_INS_UPDT_NLINE:
     6230        {
     6231            // sample nline and word index in the second flit
     6232            uint64_t receive_data = p_dspin_m2p.data.read();
    62046233            // for ins INVAL, wait for icache to take the request and fifo to be
    62056234            // empty
    6206             if ( (r_cc_receive_data_ins.read() == 1) and
    6207                  not (r_cc_receive_icache_req.read()) and
    6208                  r_cc_receive_updt_fifo_be.empty() and
    6209                  (p_dspin_in.write.read()))
    6210             {
     6235            if ( r_cc_receive_updt_fifo_be.empty() and
     6236                 p_dspin_m2p.write.read() )
     6237            {
     6238                r_cc_receive_icache_req = true;
    62116239                r_cc_receive_icache_nline  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_NLINE);
    62126240                r_cc_receive_word_idx  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_WORD_INDEX);
    62136241                r_cc_receive_icache_type = CC_TYPE_UPDT;
    62146242                // get back to idle state
    6215                 r_cc_receive_fsm = CC_RECEIVE_UPDT_DATA;
     6243                r_cc_receive_fsm = CC_RECEIVE_INS_UPDT_DATA;
    62166244                break;
    62176245            }
    6218             // we should never get there
    6219             assert ( false && "ERROR in CC_VCACHE : CC_RECEIVE_UPDT_NLINE \n");
    62206246            break;
    62216247        }
    62226248        //////////////////////////
    6223         case CC_RECEIVE_UPDT_DATA:
    6224         {
    6225             if ((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read()) and (p_dspin_in.write.read()))
    6226                 r_cc_receive_dcache_req = true;
    6227             if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read()) and (p_dspin_in.write.read()))
    6228                 r_cc_receive_icache_req = true;
    6229 
     6249        case CC_RECEIVE_DATA_UPDT_DATA:
     6250        {
    62306251            // wait for the fifo
    6231             if (r_cc_receive_updt_fifo_be.wok() and (p_dspin_in.write.read()))
    6232             {
    6233                 uint64_t receive_data = p_dspin_in.data.read();
    6234                 bool     receive_eop  = p_dspin_in.eop.read();
     6252            if (r_cc_receive_updt_fifo_be.wok() and (p_dspin_m2p.write.read()))
     6253            {
     6254                uint64_t receive_data = p_dspin_m2p.data.read();
     6255                bool     receive_eop  = p_dspin_m2p.eop.read();
    62356256                cc_receive_updt_fifo_be   = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_BE);
    62366257                cc_receive_updt_fifo_data = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_DATA);
     
    62416262            break;
    62426263        }
     6264        //////////////////////////
     6265        case CC_RECEIVE_INS_UPDT_DATA:
     6266        {
     6267            // wait for the fifo
     6268            if (r_cc_receive_updt_fifo_be.wok() and (p_dspin_m2p.write.read()))
     6269            {
     6270                uint64_t receive_data = p_dspin_m2p.data.read();
     6271                bool     receive_eop  = p_dspin_m2p.eop.read();
     6272                cc_receive_updt_fifo_be   = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_BE);
     6273                cc_receive_updt_fifo_data = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_DATA);
     6274                cc_receive_updt_fifo_eop  = receive_eop;
     6275                cc_receive_updt_fifo_put  = true;
     6276                if ( receive_eop ) r_cc_receive_fsm = CC_RECEIVE_IDLE;
     6277            }
     6278            break;
     6279        }
     6280
    62436281    } // end switch CC_RECEIVE FSM
     6282
     6283    ///////////////// DSPIN CLACK interface ///////////////
     6284   
     6285    uint64_t clack_type = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
     6286                                                     DspinDhccpParam::CLACK_TYPE);
     6287
     6288    size_t clack_way  = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
     6289                                                   DspinDhccpParam::CLACK_WAY);
     6290
     6291    size_t clack_set  = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
     6292                                                   DspinDhccpParam::CLACK_SET);
     6293
     6294    bool dspin_clack_get      = false;
     6295    bool dcache_clack_request = (clack_type == DspinDhccpParam::TYPE_CLACK_DATA);
     6296    bool icache_clack_request = (clack_type == DspinDhccpParam::TYPE_CLACK_INST);
     6297
     6298    if (r_dspin_clack_req.read())
     6299    {
     6300        // CLACK DATA: Send request to DCACHE FSM
     6301        if (dcache_clack_request and not r_dcache_clack_req.read()){
     6302            r_dcache_clack_req = true;
     6303            r_dcache_clack_way = clack_way & ((1ULL<<(uint32_log2(m_dcache_ways)))-1);
     6304            r_dcache_clack_set = clack_set & ((1ULL<<(uint32_log2(m_dcache_sets)))-1);
     6305            dspin_clack_get    = true;
     6306        }
     6307
     6308        // CLACK INST: Send request to ICACHE FSM
     6309        else if (icache_clack_request and not r_icache_clack_req.read()){
     6310            r_icache_clack_req = true;
     6311            r_icache_clack_way = clack_way & ((1ULL<<(uint32_log2(m_dcache_ways)))-1);
     6312            r_icache_clack_set = clack_set & ((1ULL<<(uint32_log2(m_icache_sets)))-1);
     6313            dspin_clack_get    = true;
     6314        }
     6315    }
     6316    else
     6317    {
     6318        dspin_clack_get = true;
     6319    }
     6320
     6321    if (dspin_clack_get)
     6322    {
     6323        r_dspin_clack_req  = p_dspin_clack.write.read();
     6324        r_dspin_clack_flit = p_dspin_clack.data.read();
     6325    }
    62446326
    62456327    ///////////////// Response FIFOs update  //////////////////////
     
    64476529        case CC_SEND_IDLE:
    64486530        {
    6449             p_dspin_out.write = false;
     6531            p_dspin_p2m.write = false;
    64506532            break;
    64516533        }
     
    64546536        {
    64556537            // initialize dspin send data
     6538//            DspinDhccpParam::dspin_set(dspin_send_data,
     6539//                                       0,
     6540//                                       DspinDhccpParam::P2M_EOP);
    64566541            DspinDhccpParam::dspin_set(dspin_send_data,
    64576542                                       m_cc_global_id,
     
    64596544            DspinDhccpParam::dspin_set(dspin_send_data,
    64606545                                       0,
    6461                                        DspinDhccpParam::FROM_L1_BC);
     6546                                       DspinDhccpParam::P2M_BC);
    64626547
    64636548            if(r_cc_send_last_client.read() == 0) // dcache active request
     
    64806565                DspinDhccpParam::dspin_set(dspin_send_data,
    64816566                                           DspinDhccpParam::TYPE_CLEANUP_DATA,
    6482                                            DspinDhccpParam::FROM_L1_TYPE);
     6567                                           DspinDhccpParam::P2M_TYPE);
    64836568                /*ODCCP*/ // If cleanup on NCC line we set the CLEANUP_NCC bit in cleanup flit
    64846569                if (r_dcache_cleanup_ncc.read())                 
     
    65166601                DspinDhccpParam::dspin_set(dspin_send_data,
    65176602                                           DspinDhccpParam::TYPE_CLEANUP_INST,
    6518                                            DspinDhccpParam::FROM_L1_TYPE);
     6603                                           DspinDhccpParam::P2M_TYPE);
    65196604               
    65206605                DspinDhccpParam::dspin_set(dspin_send_data,
     
    65236608            }
    65246609            // send flit
    6525             p_dspin_out.data  = dspin_send_data;
    6526             p_dspin_out.write = true;
    6527             p_dspin_out.eop   = false;
     6610            p_dspin_p2m.data  = dspin_send_data;
     6611            p_dspin_p2m.write = true;
     6612            p_dspin_p2m.eop   = false;
    65286613            break;
    65296614        }
     
    65356620            if (r_dcache_cc_cleanup_updt_data.read() and not r_cc_send_last_client.read())
    65366621            {
    6537                 p_dspin_out.eop   = false;
     6622                p_dspin_p2m.eop   = false;
    65386623            }
    65396624            else
    65406625            {
    6541                 p_dspin_out.eop   = true;
     6626                p_dspin_p2m.eop   = true;
    65426627            }
    65436628
     
    65556640            }
    65566641            // send flit
    6557             p_dspin_out.data  = dspin_send_data;
    6558             p_dspin_out.write = true;
     6642            p_dspin_p2m.data  = dspin_send_data;
     6643            p_dspin_p2m.write = true;
    65596644            break;
    65606645        }
     
    65646649            if (r_cc_send_cpt_word.read() == m_dcache_words-1) /*ODCCP*/ // Last flit sent
    65656650            {
    6566                 p_dspin_out.eop   = true;
     6651                p_dspin_p2m.eop   = true;
    65676652            }
    65686653            else
    65696654            {
    6570                 p_dspin_out.eop   = false;
     6655                p_dspin_p2m.eop   = false;
    65716656            }
    65726657
     
    65756660                                       DspinDhccpParam::CLEANUP_DATA_UPDT);
    65766661           
    6577             p_dspin_out.data = dspin_send_data;
    6578             p_dspin_out.write = true;
     6662            p_dspin_p2m.data = dspin_send_data;
     6663            //p_dspin_p2m.write = true;
     6664            if(r_cc_send_data_fifo.rok())
     6665                p_dspin_p2m.write = true;
     6666            else
     6667                p_dspin_p2m.write = false;
    65796668            break;
    65806669        }
     
    65856674//            DspinDhccpParam::dspin_set(dspin_send_data,
    65866675//                                       1,
    6587 //                                       DspinDhccpParam::FROM_L1_EOP);
     6676//                                       DspinDhccpParam::P2M_EOP);
    65886677            DspinDhccpParam::dspin_set(dspin_send_data,
    65896678                                       0,
    6590                                        DspinDhccpParam::FROM_L1_BC);
     6679                                       DspinDhccpParam::P2M_BC);
    65916680            DspinDhccpParam::dspin_set(dspin_send_data,
    65926681                                       DspinDhccpParam::TYPE_MULTI_ACK,
    6593                                        DspinDhccpParam::FROM_L1_TYPE);
     6682                                       DspinDhccpParam::P2M_TYPE);
    65946683
    65956684            if(r_cc_send_last_client.read() == 0) // dcache active request
     
    66236712            }
    66246713            // send flit
    6625             p_dspin_out.data  = dspin_send_data;
    6626             p_dspin_out.write = true;
    6627             p_dspin_out.eop   = true;
     6714            p_dspin_p2m.data  = dspin_send_data;
     6715            p_dspin_p2m.write = true;
     6716            p_dspin_p2m.eop   = true;
    66286717
    66296718            break;
     
    66336722    // Receive coherence packets
    66346723    // It depends on the CC_RECEIVE FSM
    6635 
    66366724    switch( r_cc_receive_fsm.read() )
    66376725    {
     
    66396727        case CC_RECEIVE_IDLE:
    66406728        {
    6641             p_dspin_in.read = false;
    6642             break;
    6643         }
    6644         //////////////////////
    6645         case CC_RECEIVE_CLACK:
    6646         {
    6647             if (((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read())) or
    6648                 ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read())))
    6649                 p_dspin_in.read = true;
    6650             else
    6651                 p_dspin_in.read = false;
     6729            p_dspin_m2p.read = false;
    66526730            break;
    66536731        }
     
    66556733        case CC_RECEIVE_BRDCAST_HEADER:
    66566734        {
    6657             p_dspin_in.read = true;
     6735            p_dspin_m2p.read = true;
    66586736            break;
    66596737        }
     
    66656743            // flip_flop to check that ?
    66666744            if (not (r_cc_receive_icache_req.read()) and not (r_cc_receive_dcache_req.read()))
    6667                 p_dspin_in.read = true;
     6745                p_dspin_m2p.read = true;
    66686746            else
    6669                 p_dspin_in.read = false;
     6747                p_dspin_m2p.read = false;
    66706748            break;
    66716749        }
    66726750        /////////////////////////////
    6673         case CC_RECEIVE_INVAL_HEADER:
    6674         {
    6675             if (((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read())) or
    6676                 ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read())))
    6677                 p_dspin_in.read = true;
     6751        case CC_RECEIVE_DATA_INVAL_HEADER:
     6752        case CC_RECEIVE_INS_INVAL_HEADER:
     6753        {
     6754            p_dspin_m2p.read = true;
     6755            break;
     6756        }
     6757        ////////////////////////////
     6758        case CC_RECEIVE_DATA_INVAL_NLINE:
     6759        {
     6760            p_dspin_m2p.read = not r_cc_receive_dcache_req.read();
     6761            break;
     6762        }
     6763        case CC_RECEIVE_INS_INVAL_NLINE:
     6764        {
     6765            p_dspin_m2p.read = not r_cc_receive_icache_req.read();
     6766            break;
     6767        }
     6768        ///////////////////////////
     6769        case CC_RECEIVE_DATA_UPDT_HEADER:
     6770        {
     6771            if (not r_cc_receive_dcache_req.read())
     6772                p_dspin_m2p.read = true;
    66786773            else
    6679                 p_dspin_in.read = false;
     6774                p_dspin_m2p.read = false;
    66806775            break;
    66816776        }
    66826777        ////////////////////////////
    6683         case CC_RECEIVE_INVAL_NLINE:
    6684         {
    6685             p_dspin_in.read = true;
    6686             break;
    6687         }
    6688         ////////////////////////////
    6689         case CC_RECEIVE_UPDT_HEADER:
    6690         {
    6691             if (((r_cc_receive_data_ins.read() == 0) and
    6692                 not r_cc_receive_dcache_req.read() and
    6693                 r_cc_receive_updt_fifo_be.empty())
    6694                 or
    6695                 (((r_cc_receive_data_ins.read() == 1) and
    6696                 not r_cc_receive_icache_req.read()) and
    6697                 r_cc_receive_updt_fifo_be.empty()))
    6698                 p_dspin_in.read = true;
     6778        case CC_RECEIVE_INS_UPDT_HEADER:
     6779        {
     6780            if ( not r_cc_receive_icache_req.read())
     6781                p_dspin_m2p.read = true;
    66996782            else
    6700                 p_dspin_in.read = false;
     6783                p_dspin_m2p.read = false;
    67016784            break;
    67026785        }
    67036786        ///////////////////////////
    6704         case CC_RECEIVE_UPDT_NLINE:
    6705         {
    6706             if (((r_cc_receive_data_ins.read() == 0) and
    6707                 not (r_cc_receive_dcache_req.read()) and
    6708                 r_cc_receive_updt_fifo_be.empty())
    6709                 or
    6710                 ((r_cc_receive_data_ins.read() == 1) and
    6711                 not (r_cc_receive_icache_req.read()) and
    6712                 r_cc_receive_updt_fifo_be.empty()))
    6713                 p_dspin_in.read = true;
     6787        case CC_RECEIVE_DATA_UPDT_NLINE:
     6788        case CC_RECEIVE_INS_UPDT_NLINE:
     6789        {
     6790            if(r_cc_receive_updt_fifo_be.empty())
     6791                p_dspin_m2p.read = true;
    67146792            else
    6715                 p_dspin_in.read = false;
    6716             break;
    6717         }
    6718         //////////////////////////
    6719         case CC_RECEIVE_UPDT_DATA:
     6793                p_dspin_m2p.read = false;
     6794            break;
     6795        }
     6796        ///////////////////////////
     6797        case CC_RECEIVE_DATA_UPDT_DATA:
     6798        case CC_RECEIVE_INS_UPDT_DATA:
    67206799        {
    67216800            if (r_cc_receive_updt_fifo_be.wok())
    6722                 p_dspin_in.read = true;
     6801                p_dspin_m2p.read = true;
    67236802            else
    6724                 p_dspin_in.read = false;
     6803                p_dspin_m2p.read = false;
    67256804            break;
    67266805        }
    67276806    } // end switch CC_RECEIVE FSM
    67286807
     6808
     6809    int clack_type = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
     6810                                                DspinDhccpParam::CLACK_TYPE);
     6811
     6812    bool dspin_clack_get      = false;
     6813    bool dcache_clack_request = (clack_type == DspinDhccpParam::TYPE_CLACK_DATA);
     6814    bool icache_clack_request = (clack_type == DspinDhccpParam::TYPE_CLACK_INST);
     6815
     6816    if (r_dspin_clack_req.read())
     6817    {
     6818        // CLACK DATA: wait if pending request to DCACHE FSM
     6819        if (dcache_clack_request and not r_dcache_clack_req.read())
     6820        {
     6821            dspin_clack_get = true;
     6822        }
     6823
     6824        // CLACK INST: wait if pending request to ICACHE FSM
     6825        else if (icache_clack_request and not r_icache_clack_req.read())
     6826        {
     6827            dspin_clack_get = true;
     6828        }
     6829    }
     6830    else
     6831    {
     6832        dspin_clack_get = true;
     6833    }
     6834
     6835    p_dspin_clack.read = dspin_clack_get;
    67296836} // end genMoore
    67306837
  • branches/ODCCP/modules/vci_mem_cache

  • branches/ODCCP/modules/vci_mem_cache/caba/metadata/vci_mem_cache.sd

    r434 r479  
    4949            Port('caba:vci_initiator', 'p_vci_ixr'),
    5050            Port('caba:dspin_input',
    51                 'p_dspin_in',
     51                'p_dspin_p2m',
    5252                dspin_data_size = parameter.Reference('dspin_in_width')
    5353            ),
    5454            Port('caba:dspin_output',
    55                 'p_dspin_out',
     55                'p_dspin_m2p',
     56                dspin_data_size = parameter.Reference('dspin_out_width')
     57            ),
     58            Port('caba:dspin_output',
     59                'p_dspin_clack',
    5660                dspin_data_size = parameter.Reference('dspin_out_width')
    5761            ),
  • branches/ODCCP/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h

    r460 r479  
    5454#define TRT_ENTRIES      4      // Number of entries in TRT
    5555#define UPT_ENTRIES      4      // Number of entries in UPT
     56#define IVT_ENTRIES      4      // Number of entries in IVT
    5657#define HEAP_ENTRIES     1024   // Number of entries in HEAP
    5758
     
    122123        CC_SEND_WRITE_IDLE,
    123124        CC_SEND_CAS_IDLE,
    124         CC_SEND_CLEANUP_IDLE,
    125125        CC_SEND_CONFIG_INVAL_HEADER,
    126126        CC_SEND_CONFIG_INVAL_NLINE,
    127127        CC_SEND_CONFIG_BRDCAST_HEADER,
    128128        CC_SEND_CONFIG_BRDCAST_NLINE,
    129         CC_SEND_CLEANUP_ACK,
    130129        CC_SEND_XRAM_RSP_BRDCAST_HEADER,
    131130        CC_SEND_XRAM_RSP_BRDCAST_NLINE,
     
    163162        CONFIG_DIR_REQ,
    164163        CONFIG_DIR_ACCESS,
    165         CONFIG_DIR_UPT_LOCK,
     164        CONFIG_DIR_IVT_LOCK,
    166165        CONFIG_BC_SEND,
    167166        CONFIG_BC_WAIT,
     
    211210        WRITE_MISS_XRAM_REQ,
    212211        WRITE_BC_TRT_LOCK,
    213         WRITE_BC_UPT_LOCK,
     212        WRITE_BC_IVT_LOCK,
    214213        WRITE_BC_DIR_INVAL,
    215214        WRITE_BC_CC_SEND,
     
    255254        IXR_CMD_XRAM_IDLE,
    256255        IXR_CMD_CLEANUP_IDLE,
     256        IXR_CMD_TRT_LOCK,
    257257        IXR_CMD_READ,
    258258        IXR_CMD_WRITE,
     
    276276        CAS_UPT_NEXT,
    277277        CAS_BC_TRT_LOCK,
    278         CAS_BC_UPT_LOCK,
     278        CAS_BC_IVT_LOCK,
    279279        CAS_BC_DIR_INVAL,
    280280        CAS_BC_CC_SEND,
     
    302302        CLEANUP_HEAP_CLEAN,
    303303        CLEANUP_HEAP_FREE,
    304         CLEANUP_UPT_LOCK,
    305         CLEANUP_UPT_DECREMENT,
    306         CLEANUP_UPT_CLEAR,
     304        CLEANUP_IVT_LOCK,
     305        CLEANUP_IVT_DECREMENT,
     306        CLEANUP_IVT_CLEAR,
    307307        CLEANUP_WRITE_RSP,
    308308        CLEANUP_CONFIG_ACK,
     
    332332        ALLOC_TRT_XRAM_RSP,
    333333        ALLOC_TRT_IXR_RSP,
    334         ALLOC_TRT_CLEANUP
     334        ALLOC_TRT_CLEANUP,
     335        ALLOC_TRT_IXR_CMD
    335336      };
    336337
     
    338339      enum alloc_upt_fsm_state_e
    339340      {
    340         ALLOC_UPT_CONFIG,
    341341        ALLOC_UPT_WRITE,
    342         ALLOC_UPT_XRAM_RSP,
    343         ALLOC_UPT_MULTI_ACK,
    344         ALLOC_UPT_CLEANUP,
    345         ALLOC_UPT_CAS
     342        ALLOC_UPT_CAS,
     343        ALLOC_UPT_MULTI_ACK
     344      };
     345
     346      /* States of the ALLOC_IVT fsm */
     347      enum alloc_ivt_fsm_state_e
     348      {
     349        ALLOC_IVT_WRITE,
     350        ALLOC_IVT_XRAM_RSP,
     351        ALLOC_IVT_CLEANUP,
     352        ALLOC_IVT_CAS,
     353        ALLOC_IVT_CONFIG
    346354      };
    347355
     
    492500      uint32_t     m_cpt_cas_fsm_upt_used;       // NB cycles UPT LOCK used
    493501     
    494       uint32_t     m_cpt_upt_unused;            // NB cycles UPT LOCK unused
     502      uint32_t     m_cpt_ivt_unused;            // NB cycles UPT LOCK unused
    495503
    496504      uint32_t     m_cpt_read_fsm_heap_lock;     // wait HEAP LOCK
     
    536544      soclib::caba::VciTarget<vci_param_int>      p_vci_tgt;
    537545      soclib::caba::VciInitiator<vci_param_ext>   p_vci_ixr;
    538       soclib::caba::DspinInput<dspin_in_width>    p_dspin_in;
    539       soclib::caba::DspinOutput<dspin_out_width>  p_dspin_out;
     546      soclib::caba::DspinInput<dspin_in_width>    p_dspin_p2m;
     547      soclib::caba::DspinOutput<dspin_out_width>  p_dspin_m2p;
     548      soclib::caba::DspinOutput<dspin_out_width>  p_dspin_clack;
    540549
    541550      VciMemCache(
     
    553562          const size_t                       trt_lines=TRT_ENTRIES,
    554563          const size_t                       upt_lines=UPT_ENTRIES,     
     564          const size_t                       ivt_lines=IVT_ENTRIES,     
    555565          const size_t                       debug_start_cycle=0,
    556566          const bool                         debug_ok=false );
     
    588598      TransactionTab                     m_trt;              // xram transaction table
    589599      uint32_t                           m_upt_lines;
    590       UpdateTab                          m_upt;              // pending update & invalidate
     600      UpdateTab                          m_upt;              // pending update
     601      UpdateTab                          m_ivt;              // pending invalidate
    591602      CacheDirectory                     m_cache_directory;  // data cache directory
    592603      CacheData                          m_cache_data;       // data array[set][way][word]
     
    677688      sc_signal<size_t>   r_config_heap_next;      // current pointer to scan HEAP
    678689
    679       sc_signal<size_t>   r_config_upt_index;  // UPT index
     690      sc_signal<size_t>   r_config_ivt_index;      // IVT index
    680691
    681692      // Buffer between CONFIG fsm and TGT_RSP fsm (send a done response to L1 cache)
     
    866877      sc_signal<size_t>   r_cleanup_to_tgt_rsp_pktid; // transaction pktid
    867878
    868       // Buffer between CLEANUP fsm and CC_SEND fsm (acknowledge a cleanup command from L1)
    869       sc_signal<bool>     r_cleanup_to_cc_send_req;       // valid request
    870       sc_signal<size_t>   r_cleanup_to_cc_send_srcid;     // L1 srcid
    871       sc_signal<size_t>   r_cleanup_to_cc_send_set_index; // L1 set index
    872       sc_signal<size_t>   r_cleanup_to_cc_send_way_index; // L1 way index
    873       sc_signal<bool>     r_cleanup_to_cc_send_inst;      // Instruction Cleanup Ack
    874 
    875879      ///////////////////////////////////////////////////////
    876880      // Registers controlled by CAS fsm
     
    960964      sc_signal<size_t>   r_xram_rsp_victim_ptr;        // victim line pointer to the heap
    961965      sc_signal<data_t> * r_xram_rsp_victim_data;       // victim line data
    962       sc_signal<size_t>   r_xram_rsp_upt_index;         // UPT entry index
     966      sc_signal<size_t>   r_xram_rsp_ivt_index;         // IVT entry index
    963967      sc_signal<size_t>   r_xram_rsp_next_ptr;          // Next pointer to the heap
    964968
     
    10411045
    10421046      ////////////////////////////////////////////////////
     1047      // Registers controlled by ALLOC_IVT fsm
     1048      ////////////////////////////////////////////////////
     1049
     1050      sc_signal<int>      r_alloc_ivt_fsm;
     1051
     1052      ////////////////////////////////////////////////////
    10431053      // Registers controlled by ALLOC_HEAP fsm
    10441054      ////////////////////////////////////////////////////
     
    10561066      sc_signal<uint32_t>  r_cleanup_pktid;
    10571067      sc_signal<data_t>    *r_cleanup_data;          // buffer for saving data from cleanup
     1068      sc_signal<data_t>    *r_ixr_cmd_data;          // buffer for saving data from cleanup
    10581069      sc_signal<bool>      r_cleanup_contains_data;
    10591070      sc_signal<bool>      r_cleanup_ncc;
  • branches/ODCCP/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r474 r479  
    102102  "CC_SEND_WRITE_IDLE",
    103103  "CC_SEND_CAS_IDLE",
    104   "CC_SEND_CLEANUP_IDLE",
    105104  "CC_SEND_CONFIG_INVAL_HEADER",
    106105  "CC_SEND_CONFIG_INVAL_NLINE",
    107106  "CC_SEND_CONFIG_BRDCAST_HEADER",
    108107  "CC_SEND_CONFIG_BRDCAST_NLINE",
    109   "CC_SEND_CLEANUP_ACK",
    110108  "CC_SEND_XRAM_RSP_BRDCAST_HEADER",
    111109  "CC_SEND_XRAM_RSP_BRDCAST_NLINE",
     
    139137  "CONFIG_DIR_REQ",
    140138  "CONFIG_DIR_ACCESS",
    141   "CONFIG_DIR_UPT_LOCK",
     139  "CONFIG_DIR_IVT_LOCK",
    142140  "CONFIG_BC_SEND",
    143141  "CONFIG_BC_WAIT",
     
    183181  "WRITE_MISS_XRAM_REQ",
    184182  "WRITE_BC_TRT_LOCK",
    185   "WRITE_BC_UPT_LOCK",
     183  "WRITE_BC_IVT_LOCK",
    186184  "WRITE_BC_DIR_INVAL",
    187185  "WRITE_BC_CC_SEND",
     
    221219  "IXR_CMD_XRAM_IDLE",
    222220  "IXR_CMD_CLEANUP_IDLE",
     221  "IXR_CMD_TRT_LOCK",
    223222  "IXR_CMD_READ",
    224223  "IXR_CMD_WRITE",
     
    240239  "CAS_UPT_NEXT",
    241240  "CAS_BC_TRT_LOCK",
    242   "CAS_BC_UPT_LOCK",
     241  "CAS_BC_IVT_LOCK",
    243242  "CAS_BC_DIR_INVAL",
    244243  "CAS_BC_CC_SEND",
     
    264263  "CLEANUP_HEAP_CLEAN",
    265264  "CLEANUP_HEAP_FREE",
    266   "CLEANUP_UPT_LOCK",
    267   "CLEANUP_UPT_DECREMENT",
    268   "CLEANUP_UPT_CLEAR",
     265  "CLEANUP_IVT_LOCK",
     266  "CLEANUP_IVT_DECREMENT",
     267  "CLEANUP_IVT_CLEAR",
    269268  "CLEANUP_WRITE_RSP",
    270269  "CLEANUP_CONFIG_ACK",
     
    290289  "ALLOC_TRT_XRAM_RSP",
    291290  "ALLOC_TRT_IXR_RSP",
    292   "ALLOC_TRT_CLEANUP"
     291  "ALLOC_TRT_CLEANUP",
     292  "ALLOC_TRT_IXR_CMD"
    293293};
    294294const char *alloc_upt_fsm_str[] =
     
    296296  "ALLOC_UPT_CONFIG",
    297297  "ALLOC_UPT_WRITE",
    298   "ALLOC_UPT_XRAM_RSP",
    299   "ALLOC_UPT_MULTI_ACK",
    300   "ALLOC_UPT_CLEANUP",
    301   "ALLOC_UPT_CAS"
     298  "ALLOC_UPT_CAS",
     299  "ALLOC_UPT_MULTI_ACK"
     300};
     301const char *alloc_ivt_fsm_str[] =
     302{
     303  "ALLOC_IVT_WRITE",
     304  "ALLOC_IVT_XRAM_RSP",
     305  "ALLOC_IVT_CLEANUP",
     306  "ALLOC_IVT_CAS",
     307  "ALLOC_IVT_CONFIG"
    302308};
    303309const char *alloc_heap_fsm_str[] =
     
    339345  const size_t        trt_lines,         // number of TRT entries
    340346  const size_t        upt_lines,         // number of UPT entries
     347  const size_t        ivt_lines,         // number of IVT entries
    341348  const size_t        debug_start_cycle,
    342349  const bool          debug_ok)
     
    350357    p_vci_tgt( "p_vci_tgt" ),
    351358    p_vci_ixr( "p_vci_ixr" ),
    352     p_dspin_in( "p_dspin_in" ),
    353     p_dspin_out( "p_dspin_out" ),
     359    p_dspin_p2m( "p_dspin_p2m" ),
     360    p_dspin_m2p( "p_dspin_m2p" ),
     361    p_dspin_clack( "p_dspin_clack" ),
    354362
    355363    m_seglist( mtp.getSegmentList(tgtid_d) ),
     
    368376    m_upt_lines(upt_lines),
    369377    m_upt(upt_lines),
     378    m_ivt(ivt_lines),
    370379    m_cache_directory(nways, nsets, nwords, vci_param_int::N),
    371380    m_cache_data(nways, nsets, nwords),
     
    459468    r_alloc_trt_fsm("r_alloc_trt_fsm"),
    460469    r_alloc_upt_fsm("r_alloc_upt_fsm"),
     470    r_alloc_ivt_fsm("r_alloc_ivt_fsm"),
    461471    r_alloc_heap_fsm("r_alloc_heap_fsm"),
    462472    r_alloc_heap_reset_cpt("r_alloc_heap_reset_cpt")
     
    534544    // Allocation for ODCCP
    535545    r_cleanup_data             = new sc_signal<data_t>[nwords];
     546    r_ixr_cmd_data             = new sc_signal<data_t>[nwords];
    536547    r_cleanup_to_ixr_cmd_data  = new sc_signal<data_t>[nwords];
    537548
     
    641652            << " | " << ixr_cmd_fsm_str[r_ixr_cmd_fsm.read()]
    642653            << " | " << ixr_rsp_fsm_str[r_ixr_rsp_fsm.read()]
    643             << " | " << xram_rsp_fsm_str[r_xram_rsp_fsm] << std::endl;
     654            << " | " << xram_rsp_fsm_str[r_xram_rsp_fsm.read()] << std::endl;
    644655  std::cout << "  "  << alloc_dir_fsm_str[r_alloc_dir_fsm.read()]
    645656            << " | " << alloc_trt_fsm_str[r_alloc_trt_fsm.read()]
    646657            << " | " << alloc_upt_fsm_str[r_alloc_upt_fsm.read()]
     658            << " | " << alloc_ivt_fsm_str[r_alloc_ivt_fsm.read()]
    647659            << " | " << alloc_heap_fsm_str[r_alloc_heap_fsm.read()] << std::endl;
    648660}
     
    672684    m_cpt_trt_rb                  = 0;
    673685    m_cpt_dir_unused              = 0;
    674     m_cpt_upt_unused              = 0;
     686    m_cpt_ivt_unused              = 0;
    675687    m_cpt_heap_unused             = 0;
    676688    m_cpt_trt_unused              = 0;
     
    771783      << "- WAIT UPT LOCK in CAS_FSM               = " << (double) m_cpt_cas_fsm_upt_lock/m_cpt_cas_fsm_n_upt_lock << std::endl
    772784      << "- NB CYCLES IN UPT LOCK in CAS_FSM       = " << (double) m_cpt_cas_fsm_upt_used/m_cpt_cas_fsm_n_upt_lock << std::endl
    773       << "- UPT UNUSED RATE                        = " << (double) m_cpt_upt_unused/m_cpt_cycles << std::endl << std::endl
     785      << "- IVT UNUSED RATE                        = " << (double) m_cpt_ivt_unused/m_cpt_cycles << std::endl << std::endl
    774786     
    775787      << "- WAIT HEAP LOCK in READ_FSM             = " << (double) m_cpt_read_fsm_heap_lock/m_cpt_read_fsm_n_heap_lock << std::endl
     
    805817
    806818  delete [] r_cleanup_data;
     819  delete [] r_ixr_cmd_data;
    807820  delete [] r_cleanup_to_ixr_cmd_data;
    808821}
     
    833846    r_alloc_trt_fsm  = ALLOC_TRT_READ;
    834847    r_alloc_upt_fsm  = ALLOC_UPT_WRITE;
     848    r_alloc_ivt_fsm  = ALLOC_IVT_XRAM_RSP;
    835849    r_ixr_rsp_fsm    = IXR_RSP_IDLE;
    836850    r_xram_rsp_fsm   = XRAM_RSP_IDLE;
     
    845859    m_trt.init();
    846860    m_upt.init();
     861    m_ivt.init();
    847862    m_llsc_table.init();
    848863
     
    946961    r_cleanup_contains_data    = false;
    947962    r_cleanup_to_ixr_cmd_req   = false;
    948     r_cleanup_to_ixr_cmd_l1_dirty_ncc = false;
    949     r_xram_rsp_to_ixr_cmd_inval_ncc_pending = false;
     963    //r_cleanup_to_ixr_cmd_l1_dirty_ncc = false;
     964    //r_xram_rsp_to_ixr_cmd_inval_ncc_pending = false;
    950965    r_cleanup_to_ixr_cmd_srcid = 0;
    951966    r_cleanup_to_ixr_cmd_trdid = 0;
     
    956971      r_cleanup_to_ixr_cmd_data[word] = 0;
    957972      r_cleanup_data[word] = 0;
     973      r_ixr_cmd_data[word] = 0;
    958974    }
    959975
     
    980996    m_cpt_trt_rb                  = 0;
    981997    m_cpt_dir_unused              = 0;
    982     m_cpt_upt_unused              = 0;
     998    m_cpt_ivt_unused              = 0;
    983999    m_cpt_heap_unused             = 0;
    9841000    m_cpt_trt_unused              = 0;
     
    17231739              r_config_dir_next_ptr   = entry.ptr;
    17241740
    1725               r_config_fsm    = CONFIG_DIR_UPT_LOCK;
     1741              r_config_fsm    = CONFIG_DIR_IVT_LOCK;
    17261742          }
    17271743          else if ( entry.valid and                       // hit & sync command
     
    17521768      }
    17531769      /////////////////////////
    1754       case CONFIG_DIR_UPT_LOCK:  // enter this state in case of INVAL command
    1755                                  // Try to get both DIR & UPT locks, and return
    1756                                  // to LOOP state if UPT full.
    1757                                  // Register inval in UPT, and invalidate the
    1758                                  // directory if UPT not full.
    1759       {
    1760           if ( r_alloc_upt_fsm.read() == ALLOC_UPT_CONFIG )
     1770      case CONFIG_DIR_IVT_LOCK:  // enter this state in case of INVAL command
     1771                                 // Try to get both DIR & IVT locks, and return
     1772                                 // to LOOP state if IVT full.
     1773                                 // Register inval in IVT, and invalidate the
     1774                                 // directory if IVT not full.
     1775      {
     1776          if ( r_alloc_ivt_fsm.read() == ALLOC_IVT_CONFIG )
    17611777          {
    17621778              size_t set        = m_y[(addr_t)(r_config_address.read())];
     
    17721788#if DEBUG_MEMC_CONFIG
    17731789if(m_debug)
    1774 std::cout << "  <MEMC " << name() << " CONFIG_DIR_UPT_LOCK>"
     1790std::cout << "  <MEMC " << name() << " CONFIG_DIR_IVT_LOCK>"
    17751791          << " No copies in L1 : inval DIR entry"  << std::endl;
    17761792#endif
    17771793              }
    1778               else    // try to register inval in UPT
     1794              else    // try to register inval in IVT
    17791795              {
    17801796                  bool        wok       = false;
     
    17871803                  size_t      nb_copies = r_config_dir_count.read();
    17881804
    1789                   wok = m_upt.set(false,       // it's an inval transaction
     1805                  wok = m_ivt.set(false,       // it's an inval transaction
    17901806                                  broadcast,   
    17911807                                  false,       // no response required
     
    17981814                                  index);
    17991815
    1800                   if ( wok )  // UPT success => inval DIR slot
     1816                  if ( wok )  // IVT success => inval DIR slot
    18011817                  {
    18021818                      m_cache_directory.inval( way, set );
    1803                       r_config_upt_index = index;
     1819                      r_config_ivt_index = index;
    18041820                      if ( broadcast )  r_config_fsm = CONFIG_BC_SEND;
    18051821                      else              r_config_fsm = CONFIG_INV_SEND;
     
    18071823#if DEBUG_MEMC_CONFIG
    18081824if(m_debug)
    1809 std::cout << "  <MEMC " << name() << " CONFIG_DIR_UPT_LOCK>"
    1810           << " Inval DIR entry and register inval in UPT"
     1825std::cout << "  <MEMC " << name() << " CONFIG_DIR_IVT_LOCK>"
     1826          << " Inval DIR entry and register inval in IVT"
    18111827          << " : index = " << std::dec << index
    18121828          << " / broadcast = " << broadcast << std::endl;
    18131829#endif
    18141830                  }
    1815                   else       // UPT full => release both DIR and UPT locks
     1831                  else       // IVT full => release both DIR and IVT locks
    18161832                  {
    18171833                      r_config_fsm = CONFIG_LOOP;
     
    18191835#if DEBUG_MEMC_CONFIG
    18201836if(m_debug)
    1821 std::cout << "  <MEMC " << name() << " CONFIG_DIR_UPT_LOCK>"
    1822           << " UPT full : release DIR & UPT locks and retry" << std::endl;
     1837std::cout << "  <MEMC " << name() << " CONFIG_DIR_IVT_LOCK>"
     1838          << " IVT full : release DIR & IVT locks and retry" << std::endl;
    18231839#endif
    18241840                  }
     
    18351851              r_config_to_cc_send_multi_req   = false;
    18361852              r_config_to_cc_send_brdcast_req = true;
    1837               r_config_to_cc_send_trdid       = r_config_upt_index.read();
     1853              r_config_to_cc_send_trdid       = r_config_ivt_index.read();
    18381854              r_config_to_cc_send_nline       = m_nline[(addr_t)(r_config_address.read())];
    18391855              r_cleanup_to_config_ack         = false;
     
    18751891              r_config_to_cc_send_multi_req   = true;
    18761892              r_config_to_cc_send_brdcast_req = false;
    1877               r_config_to_cc_send_trdid       = r_config_upt_index.read();
     1893              r_config_to_cc_send_trdid       = r_config_ivt_index.read();
    18781894              r_config_to_cc_send_nline       = m_nline[(addr_t)(r_config_address.read())];
    18791895              r_multi_ack_to_config_ack       = false;
     
    20372053  switch(r_read_fsm.read())
    20382054  {
    2039       ///////////////
    2040       case READ_IDLE:  // waiting a read request
    2041       {
     2055    ///////////////
     2056    case READ_IDLE:  // waiting a read request
     2057    {
    20422058      if(m_cmd_read_addr_fifo.rok())
    20432059      {
    20442060
    20452061#if DEBUG_MEMC_READ
    2046 if(m_debug)
    2047 std::cout << "  <MEMC " << name() << " READ_IDLE> Read request"
    2048           << " : address = " << std::hex << m_cmd_read_addr_fifo.read()
    2049           << " / srcid = " << m_cmd_read_srcid_fifo.read()
    2050           << " / trdid = " << m_cmd_read_trdid_fifo.read()
    2051           << " / pktid = " << m_cmd_read_pktid_fifo.read()
    2052           << " / nwords = " << std::dec << m_cmd_read_length_fifo.read() << std::endl;
     2062        if(m_debug)
     2063          std::cout << "  <MEMC " << name() << " READ_IDLE> Read request"
     2064            << " : address = " << std::hex << m_cmd_read_addr_fifo.read()
     2065            << " / srcid = " << m_cmd_read_srcid_fifo.read()
     2066            << " / trdid = " << m_cmd_read_trdid_fifo.read()
     2067            << " / pktid = " << m_cmd_read_pktid_fifo.read()
     2068            << " / nwords = " << std::dec << m_cmd_read_length_fifo.read() << std::endl;
    20532069#endif
    20542070        r_read_fsm = READ_DIR_REQ;
     
    21542170
    21552171    {
    2156         if(r_alloc_dir_fsm.read() == ALLOC_DIR_READ)
    2157         {
    2158             // check if this is an instruction read, this means pktid is either
    2159             // TYPE_READ_INS_UNC   0bX010 with TSAR encoding
    2160             // TYPE_READ_INS_MISS  0bX011 with TSAR encoding
    2161             bool inst_read    = ((m_cmd_read_pktid_fifo.read() & 0x2) != 0);
    2162             // check if this is a cached read, this means pktid is either
    2163             // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding
    2164             // TYPE_READ_INS_MISS  0bX011 with TSAR encoding
    2165             bool cached_read  = (m_cmd_read_pktid_fifo.read() & 0x1);
    2166             bool is_cnt       = r_read_is_cnt.read();
    2167 
    2168             // read data in the cache
    2169             size_t set        = m_y[(addr_t)(m_cmd_read_addr_fifo.read())];
    2170             size_t way        = r_read_way.read();
    2171 
    2172             m_cache_data.read_line(way, set, r_read_data);
    2173 
    2174             if(m_monitor_ok) check_monitor( m_cmd_read_addr_fifo.read(), r_read_data[0], true);
     2172      if(r_alloc_dir_fsm.read() == ALLOC_DIR_READ)
     2173      {
     2174        // check if this is an instruction read, this means pktid is either
     2175        // TYPE_READ_INS_UNC   0bX010 with TSAR encoding
     2176        // TYPE_READ_INS_MISS  0bX011 with TSAR encoding
     2177        bool inst_read    = ((m_cmd_read_pktid_fifo.read() & 0x2) != 0);
     2178        // check if this is a cached read, this means pktid is either
     2179        // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding
     2180        // TYPE_READ_INS_MISS  0bX011 with TSAR encoding
     2181        bool cached_read  = (m_cmd_read_pktid_fifo.read() & 0x1);
     2182        bool is_cnt       = r_read_is_cnt.read();
     2183
     2184        // read data in the cache
     2185        size_t set        = m_y[(addr_t)(m_cmd_read_addr_fifo.read())];
     2186        size_t way        = r_read_way.read();
     2187
     2188        m_cache_data.read_line(way, set, r_read_data);
     2189
     2190        if(m_monitor_ok) check_monitor( m_cmd_read_addr_fifo.read(), r_read_data[0], true);
    21752191
    21762192        // update the cache directory
     
    22232239
    22242240#if DEBUG_MEMC_READ
    2225 if(m_debug)
    2226 std::cout << "  <MEMC " << name() << " READ_DIR_HIT> Update directory entry:"
    2227           << " addr = " << std::hex << m_cmd_read_addr_fifo.read()
    2228           << " / set = " << std::dec << set
    2229           << " / way = " << way
    2230           << " / owner_id = " << std::hex << entry.owner.srcid
    2231           << " / owner_ins = " << std::dec << entry.owner.inst
    2232           << " / count = " << entry.count
    2233           << " / is_cnt = " << entry.is_cnt << std::endl;
     2241        if(m_debug)
     2242          std::cout << "  <MEMC " << name() << " READ_DIR_HIT> Update directory entry:"
     2243            << " addr = " << std::hex << m_cmd_read_addr_fifo.read()
     2244            << " / set = " << std::dec << set
     2245            << " / way = " << way
     2246            << " / owner_id = " << std::hex << entry.owner.srcid
     2247            << " / owner_ins = " << std::dec << entry.owner.inst
     2248            << " / count = " << entry.count
     2249            << " / is_cnt = " << entry.is_cnt << std::endl;
    22342250#endif
    22352251
     
    29772993
    29782994        wok = m_upt.set(true,  // it's an update transaction
    2979                         false,    // it's not a broadcast
    2980                         true,     // response required
    2981                         false,    // no acknowledge required
     2995                        false, // it's not a broadcast
     2996                        true,  // response required
     2997                        false, // no acknowledge required
    29822998                        srcid,   
    29832999                        trdid,
     
    31393155          entry.owner.inst)             // put the next srcid in the fifo
    31403156      {
    3141         dec_upt_counter                 = false;
     3157        dec_upt_counter                = false;
    31423158        write_to_cc_send_fifo_put      = true;
    31433159        write_to_cc_send_fifo_inst     = entry.owner.inst;
     
    31923208      {
    31933209        r_write_to_cc_send_multi_req = true;
    3194         if(r_write_to_dec.read() or dec_upt_counter)   r_write_fsm = WRITE_UPT_DEC;
     3210        if(r_write_to_dec.read() or dec_upt_counter)  r_write_fsm = WRITE_UPT_DEC;
    31953211        else                                          r_write_fsm = WRITE_IDLE;
    31963212      }
     
    34443460        {
    34453461          r_write_trt_index = wok_index;
    3446           r_write_fsm       = WRITE_BC_UPT_LOCK;
     3462          r_write_fsm       = WRITE_BC_IVT_LOCK;
    34473463        }
    34483464        else  // wait an empty entry in TRT
     
    34653481
    34663482    //////////////////////
    3467     case WRITE_BC_UPT_LOCK:      // register BC transaction in UPT
    3468     {
    3469       if(r_alloc_upt_fsm.read() == ALLOC_UPT_WRITE)
     3483    case WRITE_BC_IVT_LOCK:      // register BC transaction in IVT
     3484    {
     3485      if(r_alloc_ivt_fsm.read() == ALLOC_IVT_WRITE)
    34703486      {
    34713487        bool        wok       = false;
     
    34773493        size_t      nb_copies = r_write_count.read();
    34783494
    3479         wok = m_upt.set(false,  // it's an inval transaction
    3480                         true,     // it's a broadcast
    3481                         true,     // response required
    3482                         false,    // no acknowledge required
     3495        wok = m_ivt.set(false,  // it's an inval transaction
     3496                        true,   // it's a broadcast
     3497                        true,   // response required
     3498                        false,  // no acknowledge required
    34833499                        srcid,
    34843500                        trdid,
     
    34893505#if DEBUG_MEMC_WRITE
    34903506if( m_debug and wok )
    3491 std::cout << "  <MEMC " << name() << " WRITE_BC_UPT_LOCK> Register broadcast inval in UPT"
     3507std::cout << "  <MEMC " << name() << " WRITE_BC_IVT_LOCK> Register broadcast inval in IVT"
    34923508          << " / nb_copies = " << r_write_count.read() << std::endl;
    34933509#endif
     
    34953511
    34963512        if(wok) r_write_fsm = WRITE_BC_DIR_INVAL;
    3497         else       r_write_fsm = WRITE_WAIT;
     3513        else    r_write_fsm = WRITE_WAIT;
    34983514        m_cpt_write_fsm_n_upt_lock++;
    34993515      }
     
    35103526      // and invalidate the line in directory
    35113527      if((r_alloc_trt_fsm.read() != ALLOC_TRT_WRITE) or
    3512           (r_alloc_upt_fsm.read() != ALLOC_UPT_WRITE) or
    3513           (r_alloc_dir_fsm.read() != ALLOC_DIR_WRITE))
     3528         (r_alloc_ivt_fsm.read() != ALLOC_IVT_WRITE) or
     3529         (r_alloc_dir_fsm.read() != ALLOC_DIR_WRITE))
    35143530      {
    35153531        std::cout << "VCI_MEM_CACHE ERROR " << name() << " WRITE_BC_DIR_INVAL state" << std::endl;
    3516         std::cout << "bad TRT, DIR, or UPT allocation" << std::endl;
     3532        std::cout << "bad TRT, DIR, or IVT allocation" << std::endl;
    35173533        exit(0);
    35183534      }
     
    36363652      else if(r_cas_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_CAS;
    36373653      else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM;
     3654#if ODCCP_NON_INCLUSIVE
    36383655      else if(r_cleanup_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA;
     3656#else
     3657      else if(r_cleanup_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_TRT_LOCK;
     3658#endif
    36393659      else if(r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ;
    36403660      break;
     
    36433663      if(r_cas_to_ixr_cmd_req)           r_ixr_cmd_fsm = IXR_CMD_CAS;
    36443664      else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM;
     3665#if ODCCP_NON_INCLUSIVE
    36453666      else if(r_cleanup_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA;
     3667#else
     3668      else if(r_cleanup_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_TRT_LOCK;
     3669#endif
    36463670      else if(r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ;
    36473671      else if(r_write_to_ixr_cmd_req)    r_ixr_cmd_fsm = IXR_CMD_WRITE;
     
    36503674    case IXR_CMD_CAS_IDLE:
    36513675      if(r_xram_rsp_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_XRAM;
     3676#if ODCCP_NON_INCLUSIVE
    36523677      else if(r_cleanup_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA;
     3678#else
     3679      else if(r_cleanup_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_TRT_LOCK;
     3680#endif
    36533681      else if(r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ;
    36543682      else if(r_write_to_ixr_cmd_req)    r_ixr_cmd_fsm = IXR_CMD_WRITE;
     
    36573685    ////////////////////////
    36583686    case IXR_CMD_XRAM_IDLE:
     3687#if ODCCP_NON_INCLUSIVE
    36593688      if(r_cleanup_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA;
     3689#else
     3690      if(r_cleanup_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_TRT_LOCK;
     3691#endif
    36603692      else if(r_read_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_READ;
    36613693      else if(r_write_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_WRITE;
     
    36693701      else if(r_cas_to_ixr_cmd_req)      r_ixr_cmd_fsm = IXR_CMD_CAS;
    36703702      else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM;
     3703#if ODCCP_NON_INCLUSIVE
    36713704      else if(r_cleanup_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA;
    3672       break;     
     3705#else
     3706      else if(r_cleanup_to_ixr_cmd_req)     r_ixr_cmd_fsm = IXR_CMD_TRT_LOCK;
     3707#endif
     3708      break;     
     3709
     3710    /////////////////////
     3711    case IXR_CMD_TRT_LOCK:
     3712    {
     3713        TransactionTabEntry entry;
     3714       
     3715        if(r_alloc_trt_fsm.read() != ALLOC_TRT_IXR_CMD) break;
     3716        entry.copy( m_trt.read(r_cleanup_to_ixr_cmd_trdid.read()));
     3717        for(size_t i=0; i < m_words; i++)
     3718        {
     3719          r_ixr_cmd_data[i] = entry.wdata[i];
     3720        }
     3721
     3722        r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA;
     3723        break;
     3724    }
     3725
    36733726    //////////////////       // send a get from READ FSM
    36743727    case IXR_CMD_READ:
     
    38063859          r_ixr_cmd_fsm = IXR_CMD_CLEANUP_IDLE;
    38073860          r_cleanup_to_ixr_cmd_req = false;
    3808           r_xram_rsp_to_ixr_cmd_inval_ncc_pending = false;
     3861          //r_xram_rsp_to_ixr_cmd_inval_ncc_pending = false;
    38093862        }
    38103863        else
     
    39904043      size_t ptr   = r_xram_rsp_trt_index.read();
    39914044      size_t lines = m_trt_lines;
     4045     
    39924046      for(size_t i=0 ; i<lines ; i++)
    39934047      {
     
    40814135#else
    40824136          /*ODCCP*/ //if victim is no coherent and there is an inval no coherent pending we wait
    4083           if(!victim.coherent and r_xram_rsp_to_ixr_cmd_inval_ncc_pending.read())
     4137          /*if(!victim.coherent and r_xram_rsp_to_ixr_cmd_inval_ncc_pending.read())
    40844138          {
    40854139            r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT;
    40864140          }
    40874141          else
    4088           {
     4142          {*/
    40894143            r_xram_rsp_fsm = XRAM_RSP_INVAL_LOCK;
    4090           }
     4144         //}
    40914145#endif
    40924146        }
     
    41024156          << " way = " << std::dec << way
    41034157          << " / set = " << set
     4158          << " / victim coherent = " << victim.coherent
     4159          << " / victim owner id = " << victim.owner.srcid
    41044160          << " / inval_required = " << inval << std::endl;
    41054161#endif
     
    41144170    }
    41154171    /////////////////////////
    4116     case XRAM_RSP_INVAL_LOCK: // Take the UPT lock to check a possible pending inval
    4117     {
    4118       if(r_alloc_upt_fsm == ALLOC_UPT_XRAM_RSP)
     4172    case XRAM_RSP_INVAL_LOCK: // Take the IVT lock to check a possible pending inval
     4173    {
     4174      if(r_alloc_ivt_fsm == ALLOC_IVT_XRAM_RSP)
    41194175      {
    41204176        size_t index = 0;
    4121         if(m_upt.search_inval(r_xram_rsp_trt_buf.nline, index))  // pending inval
     4177        if(m_ivt.search_inval(r_xram_rsp_trt_buf.nline, index))  // pending inval
    41224178        {
    41234179          r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT;
     
    41264182if(m_debug)
    41274183std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL_LOCK>"
    4128           << " Get acces to UPT, but line invalidation registered"
     4184          << " Get acces to IVT, but line invalidation registered"
    41294185          << " / nline = " << std::hex << r_xram_rsp_trt_buf.nline
    41304186          << " / index = " << std::dec << index << std::endl;
     
    41324188
    41334189        }
    4134         else if(m_upt.is_full() and r_xram_rsp_victim_inval.read()) // UPT full
     4190        else if(m_ivt.is_full() and r_xram_rsp_victim_inval.read()) // IVT full
    41354191        {
    41364192          r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT;
     
    41394195if(m_debug)
    41404196std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL_LOCK>"
    4141           << " Get acces to UPT, but inval required and UPT full" << std::endl;
     4197          << " Get acces to IVT, but inval required and IVT full" << std::endl;
    41424198#endif
    41434199        }
     
    41494205if(m_debug)
    41504206std::cout << "  <MEMC " << name() << " XRAM_RSP_INVAL_LOCK>"
    4151           << " Get acces to UPT" << std::endl;
     4207          << " Get acces to IVT" << std::endl;
    41524208#endif
    41534209        }
     
    41734229    ///////////////////////
    41744230    case XRAM_RSP_DIR_UPDT:   // updates the cache (both data & directory)
    4175                               // and possibly set an inval request in UPT
     4231                              // and possibly set an inval request in IVT
    41764232    {
    41774233      // check if this is an instruction read, this means pktid is either
     
    42414297      m_cache_directory.write(set, way, entry);
    42424298
    4243       // request an invalidation request in UPT for victim line
     4299      // request an invalidation request in IVT for victim line
    42444300      if(r_xram_rsp_victim_inval.read())
    42454301      {
     
    42474303        size_t index        = 0;
    42484304        size_t count_copies = r_xram_rsp_victim_count.read();
    4249 
    4250         bool   wok = m_upt.set(false,      // it's an inval transaction
     4305       
     4306        bool   wok = m_ivt.set(false,      // it's an inval transaction
    42514307                               broadcast,  // set broadcast bit
    42524308                               false,      // no response required
     
    42594315                               index);
    42604316
    4261         r_xram_rsp_upt_index = index;
     4317        r_xram_rsp_ivt_index = index;
    42624318
    42634319        if(!wok)
    42644320        {
    42654321          std::cout << "VCI_MEM_CACHE ERROR " << name() << " XRAM_RSP_DIR_UPDT"
    4266                     << " update_tab entry free but write unsuccessful" << std::endl;
     4322                    << " invalidate_tab entry free but write unsuccessful" << std::endl;
    42674323          exit(0);
    42684324        }
     
    43134369      if(r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP)
    43144370      {
    4315         m_trt.set(r_xram_rsp_trt_index.read(),
     4371        std::vector<data_t> data_vector;
     4372        data_vector.clear();
     4373       
     4374        for(size_t i=0; i<m_words; i++)
     4375        {
     4376          data_vector.push_back(r_xram_rsp_victim_data[i]);
     4377        }
     4378        /*m_trt.set(r_xram_rsp_trt_index.read(),
    43164379                              false,       // write to XRAM
    43174380                              r_xram_rsp_victim_nline.read(),  // line index
     
    43234386                              0,
    43244387                              std::vector<be_t> (m_words,0),
    4325                               std::vector<data_t> (m_words,0));
     4388                              std::vector<data_t> (m_words,0));*/
     4389       
     4390        m_trt.set(r_xram_rsp_trt_index.read(),
     4391                  false,       // write to XRAM
     4392                  r_xram_rsp_victim_nline.read(),  // line index
     4393                  0,
     4394                  0,
     4395                  0,
     4396                  false,
     4397                  0,
     4398                  0,
     4399                  std::vector<be_t> (m_words,0),
     4400                  data_vector);
    43264401
    43274402#if DEBUG_MEMC_XRAM_RSP
     
    43954470        r_xram_rsp_to_cc_send_brdcast_req  = r_xram_rsp_victim_is_cnt.read();
    43964471        r_xram_rsp_to_cc_send_nline        = r_xram_rsp_victim_nline.read();
    4397         r_xram_rsp_to_cc_send_trdid        = r_xram_rsp_upt_index;
     4472        r_xram_rsp_to_cc_send_trdid        = r_xram_rsp_ivt_index;
    43984473        xram_rsp_to_cc_send_fifo_srcid     = r_xram_rsp_victim_copy.read();
    43994474        xram_rsp_to_cc_send_fifo_inst      = r_xram_rsp_victim_copy_inst.read();
     
    44274502    case XRAM_RSP_WRITE_DIRTY:  // send a write request to IXR_CMD FSM
    44284503    {
    4429       if((!r_xram_rsp_to_ixr_cmd_req.read()) and (!r_xram_rsp_to_ixr_cmd_inval_ncc_pending.read()))
     4504      if((!r_xram_rsp_to_ixr_cmd_req.read()) /*and (!r_xram_rsp_to_ixr_cmd_inval_ncc_pending.read())*/)
    44304505      {
    44314506
     
    44434518        if( (!r_xram_rsp_victim_coherent.read()) and (r_xram_rsp_victim_count.read() == 1) )
    44444519        {
    4445           r_xram_rsp_to_ixr_cmd_inval_ncc_pending = true; // inval no coherent pending
     4520          //r_xram_rsp_to_ixr_cmd_inval_ncc_pending = true; // inval no coherent pending
    44464521          r_xram_rsp_to_ixr_cmd_req = false;
    44474522          r_xram_rsp_fsm = XRAM_RSP_IDLE;
     
    46334708        DspinDhccpParam::dspin_get(
    46344709            flit,
    4635             DspinDhccpParam::FROM_L1_TYPE);
     4710            DspinDhccpParam::P2M_TYPE);
    46364711
    46374712      r_cleanup_way_index =
     
    46894764        DspinDhccpParam::dspin_get(flit, DspinDhccpParam::CLEANUP_NLINE_LSB);
    46904765     
    4691       bool eop = DspinDhccpParam::dspin_get(flit, DspinDhccpParam::FROM_L1_EOP);
     4766      bool eop = DspinDhccpParam::dspin_get(flit, DspinDhccpParam::P2M_EOP);
    46924767     
    46934768      /*ODCCP*/ // if not eop (more than 2 flits) there is a cleanup no coherent with data
     
    47114786std::cout << "  <MEMC "         << name()
    47124787          << " CLEANUP_GET_NLINE> Cleanup request:"
     4788          << " / ncc = "     << r_cleanup_ncc.read()
    47134789          << " / address = " << std::hex << nline * m_words * 4 << std::endl;
    47144790#endif
     
    48194895      else                // miss : check UPT for a pending invalidation transaction
    48204896      {
    4821         r_cleanup_fsm = CLEANUP_UPT_LOCK;
     4897        r_cleanup_fsm = CLEANUP_IVT_LOCK;
    48224898      }
    48234899
     
    52895365    }
    52905366    //////////////////////
    5291     case CLEANUP_UPT_LOCK:   // get the lock protecting the UPT to search a pending
     5367    case CLEANUP_IVT_LOCK:   // get the lock protecting the IVT to search a pending
    52925368                             // invalidate transaction matching the cleanup
    52935369    {
    52945370      m_cpt_cleanup_fsm_upt_lock++;
    5295       if(r_alloc_upt_fsm.read() != ALLOC_UPT_CLEANUP) break;
     5371      if(r_alloc_ivt_fsm.read() != ALLOC_IVT_CLEANUP) break;
    52965372
    52975373      size_t index = 0;
    52985374      bool   match_inval;
    52995375
    5300       match_inval = m_upt.search_inval(r_cleanup_nline.read(), index);
     5376      match_inval = m_ivt.search_inval(r_cleanup_nline.read(), index);
    53015377
    53025378      if ( not match_inval )     // no pending inval
     
    53155391if(m_debug)
    53165392std::cout << "  <MEMC " << name()
    5317           << " CLEANUP_UPT_LOCK> Unexpected cleanup"
    5318           << " with no corresponding UPT entry:"
     5393          << " CLEANUP_IVT_LOCK> Unexpected cleanup"
     5394          << " with no corresponding IVT entry:"
    53195395          << " address = " << std::hex
    53205396          << (r_cleanup_nline.read() *4*m_words)
     
    53265402
    53275403      // pending inval
    5328       r_cleanup_write_srcid = m_upt.srcid(index);
    5329       r_cleanup_write_trdid = m_upt.trdid(index);
    5330       r_cleanup_write_pktid = m_upt.pktid(index);
    5331       r_cleanup_need_rsp    = m_upt.need_rsp(index);
    5332       r_cleanup_need_ack    = m_upt.need_ack(index);
     5404      r_cleanup_write_srcid = m_ivt.srcid(index);
     5405      r_cleanup_write_trdid = m_ivt.trdid(index);
     5406      r_cleanup_write_pktid = m_ivt.pktid(index);
     5407      r_cleanup_need_rsp    = m_ivt.need_rsp(index);
     5408      r_cleanup_need_ack    = m_ivt.need_ack(index);
    53335409      r_cleanup_index       = index;
    53345410
    5335       r_cleanup_fsm         = CLEANUP_UPT_DECREMENT;
     5411      r_cleanup_fsm         = CLEANUP_IVT_DECREMENT;
    53365412
    53375413#if DEBUG_MEMC_CLEANUP
    53385414if(m_debug)
    53395415std::cout << "  <MEMC " << name()
    5340           << " CLEANUP_UPT_LOCK> Cleanup matching pending"
    5341           << " invalidate transaction on UPT:"
     5416          << " CLEANUP_IVT_LOCK> Cleanup matching pending"
     5417          << " invalidate transaction on IVT:"
    53425418          << " address = " << std::hex << r_cleanup_nline.read() * m_words * 4
    5343           << " / upt_entry = " << index << std::endl;
     5419          << " / ivt_entry = " << index << std::endl;
    53445420#endif
    53455421      break;
    53465422    }
    53475423    ///////////////////////////
    5348     case CLEANUP_UPT_DECREMENT:   // decrement response counter in UPT matching entry
    5349     {
    5350       if(r_alloc_upt_fsm.read() != ALLOC_UPT_CLEANUP)
     5424    case CLEANUP_IVT_DECREMENT: // decrement response counter in IVT matching entry
     5425    {
     5426      if(r_alloc_ivt_fsm.read() != ALLOC_IVT_CLEANUP)
    53515427      {
    53525428        std::cout
    53535429            << "VCI_MEM_CACHE ERROR "         << name()
    5354             << " CLEANUP_UPT_DECREMENT state" << std::endl
    5355             << "Bad UPT allocation"
     5430            << " CLEANUP_IVT_DECREMENT state" << std::endl
     5431            << "Bad IVT allocation"
    53565432            << std::endl;
    53575433
     
    53605436
    53615437      size_t count = 0;
    5362       m_upt.decrement(r_cleanup_index.read(), count);
     5438      m_ivt.decrement(r_cleanup_index.read(), count);
    53635439
    53645440      if(count == 0)   // multi inval transaction completed
    53655441      {
    5366         r_cleanup_fsm = CLEANUP_UPT_CLEAR;
     5442        r_cleanup_fsm = CLEANUP_IVT_CLEAR;
    53675443      }
    53685444      else             // multi inval transaction not completed
     
    53815457#if DEBUG_MEMC_CLEANUP
    53825458if(m_debug)
    5383 std::cout << "  <MEMC " << name() << " CLEANUP_UPT_DECREMENT>"
    5384           << " Decrement response counter in UPT:"
    5385             << " UPT_index = " << r_cleanup_index.read()
     5459std::cout << "  <MEMC " << name() << " CLEANUP_IVT_DECREMENT>"
     5460          << " Decrement response counter in IVT:"
     5461            << " IVT_index = " << r_cleanup_index.read()
    53865462            << " / rsp_count = " << count << std::endl;
    53875463#endif
     
    53895465    }
    53905466    ///////////////////////
    5391     case CLEANUP_UPT_CLEAR:    // Clear UPT entry
    5392     {
    5393       if(r_alloc_upt_fsm.read() != ALLOC_UPT_CLEANUP)
     5467    case CLEANUP_IVT_CLEAR:    // Clear IVT entry
     5468    {
     5469      if(r_alloc_ivt_fsm.read() != ALLOC_IVT_CLEANUP)
    53945470      {
    53955471        std::cout
    53965472            << "VCI_MEM_CACHE ERROR "     << name()
    5397             << " CLEANUP_UPT_CLEAR state" << std::endl
    5398             << "Bad UPT allocation"
     5473            << " CLEANUP_IVT_CLEAR state" << std::endl
     5474            << "Bad IVT allocation"
    53995475            << std::endl;
    54005476
     
    54025478      }
    54035479
    5404       m_upt.clear(r_cleanup_index.read());
     5480      m_ivt.clear(r_cleanup_index.read());
    54055481
    54065482      if      ( r_cleanup_need_rsp.read() ) r_cleanup_fsm = CLEANUP_WRITE_RSP;
     
    54125488if(m_debug)
    54135489std::cout << "  <MEMC "      << name()
    5414           << " CLEANUP_UPT_CLEAR> Clear entry in UPT:"
    5415           << " UPT_index = " << r_cleanup_index.read() << std::endl;
     5490          << " CLEANUP_IVT_CLEAR> Clear entry in IVT:"
     5491          << " IVT_index = " << r_cleanup_index.read() << std::endl;
    54165492#endif
    54175493      break;
     
    54875563            r_cleanup_to_ixr_cmd_pktid        = r_cleanup_pktid.read();
    54885564            r_cleanup_to_ixr_cmd_nline        = r_cleanup_nline.read();
    5489             r_cleanup_to_ixr_cmd_l1_dirty_ncc = true;
     5565            //r_cleanup_to_ixr_cmd_l1_dirty_ncc = true;
    54905566            r_cleanup_fsm = CLEANUP_SEND_CLACK;
    54915567          }
     
    55055581          r_cleanup_to_ixr_cmd_req     = true;
    55065582
    5507           for(size_t i = 0; i < m_words; i++){
    5508             r_cleanup_to_ixr_cmd_data[i]   = r_cleanup_data[i];
     5583          if (r_cleanup_contains_data.read())
     5584          { 
     5585            std::vector<data_t> data_vector;
     5586            data_vector.clear();
     5587
     5588            for(size_t i=0; i<m_words; i++)
     5589            {
     5590              data_vector.push_back(r_cleanup_data[i]);
     5591            }
     5592
     5593            m_trt.set(index,
     5594                false,       // write to XRAM
     5595                r_cleanup_nline.read(),  // line index
     5596                0,
     5597                0,
     5598                0,
     5599                false,
     5600                0,
     5601                0,
     5602                std::vector<be_t> (m_words,0),
     5603                data_vector);
    55095604          }
    5510 
    55115605          r_cleanup_to_ixr_cmd_srcid        = r_cleanup_srcid.read();
    55125606          r_cleanup_to_ixr_cmd_trdid        = index;
    55135607          r_cleanup_to_ixr_cmd_pktid        = r_cleanup_pktid.read();
    55145608          r_cleanup_to_ixr_cmd_nline        = r_cleanup_nline.read();
    5515           r_cleanup_to_ixr_cmd_l1_dirty_ncc = r_cleanup_contains_data.read();
     5609          //r_cleanup_to_ixr_cmd_l1_dirty_ncc = r_cleanup_contains_data.read();
    55165610          r_cleanup_fsm = CLEANUP_SEND_CLACK;
    55175611#endif
     
    55475641
    55485642    ////////////////////////
    5549     case CLEANUP_SEND_CLACK:    // acknowledgement to a cleanup command
    5550                               // on the coherence network (request to the CC_SEND FSM).
    5551                               // wait if pending request to the CC_SEND FSM
    5552     {
    5553       if(r_cleanup_to_cc_send_req.read()) break;
    5554 
    5555       r_cleanup_to_cc_send_req       = true;
    5556       r_cleanup_to_cc_send_set_index = r_cleanup_nline.read() & 0xFFFF;
    5557       r_cleanup_to_cc_send_way_index = r_cleanup_way_index.read();
    5558       r_cleanup_to_cc_send_srcid     = r_cleanup_srcid.read();
    5559       r_cleanup_to_cc_send_inst      = r_cleanup_inst.read();
     5643    case CLEANUP_SEND_CLACK:  // acknowledgement to a cleanup command
     5644                              // on the coherence CLACK network.
     5645    {
     5646      if(not p_dspin_clack.read) break;
    55605647
    55615648      r_cleanup_fsm = CLEANUP_IDLE;
     
    55655652std::cout << "  <MEMC " << name()
    55665653          << " CLEANUP_SEND_CLACK> Send the response to a cleanup request:"
    5567           << " srcid = " << std::dec << r_cleanup_srcid.read() << std::endl;
     5654          << " nline = "   << std::hex << r_cleanup_nline.read()
     5655          << " / way = "   << std::dec << r_cleanup_way.read()
     5656          << " / srcid = " << std::dec << r_cleanup_srcid.read()
     5657          << std::endl;
    55685658#endif
    55695659      break;
     
    58045894                !r_cas_to_cc_send_brdcast_req.read())
    58055895        {
    5806           r_cas_fsm = CAS_UPT_LOCK;     // multi update required
     5896          r_cas_fsm = CAS_UPT_LOCK;       // multi update required
    58075897        }
    58085898        else
     
    60776167          {
    60786168            r_cas_trt_index = wok_index;
    6079             r_cas_fsm       = CAS_BC_UPT_LOCK;
     6169            r_cas_fsm       = CAS_BC_IVT_LOCK;
    60806170          }
    60816171          else
     
    60966186    }
    60976187    /////////////////////
    6098     case CAS_BC_UPT_LOCK:  // register a broadcast inval transaction in UPT
     6188    case CAS_BC_IVT_LOCK:  // register a broadcast inval transaction in IVT
    60996189                           // write data in cache in case of successful registration
    61006190    {
    6101       if(r_alloc_upt_fsm.read() == ALLOC_UPT_CAS)
     6191      if(r_alloc_ivt_fsm.read() == ALLOC_IVT_CAS)
    61026192      {
    61036193        bool        wok       = false;
     
    61096199        size_t      nb_copies = r_cas_count.read();
    61106200
    6111         // register a broadcast inval transaction in UPT
    6112         wok = m_upt.set(false,  // it's an inval transaction
    6113                         true,    // it's a broadcast
    6114                         true,    // response required
    6115                         false,   // no acknowledge required
     6201        // register a broadcast inval transaction in IVT
     6202        wok = m_ivt.set(false,  // it's an inval transaction
     6203                        true,   // it's a broadcast
     6204                        true,   // response required
     6205                        false,  // no acknowledge required
    61166206                        srcid,
    61176207                        trdid,
     
    61216211                        index);
    61226212
    6123         if(wok)     // UPT not full
     6213        if(wok)     // IVT not full
    61246214        {
    61256215          // cache update
     
    61476237if(m_debug)
    61486238std::cout << "  <MEMC " << name()
    6149           << " CAS_BC_UPT_LOCK> Register a broadcast inval transaction in UPT"
     6239          << " CAS_BC_IVT_LOCK> Register a broadcast inval transaction in IVT"
    61506240          << " / nline = " << std::hex << nline
    61516241          << " / count = " << std::dec << nb_copies
    6152           << " / upt_index = " << index << std::endl;
    6153 #endif
    6154         }
    6155         else      //  releases the lock protecting UPT
     6242          << " / ivt_index = " << index << std::endl;
     6243#endif
     6244        }
     6245        else      //  releases the lock protecting IVT
    61566246        {
    61576247          r_cas_fsm = CAS_WAIT;
     
    61686258    {
    61696259      if((r_alloc_trt_fsm.read() == ALLOC_TRT_CAS) and
    6170           (r_alloc_upt_fsm.read() == ALLOC_UPT_CAS) and
    6171           (r_alloc_dir_fsm.read() == ALLOC_DIR_CAS))
     6260         (r_alloc_ivt_fsm.read() == ALLOC_IVT_CAS) and
     6261         (r_alloc_dir_fsm.read() == ALLOC_DIR_CAS))
    61726262      {
    61736263        // set TRT
     
    64166506  // network, used to update or invalidate cache lines in L1 caches.
    64176507  //
    6418   // This fsm is used also to acknowledge CLEANUP a command after request from
    6419   // the CLEANUP fsm.
    6420   //
    6421   // It implements a round-robin priority between the five possible client FSMs
    6422   //     XRAM_RSP > CAS > CLEANUP > WRITE > CONFIG
     6508  // It implements a round-robin priority between the four possible client FSMs
     6509  //     XRAM_RSP > CAS > WRITE > CONFIG
    64236510  //
    64246511  // Each FSM can request the next services:
     
    64326519  //   r_config_to_cc_send_brdcast_req : broadcast-inval
    64336520  //   
    6434   // - r_cleanup_to_cc_send_req : cleanup acknowledgement
    6435   //
    64366521  // An inval request is a double DSPIN flit command containing:
    64376522  // 1. the index of the line to be invalidated.
     
    64766561          break;
    64776562        }
    6478         // CLEANUP
    6479         if (r_cleanup_to_cc_send_req.read())
    6480         {
    6481           r_cc_send_fsm = CC_SEND_CLEANUP_ACK;
    6482           break;
    6483         }
    64846563        // WRITE
    64856564        if(m_write_to_cc_send_inst_fifo.rok() or
     
    65556634          break;
    65566635        }
    6557         // CLEANUP
    6558         if (r_cleanup_to_cc_send_req.read())
    6559         {
    6560           r_cc_send_fsm = CC_SEND_CLEANUP_ACK;
    6561           break;
    6562         }
    65636636        // WRITE
    65646637        if(m_write_to_cc_send_inst_fifo.rok() or
     
    65946667          break;
    65956668        }
    6596         // CLEANUP
    6597         if(r_cleanup_to_cc_send_req.read())
    6598         {
    6599           r_cc_send_fsm = CC_SEND_CLEANUP_ACK;
    6600           break;
    6601         }
    66026669        // WRITE
    66036670        if(m_write_to_cc_send_inst_fifo.rok() or
     
    66476714      case CC_SEND_CAS_IDLE:   // CLEANUP FSM has highest priority
    66486715      {
    6649         if(r_cleanup_to_cc_send_req.read())
    6650         {
    6651           r_cc_send_fsm = CC_SEND_CLEANUP_ACK;
    6652           break;
    6653         }
    66546716        if(m_write_to_cc_send_inst_fifo.rok() or
    66556717            r_write_to_cc_send_multi_req.read())
     
    67066768        break;
    67076769      }
    6708       //////////////////////////
    6709       case CC_SEND_CLEANUP_IDLE:   // WRITE FSM has highest priority
    6710       {
    6711         // WRITE
    6712         if(m_write_to_cc_send_inst_fifo.rok() or
    6713             r_write_to_cc_send_multi_req.read())
    6714         {
    6715           r_cc_send_fsm = CC_SEND_WRITE_UPDT_HEADER;
    6716           m_cpt_update++;
    6717           break;
    6718         }
    6719         if(r_write_to_cc_send_brdcast_req.read())
    6720         {
    6721           r_cc_send_fsm = CC_SEND_WRITE_BRDCAST_HEADER;
    6722           m_cpt_inval++;
    6723           break;
    6724         }
    6725         // CONFIG
    6726         if(r_config_to_cc_send_multi_req.read())
    6727         {
    6728           r_cc_send_fsm = CC_SEND_CONFIG_INVAL_HEADER;
    6729           m_cpt_inval++;
    6730           break;
    6731         }
    6732         if(r_config_to_cc_send_brdcast_req.read())
    6733         {
    6734           r_cc_send_fsm = CC_SEND_CONFIG_BRDCAST_HEADER;
    6735           m_cpt_inval++;
    6736           break;
    6737         }
    6738         // XRAM_RSP
    6739         if(m_xram_rsp_to_cc_send_inst_fifo.rok() or
    6740             r_xram_rsp_to_cc_send_multi_req.read())
    6741         {
    6742           r_cc_send_fsm = CC_SEND_XRAM_RSP_INVAL_HEADER;
    6743           m_cpt_inval++;
    6744           break;
    6745         }
    6746         if(r_xram_rsp_to_cc_send_brdcast_req.read())
    6747         {
    6748           r_cc_send_fsm = CC_SEND_XRAM_RSP_BRDCAST_HEADER;
    6749           m_cpt_inval++;
    6750           break;
    6751         }
    6752         // CAS
    6753         if(m_cas_to_cc_send_inst_fifo.rok() or
    6754             r_cas_to_cc_send_multi_req.read())
    6755         {
    6756           r_cc_send_fsm = CC_SEND_CAS_UPDT_HEADER;
    6757           m_cpt_update++;
    6758           break;
    6759         }
    6760         if(r_cas_to_cc_send_brdcast_req.read())
    6761         {
    6762           r_cc_send_fsm = CC_SEND_CAS_BRDCAST_HEADER;
    6763           m_cpt_inval++;
    6764           break;
    6765         }
    6766         // CLEANUP
    6767         if(r_cleanup_to_cc_send_req.read())
    6768         {
    6769           r_cc_send_fsm = CC_SEND_CLEANUP_ACK;
    6770           break;
    6771         }
    6772         break;
    6773       }
    67746770      /////////////////////////////////
    67756771      case CC_SEND_CONFIG_INVAL_HEADER:   // send first flit multi-inval (from CONFIG FSM)
     
    67776773        if(m_config_to_cc_send_inst_fifo.rok())
    67786774        {
    6779           if(not p_dspin_out.read) break;
     6775          if(not p_dspin_m2p.read) break;
    67806776          r_cc_send_fsm = CC_SEND_CONFIG_INVAL_NLINE;
    67816777          break;
     
    67886784      case CC_SEND_CONFIG_INVAL_NLINE:    // send second flit multi-inval (from CONFIG FSM)
    67896785      {
    6790         if(not p_dspin_out.read) break;
     6786        if(not p_dspin_m2p.read) break;
    67916787        m_cpt_inval_mult++;
    67926788        config_to_cc_send_fifo_get = true;
     
    68046800      case CC_SEND_CONFIG_BRDCAST_HEADER:   // send first flit BC-inval (from CONFIG FSM)
    68056801      {
    6806         if(not p_dspin_out.read) break;
     6802        if(not p_dspin_m2p.read) break;
    68076803        r_cc_send_fsm = CC_SEND_CONFIG_BRDCAST_NLINE;
    68086804        break;
     
    68116807      case CC_SEND_CONFIG_BRDCAST_NLINE:    // send second flit BC-inval (from CONFIG FSM)
    68126808      {
    6813         if(not p_dspin_out.read) break;
     6809        if(not p_dspin_m2p.read) break;
    68146810        m_cpt_inval_brdcast++;
    68156811        r_config_to_cc_send_brdcast_req = false;
     
    68246820        break;
    68256821      }
    6826       /////////////////////////
    6827       case CC_SEND_CLEANUP_ACK:   // send one flit for a cleanup acknowledgement
    6828       {
    6829         if(not p_dspin_out.read) break;
    6830 
    6831         r_cleanup_to_cc_send_req = false;
    6832         r_cc_send_fsm = CC_SEND_CLEANUP_IDLE;
    6833 
    6834 #if DEBUG_MEMC_CC_SEND
    6835 if(m_debug)
    6836 std::cout << "  <MEMC " << name()
    6837           << " CC_SEND_CLEANUP_ACK> Cleanup Ack for srcid "
    6838           << std::hex << r_cleanup_to_cc_send_srcid.read() << std::endl;
    6839 #endif
    6840         break;
    6841       }
    68426822      ///////////////////////////////////
    68436823      case CC_SEND_XRAM_RSP_INVAL_HEADER:   // send first flit multi-inval (from XRAM_RSP FSM)
     
    68456825        if(m_xram_rsp_to_cc_send_inst_fifo.rok())
    68466826        {
    6847           if(not p_dspin_out.read) break;
     6827          if(not p_dspin_m2p.read) break;
    68486828          r_cc_send_fsm = CC_SEND_XRAM_RSP_INVAL_NLINE;
    68496829          break;
     
    68566836      case CC_SEND_XRAM_RSP_INVAL_NLINE:   // send second flit multi-inval (from XRAM_RSP FSM)
    68576837      {
    6858         if(not p_dspin_out.read) break;
     6838        if(not p_dspin_m2p.read) break;
    68596839        m_cpt_inval_mult++;
    68606840        xram_rsp_to_cc_send_fifo_get = true;
     
    68646844if(m_debug)
    68656845std::cout << "  <MEMC " << name()
    6866           << " CC_SEND_XRAM_RSP_INVAL_NLINE> BC-Inval for line "
     6846          << " CC_SEND_XRAM_RSP_INVAL_NLINE> Multicast-Inval for line "
    68676847          << std::hex << r_xram_rsp_to_cc_send_nline.read() << std::endl;
    68686848#endif
     
    68726852      case CC_SEND_XRAM_RSP_BRDCAST_HEADER:  // send first flit broadcast-inval (from XRAM_RSP FSM)
    68736853      {
    6874         if(not p_dspin_out.read) break;
     6854        if(not p_dspin_m2p.read) break;
    68756855        r_cc_send_fsm = CC_SEND_XRAM_RSP_BRDCAST_NLINE;
    68766856        break;
     
    68796859      case CC_SEND_XRAM_RSP_BRDCAST_NLINE:   // send second flit broadcast-inval (from XRAM_RSP FSM)
    68806860      {
    6881         if(not p_dspin_out.read) break;
     6861        if(not p_dspin_m2p.read) break;
    68826862        m_cpt_inval_brdcast++;
    68836863        r_xram_rsp_to_cc_send_brdcast_req = false;
     
    68956875      case CC_SEND_WRITE_BRDCAST_HEADER:   // send first flit broadcast-inval (from WRITE FSM)
    68966876      {
    6897         if(not p_dspin_out.read) break;
     6877        if(not p_dspin_m2p.read) break;
    68986878        r_cc_send_fsm = CC_SEND_WRITE_BRDCAST_NLINE;
    68996879        break;
     
    69026882      case CC_SEND_WRITE_BRDCAST_NLINE:   // send second flit broadcast-inval (from WRITE FSM)
    69036883      {
    6904         if(not p_dspin_out.read) break;
     6884        if(not p_dspin_m2p.read) break;
    69056885
    69066886        m_cpt_inval_brdcast++;
     
    69226902        if(m_write_to_cc_send_inst_fifo.rok())
    69236903        {
    6924           if(not p_dspin_out.read) break;
     6904          if(not p_dspin_m2p.read) break;
    69256905
    69266906          r_cc_send_fsm = CC_SEND_WRITE_UPDT_NLINE;
     
    69396919      case CC_SEND_WRITE_UPDT_NLINE:   // send second flit for a multi-update (from WRITE FSM)
    69406920      {
    6941         if(not p_dspin_out.read) break;
     6921        if(not p_dspin_m2p.read) break;
    69426922        m_cpt_update_mult++;
    69436923
     
    69566936      case CC_SEND_WRITE_UPDT_DATA:   // send N data flits for a multi-update (from WRITE FSM)
    69576937      {
    6958         if(not p_dspin_out.read) break;
     6938        if(not p_dspin_m2p.read) break;
    69596939        if(r_cc_send_cpt.read() == (r_write_to_cc_send_count.read()-1))
    69606940        {
     
    69706950      case CC_SEND_CAS_BRDCAST_HEADER:   // send first flit  broadcast-inval (from CAS FSM)
    69716951      {
    6972         if(not p_dspin_out.read) break;
     6952        if(not p_dspin_m2p.read) break;
    69736953        r_cc_send_fsm = CC_SEND_CAS_BRDCAST_NLINE;
    69746954        break;
     
    69776957      case CC_SEND_CAS_BRDCAST_NLINE:   // send second flit broadcast-inval (from CAS FSM)
    69786958      {
    6979         if(not p_dspin_out.read) break;
     6959        if(not p_dspin_m2p.read) break;
    69806960        m_cpt_inval_brdcast++;
    69816961
     
    69966976        if(m_cas_to_cc_send_inst_fifo.rok())
    69976977        {
    6998           if(not p_dspin_out.read) break;
     6978          if(not p_dspin_m2p.read) break;
    69996979
    70006980          r_cc_send_fsm = CC_SEND_CAS_UPDT_NLINE;
     
    70146994      case CC_SEND_CAS_UPDT_NLINE:   // send second flit for a multi-update (from CAS FSM)
    70156995      {
    7016         if(not p_dspin_out.read) break;
     6996        if(not p_dspin_m2p.read) break;
    70176997
    70186998        m_cpt_update_mult++;
     
    70327012      case CC_SEND_CAS_UPDT_DATA:   // send first data for a multi-update (from CAS FSM)
    70337013      {
    7034         if(not p_dspin_out.read) break;
     7014        if(not p_dspin_m2p.read) break;
    70357015
    70367016        if(r_cas_to_cc_send_is_long.read())
     
    70477027      case CC_SEND_CAS_UPDT_DATA_HIGH:   // send second data for a multi-update (from CAS FSM)
    70487028      {
    7049         if(not p_dspin_out.read) break;
     7029        if(not p_dspin_m2p.read) break;
    70507030        cas_to_cc_send_fifo_get = true;
    70517031        r_cc_send_fsm = CC_SEND_CAS_UPDT_HEADER;
     
    70677047    case CC_RECEIVE_IDLE:
    70687048      {
    7069         if(not p_dspin_in.write) break;
     7049        if(not p_dspin_p2m.write) break;
    70707050
    70717051        uint8_t type =
    70727052          DspinDhccpParam::dspin_get(
    7073               p_dspin_in.data.read(),
    7074               DspinDhccpParam::FROM_L1_TYPE);
     7053              p_dspin_p2m.data.read(),
     7054              DspinDhccpParam::P2M_TYPE);
    70757055
    70767056        if((type == DspinDhccpParam::TYPE_CLEANUP_DATA) or
     
    70987078        // write first CLEANUP flit in CC_RECEIVE to CLEANUP fifo
    70997079
    7100         if(not p_dspin_in.write or not m_cc_receive_to_cleanup_fifo.wok())
     7080        if(not p_dspin_p2m.write or not m_cc_receive_to_cleanup_fifo.wok())
    71017081          break;
    71027082
    7103         assert(not p_dspin_in.eop.read() and
     7083        assert(not p_dspin_p2m.eop.read() and
    71047084            "VCI_MEM_CACHE ERROR in CC_RECEIVE : "
    71057085            "CLEANUP command must have two flits");
     
    71157095        // write second CLEANUP flit in CC_RECEIVE to CLEANUP fifo or more in case of cleanup data (ODCCP)
    71167096
    7117         if(not p_dspin_in.write or not m_cc_receive_to_cleanup_fifo.wok())
     7097        if(not p_dspin_p2m.write or not m_cc_receive_to_cleanup_fifo.wok())
    71187098          break;
    71197099
    7120         /*assert(p_dspin_in.eop.read() and
    7121             "VCI_MEM_CACHE ERROR in CC_RECEIVE : "
    7122             "CLEANUP command must have two flits");*/
    7123 
    71247100        cc_receive_to_cleanup_fifo_put = true;
    7125         if(p_dspin_in.eop.read())
     7101        if(p_dspin_p2m.eop.read())
    71267102          r_cc_receive_fsm               = CC_RECEIVE_IDLE;
    71277103
     
    71357111
    71367112        // wait for a WOK in the CC_RECEIVE to MULTI_ACK fifo
    7137         if(not p_dspin_in.write or not m_cc_receive_to_multi_ack_fifo.wok())
     7113        if(not p_dspin_p2m.write or not m_cc_receive_to_multi_ack_fifo.wok())
    71387114          break;
    71397115
    7140         assert(p_dspin_in.eop.read() and
     7116        assert(p_dspin_p2m.eop.read() and
    71417117            "VCI_MEM_CACHE ERROR in CC_RECEIVE : "
    71427118            "MULTI_ACK command must have one flit");
     
    75487524  //    ALLOC_UPT FSM
    75497525  ////////////////////////////////////////////////////////////////////////////////////
    7550   // The ALLOC_UPT FSM allocates the access to the Update/Inval Table (UPT),
    7551   // with a round robin priority between six FSMs, with the following order:
    7552   //  CONFIG > MULTI_ACK > WRITE > XRAM_RSP > CLEANUP > CAS
    7553   // - The CONFIG FSM initiates an inval transaction and sets a new entry in UPT.
     7526  // The ALLOC_UPT FSM allocates the access to the Update Table (UPT),
     7527  // with a round robin priority between three FSMs, with the following order:
     7528  //  WRITE -> CAS -> MULTI_ACK
     7529  // - The WRITE FSM initiates update transaction and sets a new entry in UPT.
     7530  // - The CAS FSM does the same thing as the WRITE FSM.
    75547531  // - The MULTI_ACK FSM complete those trasactions and erase the UPT entry.
    7555   // - The WRITE FSM initiates update transaction and sets a new entry in UPT.
    7556   // - The XRAM_RSP FSM initiates an inval transactions and sets a new entry in UPT.
    7557   // - The CLEANUP  FSM decrement an entry in UPT.
    7558   // - The CAS FSM does the same thing as the WRITE FSM.
    75597532  // The resource is always allocated.
    75607533  /////////////////////////////////////////////////////////////////////////////////////
    7561 
    75627534  switch(r_alloc_upt_fsm.read())
    75637535  {
    7564       //////////////////////
    7565       case ALLOC_UPT_CONFIG:   // allocated to CONFIG FSM
    7566       if (r_config_fsm.read() != CONFIG_DIR_UPT_LOCK)
    7567       {
    7568         if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK)
    7569           r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK;
    7570                
    7571         else if((r_write_fsm.read() == WRITE_UPT_LOCK) or
    7572                 (r_write_fsm.read() == WRITE_BC_UPT_LOCK))
    7573           r_alloc_upt_fsm = ALLOC_UPT_WRITE;
    7574 
    7575         else if(r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK)
    7576           r_alloc_upt_fsm = ALLOC_UPT_XRAM_RSP;
    7577 
    7578         else if(r_cleanup_fsm.read() == CLEANUP_UPT_LOCK)
    7579           r_alloc_upt_fsm = ALLOC_UPT_CLEANUP;
    7580 
    7581         else if((r_cas_fsm.read() == CAS_UPT_LOCK) or
    7582                 (r_cas_fsm.read() == CAS_BC_UPT_LOCK))
    7583           r_alloc_upt_fsm = ALLOC_UPT_CAS;
    7584       }
    7585       break;
    7586 
    75877536      /////////////////////////
    7588       case ALLOC_UPT_MULTI_ACK:   // allocated to MULTI_ACK FSM
    7589       if( (r_multi_ack_fsm.read() != MULTI_ACK_UPT_LOCK) and
    7590           (r_multi_ack_fsm.read() != MULTI_ACK_UPT_CLEAR))
    7591       {
    7592         if((r_write_fsm.read() == WRITE_UPT_LOCK) or
    7593             (r_write_fsm.read() == WRITE_BC_UPT_LOCK))
    7594           r_alloc_upt_fsm = ALLOC_UPT_WRITE;
    7595 
    7596         else if(r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK)
    7597           r_alloc_upt_fsm = ALLOC_UPT_XRAM_RSP;
    7598 
    7599         else if(r_cleanup_fsm.read() == CLEANUP_UPT_LOCK)
    7600           r_alloc_upt_fsm = ALLOC_UPT_CLEANUP;
    7601 
    7602         else if((r_cas_fsm.read() == CAS_UPT_LOCK) or
    7603                 (r_cas_fsm.read() == CAS_BC_UPT_LOCK))
    7604           r_alloc_upt_fsm = ALLOC_UPT_CAS;
    7605         else if(r_config_fsm.read() == CONFIG_DIR_UPT_LOCK)
    7606           r_alloc_upt_fsm = ALLOC_UPT_CONFIG;
    7607         else
    7608           m_cpt_upt_unused++;
    7609       }
    7610       else
    7611         m_cpt_multi_ack_fsm_upt_used++;
    7612       break;
    7613 
    7614       /////////////////////
    7615       case ALLOC_UPT_WRITE:   // allocated to WRITE FSM
    7616       if((r_write_fsm.read() != WRITE_UPT_LOCK) and
    7617           (r_write_fsm.read() != WRITE_BC_UPT_LOCK))
    7618       {
    7619         if(r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK)
    7620           r_alloc_upt_fsm = ALLOC_UPT_XRAM_RSP;
    7621 
    7622         else if(r_cleanup_fsm.read() == CLEANUP_UPT_LOCK)
    7623           r_alloc_upt_fsm = ALLOC_UPT_CLEANUP;
    7624 
    7625         else if((r_cas_fsm.read() == CAS_UPT_LOCK) or
    7626                 (r_cas_fsm.read() == CAS_BC_UPT_LOCK))
    7627           r_alloc_upt_fsm = ALLOC_UPT_CAS;
    7628 
    7629         else if(r_config_fsm.read() == CONFIG_DIR_UPT_LOCK)
    7630           r_alloc_upt_fsm = ALLOC_UPT_CONFIG;
    7631 
    7632         else if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK)
    7633           r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK;
    7634 
    7635         else
    7636           m_cpt_upt_unused++;
    7637       }
    7638       else
    7639         m_cpt_write_fsm_upt_used++;
    7640       break;
    7641 
    7642       ////////////////////////
    7643       case ALLOC_UPT_XRAM_RSP:
    7644       if(r_xram_rsp_fsm.read() != XRAM_RSP_INVAL_LOCK)
    7645       {
    7646         if(r_cleanup_fsm.read() == CLEANUP_UPT_LOCK)
    7647           r_alloc_upt_fsm = ALLOC_UPT_CLEANUP;
    7648 
    7649         else if((r_cas_fsm.read() == CAS_UPT_LOCK) or
    7650                 (r_cas_fsm.read() == CAS_BC_UPT_LOCK))
    7651           r_alloc_upt_fsm = ALLOC_UPT_CAS;
    7652 
    7653         else if(r_config_fsm.read() == CONFIG_DIR_UPT_LOCK)
    7654           r_alloc_upt_fsm = ALLOC_UPT_CONFIG;
    7655 
    7656         else if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK)
    7657           r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK;
    7658 
    7659         else if((r_write_fsm.read() == WRITE_UPT_LOCK)   or
    7660                 (r_write_fsm.read() == WRITE_BC_UPT_LOCK))
    7661           r_alloc_upt_fsm = ALLOC_UPT_WRITE;
    7662 
    7663         else
    7664           m_cpt_upt_unused++;
    7665       }
    7666       else
    7667         m_cpt_xram_rsp_fsm_upt_used++;
    7668       break;
    7669 
     7537      case ALLOC_UPT_WRITE:         // allocated to WRITE FSM
     7538          if (r_write_fsm.read() != WRITE_UPT_LOCK)
     7539          {
     7540              if (r_cas_fsm.read() == CAS_UPT_LOCK)
     7541                  r_alloc_upt_fsm = ALLOC_UPT_CAS;
     7542
     7543              else if (r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK)
     7544                  r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK;
     7545          }
     7546          break;
     7547
     7548      /////////////////////////
     7549      case ALLOC_UPT_CAS:           // allocated to CAS FSM
     7550          if (r_cas_fsm.read() != CAS_UPT_LOCK)
     7551          {
     7552              if (r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK)
     7553                  r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK;
     7554
     7555              else if (r_write_fsm.read() == WRITE_UPT_LOCK)
     7556                  r_alloc_upt_fsm = ALLOC_UPT_WRITE;
     7557          }
     7558          break;
     7559
     7560      /////////////////////////
     7561      case ALLOC_UPT_MULTI_ACK:     // allocated to MULTI_ACK FSM
     7562          if ((r_multi_ack_fsm.read() != MULTI_ACK_UPT_LOCK ) and
     7563              (r_multi_ack_fsm.read() != MULTI_ACK_UPT_CLEAR))
     7564          {
     7565              if (r_write_fsm.read() == WRITE_UPT_LOCK)
     7566                  r_alloc_upt_fsm = ALLOC_UPT_WRITE;
     7567
     7568              else if (r_cas_fsm.read() == CAS_UPT_LOCK)
     7569                  r_alloc_upt_fsm = ALLOC_UPT_CAS;
     7570          }
     7571          break;
     7572  } // end switch r_alloc_upt_fsm
     7573
     7574  ////////////////////////////////////////////////////////////////////////////////////
     7575  //    ALLOC_IVT FSM
     7576  ////////////////////////////////////////////////////////////////////////////////////
     7577  // The ALLOC_IVT FSM allocates the access to the Invalidate Table (IVT),
     7578  // with a round robin priority between five FSMs, with the following order:
     7579  //  WRITE -> XRAM_RSP -> CLEANUP -> CAS -> CONFIG
     7580  // - The WRITE FSM initiates broadcast invalidate transactions and sets a new entry
     7581  //   in IVT.
     7582  // - The CAS FSM does the same thing as the WRITE FSM.
     7583  // - The XRAM_RSP FSM initiates broadcast/multicast invalidate transaction and sets
     7584  //   a new entry in the IVT
     7585  // - The CONFIG FSM does the same thing as the XRAM_RSP FSM
     7586  // - The CLEANUP FSM complete those trasactions and erase the IVT entry.
     7587  // The resource is always allocated.
     7588  /////////////////////////////////////////////////////////////////////////////////////
     7589  switch(r_alloc_ivt_fsm.read())
     7590  {
    76707591      //////////////////////////
    7671       case ALLOC_UPT_CLEANUP:
    7672       if((r_cleanup_fsm.read() != CLEANUP_UPT_LOCK     ) and
    7673          (r_cleanup_fsm.read() != CLEANUP_UPT_DECREMENT))
    7674       {
    7675         if((r_cas_fsm.read() == CAS_UPT_LOCK) or
    7676             (r_cas_fsm.read() == CAS_BC_UPT_LOCK))
    7677           r_alloc_upt_fsm = ALLOC_UPT_CAS;
    7678 
    7679         else if(r_config_fsm.read() == CONFIG_DIR_UPT_LOCK)
    7680           r_alloc_upt_fsm = ALLOC_UPT_CONFIG;
    7681 
    7682         else if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK)
    7683           r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK;
    7684 
    7685         else if((r_write_fsm.read() == WRITE_UPT_LOCK) or
    7686                 (r_write_fsm.read() == WRITE_BC_UPT_LOCK))
    7687           r_alloc_upt_fsm = ALLOC_UPT_WRITE;
    7688 
    7689         else if(r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK)
    7690           r_alloc_upt_fsm = ALLOC_UPT_XRAM_RSP;
    7691 
    7692         else
    7693           m_cpt_upt_unused++;
    7694       }
    7695       else
    7696         m_cpt_cleanup_fsm_upt_used++;
    7697       break;
     7592      case ALLOC_IVT_WRITE:            // allocated to WRITE FSM
     7593          if (r_write_fsm.read() != WRITE_BC_IVT_LOCK)
     7594          {
     7595              if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK)
     7596                  r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP;
     7597
     7598              else if (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK)
     7599                  r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP;
     7600             
     7601              else if (r_cas_fsm.read() == CAS_BC_IVT_LOCK)
     7602                  r_alloc_ivt_fsm = ALLOC_IVT_CAS;
     7603             
     7604              else if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK)
     7605                  r_alloc_ivt_fsm = ALLOC_IVT_CONFIG;
     7606
     7607              else
     7608                  m_cpt_ivt_unused++;
     7609          }
     7610          break;
    76987611
    76997612      //////////////////////////
    7700       case ALLOC_UPT_CAS:
    7701       if((r_cas_fsm.read() != CAS_UPT_LOCK) and
    7702           (r_cas_fsm.read() != CAS_BC_UPT_LOCK))
    7703       {
    7704         if(r_config_fsm.read() == CONFIG_DIR_UPT_LOCK)
    7705           r_alloc_upt_fsm = ALLOC_UPT_CONFIG;
    7706 
    7707         else if(r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK)
    7708           r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK;
    7709 
    7710         else if((r_write_fsm.read() == WRITE_UPT_LOCK) or
    7711                 (r_write_fsm.read() == WRITE_BC_UPT_LOCK))
    7712           r_alloc_upt_fsm = ALLOC_UPT_WRITE;
    7713 
    7714         else if(r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK)
    7715           r_alloc_upt_fsm = ALLOC_UPT_XRAM_RSP;
    7716 
    7717         else if(r_cleanup_fsm.read() == CLEANUP_UPT_LOCK)
    7718           r_alloc_upt_fsm = ALLOC_UPT_CLEANUP;
    7719 
    7720         else
    7721           m_cpt_upt_unused++;
    7722       }
    7723       else
    7724         m_cpt_cas_fsm_upt_used++;
    7725       break;
    7726 
    7727   } // end switch r_alloc_upt_fsm
     7613      case ALLOC_IVT_XRAM_RSP:         // allocated to XRAM_RSP FSM
     7614          if(r_xram_rsp_fsm.read() != XRAM_RSP_INVAL_LOCK)
     7615          {
     7616            if(r_cleanup_fsm.read() == CLEANUP_IVT_LOCK)
     7617              r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP;
     7618
     7619            else if (r_cas_fsm.read() == CAS_BC_IVT_LOCK)
     7620              r_alloc_ivt_fsm = ALLOC_IVT_CAS;
     7621
     7622            else if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK)
     7623              r_alloc_ivt_fsm = ALLOC_IVT_CONFIG;
     7624
     7625            else if (r_write_fsm.read() == WRITE_BC_IVT_LOCK)
     7626              r_alloc_ivt_fsm = ALLOC_IVT_WRITE;
     7627
     7628            else
     7629              m_cpt_ivt_unused++;
     7630          }
     7631          break;
     7632
     7633      //////////////////////////
     7634      case ALLOC_IVT_CLEANUP:          // allocated to CLEANUP FSM
     7635          if ((r_cleanup_fsm.read() != CLEANUP_IVT_LOCK     ) and
     7636              (r_cleanup_fsm.read() != CLEANUP_IVT_DECREMENT))
     7637          {
     7638            if (r_cas_fsm.read() == CAS_BC_IVT_LOCK)
     7639              r_alloc_ivt_fsm = ALLOC_IVT_CAS;
     7640
     7641            else if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK)
     7642              r_alloc_ivt_fsm = ALLOC_IVT_CONFIG;
     7643
     7644            else if (r_write_fsm.read() == WRITE_BC_IVT_LOCK)
     7645              r_alloc_ivt_fsm = ALLOC_IVT_WRITE;
     7646
     7647            else if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK)
     7648              r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP;
     7649
     7650            else
     7651              m_cpt_ivt_unused++;
     7652          }
     7653          break;
     7654
     7655      //////////////////////////
     7656      case ALLOC_IVT_CAS:              // allocated to CAS FSM
     7657          if (r_cas_fsm.read() != CAS_BC_IVT_LOCK)
     7658          {
     7659            if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK)
     7660              r_alloc_ivt_fsm = ALLOC_IVT_CONFIG;
     7661
     7662            else if (r_write_fsm.read() == WRITE_BC_IVT_LOCK)
     7663              r_alloc_ivt_fsm = ALLOC_IVT_WRITE;
     7664
     7665            else if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK)
     7666              r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP;
     7667
     7668            else if (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK)
     7669              r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP;
     7670     
     7671            else
     7672              m_cpt_ivt_unused++;
     7673          }
     7674          break;
     7675     
     7676      //////////////////////////
     7677      case ALLOC_IVT_CONFIG:           // allocated to CONFIG FSM
     7678          if (r_config_fsm.read() != CONFIG_DIR_IVT_LOCK)
     7679          {
     7680            if (r_write_fsm.read() == WRITE_BC_IVT_LOCK)
     7681              r_alloc_ivt_fsm = ALLOC_IVT_WRITE;
     7682
     7683            else if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK)
     7684              r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP;
     7685
     7686            else if (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK)
     7687              r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP;
     7688
     7689            else if (r_cas_fsm.read() == CAS_BC_IVT_LOCK)
     7690              r_alloc_ivt_fsm = ALLOC_IVT_CAS;
     7691         
     7692            else
     7693              m_cpt_ivt_unused++;
     7694          }
     7695          break;
     7696
     7697  } // end switch r_alloc_ivt_fsm
    77287698
    77297699  ////////////////////////////////////////////////////////////////////////////////////
     
    77557725    if ( (r_config_fsm.read()    != CONFIG_DIR_REQ) and
    77567726         (r_config_fsm.read()    != CONFIG_DIR_ACCESS) and
    7757          (r_config_fsm.read()    != CONFIG_DIR_UPT_LOCK) )
     7727         (r_config_fsm.read()    != CONFIG_DIR_IVT_LOCK) )
    77587728    {
    77597729        if(r_read_fsm.read() == READ_DIR_REQ)
     
    78137783        (r_write_fsm.read()       != WRITE_DIR_HIT)  and
    78147784        (r_write_fsm.read()       != WRITE_BC_TRT_LOCK)  and
    7815         (r_write_fsm.read()       != WRITE_BC_UPT_LOCK)  and
     7785        (r_write_fsm.read()       != WRITE_BC_IVT_LOCK)  and
    78167786        (r_write_fsm.read()       != WRITE_MISS_TRT_LOCK)  and
    78177787        (r_write_fsm.read()       != WRITE_UPT_LOCK)  and
     
    78547824        (r_cas_fsm.read()         != CAS_DIR_HIT_WRITE)  and
    78557825        (r_cas_fsm.read()         != CAS_BC_TRT_LOCK)  and
    7856         (r_cas_fsm.read()         != CAS_BC_UPT_LOCK)  and
     7826        (r_cas_fsm.read()         != CAS_BC_IVT_LOCK)  and
    78577827        (r_cas_fsm.read()         != CAS_MISS_TRT_LOCK)  and
    78587828        (r_cas_fsm.read()         != CAS_UPT_LOCK)  and
     
    79807950          r_alloc_trt_fsm = ALLOC_TRT_CLEANUP;
    79817951
     7952        else if (r_ixr_cmd_fsm.read() == IXR_CMD_TRT_LOCK)
     7953          r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD;
     7954
    79827955        else
    79837956          m_cpt_trt_unused++;
     
    79917964      if((r_write_fsm.read() != WRITE_MISS_TRT_LOCK) and
    79927965          (r_write_fsm.read() != WRITE_BC_TRT_LOCK) and
    7993           (r_write_fsm.read() != WRITE_BC_UPT_LOCK))
     7966          (r_write_fsm.read() != WRITE_BC_IVT_LOCK))
    79947967      {
    79957968        if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) or
     
    80077980        else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ)
    80087981          r_alloc_trt_fsm = ALLOC_TRT_CLEANUP;
     7982       
     7983        else if (r_ixr_cmd_fsm.read() == IXR_CMD_TRT_LOCK)
     7984          r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD;
    80097985
    80107986        else if(r_read_fsm.read() == READ_TRT_LOCK)
     
    80227998      if((r_cas_fsm.read() != CAS_MISS_TRT_LOCK) and
    80237999          (r_cas_fsm.read() != CAS_BC_TRT_LOCK) and
    8024           (r_cas_fsm.read() != CAS_BC_UPT_LOCK))
     8000          (r_cas_fsm.read() != CAS_BC_IVT_LOCK))
    80258001      {
    80268002        if((r_xram_rsp_fsm.read()  == XRAM_RSP_DIR_LOCK) and
     
    80348010        else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ)
    80358011          r_alloc_trt_fsm = ALLOC_TRT_CLEANUP;
     8012       
     8013        else if (r_ixr_cmd_fsm.read() == IXR_CMD_TRT_LOCK)
     8014          r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD;
    80368015
    80378016        else if(r_read_fsm.read() == READ_TRT_LOCK)
     
    80638042        else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ)
    80648043          r_alloc_trt_fsm = ALLOC_TRT_CLEANUP;
     8044       
     8045        else if (r_ixr_cmd_fsm.read() == IXR_CMD_TRT_LOCK)
     8046          r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD;
    80658047
    80668048        else if(r_read_fsm.read() == READ_TRT_LOCK)
     
    80908072        if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ)
    80918073          r_alloc_trt_fsm = ALLOC_TRT_CLEANUP;
     8074       
     8075        else if (r_ixr_cmd_fsm.read() == IXR_CMD_TRT_LOCK)
     8076          r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD;
    80928077
    80938078        else if(r_read_fsm.read() == READ_TRT_LOCK)
     
    81158100      ////////////////////////
    81168101    case ALLOC_TRT_CLEANUP:
    8117       if(r_ixr_rsp_fsm.read() != CLEANUP_IXR_REQ)
    8118       {
    8119         if(r_read_fsm.read() == READ_TRT_LOCK)
     8102      if(r_cleanup_fsm.read() != CLEANUP_IXR_REQ)
     8103      {
     8104        if (r_ixr_cmd_fsm.read() == IXR_CMD_TRT_LOCK)
     8105          r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD;
     8106       
     8107        else if(r_read_fsm.read() == READ_TRT_LOCK)
    81208108          r_alloc_trt_fsm = ALLOC_TRT_READ;
    81218109
     
    81388126      break;
    81398127
     8128      ////////////////////////
     8129    case ALLOC_TRT_IXR_CMD:
     8130      if(r_ixr_cmd_fsm.read() != IXR_CMD_TRT_LOCK)
     8131      {
     8132        if(r_read_fsm.read() == READ_TRT_LOCK)
     8133          r_alloc_trt_fsm = ALLOC_TRT_READ;
     8134
     8135        else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) or
     8136                (r_write_fsm.read() == WRITE_BC_TRT_LOCK))
     8137          r_alloc_trt_fsm = ALLOC_TRT_WRITE;
     8138
     8139        else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) or
     8140                (r_cas_fsm.read() == CAS_BC_TRT_LOCK))
     8141          r_alloc_trt_fsm = ALLOC_TRT_CAS;
     8142
     8143        else if((r_xram_rsp_fsm.read()  == XRAM_RSP_DIR_LOCK) and
     8144                (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP))
     8145          r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP;
     8146
     8147        else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) ||
     8148            (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ))
     8149          r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP;
     8150       
     8151        else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ)
     8152          r_alloc_trt_fsm = ALLOC_TRT_CLEANUP;
     8153      }
     8154      break;
    81408155  } // end switch alloc_trt_fsm
    81418156
     
    84068421  m_cc_receive_to_cleanup_fifo.update( cc_receive_to_cleanup_fifo_get,
    84078422                                       cc_receive_to_cleanup_fifo_put,
    8408                                        ( (uint64_t)(p_dspin_in.eop.read() & 0x1 ) << 32 ) | p_dspin_in.data.read() );
     8423                                       ( (uint64_t)(p_dspin_p2m.eop.read() & 0x1 ) << 32 ) | p_dspin_p2m.data.read() );
     8424
    84098425  ////////////////////////////////////////////////////////////////////////////////////
    84108426  //    CC_RECEIVE to MULTI_ACK FIFO
     
    84138429  m_cc_receive_to_multi_ack_fifo.update( cc_receive_to_multi_ack_fifo_get,
    84148430                                         cc_receive_to_multi_ack_fifo_put,
    8415                                          p_dspin_in.data.read() );
     8431                                         p_dspin_p2m.data.read() );
    84168432
    84178433  ////////////////////////////////////////////////////////////////////////////////////
     
    85628578    p_vci_ixr.address = (addr_t)((r_cleanup_to_ixr_cmd_nline.read() * m_words +
    85638579                                    r_ixr_cmd_cpt.read()) * 4);
     8580#if ODCCP_NON_INCLUSIVE
     8581    p_vci_ixr.wdata   = ((wide_data_t)(r_cleanup_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read()) |
     8582          ((wide_data_t)(r_cleanup_to_ixr_cmd_data[r_ixr_cmd_cpt.read() + 1].read()) << 32));
     8583#else
     8584    p_vci_ixr.wdata   = ((wide_data_t)(r_ixr_cmd_data[r_ixr_cmd_cpt.read()].read()) |
     8585          ((wide_data_t)(r_ixr_cmd_data[r_ixr_cmd_cpt.read() + 1].read()) << 32));
     8586#endif
    85648587   
     8588    /*
    85658589    if(r_cleanup_to_ixr_cmd_l1_dirty_ncc.read()) // if cleanup data contains data, we use cleanup_data buffer (cleanup dirty)
    85668590    {
     
    85738597          ((wide_data_t)(r_xram_rsp_to_ixr_cmd_data[r_ixr_cmd_cpt.read() + 1].read()) << 32));
    85748598    }
    8575 
     8599    */
    85768600    p_vci_ixr.trdid   = r_cleanup_to_ixr_cmd_trdid.read();
    85778601    p_vci_ixr.eop     = (r_ixr_cmd_cpt == (m_words - 2));
     
    87778801
    87788802  ////////////////////////////////////////////////////////////////////
    8779   //  p_dspin_out port (CC_SEND FSM)
     8803  //  p_dspin_m2p port (CC_SEND FSM)
    87808804  ////////////////////////////////////////////////////////////////////
    87818805
    8782   p_dspin_out.write = false;
    8783   p_dspin_out.eop   = false;
    8784   p_dspin_out.data  = 0;
     8806  p_dspin_m2p.write = false;
     8807  p_dspin_m2p.eop   = false;
     8808  p_dspin_m2p.data  = 0;
    87858809
    87868810  switch(r_cc_send_fsm.read())
     
    87918815    case CC_SEND_WRITE_IDLE:
    87928816    case CC_SEND_CAS_IDLE:
    8793     case CC_SEND_CLEANUP_IDLE:
    87948817    {
    87958818        break;
     
    88268849        DspinDhccpParam::dspin_set( flit,
    88278850                                    multi_inval_type,
    8828                                     DspinDhccpParam::FROM_MC_TYPE);
    8829         p_dspin_out.write = true;
    8830         p_dspin_out.data  = flit;
     8851                                    DspinDhccpParam::M2P_TYPE);
     8852        p_dspin_m2p.write = true;
     8853        p_dspin_m2p.data  = flit;
    88318854        break;
    88328855    }
     
    88388861                                    r_config_to_cc_send_nline.read(),
    88398862                                    DspinDhccpParam::MULTI_INVAL_NLINE);
    8840         p_dspin_out.eop   = true;
    8841         p_dspin_out.write = true;
    8842         p_dspin_out.data  = flit;
     8863        p_dspin_m2p.eop   = true;
     8864        p_dspin_m2p.write = true;
     8865        p_dspin_m2p.data  = flit;
    88438866        break;
    88448867    }
    8845     ////////////////////////
    8846     case CC_SEND_CLEANUP_ACK:
    8847       {
    8848         uint8_t cleanup_ack_type;
    8849         if(r_cleanup_to_cc_send_inst.read())
    8850         {
    8851           cleanup_ack_type = DspinDhccpParam::TYPE_CLEANUP_ACK_INST;
    8852         }
    8853         else
    8854         {
    8855           cleanup_ack_type = DspinDhccpParam::TYPE_CLEANUP_ACK_DATA;
    8856         }
    8857 
    8858         uint64_t flit = 0;
    8859         uint64_t dest =
    8860           r_cleanup_to_cc_send_srcid.read() <<
    8861           (DspinDhccpParam::SRCID_WIDTH - vci_param_int::S);
    8862 
    8863         DspinDhccpParam::dspin_set(
    8864             flit,
    8865             dest,
    8866             DspinDhccpParam::CLEANUP_ACK_DEST);
    8867 
    8868         DspinDhccpParam::dspin_set(
    8869             flit,
    8870             r_cleanup_to_cc_send_set_index.read(),
    8871             DspinDhccpParam::CLEANUP_ACK_SET);
    8872 
    8873         DspinDhccpParam::dspin_set(
    8874             flit,
    8875             r_cleanup_to_cc_send_way_index.read(),
    8876             DspinDhccpParam::CLEANUP_ACK_WAY);
    8877 
    8878         DspinDhccpParam::dspin_set(
    8879             flit,
    8880             cleanup_ack_type,
    8881             DspinDhccpParam::FROM_MC_TYPE);
    8882 
    8883         p_dspin_out.eop   = true;
    8884         p_dspin_out.write = true;
    8885         p_dspin_out.data  = flit;
    8886 
    8887         break;
    8888     }
    8889 
    88908868    ///////////////////////////////////
    88918869    case CC_SEND_XRAM_RSP_INVAL_HEADER:
     
    89218899        DspinDhccpParam::dspin_set( flit,
    89228900                                    multi_inval_type,
    8923                                     DspinDhccpParam::FROM_MC_TYPE);
    8924         p_dspin_out.write = true;
    8925         p_dspin_out.data  = flit;
     8901                                    DspinDhccpParam::M2P_TYPE);
     8902        p_dspin_m2p.write = true;
     8903        p_dspin_m2p.data  = flit;
    89268904        break;
    89278905    }
     
    89358913                                    r_xram_rsp_to_cc_send_nline.read(),
    89368914                                    DspinDhccpParam::MULTI_INVAL_NLINE);
    8937         p_dspin_out.eop   = true;
    8938         p_dspin_out.write = true;
    8939         p_dspin_out.data  = flit;
     8915        p_dspin_m2p.eop   = true;
     8916        p_dspin_m2p.write = true;
     8917        p_dspin_m2p.data  = flit;
    89408918        break;
    89418919    }
     
    89598937        DspinDhccpParam::dspin_set( flit,
    89608938                                    1ULL,
    8961                                     DspinDhccpParam::FROM_MC_BC);
    8962         p_dspin_out.write = true;
    8963         p_dspin_out.data  = flit;
     8939                                    DspinDhccpParam::M2P_BC);
     8940        p_dspin_m2p.write = true;
     8941        p_dspin_m2p.data  = flit;
    89648942        break;
    89658943    }
     
    89718949                                    r_xram_rsp_to_cc_send_nline.read(),
    89728950                                    DspinDhccpParam::BROADCAST_NLINE);
    8973         p_dspin_out.write = true;
    8974         p_dspin_out.eop   = true;
    8975         p_dspin_out.data  = flit;
     8951        p_dspin_m2p.write = true;
     8952        p_dspin_m2p.eop   = true;
     8953        p_dspin_m2p.data  = flit;
    89768954        break;
    89778955    }
     
    89838961                                    r_config_to_cc_send_nline.read(),
    89848962                                    DspinDhccpParam::BROADCAST_NLINE);
    8985         p_dspin_out.write = true;
    8986         p_dspin_out.eop   = true;
    8987         p_dspin_out.data  = flit;
     8963        p_dspin_m2p.write = true;
     8964        p_dspin_m2p.eop   = true;
     8965        p_dspin_m2p.data  = flit;
    89888966        break;
    89898967    }
     
    89958973                                    r_write_to_cc_send_nline.read(),
    89968974                                    DspinDhccpParam::BROADCAST_NLINE);
    8997         p_dspin_out.write = true;
    8998         p_dspin_out.eop   = true;
    8999         p_dspin_out.data  = flit;
     8975        p_dspin_m2p.write = true;
     8976        p_dspin_m2p.eop   = true;
     8977        p_dspin_m2p.data  = flit;
    90008978        break;
    90018979    }
     
    90078985                                    r_cas_to_cc_send_nline.read(),
    90088986                                    DspinDhccpParam::BROADCAST_NLINE);
    9009         p_dspin_out.write = true;
    9010         p_dspin_out.eop   = true;
    9011         p_dspin_out.data  = flit;
     8987        p_dspin_m2p.write = true;
     8988        p_dspin_m2p.eop   = true;
     8989        p_dspin_m2p.data  = flit;
    90128990        break;
    90138991    }
     
    90509028            flit,
    90519029            multi_updt_type,
    9052             DspinDhccpParam::FROM_MC_TYPE);
    9053 
    9054         p_dspin_out.write = true;
    9055         p_dspin_out.data  = flit;
     9030            DspinDhccpParam::M2P_TYPE);
     9031
     9032        p_dspin_m2p.write = true;
     9033        p_dspin_m2p.data  = flit;
    90569034
    90579035        break;
     
    90729050            DspinDhccpParam::MULTI_UPDT_NLINE);
    90739051
    9074         p_dspin_out.write = true;
    9075         p_dspin_out.data  = flit;
     9052        p_dspin_m2p.write = true;
     9053        p_dspin_m2p.data  = flit;
    90769054
    90779055        break;
     
    90999077            DspinDhccpParam::MULTI_UPDT_DATA);
    91009078
    9101         p_dspin_out.write = true;
    9102         p_dspin_out.eop   = (r_cc_send_cpt.read() == (r_write_to_cc_send_count.read()-1));
    9103         p_dspin_out.data  = flit;
     9079        p_dspin_m2p.write = true;
     9080        p_dspin_m2p.eop   = (r_cc_send_cpt.read() == (r_write_to_cc_send_count.read()-1));
     9081        p_dspin_m2p.data  = flit;
    91049082
    91059083        break;
     
    91439121            flit,
    91449122            multi_updt_type,
    9145             DspinDhccpParam::FROM_MC_TYPE);
    9146 
    9147         p_dspin_out.write = true;
    9148         p_dspin_out.data  = flit;
     9123            DspinDhccpParam::M2P_TYPE);
     9124
     9125        p_dspin_m2p.write = true;
     9126        p_dspin_m2p.data  = flit;
    91499127
    91509128        break;
     
    91659143            DspinDhccpParam::MULTI_UPDT_NLINE);
    91669144
    9167         p_dspin_out.write = true;
    9168         p_dspin_out.data  = flit;
     9145        p_dspin_m2p.write = true;
     9146        p_dspin_m2p.data  = flit;
    91699147
    91709148        break;
     
    91859163            DspinDhccpParam::MULTI_UPDT_DATA);
    91869164
    9187         p_dspin_out.write = true;
    9188         p_dspin_out.eop   = not r_cas_to_cc_send_is_long.read();
    9189         p_dspin_out.data  = flit;
     9165        p_dspin_m2p.write = true;
     9166        p_dspin_m2p.eop   = not r_cas_to_cc_send_is_long.read();
     9167        p_dspin_m2p.data  = flit;
    91909168
    91919169        break;
     
    92069184            DspinDhccpParam::MULTI_UPDT_DATA);
    92079185
    9208         p_dspin_out.write = true;
    9209         p_dspin_out.eop   = true;
    9210         p_dspin_out.data  = flit;
     9186        p_dspin_m2p.write = true;
     9187        p_dspin_m2p.eop   = true;
     9188        p_dspin_m2p.data  = flit;
    92119189
    92129190        break;
     
    92149192  }
    92159193
     9194  ////////////////////////////////////////////////////////////////////
     9195  //  p_dspin_clack port (CLEANUP FSM)
     9196  ////////////////////////////////////////////////////////////////////
     9197
     9198  switch(r_cleanup_fsm.read())
     9199  {
     9200    case CLEANUP_IDLE:
     9201    case CLEANUP_GET_NLINE:
     9202    case CLEANUP_DIR_REQ:
     9203    case CLEANUP_DIR_LOCK:
     9204    case CLEANUP_DIR_WRITE:
     9205    case CLEANUP_HEAP_REQ:
     9206    case CLEANUP_HEAP_LOCK:
     9207    case CLEANUP_HEAP_SEARCH:
     9208    case CLEANUP_HEAP_CLEAN:
     9209    case CLEANUP_HEAP_FREE:
     9210    case CLEANUP_IVT_LOCK:
     9211    case CLEANUP_IVT_DECREMENT:
     9212    case CLEANUP_IVT_CLEAR:
     9213    case CLEANUP_WRITE_RSP:
     9214    case CLEANUP_CONFIG_ACK:
     9215      p_dspin_clack.write = false;
     9216      p_dspin_clack.eop   = false;
     9217      p_dspin_clack.data  = 0;
     9218
     9219      break;
     9220
     9221    case CLEANUP_SEND_CLACK:
     9222      {
     9223        uint8_t cleanup_ack_type;
     9224        if(r_cleanup_inst.read())
     9225        {
     9226          cleanup_ack_type = DspinDhccpParam::TYPE_CLACK_INST;
     9227        }
     9228        else
     9229        {
     9230          cleanup_ack_type = DspinDhccpParam::TYPE_CLACK_DATA;
     9231        }
     9232
     9233        uint64_t flit = 0;
     9234        uint64_t dest =
     9235          r_cleanup_srcid.read() <<
     9236          (DspinDhccpParam::SRCID_WIDTH - vci_param_int::S);
     9237
     9238        DspinDhccpParam::dspin_set(
     9239            flit,
     9240            dest,
     9241            DspinDhccpParam::CLACK_DEST);
     9242
     9243        DspinDhccpParam::dspin_set(
     9244            flit,
     9245            r_cleanup_nline.read() & 0xFFFF,
     9246            DspinDhccpParam::CLACK_SET);
     9247
     9248        DspinDhccpParam::dspin_set(
     9249            flit,
     9250            r_cleanup_way_index.read(),
     9251            DspinDhccpParam::CLACK_WAY);
     9252
     9253        DspinDhccpParam::dspin_set(
     9254            flit,
     9255            cleanup_ack_type,
     9256            DspinDhccpParam::CLACK_TYPE);
     9257
     9258        p_dspin_clack.eop   = true;
     9259        p_dspin_clack.write = true;
     9260        p_dspin_clack.data  = flit;
     9261      }
     9262      break;
     9263  }
     9264
    92169265  ///////////////////////////////////////////////////////////////////
    9217   //  p_dspin_in port (CC_RECEIVE FSM)
     9266  //  p_dspin_p2m port (CC_RECEIVE FSM)
    92189267  ///////////////////////////////////////////////////////////////////
    9219   p_dspin_in.read = false;
     9268  //
    92209269  switch(r_cc_receive_fsm.read())
    92219270  {
    92229271    case CC_RECEIVE_IDLE:
    92239272      {
     9273        p_dspin_p2m.read = false;
    92249274        break;
    92259275      }
     
    92279277    case CC_RECEIVE_CLEANUP_EOP:
    92289278      {
    9229         p_dspin_in.read = m_cc_receive_to_cleanup_fifo.wok();
     9279        p_dspin_p2m.read = m_cc_receive_to_cleanup_fifo.wok();
    92309280        break;
    92319281      }
    92329282    case CC_RECEIVE_MULTI_ACK:
    92339283      {
    9234         p_dspin_in.read = m_cc_receive_to_multi_ack_fifo.wok();
     9284        p_dspin_p2m.read = m_cc_receive_to_multi_ack_fifo.wok();
    92359285        break;
    92369286      }
Note: See TracChangeset for help on using the changeset viewer.