Changeset 535 for trunk


Ignore:
Timestamp:
Sep 26, 2013, 11:43:56 AM (11 years ago)
Author:
cfuguet
Message:

Modification in vci_mem_cache:

  • When a BROADCAST INVALIDATE is needed after a WRITE request, the the data from the cache is merged with the new data of the WRITE request.

Before this commit, the DATA from the cache was read in the
WRITE_DIR_LOCK state, but this creates a critical path RAM-to-RAM.
Therefore, this commit changes the state for read the data to
WRITE_BC_DIR_READ and because the synchronous behavior of the
RAMs, the data is available in the WRITE_BC_TRT_LOCK state.

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

Legend:

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

    r530 r535  
    449449      uint32_t     m_cpt_write_miss;     // Number of MISS WRITE
    450450      uint32_t     m_cpt_write_dirty;    // Cumulated length for WRITE transactions
     451      uint32_t     m_cpt_write_broadcast;// Number of BROADCAST INVAL because write
    451452
    452453      uint32_t     m_cpt_trt_rb;         // Read blocked by a hit in trt
     
    724725      sc_signal<bool>     r_write_sc_fail;            // sc command failed
    725726      sc_signal<data_t>   r_write_sc_key;             // sc command key
     727      sc_signal<bool>     r_write_bc_data_we;         // Write enable for data buffer
    726728
    727729      // Buffer between WRITE fsm and TGT_RSP fsm (acknowledge a write command from L1)
  • trunk/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r531 r535  
    739739                << "[036] PUT (UNIMPLEMENTED)       = " << m_cpt_put << std::endl
    740740                << "[037] GET (UNIMPLEMENTED)       = " << m_cpt_get << std::endl
     741                << "[038] WRITE BROADCAST           = " << m_cpt_write_broadcast << std::endl
    741742                << std::endl;
    742743        }
     
    974975            m_cpt_cleanup_cost       = 0;
    975976
    976             m_cpt_read_miss     = 0;
    977             m_cpt_write_miss    = 0;
    978             m_cpt_write_dirty   = 0;
    979             m_cpt_trt_rb        = 0;
    980             m_cpt_trt_full      = 0;
    981             m_cpt_get           = 0;
    982             m_cpt_put           = 0;
     977            m_cpt_read_miss       = 0;
     978            m_cpt_write_miss      = 0;
     979            m_cpt_write_dirty     = 0;
     980            m_cpt_write_broadcast = 0;
     981            m_cpt_trt_rb          = 0;
     982            m_cpt_trt_full        = 0;
     983            m_cpt_get             = 0;
     984            m_cpt_put             = 0;
    983985
    984986            return;
     
    34023404#if DEBUG_MEMC_WRITE
    34033405                        if (m_debug)
    3404                             std::cout << "  <MEMC " << name() << " WRITE_MISS_XRAM_REQ> Post a GET request to the IXR_CMD FSM" << std::endl;
     3406                            std::cout << "  <MEMC " << name()
     3407                                      << " WRITE_MISS_XRAM_REQ> Post a GET request to the"
     3408                                      << " IXR_CMD FSM" << std::endl;
    34053409#endif
    34063410                    }
     
    34093413                ///////////////////////
    34103414            case WRITE_BC_DIR_READ:  // enter this state if a broadcast-inval is required
    3411                 // the cache line must be erased in mem-cache, and written
    3412                 // into XRAM. we read the cache and complete the buffer
     3415                                     // the cache line must be erased in mem-cache, and written
     3416                                     // into XRAM.
    34133417                {
    34143418                    assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE) and
    34153419                            "MEMC ERROR in WRITE_BC_DIR_READ state: Bad DIR allocation");
    34163420
    3417                     // update local buffer
    3418                     size_t set  = m_y[(addr_t)(r_write_address.read())];
    3419                     size_t way  = r_write_way.read();
    3420                     for(size_t word=0 ; word<m_words ; word++)
    3421                     {
    3422                         data_t mask = 0;
    3423                         if (r_write_be[word].read() & 0x1) mask = mask | 0x000000FF;
    3424                         if (r_write_be[word].read() & 0x2) mask = mask | 0x0000FF00;
    3425                         if (r_write_be[word].read() & 0x4) mask = mask | 0x00FF0000;
    3426                         if (r_write_be[word].read() & 0x8) mask = mask | 0xFF000000;
    3427 
    3428                         // complete only if mask is not null (for energy consumption)
    3429                         r_write_data[word]  = (r_write_data[word].read() & mask) |
    3430                             (m_cache_data.read(way, set, word) & ~mask);
    3431                     } // end for
     3421                    m_cpt_write_broadcast++;
     3422
     3423                    // write enable signal for data buffer.
     3424                    r_write_bc_data_we = true;
    34323425
    34333426                    r_write_fsm = WRITE_BC_TRT_LOCK;
     
    34363429                    if (m_debug)
    34373430                        std::cout << "  <MEMC " << name() << " WRITE_BC_DIR_READ>"
    3438                             << " Read the cache to complete local buffer" << std::endl;
     3431                                  << " Read the cache to complete local buffer" << std::endl;
    34393432#endif
    34403433                    break;
     
    34463439                            "MEMC ERROR in WRITE_BC_TRT_LOCK state: Bad DIR allocation");
    34473440
    3448                     if (r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE)
    3449                     {
    3450                         size_t wok_index = 0;
    3451                         bool wok = not m_trt.full(wok_index);
    3452                         if (wok )       
    3453                         {
    3454                             r_write_trt_index = wok_index;
    3455                             r_write_fsm       = WRITE_BC_IVT_LOCK;
    3456                         }
    3457                         else  // wait an empty slot in TRT
    3458                         {
    3459                             r_write_fsm       = WRITE_WAIT;
    3460                         }
    3461 
     3441                    // We read the cache and complete the buffer. As the DATA cache uses a
     3442                    // synchronous RAM, the read DATA request has been performed in the
     3443                    // WRITE_BC_DIR_READ state but the data is available in this state.
     3444                    if (r_write_bc_data_we.read())
     3445                    {
     3446                        size_t set  = m_y[(addr_t)(r_write_address.read())];
     3447                        size_t way  = r_write_way.read();
     3448                        for(size_t word=0 ; word<m_words ; word++)
     3449                        {
     3450                            data_t mask = 0;
     3451                            if (r_write_be[word].read() & 0x1) mask = mask | 0x000000FF;
     3452                            if (r_write_be[word].read() & 0x2) mask = mask | 0x0000FF00;
     3453                            if (r_write_be[word].read() & 0x4) mask = mask | 0x00FF0000;
     3454                            if (r_write_be[word].read() & 0x8) mask = mask | 0xFF000000;
     3455
     3456                            // complete only if mask is not null (for energy consumption)
     3457                            r_write_data[word] =
     3458                                (r_write_data[word].read()         &  mask) |
     3459                                (m_cache_data.read(way, set, word) & ~mask);
     3460                        }
    34623461#if DEBUG_MEMC_WRITE
    34633462                        if (m_debug)
    3464                             std::cout << "  <MEMC " << name() << " WRITE_BC_TRT_LOCK> Check TRT"
    3465                                 << " : wok = " << wok << " / index = " << wok_index << std::endl;
    3466 #endif
    3467                     }
     3463                            std::cout
     3464                                << "  <MEMC "  << name()
     3465                                << " WRITE_BC_TRT_LOCK> Complete data buffer" << std::endl;
     3466#endif
     3467                    }
     3468
     3469                    if (r_alloc_trt_fsm.read() != ALLOC_TRT_WRITE)
     3470                    {
     3471                        // if we loop in this state, the data does not need to be
     3472                        // rewritten (for energy consuption)
     3473                        r_write_bc_data_we = false;
     3474                        break;
     3475                    }
     3476
     3477                    size_t wok_index = 0;
     3478                    bool wok = not m_trt.full(wok_index);
     3479                    if (wok )       
     3480                    {
     3481                        r_write_trt_index = wok_index;
     3482                        r_write_fsm       = WRITE_BC_IVT_LOCK;
     3483                    }
     3484                    else  // wait an empty slot in TRT
     3485                    {
     3486                        r_write_fsm       = WRITE_WAIT;
     3487                    }
     3488
     3489#if DEBUG_MEMC_WRITE
     3490                    if (m_debug)
     3491                        std::cout << "  <MEMC "  << name()
     3492                                  << " WRITE_BC_TRT_LOCK> Check TRT : wok = " << wok
     3493                                  << " / index = " << wok_index << std::endl;
     3494#endif
    34683495                    break;
    34693496                }
Note: See TracChangeset for help on using the changeset viewer.