Changeset 394


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

ntroducing support for 40 bits physical addresses.

Location:
trunk/modules/vci_cc_vcache_wrapper/caba/source
Files:
2 edited

Legend:

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

    r386 r394  
    6363    : public soclib::caba::BaseModule
    6464{
    65     typedef uint32_t vaddr_t;
    66     typedef uint32_t tag_t;
    67     typedef uint32_t type_t;
    68     typedef typename iss_t::DataOperationType data_op_t;
    69 
    70     typedef typename vci_param::addr_t  paddr_t;
    71     typedef typename vci_param::data_t  vci_data_t;
    72     typedef typename vci_param::be_t    vci_be_t;
    73     typedef typename vci_param::srcid_t vci_srcid_t;
    74     typedef typename vci_param::trdid_t vci_trdid_t;
    75     typedef typename vci_param::pktid_t vci_pktid_t;
    76     typedef typename vci_param::plen_t  vci_plen_t;
    77 
    78     enum icache_fsm_state_e {
     65
     66    typedef typename vci_param::fast_addr_t  paddr_t;
     67
     68    enum icache_fsm_state_e
     69    {
    7970        ICACHE_IDLE,
    8071        // handling XTN processor requests
     
    10495    };
    10596
    106     enum dcache_fsm_state_e {
     97    enum dcache_fsm_state_e
     98    {
    10799        DCACHE_IDLE,
    108100        // handling itlb & dtlb miss
     
    154146    };
    155147
    156     enum cmd_fsm_state_e {
     148    enum cmd_fsm_state_e
     149    {
    157150        CMD_IDLE,
    158151        CMD_INS_MISS,
     
    166159    };
    167160
    168     enum rsp_fsm_state_e {
     161    enum rsp_fsm_state_e
     162    {
    169163        RSP_IDLE,
    170164        RSP_INS_MISS,
     
    176170    };
    177171
    178     enum cc_receive_fsm_state_e {
     172    enum cc_receive_fsm_state_e
     173    {
    179174        CC_RECEIVE_IDLE,
    180175        CC_RECEIVE_CLACK,
     
    188183    };
    189184
    190     enum cc_send_fsm_state_e {
     185    enum cc_send_fsm_state_e
     186    {
    191187        CC_SEND_IDLE,
    192188        CC_SEND_CLEANUP_1,
     
    224220
    225221    // cc_send_type
    226     typedef enum {
     222    typedef enum
     223    {
    227224        CC_TYPE_CLEANUP,
    228225        CC_TYPE_MULTI_ACK,
     
    230227
    231228    // cc_receive_type
    232     typedef enum {
     229    typedef enum
     230    {
    233231        CC_TYPE_CLACK,
    234232        CC_TYPE_BRDCAST,
     
    238236
    239237    // TLB Mode : ITLB / DTLB / ICACHE / DCACHE
    240     enum {
     238    enum
     239    {
    241240        INS_TLB_MASK    = 0x8,
    242241        DATA_TLB_MASK   = 0x4,
     
    298297    soclib::common::AddressDecodingTable<uint32_t, bool> m_cacheability_table;
    299298
    300     const vci_srcid_t                   m_srcid;
     299    const size_t                        m_srcid;
    301300    const size_t                        m_cc_global_id;
    302301    const size_t                        m_nline_width;
     
    330329
    331330    /////////////////////////////////////////////
    332     // debug variables (for each FSM)
     331    // debug variables
    333332    /////////////////////////////////////////////
    334     bool                                m_debug_previous_hit;
    335     bool                                m_idebug_previous_hit;
    336     bool                                m_debug_dcache_fsm;
    337     bool                                m_debug_icache_fsm;
    338     bool                                m_debug_inval_itlb_fsm;
    339     bool                                m_debug_inval_dtlb_fsm;
     333    bool                                m_debug_previous_i_hit;
     334    bool                                m_debug_previous_d_hit;
     335    bool                                m_debug_activated;
    340336
    341337    ///////////////////////////////
     
    404400    sc_signal<uint32_t>     r_dcache_save_vaddr;        // virtual address (from proc)
    405401    sc_signal<uint32_t>     r_dcache_save_wdata;        // write data (from proc)
    406     sc_signal<vci_be_t>     r_dcache_save_be;           // byte enable (from proc)
     402    sc_signal<uint32_t>     r_dcache_save_be;           // byte enable (from proc)
    407403    sc_signal<paddr_t>      r_dcache_save_paddr;        // physical address
    408404    sc_signal<bool>         r_dcache_save_cacheable;    // address cacheable
     
    425421    sc_signal<bool>         r_dcache_vci_ll_req;        // atomic read request LL
    426422    sc_signal<bool>         r_dcache_vci_sc_req;        // atomic write request SC
    427     sc_signal<vci_data_t>   r_dcache_vci_sc_data;       // SC data (command)
     423    sc_signal<uint32_t>     r_dcache_vci_sc_data;       // SC data (command)
    428424
    429425    // register used for XTN inval
     
    482478
    483479    // dcache directory extension
    484     bool                    *r_dcache_in_tlb;           // copy exist in dtlb or itlb
    485     bool                    *r_dcache_contains_ptd;     // cache line contains a PTD
     480    bool                    *r_dcache_in_tlb;               // copy exist in dtlb or itlb
     481    bool                    *r_dcache_contains_ptd;         // cache line contains a PTD
     482
     483    // Physical address extension for data access
     484    sc_signal<uint32_t>     r_dcache_paddr_ext;             // CP2 register (if vci_address > 32)
    486485
    487486    ///////////////////////////////////
     
    489488    ///////////////////////////////////
    490489    sc_signal<int>          r_vci_cmd_fsm;
    491     sc_signal<size_t>       r_vci_cmd_min;                  // used for write bursts
    492     sc_signal<size_t>       r_vci_cmd_max;                  // used for write bursts
    493     sc_signal<size_t>       r_vci_cmd_cpt;                  // used for write bursts
    494     sc_signal<bool>         r_vci_cmd_imiss_prio;           // round-robin between imiss & dmiss
     490    sc_signal<size_t>       r_vci_cmd_min;                      // used for write bursts
     491    sc_signal<size_t>       r_vci_cmd_max;                      // used for write bursts
     492    sc_signal<size_t>       r_vci_cmd_cpt;                      // used for write bursts
     493    sc_signal<bool>         r_vci_cmd_imiss_prio;               // round-robin between imiss & dmiss
    495494
    496495    ///////////////////////////////////
     
    501500    sc_signal<bool>         r_vci_rsp_ins_error;
    502501    sc_signal<bool>         r_vci_rsp_data_error;
    503     GenericFifo<uint32_t>   r_vci_rsp_fifo_icache;          // response FIFO to ICACHE FSM
    504     GenericFifo<uint32_t>   r_vci_rsp_fifo_dcache;          // response FIFO to DCACHE FSM
     502    GenericFifo<uint32_t>   r_vci_rsp_fifo_icache;              // response FIFO to ICACHE FSM
     503    GenericFifo<uint32_t>   r_vci_rsp_fifo_dcache;              // response FIFO to DCACHE FSM
    505504
    506505    ///////////////////////////////////
    507506    //  CC_SEND FSM REGISTER
    508507    ///////////////////////////////////
    509     sc_signal<int>          r_cc_send_fsm;          // state register
    510     sc_signal<bool>         r_cc_send_last_client;  // round robin flip-flop : 0 dcache / 1 icache
     508    sc_signal<int>          r_cc_send_fsm;                  // state register
     509    sc_signal<bool>         r_cc_send_last_client;          // 0 dcache / 1 icache
    511510
    512511    ///////////////////////////////////
    513512    //  CC_RECEIVE FSM REGISTER
    514513    ///////////////////////////////////
    515     sc_signal<int>          r_cc_receive_fsm;          // state register
    516     sc_signal<bool>         r_cc_receive_data_ins;     // request concerning : 0 dcache / 1 icache
    517 
    518     // communication cc updt FIFO between CC_RECEIVE FSM and ICACHE/DCACHE FSM
    519     sc_signal<size_t>       r_cc_receive_word_idx;  // word index
     514    sc_signal<int>          r_cc_receive_fsm;               // state register
     515    sc_signal<bool>         r_cc_receive_data_ins;          // request to : 0 dcache / 1 icache
     516
     517    // communication between CC_RECEIVE FSM and ICACHE/DCACHE FSM
     518    sc_signal<size_t>       r_cc_receive_word_idx;          // word index
    520519    GenericFifo<uint32_t>   r_cc_receive_updt_fifo_be;
    521520    GenericFifo<uint32_t>   r_cc_receive_updt_fifo_data;
     
    523522
    524523    // communication between CC_RECEIVE FSM and ICACHE FSM
    525     sc_signal<bool>         r_cc_receive_icache_req;       // cc_receive to icache request
    526     sc_signal<cc_receive_t> r_cc_receive_icache_type;      // cc_receive type of coherence request
    527     sc_signal<size_t>       r_cc_receive_icache_way;       // cc_receive to icache way
    528     sc_signal<size_t>       r_cc_receive_icache_set;       // cc_receive to icache set
     524    sc_signal<bool>         r_cc_receive_icache_req;        // cc_receive to icache request
     525    sc_signal<cc_receive_t> r_cc_receive_icache_type;       // cc_receive type of request
     526    sc_signal<size_t>       r_cc_receive_icache_way;        // cc_receive to icache way
     527    sc_signal<size_t>       r_cc_receive_icache_set;        // cc_receive to icache set
    529528    sc_signal<size_t>       r_cc_receive_icache_updt_tab_idx;  // cc_receive update table index
    530     sc_signal<paddr_t>      r_cc_receive_icache_nline;     // cache line physical address
     529    sc_signal<paddr_t>      r_cc_receive_icache_nline;      // cache line physical address
    531530
    532531    // communication between CC_RECEIVE FSM and DCACHE FSM
    533     sc_signal<bool>         r_cc_receive_dcache_req;       // cc_receive to dcache request
    534     sc_signal<cc_receive_t> r_cc_receive_dcache_type;      // cc_receive type of coherence request
    535     sc_signal<size_t>       r_cc_receive_dcache_way;       // cc_receive to dcache way
    536     sc_signal<size_t>       r_cc_receive_dcache_set;       // cc_receive to dcache set
     532    sc_signal<bool>         r_cc_receive_dcache_req;        // cc_receive to dcache request
     533    sc_signal<cc_receive_t> r_cc_receive_dcache_type;       // cc_receive type of request
     534    sc_signal<size_t>       r_cc_receive_dcache_way;        // cc_receive to dcache way
     535    sc_signal<size_t>       r_cc_receive_dcache_set;        // cc_receive to dcache set
    537536    sc_signal<size_t>       r_cc_receive_dcache_updt_tab_idx;  // cc_receive update table index
    538     sc_signal<paddr_t>      r_cc_receive_dcache_nline;     // cache line physical address
     537    sc_signal<paddr_t>      r_cc_receive_dcache_nline;      // cache line physical address
    539538
    540539    //////////////////////////////////////////////////////////////////
     
    714713    void print_trace(size_t mode = 0);
    715714    void cache_monitor(paddr_t addr);
    716     inline void iss_set_debug_mask(uint v) {
    717         r_iss.set_debug_mask(v);
     715    inline void iss_set_debug_mask(uint v)
     716    {
     717            r_iss.set_debug_mask(v);
    718718    }
    719719
  • trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp

    r387 r394  
    3434#define DEBUG_DCACHE            1
    3535#define DEBUG_ICACHE            1
    36 #define DEBUG_CLEANUP           1
     36#define DEBUG_CMD               0
    3737
    3838namespace soclib {
     
    464464              << " | " << rsp_fsm_state_str[r_vci_rsp_fsm.read()]
    465465              << " | " << cc_receive_fsm_state_str[r_cc_receive_fsm.read()]
    466               << " | " << cc_send_fsm_state_str[r_cc_send_fsm.read()];
     466              << " | " << cc_send_fsm_state_str[r_cc_send_fsm.read()]
     467              << " | MMU = " << r_mmu_mode.read();
    467468    if (r_dcache_updt_req.read() ) std::cout << " | P1_UPDT";
    468469    if (r_dcache_wbuf_req.read() ) std::cout << " | P1_WBUF";
     
    499500//////////////////////////////////////////
    500501{
    501     size_t          cache_way;
    502     size_t          cache_set;
    503     size_t          cache_word;
    504     uint32_t    cache_rdata;
    505     bool            cache_hit = r_dcache.read_neutral( addr,
    506                                                    &cache_rdata,
    507                                                    &cache_way,
    508                                                    &cache_set,
    509                                                    &cache_word );
    510     bool        icache_hit = r_icache.read_neutral( addr,
    511                                            &cache_rdata,
    512                                            &cache_way,
    513                                            &cache_set,
    514                                            &cache_word );
    515     if ( cache_hit != m_debug_previous_hit )
    516     {
    517         std::cout << "PROC " << name()
    518                   << " dcache change at cycle " << std::dec << m_cpt_total_cycles
    519                   << " for adresse " << std::hex << addr
    520                   << " / HIT = " << std::dec << cache_hit << std::endl;
    521         m_debug_previous_hit = cache_hit;
    522     }
    523     if ( icache_hit != m_idebug_previous_hit )
    524     {
    525         std::cout << "PROC " << name()
    526                   << " icache change at cycle " << std::dec << m_cpt_total_cycles
    527                   << " for adresse " << std::hex << addr
    528                   << " / HIT = " << icache_hit << std::endl;
    529         m_idebug_previous_hit = icache_hit;
     502    bool        cache_hit;
     503    size_t          cache_way = 0;
     504    size_t          cache_set = 0;
     505    size_t          cache_word = 0;
     506    uint32_t    cache_rdata = 0;
     507
     508    cache_hit = r_dcache.read_neutral( addr,
     509                                       &cache_rdata,
     510                                       &cache_way,
     511                                       &cache_set,
     512                                       &cache_word );
     513
     514    if ( cache_hit != m_debug_previous_d_hit )
     515    {
     516        std::cout << "Monitor PROC " << name()
     517                  << " DCACHE at cycle " << std::dec << m_cpt_total_cycles
     518                  << " / HIT = " << cache_hit
     519                  << " / PADDR = " << std::hex << addr
     520                  << " / DATA = " << cache_rdata
     521                  << " / WAY = " << cache_way << std::endl;
     522            m_debug_previous_d_hit = cache_hit;
     523    }
     524
     525    cache_hit = r_icache.read_neutral( addr,
     526                                       &cache_rdata,
     527                                       &cache_way,
     528                                       &cache_set,
     529                                       &cache_word );
     530
     531    if ( cache_hit != m_debug_previous_i_hit )
     532    {
     533        std::cout << "Monitor PROC " << name()
     534                  << " ICACHE at cycle " << std::dec << m_cpt_total_cycles
     535                  << " / HIT = " << cache_hit
     536                  << " / PADDR = " << std::hex << addr
     537                  << " / DATA = " << cache_rdata
     538                  << " / WAY = " << cache_way << std::endl;
     539            m_debug_previous_i_hit = cache_hit;
    530540    }
    531541}
     
    681691/////////////////////////
    682692{
    683     #define LLSCLocalTable GenericLLSCLocalTable<8000, 1, paddr_t, vci_trdid_t, vci_data_t>
    684693    if ( not p_resetn.read() )
    685694    {
     
    698707        r_cc_send_fsm     = CC_SEND_IDLE;
    699708
     709        // reset data physical address extension
     710        r_dcache_paddr_ext = 0;
     711
    700712        // reset dcache directory extension
    701713        for (size_t i=0 ; i< m_dcache_ways*m_dcache_sets ; i++)
     
    710722
    711723        // ICACHE & DCACHE activated
     724        // ITLB & DTLB desactivated
    712725        r_mmu_mode = 0x3;
    713726
     
    762775
    763776        // Debug variables
    764         m_debug_previous_hit       = false;
    765         m_idebug_previous_hit      = false;
    766         m_debug_dcache_fsm             = false;
    767         m_debug_icache_fsm             = false;
     777        m_debug_previous_i_hit     = false;
     778        m_debug_previous_d_hit     = false;
     779        m_debug_activated              = false;
    768780
    769781        // activity counters
     
    905917    m_cpt_total_cycles++;
    906918
    907     m_debug_icache_fsm     = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok;
    908     m_debug_dcache_fsm     = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok;
     919    m_debug_activated = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok;
    909920
    910921    /////////////////////////////////////////////////////////////////////
     
    11571168                    r_icache_fsm      = ICACHE_MISS_SELECT;
    11581169#if DEBUG_ICACHE
    1159 if ( m_debug_icache_fsm )
    1160 {
    1161     std::cout << "  <PROC " << name()
    1162               << " ICACHE_IDLE> READ MISS in icache"
    1163               << " : PADDR = " << std::hex << paddr << std::endl;
    1164 }
     1170if ( m_debug_activated )
     1171std::cout << "  <PROC " << name() << " ICACHE_IDLE> READ MISS in icache"
     1172          << " : PADDR = " << std::hex << paddr << std::endl;
    11651173#endif
    11661174                   r_icache_miss_req = true;
     
    11821190                    r_icache_fsm       = ICACHE_IDLE;
    11831191#if DEBUG_ICACHE
    1184 if ( m_debug_icache_fsm )
    1185 {
    1186     std::cout << "  <PROC " << name()
    1187               << " ICACHE_IDLE> READ HIT in icache"
    1188               << " : PADDR = " << std::hex << paddr << std::endl;
    1189 }
     1192if ( m_debug_activated )
     1193std::cout << "  <PROC " << name() << " ICACHE_IDLE> READ HIT in icache"
     1194          << " : PADDR = " << std::hex << paddr << std::endl;
    11901195#endif
    11911196                }
     
    11971202
    11981203#if DEBUG_ICACHE
    1199 if ( m_debug_icache_fsm )
     1204if ( m_debug_activated )
    12001205{
    12011206    std::cout << "  <PROC " << name()
     
    12711276        {
    12721277            int       state;
    1273             uint32_t  tag;
     1278            paddr_t   tag;
    12741279            size_t        way = r_icache_flush_count.read()/m_icache_sets;
    12751280            size_t        set = r_icache_flush_count.read()%m_icache_sets;
     
    15051510
    15061511#if DEBUG_ICACHE
    1507 if ( m_debug_dcache_fsm )
     1512if ( m_debug_activated )
    15081513{
    15091514    std::cout << "  <PROC " << name()
     
    15311536                            CACHE_SLOT_STATE_ZOMBI);
    15321537#if DEBUG_ICACHE
    1533 if ( m_debug_dcache_fsm )
     1538if ( m_debug_activated )
    15341539{
    15351540    std::cout << "  <PROC " << name()
     
    15881593                            r_vci_rsp_fifo_icache.read() );
    15891594#if DEBUG_ICACHE
    1590 if ( m_debug_icache_fsm )
     1595if ( m_debug_activated )
    15911596{
    15921597    std::cout << "  <PROC " << name()
     
    16481653                                        CACHE_SLOT_STATE_ZOMBI );
    16491654#if DEBUG_ICACHE
    1650 if ( m_debug_icache_fsm )
     1655if ( m_debug_activated )
    16511656{
    16521657    std::cout << "  <PROC " << name()
     
    16721677                                    CACHE_SLOT_STATE_VALID );
    16731678#if DEBUG_ICACHE
    1674 if ( m_debug_icache_fsm )
     1679if ( m_debug_activated )
    16751680{
    16761681    std::cout << "  <PROC " << name()
     
    17541759
    17551760#if DEBUG_ICACHE
    1756 if ( m_debug_icache_fsm )
     1761if ( m_debug_activated )
    17571762{
    17581763    std::cout << "  <PROC " << name()
     
    17871792            }
    17881793#if DEBUG_ICACHE
    1789 if ( m_debug_icache_fsm )
     1794if ( m_debug_activated )
    17901795{
    17911796    std::cout << "  <PROC " << name()
     
    18561861
    18571862#if DEBUG_ICACHE
    1858 if ( m_debug_icache_fsm )
     1863if ( m_debug_activated )
    18591864{
    18601865    std::cout << "  <PROC " << name()
     
    19001905
    19011906#if DEBUG_ICACHE
    1902 if ( m_debug_icache_fsm )
     1907if ( m_debug_activated )
    19031908{
    19041909    std::cout << "  <PROC " << name()
     
    19631968
    19641969#if DEBUG_ICACHE
    1965 if ( m_debug_icache_fsm )
     1970if ( m_debug_activated )
    19661971{
    19671972    std::cout << "  <PROC " << name()
     
    21532158            else                                    // identity mapping
    21542159            {
    2155                 paddr       = (paddr_t)m_dreq.addr;
     2160                paddr = (paddr_t)m_dreq.addr;
     2161                // we take into account the paddr extension
     2162                if (vci_param::N > 32)
     2163                    paddr = paddr | ((paddr_t)(r_dcache_paddr_ext.read()) << 32);
    21562164            }
    21572165        } // end physical address computation
     
    22272235
    22282236#if DEBUG_DCACHE
    2229 if ( m_debug_dcache_fsm )
    2230 {
    2231     std::cout << "  <PROC " << name()
    2232               << " DCACHE_IDLE> Cache update in P1 stage" << std::dec
    2233               << " / WAY = " << r_dcache_save_cache_way.read()
    2234               << " / SET = " << r_dcache_save_cache_set.read()
    2235               << " / WORD = " << r_dcache_save_cache_word.read() << std::hex
    2236               << " / DATA = " << r_dcache_save_wdata.read()
    2237               << " / BE = " << r_dcache_save_be.read() << std::endl;
    2238 }
     2237if ( m_debug_activated )
     2238std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
     2239          << " Cache update in P1 stage" << std::dec
     2240          << " / WAY = " << r_dcache_save_cache_way.read()
     2241          << " / SET = " << r_dcache_save_cache_set.read()
     2242          << " / WORD = " << r_dcache_save_cache_word.read() << std::hex
     2243          << " / WDATA = " << r_dcache_save_wdata.read()
     2244          << " / BE = " << r_dcache_save_be.read() << std::endl;
    22392245#endif
    22402246        } // end test TLB inval
     
    23792385                    case iss_t::XTN_MMU_WORD_HI:
    23802386                        m_drsp.rdata = r_mmu_word_hi.read();
     2387                        m_drsp.valid = true;
     2388                        m_drsp.error = false;
     2389                        break;
     2390
     2391                    case iss_t::XTN_DATA_PADDR_EXT:
     2392                        m_drsp.rdata = r_dcache_paddr_ext.read();
    23812393                        m_drsp.valid = true;
    23822394                        m_drsp.error = false;
     
    25032515                        m_drsp.valid     = true;
    25042516                        r_dcache_fsm     = DCACHE_IDLE;
     2517                    break;
     2518
     2519                    case iss_t::XTN_DATA_PADDR_EXT:     // no cache or tlb access
     2520                        r_dcache_paddr_ext = m_dreq.wdata;
     2521                        m_drsp.valid       = true;
     2522                        r_dcache_fsm       = DCACHE_IDLE;
    25052523                    break;
    25062524
     
    25682586                            m_drsp.rdata = 0;
    25692587#if DEBUG_DCACHE
    2570 if ( m_debug_dcache_fsm )
    2571 {
    2572     std::cout << "  <PROC " << name()
    2573               << ".DCACHE_IDLE> HIT in dtlb, but privilege violation" << std::endl;
    2574 }
     2588if ( m_debug_activated )
     2589std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
     2590          << " HIT in dtlb, but privilege violation" << std::endl;
    25752591#endif
    25762592                        }
     
    25862602                            m_drsp.rdata = 0;
    25872603#if DEBUG_DCACHE
    2588 if ( m_debug_dcache_fsm )
    2589 {
    2590     std::cout << "  <PROC " << name()
    2591               << ".DCACHE_IDLE> HIT in dtlb, but writable violation" << std::endl;
    2592 }
     2604if ( m_debug_activated )
     2605std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
     2606          << " HIT in dtlb, but writable violation" << std::endl;
    25932607#endif
    25942608                        }
     
    26072621                }    // end DTLB activated
    26082622
    2609                 if ( valid_req )        // processor request is valid after TLB check
     2623                if ( valid_req )        // processor request is valid (after MMU check)
    26102624                {
    26112625                    r_dcache_save_cacheable  = cacheable;
     
    26312645                                r_dcache_fsm          = DCACHE_MISS_SELECT;
    26322646#if DEBUG_DCACHE
    2633 if ( m_debug_dcache_fsm )
    2634 {
    2635     std::cout << "  <PROC " << name()
    2636               << " DCACHE_IDLE> READ MISS in dcache"
    2637               << " : PADDR = " << std::hex << paddr << std::endl;
    2638 }
     2647if ( m_debug_activated )
     2648std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
     2649          << " READ MISS in dcache"
     2650          << " / PADDR = " << std::hex << paddr << std::endl;
    26392651#endif
    26402652                            }
     
    26432655                                // stalled until cleanup is acknowledged
    26442656                                r_dcache_fsm   = DCACHE_IDLE;
     2657#if DEBUG_DCACHE
     2658if ( m_debug_activated )
     2659std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
     2660          << " Pending cleanup, stalled until cleanup acknowledge"
     2661          << " / PADDR = " << std::hex << paddr << std::endl;
     2662#endif
    26452663                            }
    26462664                            else                                      // cache hit
     
    26542672                                m_drsp.rdata   = cache_rdata;
    26552673#if DEBUG_DCACHE
    2656 if ( m_debug_dcache_fsm )
    2657 {
    2658     std::cout << "  <PROC " << name()
    2659               << " DCACHE_IDLE> READ HIT in dcache"
    2660               << " : PADDR = " << std::hex << paddr << std::endl;
    2661 }
     2674if ( m_debug_activated )
     2675std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
     2676          << " READ HIT in dcache"
     2677          << " / PADDR = " << std::hex << paddr << std::endl;
    26622678#endif
    26632679                            }
     
    26702686                            r_dcache_fsm          = DCACHE_UNC_WAIT;
    26712687#if DEBUG_DCACHE
    2672 if ( m_debug_dcache_fsm )
    2673 {
    2674     std::cout << "  <PROC " << name()
    2675               << " DCACHE_IDLE> READ UNCACHEABLE in dcache"
    2676               << " : PADDR = " << std::hex << paddr << std::endl;
    2677 }
     2688if ( m_debug_activated )
     2689std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
     2690          << " READ UNCACHEABLE in dcache"
     2691          << " / PADDR = " << std::hex << paddr << std::endl;
    26782692#endif
    26792693                        }
     
    28452859        if ( not bypass )     // Try to read PTE1/PTD1 in dcache
    28462860        {
    2847             pte_paddr = (paddr_t)r_mmu_ptpr.read() << (INDEX1_NBITS+2) |
    2848                         (paddr_t)((r_dcache_tlb_vaddr.read() >> PAGE_M_NBITS) << 2);
     2861            pte_paddr = (((paddr_t)r_mmu_ptpr.read()) << (INDEX1_NBITS+2)) |
     2862                        ((((paddr_t)r_dcache_tlb_vaddr.read()) >> PAGE_M_NBITS) << 2);
    28492863            r_dcache_tlb_paddr = pte_paddr;
    28502864            r_dcache_fsm       = DCACHE_TLB_PTE1_GET;
     
    28592873
    28602874#if DEBUG_DCACHE
    2861 if ( m_debug_dcache_fsm )
     2875if ( m_debug_activated )
    28622876{
    28632877    if ( r_dcache_tlb_ins.read() )
    2864     {
    2865         std::cout << "  <PROC " << name() << ".DCACHE_TLB_MISS> ITLB miss";
    2866     }
     2878        std::cout << "  <PROC " << name() << " DCACHE_TLB_MISS> ITLB miss";
    28672879    else
    2868     {
    2869         std::cout << "  <PROC " << name() << ".DCACHE_TLB_MISS> DTLB miss";
    2870     }
     2880        std::cout << "  <PROC " << name() << " DCACHE_TLB_MISS> DTLB miss";
    28712881    std::cout << " / VADDR = " << std::hex << r_dcache_tlb_vaddr.read()
     2882              << " / ptpr  = " << (((paddr_t)r_mmu_ptpr.read()) << (INDEX1_NBITS+2))
    28722883              << " / BYPASS = " << bypass
    28732884              << " / PTE_ADR = " << pte_paddr << std::endl;
     
    29242935
    29252936#if DEBUG_DCACHE
    2926 if ( m_debug_dcache_fsm )
     2937if ( m_debug_activated )
    29272938{
    2928     std::cout << "  <PROC " << name() << ".DCACHE_TLB_PTE1_GET> HIT in dcache, but unmapped"
     2939    std::cout << "  <PROC " << name()
     2940              << " DCACHE_TLB_PTE1_GET> HIT in dcache, but unmapped"
    29292941              << std::hex << " / paddr = " << r_dcache_tlb_paddr.read()
    29302942              << std::dec << " / way = " << way
     
    29602972
    29612973#if DEBUG_DCACHE
    2962 if ( m_debug_dcache_fsm )
     2974if ( m_debug_activated )
    29632975{
    2964     std::cout << "  <PROC " << name() << ".DCACHE_TLB_PTE1_GET> HIT in dcache"
     2976    std::cout << "  <PROC " << name()
     2977              << " DCACHE_TLB_PTE1_GET> HIT in dcache"
    29652978              << std::hex << " / paddr = " << r_dcache_tlb_paddr.read()
    29662979              << std::dec << " / way = " << way
     
    29812994
    29822995#if DEBUG_DCACHE
    2983 if ( m_debug_dcache_fsm )
     2996if ( m_debug_activated )
    29842997{
    2985     std::cout << "  <PROC " << name() << ".DCACHE_TLB_PTE1_GET> HIT in dcache"
     2998    std::cout << "  <PROC " << name()
     2999              << " DCACHE_TLB_PTE1_GET> HIT in dcache"
    29863000              << std::hex << " / paddr = " << r_dcache_tlb_paddr.read()
    29873001              << std::dec << " / way = " << way
     
    30073021
    30083022#if DEBUG_DCACHE
    3009 if ( m_debug_dcache_fsm )
     3023if ( m_debug_activated )
    30103024{
    3011     std::cout << "  <PROC " << name() << ".DCACHE_TLB_PTE1_GET> MISS in dcache:"
     3025    std::cout << "  <PROC " << name()
     3026              << " DCACHE_TLB_PTE1_GET> MISS in dcache:"
    30123027              << " PTE1 address = " << std::hex << r_dcache_tlb_paddr.read() << std::endl;
    30133028}
     
    30473062
    30483063#if DEBUG_DCACHE
    3049 if ( m_debug_dcache_fsm )
     3064if ( m_debug_activated )
    30503065{
    30513066    if ( r_dcache_tlb_ins.read() )
    3052         std::cout << "  <PROC " << name() << ".DCACHE_TLB_PTE1_SELECT> Select a slot in ITLB:";
     3067        std::cout << "  <PROC " << name()
     3068                  << " DCACHE_TLB_PTE1_SELECT> Select a slot in ITLB:";
    30533069    else
    3054         std::cout << "  <PROC " << name() << ".DCACHE_TLB_PTE1_SELECT> Select a slot in DTLB:";
     3070        std::cout << "  <PROC " << name()
     3071                  << ".DCACHE_TLB_PTE1_SELECT> Select a slot in DTLB:";
    30553072        std::cout << " way = " << std::dec << way
    30563073                  << " / set = " << set << std::endl;
     
    31173134
    31183135#if DEBUG_DCACHE
    3119 if ( m_debug_dcache_fsm )
     3136if ( m_debug_activated )
    31203137{
    3121     std::cout << "  <PROC " << name() << ".DCACHE_TLB_PTE1_UPDT> write PTE1 in ITLB";
    3122     std::cout << " / set = " << std::dec << r_dcache_tlb_set.read()
     3138    std::cout << "  <PROC " << name()
     3139              << " DCACHE_TLB_PTE1_UPDT> write PTE1 in ITLB"
     3140              << " / set = " << std::dec << r_dcache_tlb_set.read()
    31233141              << " / way = " << r_dcache_tlb_way.read() << std::endl;
    31243142    r_itlb.printTrace();
     
    31403158
    31413159#if DEBUG_DCACHE
    3142 if ( m_debug_dcache_fsm )
     3160if ( m_debug_activated )
    31433161{
    3144     std::cout << "  <PROC " << name() << ".DCACHE_TLB_PTE1_UPDT> write PTE1 in DTLB";
    3145     std::cout << " / set = " << std::dec << r_dcache_tlb_set.read()
     3162    std::cout << "  <PROC " << name()
     3163              << " DCACHE_TLB_PTE1_UPDT> write PTE1 in DTLB"
     3164              << " / set = " << std::dec << r_dcache_tlb_set.read()
    31463165              << " / way = " << r_dcache_tlb_way.read() << std::endl;
    31473166    r_dtlb.printTrace();
     
    31563175
    31573176#if DEBUG_DCACHE
    3158 if ( m_debug_dcache_fsm )
     3177if ( m_debug_activated )
    31593178{
    3160     std::cout << "  <PROC " << name() << ".DCACHE_TLB_PTE1_UPDT> L/R bit update required"
     3179    std::cout << "  <PROC " << name()
     3180              << " DCACHE_TLB_PTE1_UPDT> L/R bit update required"
    31613181              << std::endl;
    31623182}
     
    32153235
    32163236#if DEBUG_DCACHE
    3217 if ( m_debug_dcache_fsm )
     3237if ( m_debug_activated )
    32183238{
    32193239    std::cout << "  <PROC " << name()
     
    32353255
    32363256#if DEBUG_DCACHE
    3237 if ( m_debug_dcache_fsm )
     3257if ( m_debug_activated )
    32383258{
    32393259    std::cout << "  <PROC " << name()
     
    32513271
    32523272#if DEBUG_DCACHE
    3253 if ( m_debug_dcache_fsm )
     3273if ( m_debug_activated )
    32543274{
    32553275    std::cout << "  <PROC " << name()
     
    32683288
    32693289#if DEBUG_DCACHE
    3270 if ( m_debug_dcache_fsm )
     3290if ( m_debug_activated )
    32713291{
    32723292    std::cout << "  <PROC " << name()
     
    33063326
    33073327#if DEBUG_DCACHE
    3308 if ( m_debug_dcache_fsm )
     3328if ( m_debug_activated )
    33093329{
    33103330    if ( r_dcache_tlb_ins.read() )
     
    33823402
    33833403#if DEBUG_DCACHE
    3384 if ( m_debug_dcache_fsm )
     3404if ( m_debug_activated )
    33853405{
    33863406    std::cout << "  <PROC " << name()
     
    34063426
    34073427#if DEBUG_DCACHE
    3408 if ( m_debug_dcache_fsm )
     3428if ( m_debug_activated )
    34093429{
    34103430    std::cout << "  <PROC " << name()
     
    34243444
    34253445#if DEBUG_DCACHE
    3426 if ( m_debug_dcache_fsm )
     3446if ( m_debug_activated )
    34273447{
    34283448    std::cout << "  <PROC " << name()
     
    34373457    {
    34383458#if DEBUG_DCACHE
    3439 if ( m_debug_dcache_fsm )
     3459if ( m_debug_activated )
    34403460{
    34413461    std::cout << "  <PROC " << name()
     
    34823502        {
    34833503#if DEBUG_DCACHE
    3484 if ( m_debug_dcache_fsm )
     3504if ( m_debug_activated )
    34853505{
    34863506    std::cout << "  <PROC " << name()
     
    34973517    {
    34983518#if DEBUG_DCACHE
    3499 if ( m_debug_dcache_fsm )
     3519if ( m_debug_activated )
    35003520{
    35013521    std::cout << "  <PROC " << name()
     
    36033623        {
    36043624            int       state;
    3605             uint32_t  tag;
     3625            paddr_t   tag;
    36063626            size_t    way = r_dcache_flush_count.read()/m_dcache_sets;
    36073627            size_t    set = r_dcache_flush_count.read()%m_dcache_sets;
     
    37233743
    37243744#if DEBUG_DCACHE
    3725 if ( m_debug_dcache_fsm )
     3745if ( m_debug_activated )
    37263746{
    37273747    std::cout << "  <PROC " << name()
     
    37663786
    37673787#if DEBUG_DCACHE
    3768 if ( m_debug_dcache_fsm )
     3788if ( m_debug_activated )
    37693789{
    37703790    std::cout << "  <PROC " << name()
     
    38263846
    38273847#if DEBUG_DCACHE
    3828 if ( m_debug_dcache_fsm )
     3848if ( m_debug_activated )
    38293849{
    38303850    std::cout << "  <PROC " << name()
     
    39003920
    39013921#if DEBUG_DCACHE
    3902 if ( m_debug_dcache_fsm )
     3922if ( m_debug_activated )
    39033923{
    39043924    std::cout << "  <PROC " << name()
     
    39073927              << " / SET = "   << set
    39083928              << " / PADDR = " << std::hex << r_dcache_save_paddr.read();
    3909     if(cleanup) std::cout << " / VICTIM = " << std::hex << victim << std::endl;
     3929    if(cleanup) std::cout << " / VICTIM = " << (victim*m_dcache_words*4) << std::endl;
    39103930    else        std::cout << std::endl;
    39113931}
     
    39233943        size_t  way   = r_dcache_miss_way.read();
    39243944        size_t  set   = r_dcache_miss_set.read();
    3925         paddr_t nline = r_dcache_save_paddr.read() / (m_dcache_words<<2);
    39263945
    39273946#ifdef INSTRUMENTATION
     
    39323951                            CACHE_SLOT_STATE_ZOMBI );
    39333952#if DEBUG_DCACHE
    3934 if ( m_debug_dcache_fsm )
     3953if ( m_debug_activated )
    39353954{
    39363955    std::cout << "  <PROC " << name()
     
    40544073                                r_vci_rsp_fifo_dcache.read() );
    40554074#if DEBUG_DCACHE
    4056 if ( m_debug_dcache_fsm )
     4075if ( m_debug_activated )
    40574076{
    40584077    std::cout << "  <PROC " << name()
     
    40974116            if ( r_dcache_miss_inval.read() ) // switch slot to ZOMBI state, and new cleanup
    40984117            {
    4099                 if ( not r_dcache_cc_send_req.read() ) // blocked until previous cc_send request is sent
     4118                if ( not r_dcache_cc_send_req.read() ) // blocked until previous request sent
    41004119                {
    41014120                    r_dcache_miss_inval     = false;
     
    41144133                                        CACHE_SLOT_STATE_ZOMBI );
    41154134#if DEBUG_DCACHE
    4116 if ( m_debug_dcache_fsm )
    4117 {
    4118     std::cout << "  <PROC " << name()
    4119               << " DCACHE_MISS_DIR_UPDT> Switch slot to ZOMBI state"
    4120               << " PADDR = " << std::hex << r_dcache_save_paddr.read()
    4121               << " / WAY = "   << std::dec << r_dcache_miss_way.read()
    4122               << " / SET = "   << r_dcache_miss_set.read() << std::endl;
    4123 }
     4135if ( m_debug_activated )
     4136std::cout << "  <PROC " << name()
     4137          << " DCACHE_MISS_DIR_UPDT> Switch slot to ZOMBI state"
     4138          << " PADDR = " << std::hex << r_dcache_save_paddr.read()
     4139          << " / WAY = "   << std::dec << r_dcache_miss_way.read()
     4140          << " / SET = "   << r_dcache_miss_set.read() << std::endl;
    41244141#endif
    41254142                }
     
    41394156
    41404157#if DEBUG_DCACHE
    4141 if ( m_debug_dcache_fsm )
    4142 {
    4143     std::cout << "  <PROC " << name()
    4144               << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID state"
    4145               << " PADDR = " << std::hex << r_dcache_save_paddr.read()
    4146               << " / WAY = "   << std::dec << r_dcache_miss_way.read()
    4147               << " / SET = "   << r_dcache_miss_set.read() << std::endl;
    4148 
    4149 //    r_dcache.printTrace();
    4150 
    4151 
    4152 }
     4158if ( m_debug_activated )
     4159std::cout << "  <PROC " << name()
     4160          << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID state"
     4161          << " PADDR = " << std::hex << r_dcache_save_paddr.read()
     4162          << " / WAY = "   << std::dec << r_dcache_miss_way.read()
     4163          << " / SET = "   << r_dcache_miss_set.read() << std::endl;
    41534164#endif
    41544165                // reset directory extension
     
    43224333
    43234334#if DEBUG_DCACHE
    4324 if ( m_debug_dcache_fsm )
     4335if ( m_debug_activated )
    43254336{
    43264337    std::cout << "  <PROC " << name()
     
    43624373
    43634374#if DEBUG_DCACHE
    4364 if ( m_debug_dcache_fsm )
     4375if ( m_debug_activated )
    43654376{
    43664377    std::cout << "  <PROC " << name()
     
    43844395
    43854396#if DEBUG_DCACHE
    4386 if ( m_debug_dcache_fsm )
     4397if ( m_debug_activated )
    43874398{
    43884399    std::cout << "  <PROC " << name()
     
    43904401              << " r_dcache_vci_paddr = " << r_dcache_vci_paddr.read()
    43914402              << " mask = " << mask
    4392               << " (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) = " << (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT)
    4393               << " (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT) = " << (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT)
    4394               << " ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) = " << ((r_dcache_vci_paddr.read() & mask) == (paddr & mask))
     4403              << " (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) = "
     4404              << (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT)
     4405              << " (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT) = "
     4406              << (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT)
     4407              << " ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) = "
     4408              << ((r_dcache_vci_paddr.read() & mask) == (paddr & mask))
    43954409              <<std::endl;
    43964410}
     
    44204434            r_cc_receive_dcache_req = false;
    44214435#if DEBUG_DCACHE
    4422 if ( m_debug_dcache_fsm )
     4436if ( m_debug_activated )
    44234437{
    44244438    std::cout << "  <PROC " << name()
     
    44544468
    44554469#if DEBUG_DCACHE
    4456 if ( m_debug_dcache_fsm )
     4470if ( m_debug_activated )
    44574471{
    44584472    std::cout << "  <PROC " << name()
     
    45184532
    45194533#if DEBUG_DCACHE
    4520 if ( m_debug_dcache_fsm )
     4534if ( m_debug_activated )
    45214535{
    45224536    std::cout << "  <PROC " << name()
     
    45574571
    45584572#if DEBUG_DCACHE
    4559 if ( m_debug_dcache_fsm )
     4573if ( m_debug_activated )
    45604574{
    45614575    std::cout << "  <PROC " << name()
     
    45734587
    45744588#if DEBUG_DCACHE
    4575 if ( m_debug_dcache_fsm )
     4589if ( m_debug_activated )
    45764590{
    45774591    std::cout << "  <PROC " << name()
     
    46294643
    46304644#if DEBUG_DCACHE
    4631 if ( m_debug_dcache_fsm )
     4645if ( m_debug_activated )
    46324646{
    46334647    std::cout << "  <PROC " << name()
     
    46494663
    46504664#if DEBUG_DCACHE
    4651 if ( m_debug_dcache_fsm )
     4665if ( m_debug_activated )
    46524666{
    46534667    std::cout << "  <PROC " << name()
     
    47224736
    47234737#if DEBUG_DCACHE
    4724 if ( m_debug_dcache_fsm )
     4738if ( m_debug_activated )
    47254739{
    47264740    std::cout << "  <PROC " << name()
     
    47394753                r_dcache_cc_need_write = false;
    47404754#if DEBUG_DCACHE
    4741 if ( m_debug_dcache_fsm )
     4755if ( m_debug_activated )
    47424756{
    47434757    std::cout << "  <PROC " << name()
     
    47934807
    47944808#if DEBUG_DCACHE
    4795 if ( m_debug_dcache_fsm and ok )
     4809if ( m_debug_activated and ok )
    47964810{
    47974811    std::cout << "  <PROC " << name()
     
    48094823
    48104824#if DEBUG_DCACHE
    4811 if ( m_debug_dcache_fsm and ok )
    4812 {
    4813     std::cout << "  <PROC " << name()
    4814               << ".DCACHE_INVAL_TLB_SCAN> Invalidate DTLB entry:" << std::hex
    4815               << " line = " << line << std::dec
    4816               << " / set = " << set
    4817               << " / way = " << way << std::endl;
    4818 }
     4825if ( m_debug_activated and ok )
     4826std::cout << "  <PROC " << name() << " DCACHE_INVAL_TLB_SCAN>"
     4827          << " Invalidate DTLB entry" << std::hex
     4828          << " / line = " << line << std::dec
     4829          << " / set = " << set
     4830          << " / way = " << way << std::endl;
    48194831#endif
    48204832        }
     
    49114923        case CMD_IDLE:
    49124924        {
    4913             // DDACHE read requests (r_dcache_vci_miss_req or r_dcache_vci_ll_req), and
     4925            // DCACHE read requests (r_dcache_vci_miss_req or r_dcache_vci_ll_req), and
    49144926            // ICACHE read requests (r_icache_miss_req) require both a write_buffer access
    49154927            // to check a possible pending write on the same cache line.
     
    49364948                     or r_vci_cmd_imiss_prio.read() );
    49374949
    4938 
    49394950            // 1 - Data Read Miss
    49404951            if ( dcache_miss_req and r_wbuf.miss(r_dcache_vci_paddr.read()) )
     
    49704981            else if ( r_icache_unc_req.read() )
    49714982            {
    4972                 r_vci_cmd_fsm    = CMD_INS_UNC;
    4973                 r_icache_unc_req = false;
     4983                r_vci_cmd_fsm       = CMD_INS_UNC;
     4984                r_icache_unc_req    = false;
    49744985//                m_cpt_iunc_transaction++;
    49754986            }
     
    50005011//              m_cpt_cas_transaction++;
    50015012            }
     5013
     5014#if DEBUG_CMD
     5015if ( m_debug_activated )
     5016{
     5017std::cout << "  <PROC " << name() << " CMD_IDLE>"
     5018          << " / dmiss_req = " << dcache_miss_req
     5019          << " / imiss_req = " << icache_miss_req
     5020          << std::endl;
     5021}
     5022#endif
    50025023            break;
    50035024        }
     
    58205841
    58215842   
    5822     // Send coherence packets on DSPIN L2M
     5843    // Send coherence packets on DSPIN P2M
    58235844    // it depends on the CC_SEND FSM
    58245845
     
    58575878
    58585879                DspinDhccpParam::dspin_set(dspin_send_data,
    5859                                            r_dcache_cc_send_nline.read() & 0x300000000ULL,
     5880                                           (r_dcache_cc_send_nline.read() & 0x300000000ULL)>>32,
    58605881                                           DspinDhccpParam::CLEANUP_NLINE_MSB);
    58615882
     
    58795900
    58805901                DspinDhccpParam::dspin_set(dspin_send_data,
    5881                                            r_icache_cc_send_nline.read() & 0x300000000ULL,
     5902                                           (r_icache_cc_send_nline.read() & 0x300000000ULL)>>32,
    58825903                                           DspinDhccpParam::CLEANUP_NLINE_MSB);
    58835904
Note: See TracChangeset for help on using the changeset viewer.