Changeset 899


Ignore:
Timestamp:
Dec 3, 2014, 1:49:53 PM (9 years ago)
Author:
cfuguet
Message:

reconf: merge from the trunk (r891) the CONFIG FSM bugfix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/reconfiguration/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r871 r899  
    12691269        // The TGT_CMD_FSM controls the incoming VCI command pakets from the processors,
    12701270        // and dispatch these commands to the proper FSM through dedicated FIFOs.
     1271        // These READ/WRITE commands can be for the XRAM segment, or for the
     1272        // CONFIG segment:
    12711273        //
    1272         // There are 5 types of commands accepted in the XRAM segment:
     1274        // There are 5 types of commands accepted for the XRAM segment:
    12731275        // - READ   : A READ request has a length of 1 VCI flit. It can be a single word
    12741276        //            or an entire cache line, depending on the PLEN value => READ FSM
     
    12801282        //            acces key, second flit the data to write => WRITE FSM.
    12811283        //
    1282         // The READ/WRITE commands accepted in the configuration segment are targeting
     1284        // The READ/WRITE commands accepted for the CONFIG segment are targeting
    12831285        // configuration or status registers. They must contain one single flit.
    12841286        // - For almost all addressable registers, the response is returned immediately.
     
    13821384                break;
    13831385
    1384                 ///////////////////
     1386            ///////////////////
    13851387            case TGT_CMD_ERROR:  // response error must be sent
    13861388
     
    14131415                break;
    14141416
    1415                 ////////////////////
     1417            ////////////////////
    14161418            case TGT_CMD_CONFIG:    // execute config request and return response
    14171419            {
     
    14611463
    14621464                addr_t addr_lsb = p_vci_tgt.address.read() & m_config_addr_mask;
    1463 
    1464                 addr_t cell = (addr_lsb / vci_param_int::B);
    1465 
    1466                 size_t regr = cell & m_config_regr_idx_mask;
    1467 
    1468                 size_t func = (cell >> m_config_regr_width) & m_config_func_idx_mask;
     1465                addr_t cell     = (addr_lsb / vci_param_int::B);
     1466                size_t regr     = cell & m_config_regr_idx_mask;
     1467                size_t func     = (cell >> m_config_regr_width) & m_config_func_idx_mask;
    14691468
    14701469                bool     need_rsp;
     
    22862285            ////////////////////
    22872286            case CONFIG_TRT_SET:       // read data in cache
    2288             // and post a PUT request in TRT
     2287                                       // and post a PUT request in TRT
    22892288            {
    22902289                assert((r_alloc_dir_fsm.read() == ALLOC_DIR_CONFIG) and
     
    24812480                    not r_config_to_cc_send_brdcast_req.read())
    24822481                {
     2482                    // post first copy into FIFO
     2483                    config_to_cc_send_fifo_srcid = r_config_dir_copy_srcid.read();
     2484                    config_to_cc_send_fifo_inst  = r_config_dir_copy_inst.read();
     2485                    config_to_cc_send_fifo_put   = true;
     2486
     2487                    if (r_config_dir_count.read() == 1)  // only one copy
     2488                    {
     2489                        // post multi inval request
     2490                        r_config_to_cc_send_multi_req = true;
     2491                        r_config_to_cc_send_brdcast_req = false;
     2492                        r_config_to_cc_send_trdid = r_config_ivt_index.read();
     2493                        r_config_to_cc_send_nline = m_nline[(addr_t)(r_config_address.read())];
     2494
     2495                        // prepare next iteration (next line to be invalidated)
     2496                        r_config_cmd_lines = r_config_cmd_lines.read() - 1;
     2497                        r_config_address = r_config_address.read() + (m_words << 2);
     2498                        r_config_fsm = CONFIG_LOOP;
     2499                    }
     2500                    else                                   // several copies : must use heap
     2501                    {
     2502                        r_config_fsm = CONFIG_HEAP_REQ;
     2503                    }
     2504
     2505#if DEBUG_MEMC_CONFIG
     2506                    if (m_debug)
     2507                    {
     2508                        std::cout << "  <MEMC " << name() << " CONFIG_INVAL_SEND>"
     2509                            << " Post multi inval request to CC_SEND FSM"
     2510                            << " / address = " << std::hex << r_config_address.read()
     2511                            << " / copy = " << r_config_dir_copy_srcid.read()
     2512                            << " / inst = " << std::dec << r_config_dir_copy_inst.read() << std::endl;
     2513                    }
     2514#endif
     2515                }
     2516                break;
     2517            }
     2518            /////////////////////
     2519            case CONFIG_HEAP_REQ:  // Try to get access to Heap
     2520            {
     2521                if (r_alloc_heap_fsm.read() == ALLOC_HEAP_CONFIG)
     2522                {
     2523                    r_config_fsm = CONFIG_HEAP_SCAN;
     2524                    r_config_heap_next = r_config_dir_ptr.read();
     2525                }
     2526
     2527#if DEBUG_MEMC_CONFIG
     2528                if (m_debug)
     2529                {
     2530                    std::cout << "  <MEMC " << name() << " CONFIG_HEAP_REQ>"
     2531                        << " Requesting HEAP lock" << std::endl;
     2532                }
     2533#endif
     2534                break;
     2535            }
     2536            //////////////////////
     2537            case CONFIG_HEAP_SCAN: // scan HEAP and send inval to CC_SEND FSM
     2538            {
     2539                HeapEntry entry = m_heap.read(r_config_heap_next.read());
     2540                bool last_copy = (entry.next == r_config_heap_next.read());
     2541
     2542                // post one more copy into fifo
     2543                config_to_cc_send_fifo_srcid = entry.owner.srcid;
     2544                config_to_cc_send_fifo_inst = entry.owner.inst;
     2545                config_to_cc_send_fifo_put = true;
     2546
     2547                assert ( (m_config_to_cc_send_inst_fifo.wok()) and
     2548                        "MEMC ERROR in CONFIG_HEAP_SCAN: The m_config_to_cc_send fifo should never overflow");
     2549
     2550                r_config_heap_next = entry.next;
     2551                if (last_copy)
     2552                {
    24832553                    // post multi inval request
    24842554                    r_config_to_cc_send_multi_req = true;
     
    24872557                    r_config_to_cc_send_nline = m_nline[(addr_t)(r_config_address.read())];
    24882558
    2489                     // post data into FIFO
    2490                     config_to_cc_send_fifo_srcid = r_config_dir_copy_srcid.read();
    2491                     config_to_cc_send_fifo_inst  = r_config_dir_copy_inst.read();
    2492                     config_to_cc_send_fifo_put   = true;
    2493 
    2494                     if (r_config_dir_count.read() == 1)  // one copy
    2495                     {
    2496                         // prepare next iteration
    2497                         r_config_cmd_lines = r_config_cmd_lines.read() - 1;
    2498                         r_config_address = r_config_address.read() + (m_words << 2);
    2499                         r_config_fsm = CONFIG_LOOP;
    2500                     }
    2501                     else                                   // several copies
    2502                     {
    2503                         r_config_fsm = CONFIG_HEAP_REQ;
    2504                     }
    2505 
    2506 #if DEBUG_MEMC_CONFIG
    2507                     if (m_debug)
    2508                     {
    2509                         std::cout << "  <MEMC " << name() << " CONFIG_INVAL_SEND>"
    2510                             << " Post multi inval request to CC_SEND FSM"
    2511                             << " / address = " << std::hex << r_config_address.read()
    2512                             << " / copy = " << r_config_dir_copy_srcid.read()
    2513                             << " / inst = " << std::dec << r_config_dir_copy_inst.read() << std::endl;
    2514                     }
    2515 #endif
    2516                 }
    2517                 break;
    2518             }
    2519             /////////////////////
    2520             case CONFIG_HEAP_REQ:  // Try to get access to Heap
    2521             {
    2522                 if (r_alloc_heap_fsm.read() == ALLOC_HEAP_CONFIG)
    2523                 {
    2524                     r_config_fsm = CONFIG_HEAP_SCAN;
    2525                     r_config_heap_next = r_config_dir_ptr.read();
    2526                 }
    2527 
    2528 #if DEBUG_MEMC_CONFIG
    2529                 if (m_debug)
    2530                 {
    2531                     std::cout << "  <MEMC " << name() << " CONFIG_HEAP_REQ>"
    2532                         << " Requesting HEAP lock" << std::endl;
    2533                 }
    2534 #endif
    2535                 break;
    2536             }
    2537             //////////////////////
    2538             case CONFIG_HEAP_SCAN: // scan HEAP and send inval to CC_SEND FSM
    2539             {
    2540                 HeapEntry entry = m_heap.read(r_config_heap_next.read());
    2541                 bool last_copy = (entry.next == r_config_heap_next.read());
    2542 
    2543                 config_to_cc_send_fifo_srcid = entry.owner.srcid;
    2544                 config_to_cc_send_fifo_inst = entry.owner.inst;
    2545                 config_to_cc_send_fifo_put = true;
    2546 
    2547                 if (m_config_to_cc_send_inst_fifo.wok()) // inval request accepted
    2548                 {
    2549                     r_config_heap_next = entry.next;
    2550                     if (last_copy) r_config_fsm = CONFIG_HEAP_LAST;
    2551                 }
    2552 
     2559                    // prepare next iteration (next line to be invalidated)
     2560                    r_config_cmd_lines = r_config_cmd_lines.read() - 1;
     2561                    r_config_address = r_config_address.read() + (m_words << 2);
     2562                    r_config_fsm = CONFIG_HEAP_LAST;
     2563                }
    25532564#if DEBUG_MEMC_CONFIG
    25542565                if (m_debug)
     
    25842595                m_heap.write(r_config_heap_next.read(), last_entry);
    25852596
    2586                 // prepare next iteration
    2587                 r_config_cmd_lines = r_config_cmd_lines.read() - 1;
    2588                 r_config_address   = r_config_address.read() + (m_words << 2);
    25892597                r_config_fsm       = CONFIG_LOOP;
    25902598
     
    55255533            //////////////////////
    55265534            case CLEANUP_HEAP_LOCK:      // two cases are handled in this state :
    5527             // 1. the matching copy is directly in the directory
    5528             // 2. the matching copy is the first copy in the heap
     5535                                         // 1. the matching copy is directly in the directory
     5536                                         // 2. the matching copy is the first copy in the heap
    55295537            {
    55305538                assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) and
     
    56205628            ////////////////////////
    56215629            case CLEANUP_HEAP_SEARCH:     // This state is handling the case where the copy
    5622             // is in the heap, but not the first in linked list
     5630                                          // is in the heap, but not the first in linked list
    56235631            {
    56245632                assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) and
     
    57515759            //////////////////////
    57525760            case CLEANUP_IVT_LOCK:   // get the lock protecting the IVT to search a pending
    5753             // invalidate transaction matching the cleanup
     5761                                     // invalidate transaction matching the cleanup
    57545762            {
    57555763                if (r_alloc_ivt_fsm.read() != ALLOC_IVT_CLEANUP) break;
     
    58215829            ///////////////////////
    58225830            case CLEANUP_IVT_CLEAR:    // Clear IVT entry
    5823             // Acknowledge CONFIG FSM if required
     5831                                       // Acknowledge CONFIG FSM if required
    58245832            {
    58255833                assert((r_alloc_ivt_fsm.read() == ALLOC_IVT_CLEANUP) and
Note: See TracChangeset for help on using the changeset viewer.