Changeset 919


Ignore:
Timestamp:
Jan 9, 2015, 11:55:11 PM (9 years ago)
Author:
cfuguet
Message:

reconf: implement the CC_TEST FSM in the cc_vcache_wrapper

  • Watchdog on the CC_TEST FSM is still missing
Location:
branches/reconfiguration
Files:
4 edited

Legend:

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

    r905 r919  
    123123        DCACHE_XTN_DC_INVAL_GO,
    124124        DCACHE_XTN_DT_INVAL,
     125        DCACHE_XTN_CC_TEST,
    125126        //handling dirty bit update
    126127        DCACHE_DIRTY_GET_PTE,
     
    184185        CC_RECEIVE_INS_UPDT_DATA,
    185186        CC_RECEIVE_DATA_UPDT_DATA,
     187        CC_RECEIVE_TEST_HEADER,
     188        CC_RECEIVE_TEST_SIGNATURE,
    186189    };
    187190
     
    192195        CC_SEND_CLEANUP_2,
    193196        CC_SEND_MULTI_ACK,
     197        CC_SEND_TEST_HEADER,
     198        CC_SEND_TEST_SIGNATURE,
     199    };
     200
     201    enum cc_test_fsm_state_e
     202    {
     203        CC_TEST_IDLE,
     204        CC_TEST_P2M_REQ,
     205        CC_TEST_P2M_WAIT,
     206        CC_TEST_ACK_WAIT,
    194207    };
    195208
     
    279292
    280293    // this enumeration type extends the ExternalAcessTypes defined in iss2.h
     294    // XTN_CC_TEST:
     295    //    When XTN_WRITE: triggers the CC_TEST. The target MEMC is in dreq.wdata
     296    //    When XTN_READ: returns the CC_TEST result
    281297    enum xtn_cop2_extension_e {
    282298        XTN_WDT_MAX = 26,              // Read & Write the watchdog timer threshold
     299        XTN_CC_TEST = 27,              // Trigger coherence network test
    283300    };
    284301
     
    516533    sc_signal<uint32_t>     r_dcache_paddr_ext;             // CP2 register (if vci_address > 32)
    517534
     535    // communication between DCACHE FSM and CC_TEST FSM
     536    sc_signal<bool>         r_dcache_to_cc_test_req;
     537    sc_signal<uint32_t>     r_dcache_to_cc_test_dest;
     538
    518539    ///////////////////////////////////
    519540    // VCI_CMD FSM REGISTERS
     
    574595    sc_signal<bool>         r_dspin_clack_req;
    575596    sc_signal<uint64_t>     r_dspin_clack_flit;
     597    sc_signal<bool>         r_dspin_clack_test;
     598
     599    ///////////////////////////////////
     600    //  CC_TEST FSM REGISTER
     601    ///////////////////////////////////
     602    enum cc_test_result_e
     603    {
     604        CC_TEST_SUCCESS = 0,
     605        CC_TEST_FAILURE = 1,
     606    };
     607
     608    sc_signal<int>          r_cc_test_fsm;
     609    sc_signal<bool>         r_cc_test_to_cc_send_req;
     610    sc_signal<bool>         r_cc_test_m2p_req;
     611    sc_signal<uint64_t>     r_cc_test_m2p_sign;
     612    sc_signal<bool>         r_cc_test_clack_req;
     613    sc_signal<uint64_t>     r_cc_test_clack_sign;
     614    sc_signal<int>          r_cc_test_to_dcache_result;
    576615
    577616    //////////////////////////////////////////////////////////////////
  • branches/reconfiguration/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp

    r903 r919  
    9696        "DCACHE_XTN_DC_INVAL_GO",
    9797        "DCACHE_XTN_DT_INVAL",
     98        "DCACHE_XTN_CC_TEST",
    9899
    99100        "DCACHE_DIRTY_GET_PTE",
     
    172173        "CC_RECEIVE_DATA_UPDT_NLINE",
    173174        "CC_RECEIVE_DATA_UPDT_DATA",
     175        "CC_RECEIVE_TEST_HEADER",
     176        "CC_RECEIVE_TEST_SIGNATURE",
    174177    };
    175178
     
    179182        "CC_SEND_CLEANUP_2",
    180183        "CC_SEND_MULTI_ACK",
     184        "CC_SEND_TEST_HEADER",
     185        "CC_SEND_TEST_SIGNATURE",
     186    };
     187
     188const char * cc_test_fsm_state_str[] = {
     189        "CC_TEST_IDLE",
     190        "CC_TEST_P2M_REQ",
     191        "CC_TEST_P2M_WAIT",
     192        "CC_TEST_ACK_WAIT",
    181193    };
    182194}
     
    371383      r_dcache_cc_send_updt_tab_idx("r_dcache_cc_send_updt_tab_idx"),
    372384
     385      r_dcache_to_cc_test_req("r_dcache_to_cc_test_req"),
     386      r_dcache_to_cc_test_dest("r_dcache_to_cc_test_dest"),
     387
    373388      r_vci_cmd_fsm("r_vci_cmd_fsm"),
    374389      r_vci_cmd_min("r_vci_cmd_min"),
     
    407422      r_cc_receive_dcache_updt_tab_idx("r_cc_receive_dcache_updt_tab_idx"),
    408423      r_cc_receive_dcache_nline("r_cc_receive_dcache_nline"),
     424
     425      r_cc_test_fsm("r_cc_test_fsm"),
     426      r_cc_test_to_cc_send_req("r_cc_test_to_cc_send_req"),
     427      r_cc_test_m2p_req("r_cc_test_m2p_req"),
     428      r_cc_test_m2p_sign("r_cc_test_m2p_sign"),
     429      r_cc_test_clack_req("r_cc_test_clack_req"),
     430      r_cc_test_clack_sign("r_cc_test_clack_sign"),
     431      r_cc_test_to_dcache_result("r_cc_test_to_dcache_result"),
    409432
    410433      r_iss(this->name(), proc_id),
     
    503526              << " | " << cc_receive_fsm_state_str[r_cc_receive_fsm.read()]
    504527              << " | " << cc_send_fsm_state_str[r_cc_send_fsm.read()]
     528              << " | " << cc_test_fsm_state_str[r_cc_test_fsm.read()]
    505529              << " | MMU = " << r_mmu_mode.read();
    506530
     
    762786        r_cc_receive_fsm = CC_RECEIVE_IDLE;
    763787        r_cc_send_fsm    = CC_SEND_IDLE;
     788        r_cc_test_fsm    = CC_TEST_IDLE;
    764789
    765790        // reset data physical address extension
     
    837862
    838863        r_dspin_clack_req          = false;
     864        r_dspin_clack_test         = false;
     865
     866        r_cc_test_to_cc_send_req   = false;
     867        r_cc_test_m2p_req          = false;
     868        r_cc_test_clack_req        = false;
    839869
    840870        // No signalisation  of errors
     
    25412571                        break;
    25422572
     2573                    case XTN_CC_TEST:
     2574                        m_drsp.rdata = r_cc_test_to_dcache_result.read();
     2575                        m_drsp.valid = true;
     2576                        m_drsp.error = false;
     2577                        break;
     2578
    25432579                    default:
    25442580                        r_mmu_detr   = MMU_READ_UNDEFINED_XTN;
     
    26842720                        m_drsp.valid = true;
    26852721                        r_dcache_fsm = DCACHE_IDLE;
     2722                        break;
     2723
     2724                    case XTN_CC_TEST:
     2725                        r_dcache_to_cc_test_dest = m_dreq.wdata;
     2726                        r_dcache_to_cc_test_req = true;
     2727                        r_dcache_fsm = DCACHE_XTN_CC_TEST;
    26862728                        break;
    26872729
     
    41214163        r_dcache_fsm = DCACHE_IDLE;
    41224164        m_drsp.valid = true;
     4165        break;
     4166    }
     4167    //////////////////////////////
     4168    case DCACHE_XTN_CC_TEST:      // wait the CC_TEST to finish
     4169    {
     4170        // coherence clack request (from DSPIN CLACK)
     4171        if (r_dcache_clack_req.read())
     4172        {
     4173            r_dcache_fsm = DCACHE_CC_CHECK;
     4174            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4175            break;
     4176        }
     4177
     4178        // coherence request (from CC_RECEIVE FSM)
     4179        if (r_cc_receive_dcache_req.read() and not r_dcache_cc_send_req.read())
     4180        {
     4181            r_dcache_fsm = DCACHE_CC_CHECK;
     4182            r_dcache_fsm_cc_save = r_dcache_fsm.read();
     4183            break;
     4184        }
     4185
     4186        // wait the CC_TEST request to finish
     4187        // the test result is stored at the r_cc_test_to_dcache_result
     4188        if (not r_dcache_to_cc_test_req.read())
     4189        {
     4190            r_dcache_fsm = DCACHE_IDLE;
     4191            m_drsp.valid = true;
     4192
     4193#if DEBUG_DCACHE
     4194            if (m_debug_dcache_fsm)
     4195            {
     4196                std::cout << "  <PROC " << name()
     4197                    << " DCACHE_XTN_CC_TEST> CC_TEST finished:"
     4198                    << std::hex
     4199                    << " / DEST = " << r_dcache_to_cc_test_dest.read()
     4200                    << " / RESULt = " << r_cc_test_to_dcache_result.read()
     4201                    << std::dec << std::endl;
     4202            }
     4203#endif
     4204        }
    41234205        break;
    41244206    }
     
    56815763        {
    56825764            ///////////////////////////////////////////////////////
     5765            // Handle CC_TEST request                            //
     5766            ///////////////////////////////////////////////////////
     5767            if (r_cc_test_to_cc_send_req.read())
     5768            {
     5769                r_cc_send_fsm = CC_SEND_TEST_HEADER;
     5770                break;
     5771            }
     5772
     5773            ///////////////////////////////////////////////////////
    56835774            // handling round robin between icache and dcache :  //
    56845775            // we first check for the last client and listen for //
     
    57615852            break;
    57625853        }
     5854        ///////////////////////////
     5855        case CC_SEND_TEST_HEADER:
     5856        {
     5857            // the r_cc_test_to_cc_send_req can be reset by the CC_TEST FSM
     5858            // when there is a watchdog timeout
     5859            if (not r_cc_test_to_cc_send_req.read())
     5860            {
     5861                r_cc_send_fsm = CC_SEND_IDLE;
     5862                break;
     5863            }
     5864
     5865            if (not p_dspin_p2m.read.read()) break;
     5866            r_cc_send_fsm = CC_SEND_TEST_SIGNATURE;
     5867            break;
     5868        }
     5869        ///////////////////////////
     5870        case CC_SEND_TEST_SIGNATURE:
     5871        {
     5872            // the r_cc_test_to_cc_send_req can be reset by the CC_TEST FSM
     5873            // when there is a watchdog timeout
     5874            if (not p_dspin_p2m.read.read() and r_cc_test_to_cc_send_req.read()) break;
     5875            r_cc_test_to_cc_send_req = false;
     5876            r_cc_send_fsm = CC_SEND_IDLE;
     5877            break;
     5878        }
    57635879    } // end switch CC_SEND FSM
    57645880
     
    57725888    // - CC_INST_UPDT  : ICACHE update request (multi-words)
    57735889    // - CC_BROADCAST  : Broadcast invalidate request (both DCACHE & ICACHE)
     5890    // - CC_TEST_M2P   : M2P coherence network test packet
    57745891    //////////////////////////////////////////////////////////////////////////////
    57755892    switch (r_cc_receive_fsm.read())
     
    57835900                // initialize dspin received data
    57845901                uint64_t receive_data = p_dspin_m2p.data.read();
     5902
     5903                // coherence test packet (CC_TEST_M2P)
     5904                if (DspinDhccpParam::dspin_get(receive_data, DspinDhccpParam::TEST_M2P_TEST))
     5905                {
     5906                    r_cc_receive_fsm = CC_RECEIVE_TEST_HEADER;
     5907                    break;
     5908                }
     5909
    57855910                // initialize coherence packet type
    57865911                uint64_t receive_type = DspinDhccpParam::dspin_get(receive_data,
     
    58255950            uint64_t receive_data = p_dspin_m2p.data.read();
    58265951            // wait for both dcache and icache to take the request
    5827             // TODO maybe we need to wait for both only to leave the state, but
    5828             // not to actually post a request to an available cache => need a
    5829             // flip_flop to check that ?
    58305952            if (not (r_cc_receive_icache_req.read()) and
    58315953                not (r_cc_receive_dcache_req.read()) and
     
    60046126            break;
    60056127        }
     6128        //////////////////////////
     6129        case CC_RECEIVE_TEST_HEADER:
     6130        {
     6131            if (not p_dspin_m2p.write.read()) break;
     6132
     6133            typedef DspinDhccpParam DDP;
     6134            uint64_t header = p_dspin_m2p.data.read();
     6135            uint64_t dest = DDP::dspin_get(header, DDP::TEST_M2P_DEST);
     6136            assert((size_t)dest == m_cc_global_id);
     6137
     6138            r_cc_receive_fsm = CC_RECEIVE_TEST_SIGNATURE;
     6139            break;
     6140        }
     6141        //////////////////////////
     6142        case CC_RECEIVE_TEST_SIGNATURE:
     6143        {
     6144            if (not p_dspin_m2p.write.read()) break;
     6145            assert(not r_cc_test_m2p_req.read());
     6146            r_cc_test_m2p_req = true;
     6147            r_cc_test_m2p_sign = p_dspin_m2p.data.read();
     6148            r_cc_receive_fsm = CC_RECEIVE_IDLE;
     6149            break;
     6150        }
    60066151
    60076152    } // end switch CC_RECEIVE FSM
     
    60176162    size_t clack_set = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
    60186163                                                   DspinDhccpParam::CLACK_SET);
     6164
     6165    size_t clack_test = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
     6166                                                   DspinDhccpParam::TEST_CLACK_TEST);
    60196167
    60206168    bool dspin_clack_get = false;
     
    60246172    if (r_dspin_clack_req.read())
    60256173    {
     6174        // CLACK TEST first flit
     6175        if (clack_test and not r_dspin_clack_test.read())
     6176        {
     6177            r_dspin_clack_test = true;
     6178            dspin_clack_get = true;
     6179        }
     6180
     6181        // CLACK TEST second flit
     6182        else if (r_dspin_clack_test.read())
     6183        {
     6184            assert (not r_cc_test_clack_req.read());
     6185            r_cc_test_clack_req = true;
     6186            r_cc_test_clack_sign = r_dspin_clack_flit.read();
     6187
     6188            r_dspin_clack_test = false;
     6189            dspin_clack_get = true;
     6190        }
     6191
    60266192        // CLACK DATA: Send request to DCACHE FSM
    6027         if (dcache_clack_request and not r_dcache_clack_req.read())
     6193        else if (dcache_clack_request and not r_dcache_clack_req.read())
    60286194        {
    60296195            r_dcache_clack_req = true;
     
    60536219    }
    60546220
     6221    ///////////////////////////////////////////////////////////////
     6222    // CC_TEST FSM
     6223    ///////////////////////////////////////////////////////////////
     6224
     6225    // TODO: implement the watchdog timer (reuse the same that for the DATA UNC
     6226    // requests?)
     6227    const bool watchdog_timeout = false;
     6228
     6229    switch(r_cc_test_fsm.read())
     6230    {
     6231        case CC_TEST_IDLE:
     6232            if (not r_dcache_to_cc_test_req.read()) break;
     6233            r_cc_test_to_dcache_result = CC_TEST_SUCCESS;
     6234            r_cc_test_fsm = CC_TEST_P2M_REQ;
     6235            break;
     6236
     6237        case CC_TEST_P2M_REQ:
     6238            assert (not r_cc_test_to_cc_send_req.read());
     6239            r_cc_test_to_cc_send_req = true;
     6240            r_cc_test_fsm = CC_TEST_P2M_WAIT;
     6241            break;
     6242
     6243        case CC_TEST_P2M_WAIT:
     6244            if (r_cc_test_to_cc_send_req.read())
     6245            {
     6246                if (not watchdog_timeout) break;
     6247                r_dcache_to_cc_test_req = false;
     6248                r_cc_test_to_cc_send_req = false;
     6249                r_cc_test_to_dcache_result = CC_TEST_FAILURE;
     6250                r_cc_test_fsm = CC_TEST_IDLE;
     6251                break;
     6252            }
     6253            assert (not r_cc_test_clack_req.read() and not r_cc_test_m2p_req.read());
     6254            r_cc_test_fsm = CC_TEST_ACK_WAIT;
     6255            break;
     6256
     6257        case CC_TEST_ACK_WAIT:
     6258            if (not r_cc_test_clack_req.read() or not r_cc_test_m2p_req.read())
     6259            {
     6260                if (not watchdog_timeout) break;
     6261                r_cc_test_to_dcache_result = CC_TEST_FAILURE;
     6262            }
     6263
     6264            // TODO: compare signatures from M2P and CLACK with the sent one
     6265            r_dcache_to_cc_test_req = false;
     6266            r_cc_test_clack_req = false;
     6267            r_cc_test_m2p_req = false;
     6268            r_cc_test_fsm = CC_TEST_IDLE;
     6269            break;
     6270    }
     6271
    60556272    ///////////////// Response FIFOs update  //////////////////////
    60566273    r_vci_rsp_fifo_icache.update(vci_rsp_fifo_icache_get,
     
    60636280
    60646281    ///////////////// updt FIFO update  //////////////////////
    6065     //TODO check this
    60666282    r_cc_receive_updt_fifo_be.update(cc_receive_updt_fifo_get,
    60676283                                 cc_receive_updt_fifo_put,
     
    63956611            break;
    63966612        }
     6613        ///////////////////////
     6614        case CC_SEND_TEST_HEADER:
     6615        {
     6616            typedef DspinDhccpParam DDP;
     6617            uint64_t flit = 0;
     6618
     6619            uint64_t dest = (uint64_t)r_dcache_to_cc_test_dest.read()
     6620                            << (DspinDhccpParam::GLOBALID_WIDTH - m_x_width - m_y_width);
     6621
     6622            DDP::dspin_set(flit, DDP::TYPE_TEST, DDP::P2M_TYPE);
     6623            DDP::dspin_set(flit, dest, DDP::TEST_P2M_DEST);
     6624            DDP::dspin_set(flit, m_cc_global_id, DDP::TEST_P2M_SRCID);
     6625            DDP::dspin_set(flit, 1ULL, DDP::TEST_P2M_TEST);
     6626
     6627            p_dspin_p2m.data  = flit;
     6628            p_dspin_p2m.write = true;
     6629            p_dspin_p2m.eop   = false;
     6630            break;
     6631        }
     6632        ///////////////////////
     6633        case CC_SEND_TEST_SIGNATURE:
     6634        {
     6635            typedef DspinDhccpParam DDP;
     6636            uint64_t flit = 0;
     6637
     6638            DDP::dspin_set(flit, r_mmu_word_lo.read(), DDP::TEST_P2M_SIGNATURE);
     6639
     6640            p_dspin_p2m.data  = flit;
     6641            p_dspin_p2m.write = true;
     6642            p_dspin_p2m.eop   = true;
     6643            break;
     6644        }
     6645
    63976646    } // end switch CC_SEND FSM
    63986647
     
    64166665        case CC_RECEIVE_BRDCAST_NLINE:
    64176666        {
    6418             // TODO maybe we need to wait for both only to leave the state, but
    6419             // not to actually post a request to an available cache => need a
    6420             // flip_flop to check that ?
    64216667            if (not (r_cc_receive_icache_req.read()) and not (r_cc_receive_dcache_req.read()))
    64226668                p_dspin_m2p.read = true;
     
    64816727            break;
    64826728        }
     6729        ///////////////////////////////
     6730        case CC_RECEIVE_TEST_HEADER:
     6731        {
     6732            p_dspin_m2p.read = true;
     6733            break;
     6734        }
     6735        ///////////////////////////////
     6736        case CC_RECEIVE_TEST_SIGNATURE:
     6737        {
     6738            p_dspin_m2p.read = true;
     6739            break;
     6740        }
    64836741    } // end switch CC_RECEIVE FSM
    64846742
     
    64866744    int clack_type = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
    64876745                                                DspinDhccpParam::CLACK_TYPE);
     6746
     6747    size_t clack_test = DspinDhccpParam::dspin_get(r_dspin_clack_flit.read(),
     6748                                                   DspinDhccpParam::TEST_CLACK_TEST);
    64886749
    64896750    bool dspin_clack_get = false;
     
    64936754    if (r_dspin_clack_req.read())
    64946755    {
     6756        // CLACK TEST
     6757        if (clack_test or r_dspin_clack_test.read())
     6758        {
     6759            dspin_clack_get = true;
     6760        }
     6761
    64956762        // CLACK DATA: wait if pending request to DCACHE FSM
    6496         if (dcache_clack_request and not r_dcache_clack_req.read())
     6763        else if (dcache_clack_request and not r_dcache_clack_req.read())
    64976764        {
    64986765            dspin_clack_get = true;
  • branches/reconfiguration/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp

    r915 r919  
    53465346            case CLEANUP_TEST_HEADER:
    53475347            {
    5348                 if (not p_dspin_clack.read) break;
     5348                if (not p_dspin_clack.read.read()) break;
    53495349                r_cleanup_fsm = CLEANUP_TEST_SIGNATURE;
    53505350                break;
     
    53535353            case CLEANUP_TEST_SIGNATURE:
    53545354            {
    5355                 if (not p_dspin_clack.read) break;
     5355                if (not p_dspin_clack.read.read()) break;
    53565356                r_cc_test_to_cleanup_req = false;
    53575357                r_cleanup_fsm = CLEANUP_IDLE;
     
    67356735            case CC_TEST_WAIT:
    67366736                if (r_cc_test_to_cc_send_req.read() or
    6737                     r_cc_test_to_cleanup_req.read())
    6738                 {
    6739                     // TODO:
    6740                     // When a timeout exception is triggered:
    6741                     //  1. go to IDLE
    6742                     //  2. consume the test flit from the FIFO
    6743                     break;
    6744                 }
     6737                    r_cc_test_to_cleanup_req.read()) break;
    67456738
    67466739                cc_receive_to_cc_test_fifo_get = true;
     
    74187411            case CC_SEND_TEST_HEADER:         // send first flit TEST (from CC_TEST FSM)
    74197412            {
    7420                 if (not p_dspin_m2p.read) break;
     7413                if (not p_dspin_m2p.read.read()) break;
    74217414                r_cc_send_fsm = CC_SEND_TEST_SIGNATURE;
    74227415                break;
     
    74257418            case CC_SEND_TEST_SIGNATURE:      // send second flit TEST (from CC_TEST FSM)
    74267419            {
    7427                 if (not p_dspin_m2p.read) break;
     7420                if (not p_dspin_m2p.read.read()) break;
    74287421                r_cc_test_to_cc_send_req = false;
    74297422                r_cc_send_fsm = CC_SEND_TEST_IDLE;
  • branches/reconfiguration/platforms/tsar_generic_iob/scripts/onerun.py

    r907 r919  
    109109        command.extend(["-PROCID", str(args.debug[2])]);
    110110        command.extend(["-MEMCID", str(args.debug[3])]);
    111     else:
    112         # by observation, the procedure grows linearly with the diameter of the mesh.
     111    elif os.environ.get('SOCLIB_GDB') == None:
     112        # the procedure grows linearly with the diameter of the mesh.
    113113        maxcycles = 400000 + (args.x + args.y) * 20000;
    114114        command.extend(["-NCYCLES", str(maxcycles)])
Note: See TracChangeset for help on using the changeset viewer.