Changeset 454 for branches/v5/modules


Ignore:
Timestamp:
Jul 19, 2013, 10:15:13 AM (11 years ago)
Author:
haoliu
Message:

modified CC_RECEIVE FSM and CC_CHECK FSM (icache and dcache) for new version V5

Location:
branches/v5/modules/vci_cc_vcache_wrapper/caba/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/v5/modules/vci_cc_vcache_wrapper/caba/source/include/vci_cc_vcache_wrapper.h

    r446 r454  
    9191        ICACHE_CC_UPDT,
    9292        ICACHE_CC_INVAL,
    93         ICACHE_CC_SEND_WAIT,
    9493    };
    9594
     
    139138        DCACHE_CC_UPDT,
    140139        DCACHE_CC_INVAL,
    141         DCACHE_CC_SEND_WAIT,
    142140        // handling TLB inval (after a coherence or XTN request)
    143141        DCACHE_INVAL_TLB_SCAN,
     
    171169    {
    172170        CC_RECEIVE_IDLE,
    173         CC_RECEIVE_CLACK,
    174171        CC_RECEIVE_BRDCAST_HEADER,
    175172        CC_RECEIVE_BRDCAST_NLINE,
    176         CC_RECEIVE_INVAL_HEADER,
    177         CC_RECEIVE_INVAL_NLINE,
    178         CC_RECEIVE_UPDT_HEADER,
    179         CC_RECEIVE_UPDT_NLINE,
    180         CC_RECEIVE_UPDT_DATA,
     173        CC_RECEIVE_INS_INVAL_HEADER,
     174        CC_RECEIVE_INS_INVAL_NLINE,
     175        CC_RECEIVE_INS_UPDT_HEADER,
     176        CC_RECEIVE_INS_UPDT_NLINE,
     177        CC_RECEIVE_INS_UPDT_DATA,
     178        CC_RECEIVE_DATA_INVAL_HEADER,
     179        CC_RECEIVE_DATA_INVAL_NLINE,
     180        CC_RECEIVE_DATA_UPDT_HEADER,
     181        CC_RECEIVE_DATA_UPDT_NLINE,
     182        CC_RECEIVE_DATA_UPDT_DATA,
    181183    };
    182184
  • branches/v5/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp

    r446 r454  
    6464        "ICACHE_CC_UPDT",
    6565        "ICACHE_CC_INVAL",
    66         "ICACHE_CC_SEND_WAIT",
    6766    };
    6867
     
    111110        "DCACHE_CC_UPDT",
    112111        "DCACHE_CC_INVAL",
    113         "DCACHE_CC_SEND_WAIT",
    114112
    115113        "DCACHE_INVAL_TLB_SCAN",
     
    158156const char *cc_receive_fsm_state_str[] = {
    159157        "CC_RECEIVE_IDLE",
    160         "CC_RECEIVE_CLACK",
    161158        "CC_RECEIVE_BRDCAST_HEADER",
    162159        "CC_RECEIVE_BRDCAST_NLINE",
    163         "CC_RECEIVE_INVAL_HEADER",
    164         "CC_RECEIVE_INVAL_NLINE",
    165         "CC_RECEIVE_UPDT_HEADER",
    166         "CC_RECEIVE_UPDT_NLINE",
    167         "CC_RECEIVE_UPDT_DATA",
     160        "CC_RECEIVE_INS_INVAL_HEADER",
     161        "CC_RECEIVE_INS_INVAL_NLINE",
     162        "CC_RECEIVE_INS_UPDT_HEADER",
     163        "CC_RECEIVE_INS_UPDT_NLINE",
     164        "CC_RECEIVE_INS_UPDT_DATA",
     165        "CC_RECEIVE_DATA_INVAL_HEADER",
     166        "CC_RECEIVE_DATA_INVAL_NLINE",
     167        "CC_RECEIVE_DATA_UPDT_HEADER",
     168        "CC_RECEIVE_DATA_UPDT_NLINE",
     169        "CC_RECEIVE_DATA_UPDT_DATA",
    168170    };
    169171
     
    18171819        paddr_t  mask  = ~((m_icache_words<<2)-1);
    18181820
    1819         if (r_icache_clack_req.read())
     1821        if ( r_icache_clack_req.read() )
    18201822                                // We switch the directory slot to EMPTY state
    18211823                            // and reset r_icache_miss_clack if the cleanup ack
     
    18371839                    r_icache_miss_clack = false;
    18381840
    1839             r_icache_fsm = r_icache_fsm_save.read() ;
    18401841            r_icache_clack_req = false;
    18411842
     
    18491850}
    18501851#endif
    1851         }
    1852         else if( ((r_icache_fsm_save.read() == ICACHE_MISS_SELECT) or
     1852            // we should handle the clack request first,
     1853            // if the cc request is arrived simultaneously,
     1854            // we stay here in next cycle for treating the cc request.
     1855            if ( not r_cc_receive_icache_req.read() )
     1856                r_icache_fsm          = r_icache_fsm_save.read();
     1857
     1858            break;
     1859       }
     1860        else if( r_cc_receive_icache_req.read() and
     1861                 ((r_icache_fsm_save.read() == ICACHE_MISS_SELECT) or
    18531862                 (r_icache_fsm_save.read() == ICACHE_MISS_WAIT) or
    18541863                 (r_icache_fsm_save.read() == ICACHE_MISS_DIR_UPDT)) and
     
    19011910            r_icache_cc_set = set;
    19021911
    1903             if (state == CACHE_SLOT_STATE_VALID)            // hit
     1912            if ( state == CACHE_SLOT_STATE_VALID)            // hit
    19041913            {
    19051914                // need to update the cache state
    1906                 r_icache_cc_need_write = true;
    19071915                if (r_cc_receive_icache_type.read() == CC_TYPE_UPDT)  // hit update
    19081916                {
     1917                    r_icache_cc_need_write = true;
    19091918                    r_icache_fsm          = ICACHE_CC_UPDT;
    19101919                    r_icache_cc_word      = r_cc_receive_word_idx.read();
    19111920                }
    1912                 else if ((r_cc_receive_icache_type.read() == CC_TYPE_INVAL  ) || // hit inval
    1913                          (r_cc_receive_icache_type.read() == CC_TYPE_BRDCAST))   // hit broadcast
     1921                else if ( r_cc_receive_icache_type.read() == CC_TYPE_INVAL ) // hit inval
    19141922                {
    19151923                    r_icache_fsm          = ICACHE_CC_INVAL;
     
    19351943        break;
    19361944    }
     1945    /////////////////////
     1946    case ICACHE_CC_INVAL:       // hit inval : switch slot to ZOMBI state
     1947    {
     1948
     1949#if DEBUG_ICACHE
     1950if ( m_debug_activated )
     1951{
     1952    std::cout << "  <PROC " << name()
     1953              << " ICACHE_CC_INVAL> slot returns to zombi state"
     1954              << " set = " << r_icache_cc_set.read()
     1955              << " / way = " << r_icache_cc_way.read() << std::endl;
     1956}
     1957#endif
     1958
     1959#ifdef INSTRUMENTATION
     1960m_cpt_icache_dir_read++;
     1961#endif
     1962        // send a cleanup request to cc_send_fsm
     1963        if(not r_icache_cc_send_req.read()) // cc_send is available
     1964        {
     1965            r_icache.write_dir( 0,
     1966                                    r_icache_cc_way.read(),
     1967                                    r_icache_cc_set.read(),
     1968                                CACHE_SLOT_STATE_ZOMBI );
     1969            // coherence request completed
     1970            r_icache_cc_send_req = true;
     1971            r_icache_cc_send_nline = r_cc_receive_icache_nline.read();
     1972            r_icache_cc_send_way   = r_icache_cc_way.read();
     1973            r_icache_cc_send_type  = CC_TYPE_CLEANUP;
     1974
     1975            r_icache_fsm          = r_icache_fsm_save.read();
     1976        }
     1977        //else go to CC_CHECK
     1978        else
     1979            r_icache_fsm          = ICACHE_CC_CHECK;
     1980        break;
     1981       
     1982    }
    19371983    ////////////////////
    19381984    case ICACHE_CC_UPDT:        // hit update : write one word per cycle
     
    19572003        size_t  set   = r_icache_cc_set.read();
    19582004
    1959         if (r_cc_receive_updt_fifo_be.rok())
     2005        if( (not r_icache_cc_send_req.read()) and r_cc_receive_updt_fifo_be.rok() ) // cc_send is available
    19602006        {
    19612007            if (r_icache_cc_need_write.read())
     
    19732019                // no need to write in the cache anymore
    19742020                r_icache_cc_need_write = false;
    1975                 // wait to send a request to cc_send_fsm
    1976                 if(not r_icache_cc_send_req.read()) // cc_send is available
    1977                 {
    1978                     //consume last flit
    1979                     cc_receive_updt_fifo_get  = true;
    1980                     // coherence request completed
    1981                     r_cc_receive_icache_req = false;
    1982                     // request multicast acknowledgement
    1983                     r_icache_cc_send_req = true;
    1984                     r_icache_cc_send_nline = r_cc_receive_icache_nline.read();
    1985                     r_icache_cc_send_updt_tab_idx = r_cc_receive_icache_updt_tab_idx.read();
    1986                     r_icache_cc_send_type = CC_TYPE_MULTI_ACK;
    1987 
    1988                     r_icache_fsm          = r_icache_fsm_save.read();
    1989                 }
    1990             }
    1991             else
    1992             {
    1993                 //consume fifo if not eop
    1994                 cc_receive_updt_fifo_get  = true;
    1995             }
    1996         }
     2021                // coherence request completed
     2022                r_cc_receive_icache_req = false;
     2023                // request multicast acknowledgement
     2024                r_icache_cc_send_req = true;
     2025                r_icache_cc_send_nline = r_cc_receive_icache_nline.read();
     2026                r_icache_cc_send_updt_tab_idx = r_cc_receive_icache_updt_tab_idx.read();
     2027                r_icache_cc_send_type = CC_TYPE_MULTI_ACK;
     2028
     2029                r_icache_fsm          = r_icache_fsm_save.read();
     2030            }
     2031            //consume fifo if not eop
     2032            cc_receive_updt_fifo_get  = true;
     2033        }
     2034        else
     2035            r_icache_fsm            = ICACHE_CC_CHECK;
     2036
    19972037        break;
    19982038    }
    1999     /////////////////////////
    2000     case ICACHE_CC_INVAL:  // hit invalidate : switch slot to ZOMBI state
    2001                            // and request a cleanup
    2002     {
    2003 
    2004 #if DEBUG_ICACHE
    2005 if ( m_debug_activated )
    2006 {
    2007     std::cout << "  <PROC " << name()
    2008               << " ICACHE_CC_INVAL > Slot goes to zombi state "
    2009               << " set = " << r_icache_cc_set.read()
    2010               << " / way = " << r_icache_cc_way.read() << std::endl;
    2011 }
    2012 #endif
    2013 
    2014 #ifdef INSTRUMENTATION
    2015 m_cpt_icache_dir_write++;
    2016 #endif
    2017         if (r_icache_cc_need_write.read())
    2018         {
    2019             r_icache.write_dir( r_icache_cc_way.read(),
    2020                                     r_icache_cc_set.read(),
    2021                                 CACHE_SLOT_STATE_ZOMBI );
    2022             // no need to write in the cache anymore
    2023             r_icache_cc_need_write = false;
    2024         }
    2025 
    2026         // cleanup
    2027         // send a request to cc_send_fsm
    2028         if(not r_icache_cc_send_req.read()) // cc_send is available
    2029         {
    2030             // coherence request completed
    2031             r_cc_receive_icache_req = false;
    2032             // request cleanup
    2033             r_icache_cc_send_req = true;
    2034             r_icache_cc_send_nline = r_cc_receive_icache_nline.read();
    2035             r_icache_cc_send_way   = r_icache_cc_way.read();
    2036             r_icache_cc_send_type  = CC_TYPE_CLEANUP;
    2037 
    2038             r_icache_fsm          = r_icache_fsm_save.read();
    2039         }
    2040         //else wait for previous cc_send request to be sent
    2041         break;
    2042     }
     2039
    20432040    } // end switch r_icache_fsm
    20442041
     
    45574554#endif
    45584555
    4559         if (r_dcache_clack_req.read())
     4556        if ( r_dcache_clack_req.read() )
    45604557                            // We switch the directory slot to EMPTY state
    45614558                            // and reset r_icache_miss_clack if the cleanup ack
     
    45774574                  r_dcache_miss_clack = false;
    45784575
    4579             r_dcache_fsm = r_dcache_fsm_cc_save.read() ;
    45804576            r_dcache_clack_req = false;
    45814577#if DEBUG_DCACHE
     
    45884584}
    45894585#endif
    4590         }
    4591         else if( ((r_dcache_fsm_cc_save == DCACHE_MISS_SELECT) or
    4592                   (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) or
    4593                   (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT)) and
    4594                   ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) ) // matching
     4586            if ( not r_cc_receive_dcache_req.read() )
     4587                r_dcache_fsm = r_dcache_fsm_cc_save.read() ;
     4588
     4589            break;
     4590        }
     4591        else if( r_cc_receive_dcache_req.read() and
     4592                 ((r_dcache_fsm_cc_save == DCACHE_MISS_SELECT) or
     4593                 (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) or
     4594                 (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT)) and
     4595                 ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) ) // matching
    45954596        {
    45964597            // signaling matching
     
    46454646            {
    46464647                // need to update the cache state
    4647                 r_dcache_cc_need_write = true;
    46484648                if (r_cc_receive_dcache_type.read() == CC_TYPE_UPDT)  // hit update
    46494649                {
     4650                    r_dcache_cc_need_write = true;
    46504651                    r_dcache_fsm          = DCACHE_CC_UPDT;
    46514652                    r_dcache_cc_word      = r_cc_receive_word_idx.read();
    46524653                }
    4653                 else if ((r_cc_receive_dcache_type.read() == CC_TYPE_BRDCAST) || // hit broadcast
    4654                          (r_cc_receive_dcache_type.read() == CC_TYPE_INVAL  ))      // hit inval
     4654                else if ( r_cc_receive_dcache_type.read() == CC_TYPE_INVAL )    // hit inval
    46554655                {
    46564656                    r_dcache_fsm          = DCACHE_CC_INVAL;
     
    46874687        break;
    46884688    }
     4689    /////////////////////
     4690    case DCACHE_CC_INVAL:       // hit inval: switch slot to EMPTY state,
     4691                                // after possible invalidation of copies in TLBs
     4692    {
     4693        size_t   way    = r_dcache_cc_way.read();
     4694        size_t   set    = r_dcache_cc_set.read();
     4695
     4696        if ( r_dcache_in_tlb[way*m_dcache_sets+set] )                   // selective TLB inval
     4697        {
     4698            r_dcache_in_tlb[way*m_dcache_sets+set] = false;
     4699            r_dcache_tlb_inval_line  = r_cc_receive_dcache_nline.read();
     4700            r_dcache_tlb_inval_set   = 0;
     4701            r_dcache_fsm_scan_save   = r_dcache_fsm.read();
     4702            r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
     4703            break;
     4704        }
     4705
     4706        if ( r_dcache_contains_ptd[way*m_dcache_sets+set] )     // TLB flush
     4707        {
     4708            r_itlb.reset();
     4709            r_dtlb.reset();
     4710            r_dcache_contains_ptd[way*m_dcache_sets+set] = false;
     4711
     4712#if DEBUG_DCACHE
     4713if ( m_debug_activated )
     4714{
     4715    std::cout << "  <PROC " << name()
     4716              << " DCACHE_CC_INVAL> Flush DTLB & ITLB" << std::endl;
     4717}
     4718#endif
     4719        }
     4720       
     4721        if ( not r_dcache_cc_send_req.read() ) // cc_send is available
     4722        {
     4723            r_dcache.write_dir( 0,
     4724                                way,
     4725                                set,
     4726                                CACHE_SLOT_STATE_ZOMBI );
     4727
     4728#if DEBUG_DCACHE
     4729if ( m_debug_activated )
     4730{
     4731    std::cout << "  <PROC " << name()
     4732              << " DCACHE_CC_INVAL> Switch slot to EMPTY state:" << std::dec
     4733              << " / WAY = " << way
     4734              << " / SET = " << set << std::endl;
     4735}
     4736#endif
     4737            // coherence request completed
     4738            r_cc_receive_dcache_req = false;
     4739            r_dcache_cc_send_req = true;
     4740            r_dcache_cc_send_nline = r_cc_receive_dcache_nline.read();
     4741            r_dcache_cc_send_way   = r_dcache_cc_way.read();
     4742            r_dcache_cc_send_type  = CC_TYPE_CLEANUP;
     4743
     4744            r_dcache_fsm          = r_dcache_fsm_cc_save.read();
     4745        }
     4746        //else go to DCACHE_CC_CHECK
     4747        else
     4748            r_dcache_fsm          = DCACHE_CC_CHECK;
     4749
     4750        break;
     4751    }
    46894752    ///////////////////
    46904753    case DCACHE_CC_UPDT:        // hit update: write one word per cycle,
     
    46954758        size_t   set        = r_dcache_cc_set.read();
    46964759
    4697         if (r_cc_receive_updt_fifo_be.rok())
    4698         {
    4699             if (r_dcache_cc_need_write.read())
    4700             {
    4701                 if ( r_dcache_in_tlb[way*m_dcache_sets+set] )                   // selective TLB inval
    4702                 {
    4703                     r_dcache_in_tlb[way*m_dcache_sets+set] = false;
    4704                     r_dcache_tlb_inval_line  = r_cc_receive_dcache_nline.read();
    4705                     r_dcache_tlb_inval_set   = 0;
    4706                     r_dcache_fsm_scan_save   = r_dcache_fsm.read();
    4707                     r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
    4708                     break;
    4709                 }
    4710 
    4711                 if ( r_dcache_contains_ptd[way*m_dcache_sets+set] )     // TLB flush
    4712                 {
    4713                     r_itlb.reset();
    4714                     r_dtlb.reset();
    4715                     r_dcache_contains_ptd[way*m_dcache_sets+set] = false;
     4760        if ( r_dcache_in_tlb[way*m_dcache_sets+set] )                   // selective TLB inval
     4761        {
     4762            r_dcache_in_tlb[way*m_dcache_sets+set] = false;
     4763            r_dcache_tlb_inval_line  = r_cc_receive_dcache_nline.read();
     4764            r_dcache_tlb_inval_set   = 0;
     4765            r_dcache_fsm_scan_save   = r_dcache_fsm.read();
     4766            r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
     4767            break;
     4768        }
     4769
     4770        if ( r_dcache_contains_ptd[way*m_dcache_sets+set] )     // TLB flush
     4771        {
     4772            r_itlb.reset();
     4773            r_dtlb.reset();
     4774            r_dcache_contains_ptd[way*m_dcache_sets+set] = false;
    47164775
    47174776#if DEBUG_DCACHE
     
    47224781}
    47234782#endif
    4724                 }
    4725 
     4783        }
     4784
     4785        if ( (not r_dcache_cc_send_req.read()) and r_cc_receive_updt_fifo_be.rok())
     4786        {
     4787            if (r_dcache_cc_need_write.read())
     4788            {
     4789           
    47264790#ifdef INSTRUMENTATION
    47274791m_cpt_dcache_data_write++;
     
    47534817                r_dcache_cc_need_write = false;
    47544818
    4755                 // wait to send a request to cc_send_fsm
    4756                 if(not r_dcache_cc_send_req.read())
    4757                 // cc_send is available
    4758                 {
    4759                     //consume last fifo flit if eop and request to cc_send possible
    4760                     cc_receive_updt_fifo_get  = true;
    4761 
    4762                     // coherence request completed
    4763                     r_cc_receive_dcache_req = false;
    4764 
    4765                     // request multicast acknowledgement
    4766                     r_dcache_cc_send_req = true;
    4767                     r_dcache_cc_send_nline = r_cc_receive_dcache_nline.read();
    4768                     r_dcache_cc_send_updt_tab_idx = r_cc_receive_dcache_updt_tab_idx.read();
    4769                     r_dcache_cc_send_type = CC_TYPE_MULTI_ACK;
    4770 
    4771                     r_dcache_fsm          = r_dcache_fsm_cc_save.read();
    4772                 }
    4773             }
    4774             else
    4775             {
    4776                 //consume fifo if not eop
    4777                 cc_receive_updt_fifo_get  = true;
    4778             }
    4779         }
    4780         break;
    4781     }
    4782     /////////////////////////
    4783     case DCACHE_CC_INVAL:   // hit invalidate : switch state to ZOMBI state
    4784                             // and request a cleanup, after possible
    4785                             // invalidation of copies in TLBs
    4786     {
    4787         size_t   way   = r_dcache_cc_way.read();
    4788         size_t   set   = r_dcache_cc_set.read();
    4789         paddr_t  nline = r_cc_receive_dcache_nline.read();
    4790 
    4791         if (r_dcache_cc_need_write.read())
    4792         {
    4793             if ( r_dcache_in_tlb[way*m_dcache_sets+set] )                       // selective TLB inval
    4794             {
    4795                 r_dcache_in_tlb[way*m_dcache_sets+set] = false;
    4796                 r_dcache_tlb_inval_line  = nline;
    4797                 r_dcache_tlb_inval_set   = 0;
    4798                 r_dcache_fsm_scan_save   = r_dcache_fsm.read();
    4799                 r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
    4800                 break;
    4801             }
    4802             else
    4803             {
    4804                 if ( r_dcache_contains_ptd[way*m_dcache_sets+set] )     // TLB flush
    4805                 {
    4806                     r_itlb.reset();
    4807                     r_dtlb.reset();
    4808                     r_dcache_contains_ptd[way*m_dcache_sets+set] = false;
    4809 
    4810 #if DEBUG_DCACHE
    4811 if ( m_debug_activated )
    4812 {
    4813     std::cout << "  <PROC " << name()
    4814               << " DCACHE_CC_INVAL> Flush DTLB & ITLB" << std::endl;
    4815 }
    4816 #endif
    4817                 }
    4818 
    4819 #ifdef INSTRUMENTATION
    4820 m_cpt_dcache_dir_write++;
    4821 #endif
    4822                 r_dcache.write_dir( way,
    4823                                     set,
    4824                                     CACHE_SLOT_STATE_ZOMBI );
    4825 
    4826                 r_dcache_cc_need_write = false;
    4827 #if DEBUG_DCACHE
    4828 if ( m_debug_activated )
    4829 {
    4830     std::cout << "  <PROC " << name()
    4831               << " DCACHE_CC_INVAL > Slot goes to ZOMBI state "
    4832               << " SET = " << set
    4833               << " / WAY = " << way << std::endl;
    4834 }
    4835 #endif
    4836             }
    4837         }
    4838         // cleanup
    4839         // send a request to cc_send_fsm
    4840         if(not r_dcache_cc_send_req.read()) // cc_send is available
    4841         {
    4842             // coherence request completed
    4843             r_cc_receive_dcache_req = false;
    4844             // request cleanup
    4845             r_dcache_cc_send_req = true;
    4846             r_dcache_cc_send_nline = r_cc_receive_dcache_nline.read();
    4847             r_dcache_cc_send_way   = r_dcache_cc_way.read();
    4848             r_dcache_cc_send_type  = CC_TYPE_CLEANUP;
    4849 
    4850             r_dcache_fsm          = r_dcache_fsm_cc_save.read();
    4851         }
    4852         //else wait for previous cc_send request to be sent
     4819                // coherence request completed
     4820                r_cc_receive_dcache_req = false;
     4821
     4822                // request multicast acknowledgement
     4823                r_dcache_cc_send_req = true;
     4824                r_dcache_cc_send_nline = r_cc_receive_dcache_nline.read();
     4825                r_dcache_cc_send_updt_tab_idx = r_cc_receive_dcache_updt_tab_idx.read();
     4826                r_dcache_cc_send_type = CC_TYPE_MULTI_ACK;
     4827
     4828                r_dcache_fsm          = r_dcache_fsm_cc_save.read();
     4829            }
     4830
     4831            //consume fifo if not eop
     4832            cc_receive_updt_fifo_get  = true;
     4833        }
     4834        else
     4835            r_dcache_fsm        = DCACHE_CC_CHECK;
     4836
    48534837        break;
    48544838    }
     
    54805464
    54815465    ///////////////////////////////////////////////////////////////////////////////
    5482     //   C_RECEIVE  FSM
     5466    //  CC_RECEIVE  FSM
    54835467    // This FSM receive all coherence packets on a DSPIN40 port.
    5484     // There is 7 packet types:
     5468    // There is 5 packet types:
    54855469    // - CC_DATA_INVAL : DCACHE invalidate request
    54865470    // - CC_DATA_UPDT  : DCACHE update request (multi-words)
     
    54885472    // - CC_INST_UPDT  : ICACHE update request (multi-words)
    54895473    // - CC_BROADCAST  : Broadcast invalidate request (both DCACHE & ICACHE)
    5490     // - CC_DATA_CLACK : DCACHE cleanup acknowledge
    5491     // - CC_INST_CLACK : ICACHE cleanup acknowledge
    54925474    //////////////////////////////////////////////////////////////////////////////
    54935475    switch( r_cc_receive_fsm.read() )
     
    55045486                uint64_t receive_type = DspinDhccpParam::dspin_get(receive_data,
    55055487                                            DspinDhccpParam::M2P_TYPE);
    5506                 // initialize data/ins flip_flop (0 data / 1 ins)
    5507                 r_cc_receive_data_ins = (bool)(receive_type & 0x1);
    55085488                // test for a broadcast
    55095489                if (DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::M2P_BC))
     
    55125492                }
    55135493                // test for a multi updt
    5514                 else if ((receive_type == DspinDhccpParam::TYPE_MULTI_UPDT_DATA) or
    5515                          (receive_type == DspinDhccpParam::TYPE_MULTI_UPDT_INST))
     5494                else if (receive_type == DspinDhccpParam::TYPE_MULTI_UPDT_DATA)
    55165495                {
    5517                     r_cc_receive_fsm = CC_RECEIVE_UPDT_HEADER;
     5496                    r_cc_receive_fsm = CC_RECEIVE_DATA_UPDT_HEADER;
     5497                }
     5498                else if (receive_type == DspinDhccpParam::TYPE_MULTI_UPDT_INST)
     5499                {
     5500                    r_cc_receive_fsm = CC_RECEIVE_INS_UPDT_HEADER;
    55185501                }
    55195502                // test for a multi inval
     5503                else if (receive_type == DspinDhccpParam::TYPE_MULTI_INVAL_DATA)
     5504                {
     5505                    r_cc_receive_fsm = CC_RECEIVE_DATA_INVAL_HEADER;
     5506                }
    55205507                else
    55215508                {
    5522                     r_cc_receive_fsm = CC_RECEIVE_INVAL_HEADER;
     5509                    r_cc_receive_fsm = CC_RECEIVE_INS_INVAL_HEADER;
    55235510                }
    55245511            }
     
    55465533            {
    55475534                // request dcache to handle the BROADCAST
    5548                 r_cc_receive_dcache_req  = true;
     5535                r_cc_receive_dcache_req = true;
    55495536                r_cc_receive_dcache_nline  = DspinDhccpParam::dspin_get(receive_data,
    55505537                                             DspinDhccpParam::BROADCAST_NLINE);
    5551                 r_cc_receive_dcache_type = CC_TYPE_BRDCAST;
     5538                r_cc_receive_dcache_type = CC_TYPE_INVAL;
    55525539                // request icache to handle the BROADCAST
    5553                 r_cc_receive_icache_req  = true;
     5540                r_cc_receive_icache_req = true;
    55545541                r_cc_receive_icache_nline  = DspinDhccpParam::dspin_get(receive_data,
    55555542                                             DspinDhccpParam::BROADCAST_NLINE);
    5556                 r_cc_receive_icache_type = CC_TYPE_BRDCAST;
     5543                r_cc_receive_icache_type = CC_TYPE_INVAL;
    55575544                // get back to idle state
    55585545                r_cc_receive_fsm = CC_RECEIVE_IDLE;
     
    55635550        }
    55645551        /////////////////////////////
    5565         case CC_RECEIVE_INVAL_HEADER:
     5552        case CC_RECEIVE_DATA_INVAL_HEADER:
    55665553        {
    55675554            // sample updt tab index in the HEADER, then skip to second flit
    5568             uint64_t receive_data = p_dspin_m2p.data.read();
    5569             // for data INVAL, wait for dcache to take the request
    5570             if ((r_cc_receive_data_ins.read() == 0) and
    5571                  not (r_cc_receive_dcache_req.read()))
    5572             {
    5573                 r_cc_receive_dcache_updt_tab_idx = DspinDhccpParam::dspin_get(receive_data,
    5574                                                    DspinDhccpParam::MULTI_INVAL_UPDT_INDEX);
    5575                 r_cc_receive_fsm = CC_RECEIVE_INVAL_NLINE;
    5576                 break;
    5577             }
    5578             // for ins INVAL, wait for icache to take the request
    5579             if ((r_cc_receive_data_ins.read() == 1) and
    5580                  not (r_cc_receive_icache_req.read()))
    5581             {
    5582                 r_cc_receive_icache_updt_tab_idx = DspinDhccpParam::dspin_get(receive_data,
    5583                                                    DspinDhccpParam::MULTI_INVAL_UPDT_INDEX);
    5584                 r_cc_receive_fsm = CC_RECEIVE_INVAL_NLINE;
    5585                 break;
    5586             }
    5587             // keep waiting for the correct cache to accept the request
     5555            r_cc_receive_fsm = CC_RECEIVE_DATA_INVAL_NLINE;
     5556            break;
     5557        }
     5558        /////////////////////////////
     5559        case CC_RECEIVE_INS_INVAL_HEADER:
     5560        {
     5561            // sample updt tab index in the HEADER, then skip to second flit
     5562            r_cc_receive_fsm = CC_RECEIVE_INS_INVAL_NLINE;
    55885563            break;
    55895564        }
    55905565        ////////////////////////////
    5591         case CC_RECEIVE_INVAL_NLINE:
     5566        case CC_RECEIVE_DATA_INVAL_NLINE:
    55925567        {
    55935568            // sample nline in the second flit
    55945569            uint64_t receive_data = p_dspin_m2p.data.read();
    55955570            // for data INVAL, wait for dcache to take the request
    5596             if ( (r_cc_receive_data_ins.read() == 0) and
    5597                  not (r_cc_receive_dcache_req.read()) and
    5598                  (p_dspin_m2p.write.read()) )
     5571            if (p_dspin_m2p.write.read() and not r_cc_receive_dcache_req.read())
    55995572            {
    56005573                // request dcache to handle the INVAL
    5601                 r_cc_receive_dcache_req  = true;
    5602                 r_cc_receive_dcache_nline  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_INVAL_NLINE);
     5574                r_cc_receive_dcache_req = true;
     5575                r_cc_receive_dcache_nline = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_INVAL_NLINE);
    56035576                r_cc_receive_dcache_type = CC_TYPE_INVAL;
    56045577                // get back to idle state
     
    56065579                break;
    56075580            }
     5581            break;
     5582        }
     5583        //////////////////////////////
     5584        case CC_RECEIVE_INS_INVAL_NLINE:
     5585        {
     5586            // sample nline in the second flit
     5587            uint64_t receive_data = p_dspin_m2p.data.read();
    56085588            // for ins INVAL, wait for icache to take the request
    5609             if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read()) and (p_dspin_m2p.write.read()))
     5589            if (p_dspin_m2p.write.read() and not r_cc_receive_icache_req.read())
    56105590            {
    56115591                // request icache to handle the INVAL
    5612                 r_cc_receive_icache_req  = true;
    5613                 r_cc_receive_icache_nline  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_INVAL_NLINE);
     5592                r_cc_receive_icache_req = true;
     5593                r_cc_receive_icache_nline = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_INVAL_NLINE);
    56145594                r_cc_receive_icache_type = CC_TYPE_INVAL;
    56155595                // get back to idle state
     
    56175597                break;
    56185598            }
    5619             // we should never get there
    5620             assert ( false && "ERROR in CC_VCACHE : CC_RECEIVE_INVAL_NLINE\n");
     5599            break;
    56215600        }
    56225601        ////////////////////////////
    5623         case CC_RECEIVE_UPDT_HEADER:
     5602        case CC_RECEIVE_DATA_UPDT_HEADER:
    56245603        {
    56255604            // sample updt tab index in the HEADER, than skip to second flit
     
    56275606            // for data INVAL, wait for dcache to take the request and fifo to
    56285607            // be empty
    5629             if ((r_cc_receive_data_ins.read() == 0) and not r_cc_receive_dcache_req.read() and r_cc_receive_updt_fifo_be.empty())
     5608            if (not r_cc_receive_dcache_req.read())
    56305609            {
    56315610                r_cc_receive_dcache_updt_tab_idx  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_UPDT_INDEX);
    5632                 r_cc_receive_fsm = CC_RECEIVE_UPDT_NLINE;
     5611                r_cc_receive_fsm = CC_RECEIVE_DATA_UPDT_NLINE;
    56335612                break;
    56345613            }
     5614            break;
     5615        }
     5616        ////////////////////////////
     5617        case CC_RECEIVE_INS_UPDT_HEADER:
     5618        {
     5619            // sample updt tab index in the HEADER, than skip to second flit
     5620            uint64_t receive_data = p_dspin_m2p.data.read();
    56355621            // for ins INVAL, wait for icache to take the request and fifo to be
    56365622            // empty
    5637             if ((r_cc_receive_data_ins.read() == 1) and not r_cc_receive_icache_req.read() and r_cc_receive_updt_fifo_be.empty())
     5623            if (not r_cc_receive_icache_req.read())
    56385624            {
    56395625                r_cc_receive_icache_updt_tab_idx  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_UPDT_INDEX);
    5640                 r_cc_receive_fsm = CC_RECEIVE_UPDT_NLINE;
     5626                r_cc_receive_fsm = CC_RECEIVE_INS_UPDT_NLINE;
    56415627                break;
    56425628            }
     
    56455631        }
    56465632        ///////////////////////////
    5647         case CC_RECEIVE_UPDT_NLINE:
     5633        case CC_RECEIVE_DATA_UPDT_NLINE:
    56485634        {
    56495635            // sample nline and word index in the second flit
     
    56515637            // for data INVAL, wait for dcache to take the request and fifo to
    56525638            // be empty
    5653             if ( (r_cc_receive_data_ins.read() == 0) and
    5654                  not (r_cc_receive_dcache_req.read()) and
    5655                  r_cc_receive_updt_fifo_be.empty() and
    5656                  (p_dspin_m2p.write.read()) )
    5657             {
     5639            if ( r_cc_receive_updt_fifo_be.empty() and
     5640                 p_dspin_m2p.write.read() )
     5641            {
     5642                r_cc_receive_dcache_req = true;
    56585643                r_cc_receive_dcache_nline  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_NLINE);
    56595644                r_cc_receive_word_idx  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_WORD_INDEX);
    56605645                r_cc_receive_dcache_type = CC_TYPE_UPDT;
    56615646                // get back to idle state
    5662                 r_cc_receive_fsm = CC_RECEIVE_UPDT_DATA;
     5647                r_cc_receive_fsm = CC_RECEIVE_DATA_UPDT_DATA;
    56635648                break;
    56645649            }
     5650            break;
     5651        }
     5652        ////////////////////////////
     5653        case CC_RECEIVE_INS_UPDT_NLINE:
     5654        {
     5655            // sample nline and word index in the second flit
     5656            uint64_t receive_data = p_dspin_m2p.data.read();
    56655657            // for ins INVAL, wait for icache to take the request and fifo to be
    56665658            // empty
    5667             if ( (r_cc_receive_data_ins.read() == 1) and
    5668                  not (r_cc_receive_icache_req.read()) and
    5669                  r_cc_receive_updt_fifo_be.empty() and
    5670                  (p_dspin_m2p.write.read()))
    5671             {
     5659            if ( r_cc_receive_updt_fifo_be.empty() and
     5660                 p_dspin_m2p.write.read() )
     5661            {
     5662                r_cc_receive_icache_req = true;
    56725663                r_cc_receive_icache_nline  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_NLINE);
    56735664                r_cc_receive_word_idx  = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_WORD_INDEX);
    56745665                r_cc_receive_icache_type = CC_TYPE_UPDT;
    56755666                // get back to idle state
    5676                 r_cc_receive_fsm = CC_RECEIVE_UPDT_DATA;
     5667                r_cc_receive_fsm = CC_RECEIVE_INS_UPDT_DATA;
    56775668                break;
    56785669            }
    5679             // we should never get there
    5680             assert ( false && "ERROR in CC_VCACHE : CC_RECEIVE_UPDT_NLINE \n");
    56815670            break;
    56825671        }
    56835672        //////////////////////////
    5684         case CC_RECEIVE_UPDT_DATA:
    5685         {
    5686             if ((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read()) and (p_dspin_m2p.write.read()))
    5687                 r_cc_receive_dcache_req = true;
    5688             if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read()) and (p_dspin_m2p.write.read()))
    5689                 r_cc_receive_icache_req = true;
    5690 
     5673        case CC_RECEIVE_DATA_UPDT_DATA:
     5674        {
    56915675            // wait for the fifo
    56925676            if (r_cc_receive_updt_fifo_be.wok() and (p_dspin_m2p.write.read()))
     
    57025686            break;
    57035687        }
     5688        //////////////////////////
     5689        case CC_RECEIVE_INS_UPDT_DATA:
     5690        {
     5691            // wait for the fifo
     5692            if (r_cc_receive_updt_fifo_be.wok() and (p_dspin_m2p.write.read()))
     5693            {
     5694                uint64_t receive_data = p_dspin_m2p.data.read();
     5695                bool     receive_eop  = p_dspin_m2p.eop.read();
     5696                cc_receive_updt_fifo_be   = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_BE);
     5697                cc_receive_updt_fifo_data = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_DATA);
     5698                cc_receive_updt_fifo_eop  = receive_eop;
     5699                cc_receive_updt_fifo_put  = true;
     5700                if ( receive_eop ) r_cc_receive_fsm = CC_RECEIVE_IDLE;
     5701            }
     5702            break;
     5703        }
     5704
    57045705    } // end switch CC_RECEIVE FSM
    57055706
     
    60916092    // Receive coherence packets
    60926093    // It depends on the CC_RECEIVE FSM
    6093 
    60946094    switch( r_cc_receive_fsm.read() )
    60956095    {
     
    60986098        {
    60996099            p_dspin_m2p.read = false;
    6100             break;
    6101         }
    6102         //////////////////////
    6103         case CC_RECEIVE_CLACK:
    6104         {
    6105             if (((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read())) or
    6106                 ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read())))
    6107                 p_dspin_m2p.read = true;
    6108             else
    6109                 p_dspin_m2p.read = false;
    61106100            break;
    61116101        }
     
    61296119        }
    61306120        /////////////////////////////
    6131         case CC_RECEIVE_INVAL_HEADER:
    6132         {
    6133             if (((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read())) or
    6134                 ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read())))
     6121        case CC_RECEIVE_DATA_INVAL_HEADER:
     6122        case CC_RECEIVE_INS_INVAL_HEADER:
     6123        {
     6124            p_dspin_m2p.read = true;
     6125            break;
     6126        }
     6127        ////////////////////////////
     6128        case CC_RECEIVE_DATA_INVAL_NLINE:
     6129        {
     6130            p_dspin_m2p.read = not r_cc_receive_dcache_req.read();
     6131            break;
     6132        }
     6133        case CC_RECEIVE_INS_INVAL_NLINE:
     6134        {
     6135            p_dspin_m2p.read = not r_cc_receive_icache_req.read();
     6136            break;
     6137        }
     6138        ///////////////////////////
     6139        case CC_RECEIVE_DATA_UPDT_HEADER:
     6140        {
     6141            if (not r_cc_receive_dcache_req.read())
    61356142                p_dspin_m2p.read = true;
    61366143            else
     
    61396146        }
    61406147        ////////////////////////////
    6141         case CC_RECEIVE_INVAL_NLINE:
    6142         {
    6143             p_dspin_m2p.read = true;
    6144             break;
    6145         }
    6146         ////////////////////////////
    6147         case CC_RECEIVE_UPDT_HEADER:
    6148         {
    6149             if (((r_cc_receive_data_ins.read() == 0) and
    6150                 not r_cc_receive_dcache_req.read() and
    6151                 r_cc_receive_updt_fifo_be.empty())
    6152                 or
    6153                 (((r_cc_receive_data_ins.read() == 1) and
    6154                 not r_cc_receive_icache_req.read()) and
    6155                 r_cc_receive_updt_fifo_be.empty()))
     6148        case CC_RECEIVE_INS_UPDT_HEADER:
     6149        {
     6150            if ( not r_cc_receive_icache_req.read())
    61566151                p_dspin_m2p.read = true;
    61576152            else
     
    61606155        }
    61616156        ///////////////////////////
    6162         case CC_RECEIVE_UPDT_NLINE:
    6163         {
    6164             if (((r_cc_receive_data_ins.read() == 0) and
    6165                 not (r_cc_receive_dcache_req.read()) and
    6166                 r_cc_receive_updt_fifo_be.empty())
    6167                 or
    6168                 ((r_cc_receive_data_ins.read() == 1) and
    6169                 not (r_cc_receive_icache_req.read()) and
    6170                 r_cc_receive_updt_fifo_be.empty()))
     6157        case CC_RECEIVE_DATA_UPDT_NLINE:
     6158        case CC_RECEIVE_INS_UPDT_NLINE:
     6159        {
     6160            if(r_cc_receive_updt_fifo_be.empty())
    61716161                p_dspin_m2p.read = true;
    61726162            else
     
    61746164            break;
    61756165        }
    6176         //////////////////////////
    6177         case CC_RECEIVE_UPDT_DATA:
     6166        ///////////////////////////
     6167        case CC_RECEIVE_DATA_UPDT_DATA:
     6168        case CC_RECEIVE_INS_UPDT_DATA:
    61786169        {
    61796170            if (r_cc_receive_updt_fifo_be.wok())
     
    61846175        }
    61856176    } // end switch CC_RECEIVE FSM
     6177
    61866178
    61876179    int clack_type = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
Note: See TracChangeset for help on using the changeset viewer.