Ignore:
Timestamp:
Nov 27, 2014, 7:37:58 PM (9 years ago)
Author:
alain
Message:

Bug fix in the CONFIG_FSM: The communication channel
between the CONFIG_FSM and the CC_SEND FSM was unsafe:
we now fill the FIFO before activating the request flip-flop.

File:
1 edited

Legend:

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

    r836 r891  
    12431243        // The TGT_CMD_FSM controls the incoming VCI command pakets from the processors,
    12441244        // and dispatch these commands to the proper FSM through dedicated FIFOs.
     1245        // These READ/WRITE commands can be for the XRAM segment, or for the
     1246        // CONFIG segment:
    12451247        //
    1246         // There are 5 types of commands accepted in the XRAM segment:
     1248        // There are 5 types of commands accepted for the XRAM segment:
    12471249        // - READ   : A READ request has a length of 1 VCI flit. It can be a single word
    12481250        //            or an entire cache line, depending on the PLEN value => READ FSM
     
    12541256        //            acces key, second flit the data to write => WRITE FSM.
    12551257        //
    1256         // The READ/WRITE commands accepted in the configuration segment are targeting
     1258        // The READ/WRITE commands accepted for the CONFIG segment are targeting
    12571259        // configuration or status registers. They must contain one single flit.
    12581260        // - For almost all addressable registers, the response is returned immediately.
     
    12681270                {
    12691271#if DEBUG_MEMC_TGT_CMD
    1270                     if (m_debug)
    1271                     {
    1272                         std::cout << "  <MEMC " << name()
    1273                             << " TGT_CMD_IDLE> Receive command from srcid "
    1274                             << std::hex << p_vci_tgt.srcid.read()
    1275                             << " / address " << std::hex << p_vci_tgt.address.read() << std::endl;
    1276                     }
     1272if (m_debug)
     1273std::cout << "  <MEMC " << name()
     1274          << " TGT_CMD_IDLE> Receive command from srcid "
     1275          << std::hex << p_vci_tgt.srcid.read()
     1276          << " / address " << std::hex << p_vci_tgt.address.read() << std::endl;
    12771277#endif
    12781278                    // checking segmentation violation
     
    13071307                            // ==> mask = 0b0100 = 0x4
    13081308                            assert(((p_vci_tgt.pktid.read() & 0x4) == 0x0) and
    1309                                     "The type specified in the pktid field is incompatible with the READ CMD");
     1309                            "The type specified in the pktid field is incompatible with the READ CMD");
    13101310                            r_tgt_cmd_fsm = TGT_CMD_READ;
    13111311                        }
     
    13151315                            // ==> TYPE_WRITE = X100 with the TSAR encoding
    13161316                            // ==> mask = 0b0111 = 0x7
    1317                             assert((((p_vci_tgt.pktid.read() & 0x7) == 0x4)  or ((p_vci_tgt.pktid.read() & 0x7) == 0x0)) and
    1318                                     "The type specified in the pktid field is incompatible with the WRITE CMD");
     1317                            assert((((p_vci_tgt.pktid.read() & 0x7) == 0x4)  or
     1318                                  ((p_vci_tgt.pktid.read() & 0x7) == 0x0)) and
     1319                            "The type specified in the pktid field is incompatible with the WRITE CMD");
    13191320                            r_tgt_cmd_fsm = TGT_CMD_WRITE;
    13201321                        }
     
    13251326                            // ==> mask = 0b0111 = 0x7
    13261327                            assert(((p_vci_tgt.pktid.read() & 0x7) == 0x6) and
    1327                                     "The type specified in the pktid field is incompatible with the LL CMD");
     1328                            "The type specified in the pktid field is incompatible with the LL CMD");
    13281329                            r_tgt_cmd_fsm = TGT_CMD_READ;
    13291330                        }
     
    13371338                            // ==> mask = 0b0101 = 0x5
    13381339                            assert(((p_vci_tgt.pktid.read() & 0x5) == 0x5) and
    1339                                     "The type specified in the pktid field is incompatible with the NOP CMD");
     1340                            "The type specified in the pktid field is incompatible with the NOP CMD");
    13401341
    13411342                            if ((p_vci_tgt.pktid.read() & 0x7) == TYPE_CAS)
     
    13561357                break;
    13571358
    1358                 ///////////////////
     1359            ///////////////////
    13591360            case TGT_CMD_ERROR:  // response error must be sent
    13601361
     
    13731374
    13741375#if DEBUG_MEMC_TGT_CMD
    1375                     if (m_debug)
    1376                     {
    1377                         std::cout << "  <MEMC " << name()
    1378                             << " TGT_CMD_ERROR> Segmentation violation:"
    1379                             << " address = " << std::hex << p_vci_tgt.address.read()
    1380                             << " / srcid = " << p_vci_tgt.srcid.read()
    1381                             << " / trdid = " << p_vci_tgt.trdid.read()
    1382                             << " / pktid = " << p_vci_tgt.pktid.read()
    1383                             << " / plen = " << std::dec << p_vci_tgt.plen.read() << std::endl;
    1384                     }
    1385 #endif
    1386                 }
    1387                 break;
    1388 
    1389                 ////////////////////
     1376if (m_debug)
     1377std::cout << "  <MEMC " << name()
     1378          << " TGT_CMD_ERROR> Segmentation violation:"
     1379          << " address = " << std::hex << p_vci_tgt.address.read()
     1380          << " / srcid = " << p_vci_tgt.srcid.read()
     1381          << " / trdid = " << p_vci_tgt.trdid.read()
     1382          << " / pktid = " << p_vci_tgt.pktid.read()
     1383          << " / plen = " << std::dec << p_vci_tgt.plen.read() << std::endl;
     1384#endif
     1385                }
     1386                break;
     1387
     1388            ////////////////////
    13901389            case TGT_CMD_CONFIG:    // execute config request and return response
    13911390            {
     
    14351434
    14361435                addr_t addr_lsb = p_vci_tgt.address.read() & m_config_addr_mask;
    1437 
    1438                 addr_t cell = (addr_lsb / vci_param_int::B);
    1439 
    1440                 size_t regr = cell & m_config_regr_idx_mask;
    1441 
    1442                 size_t func = (cell >> m_config_regr_width) & m_config_func_idx_mask;
     1436                addr_t cell     = (addr_lsb / vci_param_int::B);
     1437                size_t regr     = cell & m_config_regr_idx_mask;
     1438                size_t func     = (cell >> m_config_regr_width) & m_config_func_idx_mask;
    14431439
    14441440                bool     need_rsp;
     
    14711467                        {
    14721468                            assert(((wdata % (m_words * vci_param_int::B)) == 0) and
    1473                                     "VCI_MEM_CACHE CONFIG ERROR: The buffer must be aligned on a cache line");
     1469                            "VCI_MEM_CACHE CONFIG ERROR: The buffer must be aligned on a cache line");
    14741470
    14751471                            need_rsp = true;
     
    20632059
    20642060#if DEBUG_MEMC_CONFIG
    2065                     if (m_debug)
    2066                     {
    2067                         std::cout << "  <MEMC " << name() << " CONFIG_IDLE> Config Request received"
    2068                             << " / address = " << std::hex << r_config_address.read()
    2069                             << " / lines = " << std::dec << r_config_cmd_lines.read()
    2070                             << " / type = " << r_config_cmd.read() << std::endl;
    2071                     }
     2061if (m_debug)
     2062std::cout << "  <MEMC " << name() << " CONFIG_IDLE> Config Request received"
     2063          << " / address = " << std::hex << r_config_address.read()
     2064          << " / lines = " << std::dec << r_config_cmd_lines.read()
     2065          << " / type = " << r_config_cmd.read() << std::endl;
    20722066#endif
    20732067                }
     
    20882082
    20892083#if DEBUG_MEMC_CONFIG
    2090                 if (m_debug)
    2091                 {
    2092                     std::cout << "  <MEMC " << name() << " CONFIG_LOOP>"
    2093                         << " / address = " << std::hex << r_config_address.read()
    2094                         << " / lines not handled = " << std::dec << r_config_cmd_lines.read()
    2095                         << " / command = " << r_config_cmd.read() << std::endl;
    2096                 }
     2084if (m_debug)
     2085std::cout << "  <MEMC " << name() << " CONFIG_LOOP>"
     2086          << " / address = " << std::hex << r_config_address.read()
     2087          << " / lines not handled = " << std::dec << r_config_cmd_lines.read()
     2088          << " / command = " << r_config_cmd.read() << std::endl;
    20972089#endif
    20982090                break;
     
    21072099
    21082100#if DEBUG_MEMC_CONFIG
    2109                 if (m_debug)
    2110                 {
    2111                     std::cout << "  <MEMC " << name() << " CONFIG_WAIT>"
    2112                         << " / lines to do = " << std::dec << r_config_rsp_lines.read() << std::endl;
    2113                 }
     2101if (m_debug)
     2102std::cout << "  <MEMC " << name() << " CONFIG_WAIT>"
     2103          << " / lines to do = " << std::dec << r_config_rsp_lines.read() << std::endl;
    21142104#endif
    21152105                break;
     
    21282118
    21292119#if DEBUG_MEMC_CONFIG
    2130                     if (m_debug)
    2131                     {
    2132                         std::cout << "  <MEMC " << name() << " CONFIG_RSP> Request TGT_RSP FSM to send response:"
    2133                             << " error = " << r_config_to_tgt_rsp_error.read()
    2134                             << " / rsrcid = " << std::hex << r_config_srcid.read()
    2135                             << " / rtrdid = " << std::hex << r_config_trdid.read()
    2136                             << " / rpktid = " << std::hex << r_config_pktid.read() << std::endl;
    2137                     }
     2120if (m_debug)
     2121std::cout << "  <MEMC " << name() << " CONFIG_RSP> Request TGT_RSP FSM to send response:"
     2122          << " error = " << r_config_to_tgt_rsp_error.read()
     2123          << " / rsrcid = " << std::hex << r_config_srcid.read()
     2124          << " / rtrdid = " << std::hex << r_config_trdid.read()
     2125          << " / rpktid = " << std::hex << r_config_pktid.read() << std::endl;
    21382126#endif
    21392127                }
     
    21492137
    21502138#if DEBUG_MEMC_CONFIG
    2151                 if (m_debug)
    2152                 {
    2153                     std::cout << "  <MEMC " << name() << " CONFIG_DIR_REQ>"
    2154                         << " Request DIR access" << std::endl;
    2155                 }
     2139if (m_debug)
     2140std::cout << "  <MEMC " << name() << " CONFIG_DIR_REQ>"
     2141          << " Request DIR access" << std::endl;
    21562142#endif
    21572143                break;
     
    21932179
    21942180#if DEBUG_MEMC_CONFIG
    2195                 if (m_debug)
    2196                 {
    2197                     std::cout << "  <MEMC " << name() << " CONFIG_DIR_ACCESS> Accessing directory: "
    2198                         << " address = " << std::hex << r_config_address.read()
    2199                         << " / hit = " << std::dec << entry.valid
    2200                         << " / dirty = " << entry.dirty
    2201                         << " / count = " << entry.count
    2202                         << " / is_cnt = " << entry.is_cnt << std::endl;
    2203                 }
     2181if (m_debug)
     2182std::cout << "  <MEMC " << name() << " CONFIG_DIR_ACCESS> Accessing directory: "
     2183          << " address = " << std::hex << r_config_address.read()
     2184          << " / hit = " << std::dec << entry.valid
     2185          << " / dirty = " << entry.dirty
     2186          << " / count = " << entry.count
     2187          << " / is_cnt = " << entry.is_cnt << std::endl;
    22042188#endif
    22052189                break;
     
    22482232
    22492233#if DEBUG_MEMC_CONFIG
    2250                     if (m_debug)
    2251                     {
    2252                         std::cout << "  <MEMC " << name() << " CONFIG_TRT_LOCK> Access TRT: "
    2253                             << " wok = " << std::dec << wok
    2254                             << " index = " << index << std::endl;
    2255                     }
     2234if (m_debug)
     2235std::cout << "  <MEMC " << name() << " CONFIG_TRT_LOCK> Access TRT: "
     2236          << " wok = " << std::dec << wok
     2237          << " index = " << index << std::endl;
    22562238#endif
    22572239                }
     
    22602242            ////////////////////
    22612243            case CONFIG_TRT_SET:       // read data in cache
    2262             // and post a PUT request in TRT
     2244                                       // and post a PUT request in TRT
    22632245            {
    22642246                assert((r_alloc_dir_fsm.read() == ALLOC_DIR_CONFIG) and
     
    22972279
    22982280#if DEBUG_MEMC_CONFIG
    2299                 if (m_debug)
    2300                 {
    2301                     std::cout << "  <MEMC " << name() << " CONFIG_TRT_SET> PUT request in TRT:"
    2302                         << " address = " << std::hex << r_config_address.read()
    2303                         << " index = " << std::dec << r_config_trt_index.read() << std::endl;
    2304                 }
     2281if (m_debug)
     2282std::cout << "  <MEMC " << name() << " CONFIG_TRT_SET> PUT request in TRT:"
     2283          << " address = " << std::hex << r_config_address.read()
     2284          << " index = " << std::dec << r_config_trt_index.read() << std::endl;
    23052285#endif
    23062286                break;
     
    23202300
    23212301#if DEBUG_MEMC_CONFIG
    2322                     if (m_debug)
    2323                     {
    2324                         std::cout << "  <MEMC " << name() << " CONFIG_PUT_REQ> post PUT request to IXR_CMD_FSM"
    2325                             << " / address = " << std::hex << r_config_address.read() << std::endl;
    2326                     }
     2302if (m_debug)
     2303std::cout << "  <MEMC " << name() << " CONFIG_PUT_REQ> post PUT request to IXR_CMD_FSM"
     2304          << " / address = " << std::hex << r_config_address.read() << std::endl;
    23272305#endif
    23282306                }
     
    23522330
    23532331#if DEBUG_MEMC_CONFIG
    2354                         if (m_debug)
    2355                         {
    2356                             std::cout << "  <MEMC " << name() << " CONFIG_IVT_LOCK>"
    2357                                 << " No copies in L1 : inval DIR entry"  << std::endl;
    2358                         }
     2332if (m_debug)
     2333std::cout << "  <MEMC " << name() << " CONFIG_IVT_LOCK>"
     2334          << " No copies in L1 : inval DIR entry"  << std::endl;
    23592335#endif
    23602336                    }
     
    23962372
    23972373#if DEBUG_MEMC_CONFIG
    2398                             if (m_debug)
    2399                             {
    2400                                 std::cout << "  <MEMC " << name() << " CONFIG_IVT_LOCK>"
    2401                                     << " Inval DIR entry and register inval in IVT"
    2402                                     << " / index = " << std::dec << index
    2403                                     << " / broadcast = " << broadcast << std::endl;
    2404                             }
     2374if (m_debug)
     2375std::cout << "  <MEMC " << name() << " CONFIG_IVT_LOCK>"
     2376          << " Inval DIR entry and register inval in IVT"
     2377          << " / index = " << std::dec << index
     2378          << " / broadcast = " << broadcast << std::endl;
    24052379#endif
    24062380                        }
     
    24102384
    24112385#if DEBUG_MEMC_CONFIG
    2412                             if (m_debug)
    2413                             {
    2414                                 std::cout << "  <MEMC " << name() << " CONFIG_IVT_LOCK>"
    2415                                     << " IVT full : release DIR & IVT locks and retry" << std::endl;
    2416                             }
     2386if (m_debug)
     2387std::cout << "  <MEMC " << name() << " CONFIG_IVT_LOCK>"
     2388          << " IVT full : release DIR & IVT locks and retry" << std::endl;
    24172389#endif
    24182390                        }
     
    24392411
    24402412#if DEBUG_MEMC_CONFIG
    2441                     if (m_debug)
    2442                     {
    2443                         std::cout << "  <MEMC " << name() << " CONFIG_BC_SEND>"
    2444                             << " Post a broadcast inval request to CC_SEND FSM"
    2445                             << " / address = " << r_config_address.read() <<std::endl;
    2446                     }
     2413if (m_debug)
     2414std::cout << "  <MEMC " << name() << " CONFIG_BC_SEND>"
     2415          << " Post a broadcast inval request to CC_SEND FSM"
     2416          << " / address = " << r_config_address.read() <<std::endl;
    24472417#endif
    24482418                }
     
    24542424                if (not r_config_to_cc_send_multi_req.read() and
    24552425                    not r_config_to_cc_send_brdcast_req.read())
     2426                {
     2427                    // post first copy into FIFO
     2428                    config_to_cc_send_fifo_srcid = r_config_dir_copy_srcid.read();
     2429                    config_to_cc_send_fifo_inst  = r_config_dir_copy_inst.read();
     2430                    config_to_cc_send_fifo_put   = true;
     2431
     2432                    if (r_config_dir_count.read() == 1)  // only one copy
     2433                    {
     2434                        // post multi inval request
     2435                        r_config_to_cc_send_multi_req = true;
     2436                        r_config_to_cc_send_brdcast_req = false;
     2437                        r_config_to_cc_send_trdid = r_config_ivt_index.read();
     2438                        r_config_to_cc_send_nline = m_nline[(addr_t)(r_config_address.read())];
     2439
     2440                        // prepare next iteration (next line to be invalidated)
     2441                        r_config_cmd_lines = r_config_cmd_lines.read() - 1;
     2442                        r_config_address = r_config_address.read() + (m_words << 2);
     2443                        r_config_fsm = CONFIG_LOOP;
     2444                    }
     2445                    else                                   // several copies : must use heap
     2446                    {
     2447                        r_config_fsm = CONFIG_HEAP_REQ;
     2448                    }
     2449
     2450#if DEBUG_MEMC_CONFIG
     2451if (m_debug)
     2452std::cout << "  <MEMC " << name() << " CONFIG_INVAL_SEND>"
     2453          << " Post multi inval request to CC_SEND FSM"
     2454          << " / address = " << std::hex << r_config_address.read()
     2455          << " / copy = " << r_config_dir_copy_srcid.read()
     2456          << " / inst = " << std::dec << r_config_dir_copy_inst.read() << std::endl;
     2457#endif
     2458                }
     2459                break;
     2460            }
     2461            /////////////////////
     2462            case CONFIG_HEAP_REQ:  // Try to get access to Heap
     2463            {
     2464                if (r_alloc_heap_fsm.read() == ALLOC_HEAP_CONFIG)
     2465                {
     2466                    r_config_fsm = CONFIG_HEAP_SCAN;
     2467                    r_config_heap_next = r_config_dir_ptr.read();
     2468                }
     2469
     2470#if DEBUG_MEMC_CONFIG
     2471if (m_debug)
     2472std::cout << "  <MEMC " << name() << " CONFIG_HEAP_REQ>"
     2473          << " Requesting HEAP lock" << std::endl;
     2474#endif
     2475                break;
     2476            }
     2477            //////////////////////
     2478            case CONFIG_HEAP_SCAN: // scan HEAP and send inval to CC_SEND FSM
     2479            {
     2480                HeapEntry entry = m_heap.read(r_config_heap_next.read());
     2481                bool last_copy = (entry.next == r_config_heap_next.read());
     2482
     2483                // post one more copy into fifo
     2484                config_to_cc_send_fifo_srcid = entry.owner.srcid;
     2485                config_to_cc_send_fifo_inst = entry.owner.inst;
     2486                config_to_cc_send_fifo_put = true;
     2487
     2488                assert ( (m_config_to_cc_send_inst_fifo.wok()) and
     2489                "MEMC ERROR in CONFIG_HEAP_SCAN: The m_config_to_cc_send fifo should never overflow");
     2490
     2491                r_config_heap_next = entry.next;
     2492                if (last_copy)
    24562493                {
    24572494                    // post multi inval request
     
    24612498                    r_config_to_cc_send_nline = m_nline[(addr_t)(r_config_address.read())];
    24622499
    2463                     // post data into FIFO
    2464                     config_to_cc_send_fifo_srcid = r_config_dir_copy_srcid.read();
    2465                     config_to_cc_send_fifo_inst  = r_config_dir_copy_inst.read();
    2466                     config_to_cc_send_fifo_put   = true;
    2467 
    2468                     if (r_config_dir_count.read() == 1)  // one copy
    2469                     {
    2470                         // prepare next iteration
    2471                         r_config_cmd_lines = r_config_cmd_lines.read() - 1;
    2472                         r_config_address = r_config_address.read() + (m_words << 2);
    2473                         r_config_fsm = CONFIG_LOOP;
    2474                     }
    2475                     else                                   // several copies
    2476                     {
    2477                         r_config_fsm = CONFIG_HEAP_REQ;
    2478                     }
    2479 
     2500                    // prepare next iteration (next line to be invalidated)
     2501                    r_config_cmd_lines = r_config_cmd_lines.read() - 1;
     2502                    r_config_address = r_config_address.read() + (m_words << 2);
     2503                    r_config_fsm = CONFIG_HEAP_LAST;
     2504                }
    24802505#if DEBUG_MEMC_CONFIG
    2481                     if (m_debug)
    2482                     {
    2483                         std::cout << "  <MEMC " << name() << " CONFIG_INVAL_SEND>"
    2484                             << " Post multi inval request to CC_SEND FSM"
    2485                             << " / address = " << std::hex << r_config_address.read()
    2486                             << " / copy = " << r_config_dir_copy_srcid.read()
    2487                             << " / inst = " << std::dec << r_config_dir_copy_inst.read() << std::endl;
    2488                     }
    2489 #endif
    2490                 }
    2491                 break;
    2492             }
    2493             /////////////////////
    2494             case CONFIG_HEAP_REQ:  // Try to get access to Heap
    2495             {
    2496                 if (r_alloc_heap_fsm.read() == ALLOC_HEAP_CONFIG)
    2497                 {
    2498                     r_config_fsm = CONFIG_HEAP_SCAN;
    2499                     r_config_heap_next = r_config_dir_ptr.read();
    2500                 }
    2501 
    2502 #if DEBUG_MEMC_CONFIG
    2503                 if (m_debug)
    2504                 {
    2505                     std::cout << "  <MEMC " << name() << " CONFIG_HEAP_REQ>"
    2506                         << " Requesting HEAP lock" << std::endl;
    2507                 }
    2508 #endif
    2509                 break;
    2510             }
    2511             //////////////////////
    2512             case CONFIG_HEAP_SCAN: // scan HEAP and send inval to CC_SEND FSM
    2513             {
    2514                 HeapEntry entry = m_heap.read(r_config_heap_next.read());
    2515                 bool last_copy = (entry.next == r_config_heap_next.read());
    2516 
    2517                 config_to_cc_send_fifo_srcid = entry.owner.srcid;
    2518                 config_to_cc_send_fifo_inst = entry.owner.inst;
    2519                 config_to_cc_send_fifo_put = true;
    2520 
    2521                 if (m_config_to_cc_send_inst_fifo.wok()) // inval request accepted
    2522                 {
    2523                     r_config_heap_next = entry.next;
    2524                     if (last_copy) r_config_fsm = CONFIG_HEAP_LAST;
    2525                 }
    2526 
    2527 #if DEBUG_MEMC_CONFIG
    2528                 if (m_debug)
    2529                 {
    2530                     std::cout << "  <MEMC " << name() << " CONFIG_HEAP_SCAN>"
    2531                         << " Post multi inval request to CC_SEND FSM"
    2532                         << " / address = " << std::hex << r_config_address.read()
    2533                         << " / copy = " << entry.owner.srcid
    2534                         << " / inst = " << std::dec << entry.owner.inst << std::endl;
    2535                 }
     2506if (m_debug)
     2507std::cout << "  <MEMC " << name() << " CONFIG_HEAP_SCAN>"
     2508          << " Post multi inval request to CC_SEND FSM"
     2509          << " / address = " << std::hex << r_config_address.read()
     2510          << " / copy = " << entry.owner.srcid
     2511          << " / inst = " << std::dec << entry.owner.inst << std::endl;
    25362512#endif
    25372513                break;
     
    25582534                m_heap.write(r_config_heap_next.read(), last_entry);
    25592535
    2560                 // prepare next iteration
    2561                 r_config_cmd_lines = r_config_cmd_lines.read() - 1;
    2562                 r_config_address   = r_config_address.read() + (m_words << 2);
    25632536                r_config_fsm       = CONFIG_LOOP;
    25642537
    25652538#if DEBUG_MEMC_CONFIG
    2566                 if (m_debug)
    2567                 {
    2568                     std::cout << "  <MEMC " << name() << " CONFIG_HEAP_LAST>"
    2569                         << " Heap housekeeping" << std::endl;
    2570                 }
     2539if (m_debug)
     2540std::cout << "  <MEMC " << name() << " CONFIG_HEAP_LAST>"
     2541          << " Heap housekeeping" << std::endl;
    25712542#endif
    25722543                break;
     
    53095280
    53105281#if DEBUG_MEMC_CLEANUP
    5311                 if (m_debug)
    5312                 {
    5313                     std::cout << "  <MEMC " << name()
    5314                         << " CLEANUP_IDLE> Cleanup request:" << std::hex
    5315                         << " owner_id = "   << srcid
    5316                         << " / owner_ins = "  << (type == DspinDhccpParam::TYPE_CLEANUP_INST) << std::endl;
    5317                 }
     5282if (m_debug)
     5283std::cout << "  <MEMC " << name()
     5284          << " CLEANUP_IDLE> Cleanup request:" << std::hex
     5285          << " owner_id = "   << srcid
     5286          << " / owner_ins = "  << (type == DspinDhccpParam::TYPE_CLEANUP_INST) << std::endl;
    53185287#endif
    53195288                break;
     
    53345303
    53355304#if DEBUG_MEMC_CLEANUP
    5336                 if (m_debug)
    5337                 {
    5338                     std::cout << "  <MEMC "         << name()
    5339                         << " CLEANUP_GET_NLINE> Cleanup request:"
    5340                         << " address = " << std::hex << nline * m_words * 4 << std::endl;
    5341                 }
     5305if (m_debug)
     5306std::cout << "  <MEMC "         << name()
     5307          << " CLEANUP_GET_NLINE> Cleanup request:"
     5308          << " address = " << std::hex << nline * m_words * 4 << std::endl;
    53425309#endif
    53435310                break;
     
    53515318
    53525319#if DEBUG_MEMC_CLEANUP
    5353                 if (m_debug)
    5354                 {
    5355                     std::cout << "  <MEMC " << name() << " CLEANUP_DIR_REQ> Requesting DIR lock" << std::endl;
    5356                 }
     5320if (m_debug)
     5321std::cout << "  <MEMC " << name() << " CLEANUP_DIR_REQ> Requesting DIR lock" << std::endl;
    53575322#endif
    53585323                break;
     
    53985363
    53995364#if DEBUG_MEMC_CLEANUP
    5400                 if (m_debug)
    5401                 {
    5402                     std::cout << "  <MEMC " << name()
    5403                         << " CLEANUP_DIR_LOCK> Test directory status: "
    5404                         << std::hex << " address = " << cleanup_address
    5405                         << " / hit = "        << entry.valid
    5406                         << " / dir_id = "     << entry.owner.srcid
    5407                         << " / dir_ins = "    << entry.owner.inst
    5408                         << " / search_id = "  << r_cleanup_srcid.read()
    5409                         << " / search_ins = " << r_cleanup_inst.read()
    5410                         << " / count = "      << entry.count
    5411                         << " / is_cnt = "     << entry.is_cnt << std::endl;
    5412                 }
     5365if (m_debug)
     5366std::cout << "  <MEMC " << name()
     5367          << " CLEANUP_DIR_LOCK> Test directory status: "
     5368          << std::hex << " address = " << cleanup_address
     5369          << " / hit = "        << entry.valid
     5370          << " / dir_id = "     << entry.owner.srcid
     5371          << " / dir_ins = "    << entry.owner.inst
     5372          << " / search_id = "  << r_cleanup_srcid.read()
     5373          << " / search_ins = " << r_cleanup_inst.read()
     5374          << " / count = "      << entry.count
     5375          << " / is_cnt = "     << entry.is_cnt << std::endl;
    54135376#endif
    54145377                break;
     
    54465409
    54475410#if DEBUG_MEMC_CLEANUP
    5448                 if (m_debug)
    5449                 {
    5450                     std::cout << "  <MEMC " << name()
    5451                         << " CLEANUP_DIR_WRITE> Update directory:"
    5452                         << std::hex << " address = "   << r_cleanup_nline.read() * m_words * 4
    5453                         << " / dir_id = "  << entry.owner.srcid
    5454                         << " / dir_ins = " << entry.owner.inst
    5455                         << " / count = "   << entry.count
    5456                         << " / is_cnt = "  << entry.is_cnt << std::endl;
    5457                 }
     5411if (m_debug)
     5412std::cout << "  <MEMC " << name()
     5413          << " CLEANUP_DIR_WRITE> Update directory:"
     5414          << std::hex << " address = "   << r_cleanup_nline.read() * m_words * 4
     5415          << " / dir_id = "  << entry.owner.srcid
     5416          << " / dir_ins = " << entry.owner.inst
     5417          << " / count = "   << entry.count
     5418          << " / is_cnt = "  << entry.is_cnt << std::endl;
    54585419#endif
    54595420
     
    54685429
    54695430#if DEBUG_MEMC_CLEANUP
    5470                 if (m_debug)
    5471                 {
    5472                     std::cout << "  <MEMC " << name()
    5473                         << " CLEANUP_HEAP_REQ> HEAP lock acquired " << std::endl;
    5474                 }
     5431if (m_debug)
     5432std::cout << "  <MEMC " << name()
     5433          << " CLEANUP_HEAP_REQ> HEAP lock acquired " << std::endl;
    54755434#endif
    54765435                break;
     
    54785437            //////////////////////
    54795438            case CLEANUP_HEAP_LOCK:      // two cases are handled in this state :
    5480             // 1. the matching copy is directly in the directory
    5481             // 2. the matching copy is the first copy in the heap
     5439                                         // 1. the matching copy is directly in the directory
     5440                                         // 2. the matching copy is the first copy in the heap
    54825441            {
    54835442                assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) and
     
    55565515
    55575516#if DEBUG_MEMC_CLEANUP
    5558                 if (m_debug)
    5559                 {
    5560                     std::cout << "  <MEMC " << name()
    5561                         << " CLEANUP_HEAP_LOCK> Checks matching:"
    5562                         << " address = "      << r_cleanup_nline.read() * m_words * 4
    5563                         << " / dir_id = "     << r_cleanup_copy.read()
    5564                         << " / dir_ins = "    << r_cleanup_copy_inst.read()
    5565                         << " / heap_id = "    << heap_entry.owner.srcid
    5566                         << " / heap_ins = "   << heap_entry.owner.inst
    5567                         << " / search_id = "  << r_cleanup_srcid.read()
    5568                         << " / search_ins = " << r_cleanup_inst.read() << std::endl;
    5569                 }
     5517if (m_debug)
     5518std::cout << "  <MEMC " << name()
     5519          << " CLEANUP_HEAP_LOCK> Checks matching:"
     5520          << " address = "      << r_cleanup_nline.read() * m_words * 4
     5521          << " / dir_id = "     << r_cleanup_copy.read()
     5522          << " / dir_ins = "    << r_cleanup_copy_inst.read()
     5523          << " / heap_id = "    << heap_entry.owner.srcid
     5524          << " / heap_ins = "   << heap_entry.owner.inst
     5525          << " / search_id = "  << r_cleanup_srcid.read()
     5526          << " / search_ins = " << r_cleanup_inst.read() << std::endl;
    55705527#endif
    55715528                break;
     
    55735530            ////////////////////////
    55745531            case CLEANUP_HEAP_SEARCH:     // This state is handling the case where the copy
    5575             // is in the heap, but not the first in linked list
     5532                                          // is in the heap, but not the first in linked list
    55765533            {
    55775534                assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) and
     
    56065563
    56075564#if DEBUG_MEMC_CLEANUP
    5608                 if (m_debug)
    5609                 {
    5610                     if (not match_heap)
    5611                     {
    5612                         std::cout
    5613                             << "  <MEMC " << name()
    5614                             << " CLEANUP_HEAP_SEARCH> Matching copy not found, search next:"
    5615                             << std::endl;
    5616                     }
    5617                     else
    5618                     {
    5619                         std::cout
    5620                             << "  <MEMC " << name()
    5621                             << " CLEANUP_HEAP_SEARCH> Matching copy found:"
    5622                             << std::endl;
    5623                     }
    5624                     std::cout
    5625                         << " address = "      << r_cleanup_nline.read() * m_words * 4
    5626                         << " / heap_id = "    << heap_entry.owner.srcid
    5627                         << " / heap_ins = "   << heap_entry.owner.inst
    5628                         << " / search_id = "  << r_cleanup_srcid.read()
    5629                         << " / search_ins = " << r_cleanup_inst.read()
    5630                         << " / last = "       << last
    5631                         << std::endl;
    5632                 }
     5565if (m_debug)
     5566{
     5567    if (not match_heap)
     5568    {
     5569    std::cout << "  <MEMC " << name()
     5570              << " CLEANUP_HEAP_SEARCH> Matching copy not found, search next:"
     5571              << std::endl;
     5572    }
     5573    else
     5574    {
     5575    std::cout << "  <MEMC " << name()
     5576              << " CLEANUP_HEAP_SEARCH> Matching copy found:"
     5577              << std::endl;
     5578    }
     5579    std::cout << " address = "      << r_cleanup_nline.read() * m_words * 4
     5580              << " / heap_id = "    << heap_entry.owner.srcid
     5581              << " / heap_ins = "   << heap_entry.owner.inst
     5582              << " / search_id = "  << r_cleanup_srcid.read()
     5583              << " / search_ins = " << r_cleanup_inst.read()
     5584              << " / last = "       << last
     5585              << std::endl;
     5586}
    56335587#endif
    56345588                break;
     
    56595613
    56605614#if DEBUG_MEMC_CLEANUP
    5661                 if (m_debug)
    5662                 {
    5663                     std::cout << "  <MEMC " << name() << " CLEANUP_HEAP_SEARCH>"
    5664                         << " Remove the copy in the linked list" << std::endl;
    5665                 }
     5615if (m_debug)
     5616std::cout << "  <MEMC " << name() << " CLEANUP_HEAP_SEARCH>"
     5617          << " Remove the copy in the linked list" << std::endl;
    56665618#endif
    56675619                break;
     
    56945646
    56955647#if DEBUG_MEMC_CLEANUP
    5696                 if (m_debug)
    5697                 {
    5698                     std::cout << "  <MEMC " << name() << " CLEANUP_HEAP_FREE>"
    5699                         << " Update the list of free entries" << std::endl;
    5700                 }
     5648if (m_debug)
     5649std::cout << "  <MEMC " << name() << " CLEANUP_HEAP_FREE>"
     5650          << " Update the list of free entries" << std::endl;
    57015651#endif
    57025652                break;
     
    57045654            //////////////////////
    57055655            case CLEANUP_IVT_LOCK:   // get the lock protecting the IVT to search a pending
    5706             // invalidate transaction matching the cleanup
     5656                                     // invalidate transaction matching the cleanup
    57075657            {
    57085658                if (r_alloc_ivt_fsm.read() != ALLOC_IVT_CLEANUP) break;
     
    57185668
    57195669#if DEBUG_MEMC_CLEANUP
    5720                     if (m_debug)
    5721                     {
    5722                         std::cout << "  <MEMC " << name() << " CLEANUP_IVT_LOCK>"
    5723                             << " Unexpected cleanup with no corresponding IVT entry:"
    5724                             << " address = " << std::hex << (r_cleanup_nline.read() * 4 * m_words) << std::endl;
    5725                     }
     5670if (m_debug)
     5671std::cout << "  <MEMC " << name() << " CLEANUP_IVT_LOCK>"
     5672          << " Unexpected cleanup with no corresponding IVT entry:"
     5673          << " address = " << std::hex << (r_cleanup_nline.read() * 4 * m_words) << std::endl;
    57265674#endif
    57275675                }
     
    57375685
    57385686#if DEBUG_MEMC_CLEANUP
    5739                     if (m_debug)
    5740                     {
    5741                         std::cout << "  <MEMC " << name() << " CLEANUP_IVT_LOCK>"
    5742                             << " Cleanup matching pending invalidate transaction on IVT:"
    5743                             << " address = " << std::hex << (r_cleanup_nline.read() * m_words * 4)
    5744                             << " / ivt_entry = " << index << std::endl;
    5745                     }
     5687if (m_debug)
     5688std::cout << "  <MEMC " << name() << " CLEANUP_IVT_LOCK>"
     5689          << " Cleanup matching pending invalidate transaction on IVT:"
     5690          << " address = " << std::hex << (r_cleanup_nline.read() * m_words * 4)
     5691          << " / ivt_entry = " << index << std::endl;
    57465692#endif
    57475693                }
     
    57625708
    57635709#if DEBUG_MEMC_CLEANUP
    5764                 if (m_debug)
    5765                 {
    5766                     std::cout << "  <MEMC " << name() << " CLEANUP_IVT_DECREMENT>"
    5767                         << " Decrement response counter in IVT:"
    5768                         << " IVT_index = " << r_cleanup_index.read()
    5769                         << " / rsp_count = " << count << std::endl;
    5770                 }
     5710if (m_debug)
     5711std::cout << "  <MEMC " << name() << " CLEANUP_IVT_DECREMENT>"
     5712          << " Decrement response counter in IVT:"
     5713          << " IVT_index = " << r_cleanup_index.read()
     5714          << " / rsp_count = " << count << std::endl;
    57715715#endif
    57725716                break;
     
    57745718            ///////////////////////
    57755719            case CLEANUP_IVT_CLEAR:    // Clear IVT entry
    5776             // Acknowledge CONFIG FSM if required
     5720                                       // Acknowledge CONFIG FSM if required
    57775721            {
    57785722                assert((r_alloc_ivt_fsm.read() == ALLOC_IVT_CLEANUP) and
    5779                         "MEMC ERROR in CLEANUP_IVT_CLEAR state : bad IVT allocation");
     5723                "MEMC ERROR in CLEANUP_IVT_CLEAR state : bad IVT allocation");
    57805724
    57815725                m_ivt.clear(r_cleanup_index.read());
     
    57845728                {
    57855729                    assert((r_config_rsp_lines.read() > 0) and
    5786                             "MEMC ERROR in CLEANUP_IVT_CLEAR state");
     5730                    "MEMC ERROR in CLEANUP_IVT_CLEAR state");
    57875731
    57885732                    config_rsp_lines_cleanup_decr = true;
     
    57935737
    57945738#if DEBUG_MEMC_CLEANUP
    5795                 if (m_debug)
    5796                 {
    5797                     std::cout << "  <MEMC " << name()
    5798                         << " CLEANUP_IVT_CLEAR> Clear entry in IVT:"
    5799                         << " IVT_index = " << r_cleanup_index.read() << std::endl;
    5800                 }
     5739if (m_debug)
     5740std::cout << "  <MEMC " << name()
     5741          << " CLEANUP_IVT_CLEAR> Clear entry in IVT:"
     5742          << " IVT_index = " << r_cleanup_index.read() << std::endl;
    58015743#endif
    58025744                break;
     
    58165758
    58175759#if DEBUG_MEMC_CLEANUP
    5818                 if (m_debug)
    5819                 {
    5820                     std::cout << "  <MEMC " << name() << " CLEANUP_WRITE_RSP>"
    5821                         << " Send a response to a previous write request: "
    5822                         << " rsrcid = "   << std::hex << r_cleanup_write_srcid.read()
    5823                         << " / rtrdid = " << r_cleanup_write_trdid.read()
    5824                         << " / rpktid = " << r_cleanup_write_pktid.read() << std::endl;
    5825                 }
     5760if (m_debug)
     5761std::cout << "  <MEMC " << name() << " CLEANUP_WRITE_RSP>"
     5762          << " Send a response to a previous write request: "
     5763          << " rsrcid = "   << std::hex << r_cleanup_write_srcid.read()
     5764          << " / rtrdid = " << r_cleanup_write_trdid.read()
     5765          << " / rpktid = " << r_cleanup_write_pktid.read() << std::endl;
    58265766#endif
    58275767                break;
     
    58365776
    58375777#if DEBUG_MEMC_CLEANUP
    5838                 if (m_debug)
    5839                 {
    5840                     std::cout << "  <MEMC " << name()
    5841                         << " CLEANUP_SEND_CLACK> Send the response to a cleanup request:"
    5842                         << " address = "   << std::hex << r_cleanup_nline.read() * m_words * 4
    5843                         << " / way = "   << std::dec << r_cleanup_way.read()
    5844                         << " / srcid = " << std::hex << r_cleanup_srcid.read()
    5845                         << std::endl;
    5846                 }
     5778if (m_debug)
     5779std::cout << "  <MEMC " << name()
     5780          << " CLEANUP_SEND_CLACK> Send the response to a cleanup request:"
     5781          << " address = "   << std::hex << r_cleanup_nline.read() * m_words * 4
     5782          << " / way = "   << std::dec << r_cleanup_way.read()
     5783          << " / srcid = " << std::hex << r_cleanup_srcid.read()
     5784          << std::endl;
    58475785#endif
    58485786                break;
Note: See TracChangeset for help on using the changeset viewer.