跳转至

MainPipe Submodule Documentation

MainPipe is the main flow of ICache, designed as a 2-stage pipeline. It is responsible for reading data from DataArray, performing PMP checks, ECC checks, handling misses, and returning the result to the IFU.

MainPipe Structure

S0 Pipeline Stage

In the S0 pipeline stage, metadata is obtained from WayLookup, including way hit information and ITLB query results. A single way of the DataArray is accessed. If the DataArray is being written or there is no valid entry in WayLookup, the pipeline will stall. After each redirect, the same request in FTQ is sent simultaneously to MainPipe and IPrefetchPipe. MainPipe always needs to wait for IPrefetchPipe to write the request's query information into WayLookup before proceeding, which causes a 1-cycle redirect delay. When prefetch exceeds instruction fetch, this delay is covered.

S1 Pipeline Stage

  1. Update the replacer, sending a touch request to the replacer.
  2. PMP check, sending a PMP request. The response is received in the same cycle, and the result is registered to the next pipeline stage for processing.
    • It should be pointed out that the IPrefetchPipe s1 pipeline stage also performs a PMP check, which is actually exactly the same as the check here. Checking separately is just to optimize timing (avoiding the ultra-long combinational logic path of ITLB(reg) -> ITLB.resp -> PMP.req -> PMP.resp -> WayLookup.write -> bypass -> WayLookup.read -> MainPipe s1(reg)).
  3. Receive and register the data and code returned by DataArray. Simultaneously monitor the response from MSHR. When both DataArray and MSHR responses are valid simultaneously, the latter has higher priority.

S2 Pipeline Stage

  1. DataArray ECC validation, validating the code registered in the S1 pipeline stage. If validation fails, the error is reported to the BEU.
  2. MetaArray ECC validation. After IPrefetchPipe reads out the MetaArray data, it will directly perform validation and enqueue the validation result along with hit information into WayLookup. It reaches the S2 stage with the MainPipe pipeline and is reported to the BEU here along with the DataArray's ECC validation result.
  3. Tilelink error handling. When monitoring that the data response from MissUnit is high for corrupt (i.e., the data response from L2 cache is erroneous), the error is reported to the BEU.
  4. Miss handling. When a miss occurs, the request is sent to MissUnit. Simultaneously monitor the response from MSHR. When a hit occurs, the data from the MSHR response is registered. For timing purposes, the data is sent to IFU in the next cycle.