109c6f1ddSLingrui98/*************************************************************************************** 209c6f1ddSLingrui98* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences 309c6f1ddSLingrui98* Copyright (c) 2020-2021 Peng Cheng Laboratory 409c6f1ddSLingrui98* 509c6f1ddSLingrui98* XiangShan is licensed under Mulan PSL v2. 609c6f1ddSLingrui98* You can use this software according to the terms and conditions of the Mulan PSL v2. 709c6f1ddSLingrui98* You may obtain a copy of Mulan PSL v2 at: 809c6f1ddSLingrui98* http://license.coscl.org.cn/MulanPSL2 909c6f1ddSLingrui98* 1009c6f1ddSLingrui98* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 1109c6f1ddSLingrui98* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 1209c6f1ddSLingrui98* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 1309c6f1ddSLingrui98* 1409c6f1ddSLingrui98* See the Mulan PSL v2 for more details. 1509c6f1ddSLingrui98***************************************************************************************/ 1609c6f1ddSLingrui98 1709c6f1ddSLingrui98package xiangshan.frontend 1809c6f1ddSLingrui98 1909c6f1ddSLingrui98import chipsalliance.rocketchip.config.Parameters 2009c6f1ddSLingrui98import chisel3._ 2109c6f1ddSLingrui98import chisel3.util._ 222a3050c2SJayimport freechips.rocketchip.rocket.RVCDecoder 2309c6f1ddSLingrui98import xiangshan._ 2409c6f1ddSLingrui98import xiangshan.cache.mmu._ 251d8f4dcbSJayimport xiangshan.frontend.icache._ 2609c6f1ddSLingrui98import utils._ 27b6982e83SLemoverimport xiangshan.backend.fu.{PMPReqBundle, PMPRespBundle} 2809c6f1ddSLingrui98 2909c6f1ddSLingrui98trait HasInstrMMIOConst extends HasXSParameter with HasIFUConst{ 3009c6f1ddSLingrui98 def mmioBusWidth = 64 3109c6f1ddSLingrui98 def mmioBusBytes = mmioBusWidth / 8 320be662e4SJay def maxInstrLen = 32 3309c6f1ddSLingrui98} 3409c6f1ddSLingrui98 3509c6f1ddSLingrui98trait HasIFUConst extends HasXSParameter{ 361d8f4dcbSJay def addrAlign(addr: UInt, bytes: Int, highest: Int): UInt = Cat(addr(highest-1, log2Ceil(bytes)), 0.U(log2Ceil(bytes).W)) 371d8f4dcbSJay def fetchQueueSize = 2 381d8f4dcbSJay 392a3050c2SJay def getBasicBlockIdx( pc: UInt, start: UInt ): UInt = { 402a3050c2SJay val byteOffset = pc - start 412a3050c2SJay (byteOffset - instBytes.U)(log2Ceil(PredictWidth),instOffsetBits) 421d8f4dcbSJay } 4309c6f1ddSLingrui98} 4409c6f1ddSLingrui98 4509c6f1ddSLingrui98class IfuToFtqIO(implicit p:Parameters) extends XSBundle { 4609c6f1ddSLingrui98 val pdWb = Valid(new PredecodeWritebackBundle) 4709c6f1ddSLingrui98} 4809c6f1ddSLingrui98 4909c6f1ddSLingrui98class FtqInterface(implicit p: Parameters) extends XSBundle { 5009c6f1ddSLingrui98 val fromFtq = Flipped(new FtqToIfuIO) 5109c6f1ddSLingrui98 val toFtq = new IfuToFtqIO 5209c6f1ddSLingrui98} 5309c6f1ddSLingrui98 540be662e4SJayclass UncacheInterface(implicit p: Parameters) extends XSBundle { 550be662e4SJay val fromUncache = Flipped(DecoupledIO(new InsUncacheResp)) 560be662e4SJay val toUncache = DecoupledIO( new InsUncacheReq ) 570be662e4SJay} 5809c6f1ddSLingrui98class NewIFUIO(implicit p: Parameters) extends XSBundle { 5909c6f1ddSLingrui98 val ftqInter = new FtqInterface 601d8f4dcbSJay val icacheInter = Vec(2, Flipped(new ICacheMainPipeBundle)) 611d8f4dcbSJay val icacheStop = Output(Bool()) 621d8f4dcbSJay val icachePerfInfo = Input(new ICachePerfInfo) 6309c6f1ddSLingrui98 val toIbuffer = Decoupled(new FetchToIBuffer) 640be662e4SJay val uncacheInter = new UncacheInterface 6572951335SLi Qianruo val frontendTrigger = Flipped(new FrontendTdataDistributeIO) 6672951335SLi Qianruo val csrTriggerEnable = Input(Vec(4, Bool())) 67a37fbf10SJay val rob_commits = Flipped(Vec(CommitWidth, Valid(new RobCommitInfo))) 6809c6f1ddSLingrui98} 6909c6f1ddSLingrui98 7009c6f1ddSLingrui98// record the situation in which fallThruAddr falls into 7109c6f1ddSLingrui98// the middle of an RVI inst 7209c6f1ddSLingrui98class LastHalfInfo(implicit p: Parameters) extends XSBundle { 7309c6f1ddSLingrui98 val valid = Bool() 7409c6f1ddSLingrui98 val middlePC = UInt(VAddrBits.W) 7509c6f1ddSLingrui98 def matchThisBlock(startAddr: UInt) = valid && middlePC === startAddr 7609c6f1ddSLingrui98} 7709c6f1ddSLingrui98 7809c6f1ddSLingrui98class IfuToPreDecode(implicit p: Parameters) extends XSBundle { 7909c6f1ddSLingrui98 val data = if(HasCExtension) Vec(PredictWidth + 1, UInt(16.W)) else Vec(PredictWidth, UInt(32.W)) 8072951335SLi Qianruo val frontendTrigger = new FrontendTdataDistributeIO 8172951335SLi Qianruo val csrTriggerEnable = Vec(4, Bool()) 822a3050c2SJay val pc = Vec(PredictWidth, UInt(VAddrBits.W)) 8309c6f1ddSLingrui98} 8409c6f1ddSLingrui98 852a3050c2SJay 862a3050c2SJayclass IfuToPredChecker(implicit p: Parameters) extends XSBundle { 872a3050c2SJay val ftqOffset = Valid(UInt(log2Ceil(PredictWidth).W)) 882a3050c2SJay val jumpOffset = Vec(PredictWidth, UInt(XLEN.W)) 892a3050c2SJay val target = UInt(VAddrBits.W) 902a3050c2SJay val instrRange = Vec(PredictWidth, Bool()) 912a3050c2SJay val instrValid = Vec(PredictWidth, Bool()) 922a3050c2SJay val pds = Vec(PredictWidth, new PreDecodeInfo) 932a3050c2SJay val pc = Vec(PredictWidth, UInt(VAddrBits.W)) 942a3050c2SJay} 952a3050c2SJay 962a3050c2SJayclass NewIFU(implicit p: Parameters) extends XSModule 972a3050c2SJay with HasICacheParameters 982a3050c2SJay with HasIFUConst 992a3050c2SJay with HasPdConst 100167bcd01SJay with HasCircularQueuePtrHelper 1012a3050c2SJay with HasPerfEvents 10209c6f1ddSLingrui98{ 10309c6f1ddSLingrui98 println(s"icache ways: ${nWays} sets:${nSets}") 10409c6f1ddSLingrui98 val io = IO(new NewIFUIO) 10509c6f1ddSLingrui98 val (toFtq, fromFtq) = (io.ftqInter.toFtq, io.ftqInter.fromFtq) 1061d8f4dcbSJay val (toICache, fromICache) = (VecInit(io.icacheInter.map(_.req)), VecInit(io.icacheInter.map(_.resp))) 1070be662e4SJay val (toUncache, fromUncache) = (io.uncacheInter.toUncache , io.uncacheInter.fromUncache) 10809c6f1ddSLingrui98 10909c6f1ddSLingrui98 def isCrossLineReq(start: UInt, end: UInt): Bool = start(blockOffBits) ^ end(blockOffBits) 11009c6f1ddSLingrui98 11134a88126SJinYue def isLastInCacheline(addr: UInt): Bool = addr(blockOffBits - 1, 1) === 0.U 11209c6f1ddSLingrui98 1131d8f4dcbSJay class TlbExept(implicit p: Parameters) extends XSBundle{ 1141d8f4dcbSJay val pageFault = Bool() 1151d8f4dcbSJay val accessFault = Bool() 1161d8f4dcbSJay val mmio = Bool() 117b005f7c6SJay } 11809c6f1ddSLingrui98 1192a3050c2SJay val preDecoder = Module(new PreDecode) 1202a3050c2SJay val predChecker = Module(new PredChecker) 1212a3050c2SJay val frontendTrigger = Module(new FrontendTrigger) 1222a3050c2SJay val (preDecoderIn, preDecoderOut) = (preDecoder.io.in, preDecoder.io.out) 1232a3050c2SJay val (checkerIn, checkerOut) = (predChecker.io.in, predChecker.io.out) 1241d8f4dcbSJay 12509c6f1ddSLingrui98 //--------------------------------------------- 12609c6f1ddSLingrui98 // Fetch Stage 1 : 12709c6f1ddSLingrui98 // * Send req to ICache Meta/Data 12809c6f1ddSLingrui98 // * Check whether need 2 line fetch 12909c6f1ddSLingrui98 //--------------------------------------------- 13009c6f1ddSLingrui98 13109c6f1ddSLingrui98 val f0_valid = fromFtq.req.valid 13209c6f1ddSLingrui98 val f0_ftq_req = fromFtq.req.bits 1336ce52296SJinYue val f0_doubleLine = fromFtq.req.bits.crossCacheline 13434a88126SJinYue val f0_vSetIdx = VecInit(get_idx((f0_ftq_req.startAddr)), get_idx(f0_ftq_req.nextlineStart)) 13509c6f1ddSLingrui98 val f0_fire = fromFtq.req.fire() 13609c6f1ddSLingrui98 13709c6f1ddSLingrui98 val f0_flush, f1_flush, f2_flush, f3_flush = WireInit(false.B) 13809c6f1ddSLingrui98 val from_bpu_f0_flush, from_bpu_f1_flush, from_bpu_f2_flush, from_bpu_f3_flush = WireInit(false.B) 13909c6f1ddSLingrui98 1403e52bed1SLingrui98 from_bpu_f0_flush := fromFtq.flushFromBpu.shouldFlushByStage2(f0_ftq_req.ftqIdx)/* || 1413e52bed1SLingrui98 fromFtq.flushFromBpu.shouldFlushByStage3(f0_ftq_req.ftqIdx) */ 14209c6f1ddSLingrui98 1432a3050c2SJay val wb_redirect , mmio_redirect, backend_redirect= WireInit(false.B) 1442a3050c2SJay val f3_wb_not_flush = WireInit(false.B) 1452a3050c2SJay 1462a3050c2SJay backend_redirect := fromFtq.redirect.valid 1472a3050c2SJay f3_flush := backend_redirect || (wb_redirect && !f3_wb_not_flush) 1482a3050c2SJay f2_flush := backend_redirect || mmio_redirect || wb_redirect 14909c6f1ddSLingrui98 f1_flush := f2_flush || from_bpu_f1_flush 15009c6f1ddSLingrui98 f0_flush := f1_flush || from_bpu_f0_flush 15109c6f1ddSLingrui98 15209c6f1ddSLingrui98 val f1_ready, f2_ready, f3_ready = WireInit(false.B) 15309c6f1ddSLingrui98 1541d8f4dcbSJay fromFtq.req.ready := toICache(0).ready && toICache(1).ready && f2_ready && GTimer() > 500.U 15509c6f1ddSLingrui98 1562a3050c2SJay toICache(0).valid := fromFtq.req.valid && !f0_flush 1571d8f4dcbSJay toICache(0).bits.vaddr := fromFtq.req.bits.startAddr 1582a3050c2SJay toICache(1).valid := fromFtq.req.valid && f0_doubleLine && !f0_flush 15934a88126SJinYue toICache(1).bits.vaddr := fromFtq.req.bits.nextlineStart//fromFtq.req.bits.startAddr + (PredictWidth * 2).U //TODO: timing critical 16009c6f1ddSLingrui98 161f7c29b0aSJinYue 1622a3050c2SJay /** Fetch Stage 1 */ 16309c6f1ddSLingrui98 16409c6f1ddSLingrui98 val f1_valid = RegInit(false.B) 16509c6f1ddSLingrui98 val f1_ftq_req = RegEnable(next = f0_ftq_req, enable=f0_fire) 1666ce52296SJinYue // val f1_situation = RegEnable(next = f0_situation, enable=f0_fire) 16709c6f1ddSLingrui98 val f1_doubleLine = RegEnable(next = f0_doubleLine, enable=f0_fire) 16809c6f1ddSLingrui98 val f1_vSetIdx = RegEnable(next = f0_vSetIdx, enable=f0_fire) 1691d8f4dcbSJay val f1_fire = f1_valid && f1_ready 17009c6f1ddSLingrui98 1711d8f4dcbSJay f1_ready := f2_ready || !f1_valid 17209c6f1ddSLingrui98 1733e52bed1SLingrui98 // from_bpu_f1_flush := fromFtq.flushFromBpu.shouldFlushByStage3(f1_ftq_req.ftqIdx) 1743e52bed1SLingrui98 from_bpu_f1_flush := false.B 17509c6f1ddSLingrui98 17609c6f1ddSLingrui98 when(f1_flush) {f1_valid := false.B} 17709c6f1ddSLingrui98 .elsewhen(f0_fire && !f0_flush) {f1_valid := true.B} 17809c6f1ddSLingrui98 .elsewhen(f1_fire) {f1_valid := false.B} 17909c6f1ddSLingrui98 1802a3050c2SJay val f1_pc = VecInit((0 until PredictWidth).map(i => f1_ftq_req.startAddr + (i * 2).U)) 1812a3050c2SJay val f1_half_snpc = VecInit((0 until PredictWidth).map(i => f1_ftq_req.startAddr + ((i+2) * 2).U)) 1822a3050c2SJay val f1_cut_ptr = if(HasCExtension) VecInit((0 until PredictWidth + 1).map(i => Cat(0.U(1.W), f1_ftq_req.startAddr(blockOffBits-1, 1)) + i.U )) 1832a3050c2SJay else VecInit((0 until PredictWidth).map(i => Cat(0.U(1.W), f1_ftq_req.startAddr(blockOffBits-1, 2)) + i.U )) 18409c6f1ddSLingrui98 1852a3050c2SJay /** Fetch Stage 2 */ 1861d8f4dcbSJay val icacheRespAllValid = WireInit(false.B) 18709c6f1ddSLingrui98 18809c6f1ddSLingrui98 val f2_valid = RegInit(false.B) 18909c6f1ddSLingrui98 val f2_ftq_req = RegEnable(next = f1_ftq_req, enable=f1_fire) 1906ce52296SJinYue // val f2_situation = RegEnable(next = f1_situation, enable=f1_fire) 19109c6f1ddSLingrui98 val f2_doubleLine = RegEnable(next = f1_doubleLine, enable=f1_fire) 1921d8f4dcbSJay val f2_vSetIdx = RegEnable(next = f1_vSetIdx, enable=f1_fire) 1931d8f4dcbSJay val f2_fire = f2_valid && f2_ready 1941d8f4dcbSJay 1951d8f4dcbSJay f2_ready := f3_ready && icacheRespAllValid || !f2_valid 1961d8f4dcbSJay //TODO: addr compare may be timing critical 19734a88126SJinYue val f2_icache_all_resp_wire = fromICache(0).valid && (fromICache(0).bits.vaddr === f2_ftq_req.startAddr) && ((fromICache(1).valid && (fromICache(1).bits.vaddr === f2_ftq_req.nextlineStart)) || !f2_doubleLine) 1981d8f4dcbSJay val f2_icache_all_resp_reg = RegInit(false.B) 1991d8f4dcbSJay 2001d8f4dcbSJay icacheRespAllValid := f2_icache_all_resp_reg || f2_icache_all_resp_wire 2011d8f4dcbSJay 2021d8f4dcbSJay io.icacheStop := !f3_ready 2031d8f4dcbSJay 2041d8f4dcbSJay when(f2_flush) {f2_icache_all_resp_reg := false.B} 2051d8f4dcbSJay .elsewhen(f2_valid && f2_icache_all_resp_wire && !f3_ready) {f2_icache_all_resp_reg := true.B} 2061d8f4dcbSJay .elsewhen(f2_fire && f2_icache_all_resp_reg) {f2_icache_all_resp_reg := false.B} 20709c6f1ddSLingrui98 20809c6f1ddSLingrui98 when(f2_flush) {f2_valid := false.B} 20909c6f1ddSLingrui98 .elsewhen(f1_fire && !f1_flush) {f2_valid := true.B } 21009c6f1ddSLingrui98 .elsewhen(f2_fire) {f2_valid := false.B} 21109c6f1ddSLingrui98 2121d8f4dcbSJay val f2_cache_response_data = ResultHoldBypass(valid = f2_icache_all_resp_wire, data = VecInit(fromICache.map(_.bits.readData))) 21309c6f1ddSLingrui98 2141d8f4dcbSJay val f2_except_pf = VecInit((0 until PortNumber).map(i => fromICache(i).bits.tlbExcp.pageFault)) 2151d8f4dcbSJay val f2_except_af = VecInit((0 until PortNumber).map(i => fromICache(i).bits.tlbExcp.accessFault)) 216c0b2b8e9Srvcoresjw val f2_mmio = fromICache(0).bits.tlbExcp.mmio && !fromICache(0).bits.tlbExcp.accessFault && 217c0b2b8e9Srvcoresjw !fromICache(0).bits.tlbExcp.pageFault 2180be662e4SJay 2192a3050c2SJay val f2_pc = RegEnable(next = f1_pc, enable = f1_fire) 2202a3050c2SJay val f2_half_snpc = RegEnable(next = f1_half_snpc, enable = f1_fire) 2212a3050c2SJay val f2_cut_ptr = RegEnable(next = f1_cut_ptr, enable = f1_fire) 222a37fbf10SJay 2232a3050c2SJay def isNextLine(pc: UInt, startAddr: UInt) = { 2242a3050c2SJay startAddr(blockOffBits) ^ pc(blockOffBits) 225b6982e83SLemover } 22609c6f1ddSLingrui98 2272a3050c2SJay def isLastInLine(pc: UInt) = { 2282a3050c2SJay pc(blockOffBits - 1, 0) === "b111110".U 22909c6f1ddSLingrui98 } 23009c6f1ddSLingrui98 2312a3050c2SJay //calculate 2322a3050c2SJay val f2_foldpc = VecInit(f2_pc.map(i => XORFold(i(VAddrBits-1,1), MemPredPCWidth))) 2332a3050c2SJay val f2_jump_range = Fill(PredictWidth, !f2_ftq_req.ftqOffset.valid) | Fill(PredictWidth, 1.U(1.W)) >> ~f2_ftq_req.ftqOffset.bits 2346ce52296SJinYue val f2_ftr_range = Fill(PredictWidth, f2_ftq_req.oversize || f2_ftq_req.ftqOffset.valid) | Fill(PredictWidth, 1.U(1.W)) >> ~getBasicBlockIdx(f2_ftq_req.nextStartAddr, f2_ftq_req.startAddr) 2352a3050c2SJay val f2_instr_range = f2_jump_range & f2_ftr_range 2362a3050c2SJay val f2_pf_vec = VecInit((0 until PredictWidth).map(i => (!isNextLine(f2_pc(i), f2_ftq_req.startAddr) && f2_except_pf(0) || isNextLine(f2_pc(i), f2_ftq_req.startAddr) && f2_doubleLine && f2_except_pf(1)))) 2372a3050c2SJay val f2_af_vec = VecInit((0 until PredictWidth).map(i => (!isNextLine(f2_pc(i), f2_ftq_req.startAddr) && f2_except_af(0) || isNextLine(f2_pc(i), f2_ftq_req.startAddr) && f2_doubleLine && f2_except_af(1)))) 23809c6f1ddSLingrui98 2391d8f4dcbSJay val f2_paddrs = VecInit((0 until PortNumber).map(i => fromICache(i).bits.paddr)) 2401d8f4dcbSJay val f2_perf_info = io.icachePerfInfo 24109c6f1ddSLingrui98 2422a3050c2SJay def cut(cacheline: UInt, cutPtr: Vec[UInt]) : Vec[UInt] ={ 24309c6f1ddSLingrui98 if(HasCExtension){ 24409c6f1ddSLingrui98 val result = Wire(Vec(PredictWidth + 1, UInt(16.W))) 24509c6f1ddSLingrui98 val dataVec = cacheline.asTypeOf(Vec(blockBytes * 2/ 2, UInt(16.W))) 24609c6f1ddSLingrui98 (0 until PredictWidth + 1).foreach( i => 2472a3050c2SJay result(i) := dataVec(cutPtr(i)) 24809c6f1ddSLingrui98 ) 24909c6f1ddSLingrui98 result 25009c6f1ddSLingrui98 } else { 25109c6f1ddSLingrui98 val result = Wire(Vec(PredictWidth, UInt(32.W)) ) 25209c6f1ddSLingrui98 val dataVec = cacheline.asTypeOf(Vec(blockBytes * 2/ 4, UInt(32.W))) 25309c6f1ddSLingrui98 (0 until PredictWidth).foreach( i => 2542a3050c2SJay result(i) := dataVec(cutPtr(i)) 25509c6f1ddSLingrui98 ) 25609c6f1ddSLingrui98 result 25709c6f1ddSLingrui98 } 25809c6f1ddSLingrui98 } 25909c6f1ddSLingrui98 2602a3050c2SJay val f2_datas = VecInit((0 until PortNumber).map(i => f2_cache_response_data(i))) 2612a3050c2SJay val f2_cut_data = cut( Cat(f2_datas.map(cacheline => cacheline.asUInt ).reverse).asUInt, f2_cut_ptr ) 26209c6f1ddSLingrui98 2632a3050c2SJay //** predecoder **// 2642a3050c2SJay preDecoderIn.data := f2_cut_data 2652a3050c2SJay// preDecoderIn.lastHalfMatch := f2_lastHalfMatch 2662a3050c2SJay preDecoderIn.frontendTrigger := io.frontendTrigger 2672a3050c2SJay preDecoderIn.csrTriggerEnable := io.csrTriggerEnable 2682a3050c2SJay preDecoderIn.pc := f2_pc 26909c6f1ddSLingrui98 2702a3050c2SJay val f2_expd_instr = preDecoderOut.expInstr 2712a3050c2SJay val f2_pd = preDecoderOut.pd 2722a3050c2SJay val f2_jump_offset = preDecoderOut.jumpOffset 2732a3050c2SJay// val f2_triggered = preDecoderOut.triggered 2742a3050c2SJay val f2_hasHalfValid = preDecoderOut.hasHalfValid 2752a3050c2SJay val f2_crossPageFault = VecInit((0 until PredictWidth).map(i => isLastInLine(f2_pc(i)) && !f2_except_pf(0) && f2_doubleLine && f2_except_pf(1) && !f2_pd(i).isRVC )) 27609c6f1ddSLingrui98 2771d8f4dcbSJay val predecodeOutValid = WireInit(false.B) 27809c6f1ddSLingrui98 27909c6f1ddSLingrui98 2802a3050c2SJay /** Fetch Stage 3 */ 28109c6f1ddSLingrui98 val f3_valid = RegInit(false.B) 28209c6f1ddSLingrui98 val f3_ftq_req = RegEnable(next = f2_ftq_req, enable=f2_fire) 2836ce52296SJinYue // val f3_situation = RegEnable(next = f2_situation, enable=f2_fire) 28409c6f1ddSLingrui98 val f3_doubleLine = RegEnable(next = f2_doubleLine, enable=f2_fire) 2851d8f4dcbSJay val f3_fire = io.toIbuffer.fire() 2861d8f4dcbSJay 2871d8f4dcbSJay f3_ready := io.toIbuffer.ready || !f3_valid 28809c6f1ddSLingrui98 28909c6f1ddSLingrui98 val f3_cut_data = RegEnable(next = f2_cut_data, enable=f2_fire) 2901d8f4dcbSJay 29109c6f1ddSLingrui98 val f3_except_pf = RegEnable(next = f2_except_pf, enable = f2_fire) 29209c6f1ddSLingrui98 val f3_except_af = RegEnable(next = f2_except_af, enable = f2_fire) 2930be662e4SJay val f3_mmio = RegEnable(next = f2_mmio , enable = f2_fire) 29409c6f1ddSLingrui98 2952a3050c2SJay val f3_expd_instr = RegEnable(next = f2_expd_instr, enable = f2_fire) 2962a3050c2SJay val f3_pd = RegEnable(next = f2_pd, enable = f2_fire) 2972a3050c2SJay val f3_jump_offset = RegEnable(next = f2_jump_offset, enable = f2_fire) 2982a3050c2SJay val f3_af_vec = RegEnable(next = f2_af_vec, enable = f2_fire) 2992a3050c2SJay val f3_pf_vec = RegEnable(next = f2_pf_vec , enable = f2_fire) 3002a3050c2SJay val f3_pc = RegEnable(next = f2_pc, enable = f2_fire) 3012a3050c2SJay val f3_half_snpc = RegEnable(next = f2_half_snpc, enable = f2_fire) 3022a3050c2SJay val f3_instr_range = RegEnable(next = f2_instr_range, enable = f2_fire) 3032a3050c2SJay val f3_foldpc = RegEnable(next = f2_foldpc, enable = f2_fire) 3042a3050c2SJay val f3_crossPageFault = RegEnable(next = f2_crossPageFault, enable = f2_fire) 3052a3050c2SJay val f3_hasHalfValid = RegEnable(next = f2_hasHalfValid, enable = f2_fire) 30609c6f1ddSLingrui98 val f3_except = VecInit((0 until 2).map{i => f3_except_pf(i) || f3_except_af(i)}) 30709c6f1ddSLingrui98 val f3_has_except = f3_valid && (f3_except_af.reduce(_||_) || f3_except_pf.reduce(_||_)) 3081d8f4dcbSJay val f3_pAddrs = RegEnable(next = f2_paddrs, enable = f2_fire) 309a37fbf10SJay 3102a3050c2SJay /*** MMIO State Machine***/ 311a37fbf10SJay val f3_mmio_data = Reg(UInt(maxInstrLen.W)) 312a37fbf10SJay 3132a3050c2SJay// val f3_data = if(HasCExtension) Wire(Vec(PredictWidth + 1, UInt(16.W))) else Wire(Vec(PredictWidth, UInt(32.W))) 3142a3050c2SJay// f3_data := f3_cut_data 31509c6f1ddSLingrui98 3162a3050c2SJay val mmio_idle :: mmio_send_req :: mmio_w_resp :: mmio_resend :: mmio_resend_w_resp :: mmio_wait_commit :: mmio_commited :: Nil = Enum(7) 317a37fbf10SJay val mmio_state = RegInit(mmio_idle) 318a37fbf10SJay 3199bae7d6eSJay val f3_req_is_mmio = f3_mmio && f3_valid 3202a3050c2SJay val mmio_commit = VecInit(io.rob_commits.map{commit => commit.valid && commit.bits.ftqIdx === f3_ftq_req.ftqIdx && commit.bits.ftqOffset === 0.U}).asUInt.orR 3212a3050c2SJay val f3_mmio_req_commit = f3_req_is_mmio && mmio_state === mmio_commited 322a37fbf10SJay 3232a3050c2SJay val f3_mmio_to_commit = f3_req_is_mmio && mmio_state === mmio_wait_commit 324a37fbf10SJay val f3_mmio_to_commit_next = RegNext(f3_mmio_to_commit) 325a37fbf10SJay val f3_mmio_can_go = f3_mmio_to_commit && !f3_mmio_to_commit_next 326a37fbf10SJay 3279bae7d6eSJay val f3_ftq_flush_self = fromFtq.redirect.valid && RedirectLevel.flushItself(fromFtq.redirect.bits.level) 328167bcd01SJay val f3_ftq_flush_by_older = fromFtq.redirect.valid && isBefore(fromFtq.redirect.bits.ftqIdx, f3_ftq_req.ftqIdx) 3299bae7d6eSJay 330167bcd01SJay val f3_need_not_flush = f3_req_is_mmio && fromFtq.redirect.valid && !f3_ftq_flush_self && !f3_ftq_flush_by_older 3319bae7d6eSJay 3329bae7d6eSJay when(f3_flush && !f3_need_not_flush) {f3_valid := false.B} 333a37fbf10SJay .elsewhen(f2_fire && !f2_flush ) {f3_valid := true.B } 334a37fbf10SJay .elsewhen(io.toIbuffer.fire() && !f3_req_is_mmio) {f3_valid := false.B} 335a37fbf10SJay .elsewhen{f3_req_is_mmio && f3_mmio_req_commit} {f3_valid := false.B} 336a37fbf10SJay 337a37fbf10SJay val f3_mmio_use_seq_pc = RegInit(false.B) 338a37fbf10SJay 339a37fbf10SJay val (redirect_ftqIdx, redirect_ftqOffset) = (fromFtq.redirect.bits.ftqIdx,fromFtq.redirect.bits.ftqOffset) 340a37fbf10SJay val redirect_mmio_req = fromFtq.redirect.valid && redirect_ftqIdx === f3_ftq_req.ftqIdx && redirect_ftqOffset === 0.U 341a37fbf10SJay 342a37fbf10SJay when(RegNext(f2_fire && !f2_flush) && f3_req_is_mmio) { f3_mmio_use_seq_pc := true.B } 343a37fbf10SJay .elsewhen(redirect_mmio_req) { f3_mmio_use_seq_pc := false.B } 344a37fbf10SJay 345a37fbf10SJay f3_ready := Mux(f3_req_is_mmio, io.toIbuffer.ready && f3_mmio_req_commit || !f3_valid , io.toIbuffer.ready || !f3_valid) 346a37fbf10SJay 347a37fbf10SJay when(fromUncache.fire()) {f3_mmio_data := fromUncache.bits.data} 348a37fbf10SJay 349a37fbf10SJay 350a37fbf10SJay switch(mmio_state){ 351a37fbf10SJay is(mmio_idle){ 3529bae7d6eSJay when(f3_req_is_mmio){ 353a37fbf10SJay mmio_state := mmio_send_req 354a37fbf10SJay } 355a37fbf10SJay } 356a37fbf10SJay 357a37fbf10SJay is(mmio_send_req){ 358a37fbf10SJay mmio_state := Mux(toUncache.fire(), mmio_w_resp, mmio_send_req ) 359a37fbf10SJay } 360a37fbf10SJay 361a37fbf10SJay is(mmio_w_resp){ 362a37fbf10SJay when(fromUncache.fire()){ 363a37fbf10SJay val isRVC = fromUncache.bits.data(1,0) =/= 3.U 3642a3050c2SJay mmio_state := Mux(isRVC, mmio_resend , mmio_wait_commit) 365a37fbf10SJay } 366a37fbf10SJay } 367a37fbf10SJay 368a37fbf10SJay is(mmio_resend){ 369a37fbf10SJay mmio_state := Mux(toUncache.fire(), mmio_resend_w_resp, mmio_resend ) 370a37fbf10SJay } 371a37fbf10SJay 372a37fbf10SJay is(mmio_resend_w_resp){ 373a37fbf10SJay when(fromUncache.fire()){ 3742a3050c2SJay mmio_state := mmio_wait_commit 375a37fbf10SJay } 376a37fbf10SJay } 377a37fbf10SJay 3782a3050c2SJay is(mmio_wait_commit){ 3792a3050c2SJay when(mmio_commit){ 3802a3050c2SJay mmio_state := mmio_commited 381a37fbf10SJay } 382a37fbf10SJay } 3832a3050c2SJay 3842a3050c2SJay is(mmio_commited){ 3852a3050c2SJay mmio_state := mmio_idle 3862a3050c2SJay } 387a37fbf10SJay } 388a37fbf10SJay 389167bcd01SJay when(f3_ftq_flush_self || f3_ftq_flush_by_older) { 3909bae7d6eSJay mmio_state := mmio_idle 3919bae7d6eSJay f3_mmio_data := 0.U 3929bae7d6eSJay } 3939bae7d6eSJay 394a37fbf10SJay toUncache.valid := ((mmio_state === mmio_send_req) || (mmio_state === mmio_resend)) && f3_req_is_mmio 395a37fbf10SJay toUncache.bits.addr := Mux((mmio_state === mmio_resend), f3_pAddrs(0) + 2.U, f3_pAddrs(0)) 396a37fbf10SJay fromUncache.ready := true.B 397a37fbf10SJay 398f7c29b0aSJinYue 3992a3050c2SJay val f3_lastHalf = RegInit(0.U.asTypeOf(new LastHalfInfo)) 40009c6f1ddSLingrui98 40109c6f1ddSLingrui98 val f3_predecode_range = VecInit(preDecoderOut.pd.map(inst => inst.valid)).asUInt 4020be662e4SJay val f3_mmio_range = VecInit((0 until PredictWidth).map(i => if(i ==0) true.B else false.B)) 4032a3050c2SJay val f3_instr_valid = Wire(Vec(PredictWidth, Bool())) 40409c6f1ddSLingrui98 4052a3050c2SJay /*** prediction result check ***/ 4062a3050c2SJay checkerIn.ftqOffset := f3_ftq_req.ftqOffset 4072a3050c2SJay checkerIn.jumpOffset := f3_jump_offset 4086ce52296SJinYue checkerIn.target := f3_ftq_req.nextStartAddr 4092a3050c2SJay checkerIn.instrRange := f3_instr_range.asTypeOf(Vec(PredictWidth, Bool())) 4102a3050c2SJay checkerIn.instrValid := f3_instr_valid.asTypeOf(Vec(PredictWidth, Bool())) 4112a3050c2SJay checkerIn.pds := f3_pd 4122a3050c2SJay checkerIn.pc := f3_pc 4132a3050c2SJay 4142a3050c2SJay /*** process half RVI in the last 2 Bytes ***/ 4152a3050c2SJay 4162a3050c2SJay def hasLastHalf(idx: UInt) = { 4172a3050c2SJay !f3_pd(idx).isRVC && checkerOut.fixedRange(idx) && f3_instr_valid(idx) && !checkerOut.fixedTaken(idx) && !checkerOut.fixedMissPred(idx) && ! f3_req_is_mmio && !f3_ftq_req.oversize 4182a3050c2SJay } 4192a3050c2SJay 4202a3050c2SJay val f3_last_validIdx = ~ParallelPriorityEncoder(checkerOut.fixedRange.reverse) 4212a3050c2SJay 4222a3050c2SJay val f3_hasLastHalf = hasLastHalf((PredictWidth - 1).U) 4232a3050c2SJay val f3_false_lastHalf = hasLastHalf(f3_last_validIdx) 4242a3050c2SJay val f3_false_snpc = f3_half_snpc(f3_last_validIdx) 4252a3050c2SJay 4262a3050c2SJay val f3_lastHalf_mask = VecInit((0 until PredictWidth).map( i => if(i ==0) false.B else true.B )).asUInt() 4272a3050c2SJay 4282a3050c2SJay when (f3_flush) { 4292a3050c2SJay f3_lastHalf.valid := false.B 4302a3050c2SJay }.elsewhen (f3_fire) { 4312a3050c2SJay f3_lastHalf.valid := f3_hasLastHalf 4326ce52296SJinYue f3_lastHalf.middlePC := f3_ftq_req.nextStartAddr 4332a3050c2SJay } 4342a3050c2SJay 4352a3050c2SJay f3_instr_valid := Mux(f3_lastHalf.valid,f3_hasHalfValid ,VecInit(f3_pd.map(inst => inst.valid))) 4362a3050c2SJay 4372a3050c2SJay /*** frontend Trigger ***/ 4382a3050c2SJay frontendTrigger.io.pds := f3_pd 4392a3050c2SJay frontendTrigger.io.pc := f3_pc 4402a3050c2SJay frontendTrigger.io.data := f3_cut_data 4412a3050c2SJay 4422a3050c2SJay frontendTrigger.io.frontendTrigger := io.frontendTrigger 4432a3050c2SJay frontendTrigger.io.csrTriggerEnable := io.csrTriggerEnable 4442a3050c2SJay 4452a3050c2SJay val f3_triggered = frontendTrigger.io.triggered 4462a3050c2SJay 4472a3050c2SJay /*** send to Ibuffer ***/ 4482a3050c2SJay 4492a3050c2SJay io.toIbuffer.valid := f3_valid && (!f3_req_is_mmio || f3_mmio_can_go) && !f3_flush 4502a3050c2SJay io.toIbuffer.bits.instrs := f3_expd_instr 4512a3050c2SJay io.toIbuffer.bits.valid := f3_instr_valid.asUInt 4522a3050c2SJay io.toIbuffer.bits.enqEnable := checkerOut.fixedRange.asUInt & f3_instr_valid.asUInt 4532a3050c2SJay io.toIbuffer.bits.pd := f3_pd 45409c6f1ddSLingrui98 io.toIbuffer.bits.ftqPtr := f3_ftq_req.ftqIdx 4552a3050c2SJay io.toIbuffer.bits.pc := f3_pc 4562a3050c2SJay io.toIbuffer.bits.ftqOffset.zipWithIndex.map{case(a, i) => a.bits := i.U; a.valid := checkerOut.fixedTaken(i) && !f3_req_is_mmio} 4572a3050c2SJay io.toIbuffer.bits.foldpc := f3_foldpc 4582a3050c2SJay io.toIbuffer.bits.ipf := f3_pf_vec 4592a3050c2SJay io.toIbuffer.bits.acf := f3_af_vec 4602a3050c2SJay io.toIbuffer.bits.crossPageIPFFix := f3_crossPageFault 4612a3050c2SJay io.toIbuffer.bits.triggered := f3_triggered 4622a3050c2SJay 4632a3050c2SJay val lastHalfMask = VecInit((0 until PredictWidth).map(i => if(i ==0) false.B else true.B)) 4642a3050c2SJay when(f3_lastHalf.valid){ 4652a3050c2SJay io.toIbuffer.bits.enqEnable := checkerOut.fixedRange.asUInt & f3_instr_valid.asUInt & lastHalfMask.asUInt 4662a3050c2SJay io.toIbuffer.bits.valid := f3_lastHalf_mask & f3_instr_valid.asUInt 4672a3050c2SJay } 4682a3050c2SJay 4692a3050c2SJay /** external predecode for MMIO instruction */ 4702a3050c2SJay when(f3_req_is_mmio){ 4712a3050c2SJay val inst = Cat(f3_mmio_data(31,16), f3_mmio_data(15,0)) 4722a3050c2SJay val currentIsRVC = isRVC(inst) 4732a3050c2SJay 4742a3050c2SJay val brType::isCall::isRet::Nil = brInfo(inst) 4752a3050c2SJay val jalOffset = jal_offset(inst, currentIsRVC) 4762a3050c2SJay val brOffset = br_offset(inst, currentIsRVC) 4772a3050c2SJay 4782a3050c2SJay io.toIbuffer.bits.instrs (0) := new RVCDecoder(inst, XLEN).decode.bits 4792a3050c2SJay 4802a3050c2SJay io.toIbuffer.bits.pd(0).valid := true.B 4812a3050c2SJay io.toIbuffer.bits.pd(0).isRVC := currentIsRVC 4822a3050c2SJay io.toIbuffer.bits.pd(0).brType := brType 4832a3050c2SJay io.toIbuffer.bits.pd(0).isCall := isCall 4842a3050c2SJay io.toIbuffer.bits.pd(0).isRet := isRet 4852a3050c2SJay 4862a3050c2SJay io.toIbuffer.bits.enqEnable := f3_mmio_range.asUInt 4872a3050c2SJay } 4882a3050c2SJay 48909c6f1ddSLingrui98 49009c6f1ddSLingrui98 //Write back to Ftq 491a37fbf10SJay val f3_cache_fetch = f3_valid && !(f2_fire && !f2_flush) 492a37fbf10SJay val finishFetchMaskReg = RegNext(f3_cache_fetch) 493a37fbf10SJay 4942a3050c2SJay val mmioFlushWb = Wire(Valid(new PredecodeWritebackBundle)) 4950be662e4SJay val f3_mmio_missOffset = Wire(ValidUndirectioned(UInt(log2Ceil(PredictWidth).W))) 496a37fbf10SJay f3_mmio_missOffset.valid := f3_req_is_mmio 4970be662e4SJay f3_mmio_missOffset.bits := 0.U 4980be662e4SJay 4992a3050c2SJay mmioFlushWb.valid := (f3_req_is_mmio && mmio_state === mmio_wait_commit && RegNext(fromUncache.fire()) && f3_mmio_use_seq_pc) 5002a3050c2SJay mmioFlushWb.bits.pc := f3_pc 5012a3050c2SJay mmioFlushWb.bits.pd := f3_pd 5022a3050c2SJay mmioFlushWb.bits.pd.zipWithIndex.map{case(instr,i) => instr.valid := f3_mmio_range(i)} 5032a3050c2SJay mmioFlushWb.bits.ftqIdx := f3_ftq_req.ftqIdx 5042a3050c2SJay mmioFlushWb.bits.ftqOffset := f3_ftq_req.ftqOffset.bits 5052a3050c2SJay mmioFlushWb.bits.misOffset := f3_mmio_missOffset 5062a3050c2SJay mmioFlushWb.bits.cfiOffset := DontCare 5072a3050c2SJay mmioFlushWb.bits.target := Mux((f3_mmio_data(1,0) =/= 3.U), f3_ftq_req.startAddr + 2.U , f3_ftq_req.startAddr + 4.U) 5082a3050c2SJay mmioFlushWb.bits.jalTarget := DontCare 5092a3050c2SJay mmioFlushWb.bits.instrRange := f3_mmio_range 51009c6f1ddSLingrui98 5112a3050c2SJay mmio_redirect := (f3_req_is_mmio && mmio_state === mmio_wait_commit && RegNext(fromUncache.fire()) && f3_mmio_use_seq_pc) 51209c6f1ddSLingrui98 5132a3050c2SJay /* --------------------------------------------------------------------- 5142a3050c2SJay * Ftq Write back : 5152a3050c2SJay * 5162a3050c2SJay * --------------------------------------------------------------------- 5172a3050c2SJay */ 5182a3050c2SJay val wb_valid = RegNext(RegNext(f2_fire && !f2_flush) && !f3_req_is_mmio && !f3_flush) 5192a3050c2SJay val wb_ftq_req = RegNext(f3_ftq_req) 520cd365d4cSrvcoresjw 5212a3050c2SJay val wb_check_result = RegNext(checkerOut) 5222a3050c2SJay val wb_instr_range = RegNext(io.toIbuffer.bits.enqEnable) 5232a3050c2SJay val wb_pc = RegNext(f3_pc) 5242a3050c2SJay val wb_pd = RegNext(f3_pd) 5252a3050c2SJay val wb_instr_valid = RegNext(f3_instr_valid) 5262a3050c2SJay 5272a3050c2SJay /* false hit lastHalf */ 5282a3050c2SJay val wb_lastIdx = RegNext(f3_last_validIdx) 5292a3050c2SJay val wb_false_lastHalf = RegNext(f3_false_lastHalf) && wb_lastIdx =/= (PredictWidth - 1).U 5302a3050c2SJay val wb_false_target = RegNext(f3_false_snpc) 5312a3050c2SJay 5322a3050c2SJay val wb_half_flush = wb_false_lastHalf 5332a3050c2SJay val wb_half_target = wb_false_target 5342a3050c2SJay 5352a3050c2SJay f3_wb_not_flush := wb_ftq_req.ftqIdx === f3_ftq_req.ftqIdx && f3_valid && wb_valid 5362a3050c2SJay 5372a3050c2SJay val checkFlushWb = Wire(Valid(new PredecodeWritebackBundle)) 5382a3050c2SJay checkFlushWb.valid := wb_valid 5392a3050c2SJay checkFlushWb.bits.pc := wb_pc 5402a3050c2SJay checkFlushWb.bits.pd := wb_pd 5412a3050c2SJay checkFlushWb.bits.pd.zipWithIndex.map{case(instr,i) => instr.valid := wb_instr_valid(i)} 5422a3050c2SJay checkFlushWb.bits.ftqIdx := wb_ftq_req.ftqIdx 5432a3050c2SJay checkFlushWb.bits.ftqOffset := wb_ftq_req.ftqOffset.bits 5442a3050c2SJay checkFlushWb.bits.misOffset.valid := ParallelOR(wb_check_result.fixedMissPred) || wb_half_flush 5452a3050c2SJay checkFlushWb.bits.misOffset.bits := Mux(wb_half_flush, (PredictWidth - 1).U, ParallelPriorityEncoder(wb_check_result.fixedMissPred)) 5462a3050c2SJay checkFlushWb.bits.cfiOffset.valid := ParallelOR(wb_check_result.fixedTaken) 5472a3050c2SJay checkFlushWb.bits.cfiOffset.bits := ParallelPriorityEncoder(wb_check_result.fixedTaken) 5482a3050c2SJay checkFlushWb.bits.target := Mux(wb_half_flush, wb_half_target, wb_check_result.fixedTarget(ParallelPriorityEncoder(wb_check_result.fixedMissPred))) 549*b37e4b45SLingrui98 checkFlushWb.bits.jalTarget := wb_check_result.fixedTarget(ParallelPriorityEncoder(VecInit(wb_pd.zip(wb_instr_valid).map{case (pd, v) => v && pd.isJal }))) 5502a3050c2SJay checkFlushWb.bits.instrRange := wb_instr_range.asTypeOf(Vec(PredictWidth, Bool())) 5512a3050c2SJay 5522a3050c2SJay toFtq.pdWb := Mux(f3_req_is_mmio, mmioFlushWb, checkFlushWb) 5532a3050c2SJay 5542a3050c2SJay wb_redirect := checkFlushWb.bits.misOffset.valid && wb_valid 55509c6f1ddSLingrui98 5561d8f4dcbSJay 5571d8f4dcbSJay /** performance counter */ 5581d8f4dcbSJay val f3_perf_info = RegEnable(next = f2_perf_info, enable = f2_fire) 5591d8f4dcbSJay val f3_req_0 = io.toIbuffer.fire() 5601d8f4dcbSJay val f3_req_1 = io.toIbuffer.fire() && f3_doubleLine 5611d8f4dcbSJay val f3_hit_0 = io.toIbuffer.fire() && f3_perf_info.bank_hit(0) 5621d8f4dcbSJay val f3_hit_1 = io.toIbuffer.fire() && f3_doubleLine & f3_perf_info.bank_hit(1) 5631d8f4dcbSJay val f3_hit = f3_perf_info.hit 564cd365d4cSrvcoresjw val perfEvents = Seq( 5652a3050c2SJay ("frontendFlush ", wb_redirect ), 566cd365d4cSrvcoresjw ("ifu_req ", io.toIbuffer.fire() ), 5671d8f4dcbSJay ("ifu_miss ", io.toIbuffer.fire() && !f3_perf_info.hit ), 568cd365d4cSrvcoresjw ("ifu_req_cacheline_0 ", f3_req_0 ), 569cd365d4cSrvcoresjw ("ifu_req_cacheline_1 ", f3_req_1 ), 570cd365d4cSrvcoresjw ("ifu_req_cacheline_0_hit ", f3_hit_1 ), 571cd365d4cSrvcoresjw ("ifu_req_cacheline_1_hit ", f3_hit_1 ), 5721d8f4dcbSJay ("only_0_hit ", f3_perf_info.only_0_hit && io.toIbuffer.fire() ), 5731d8f4dcbSJay ("only_0_miss ", f3_perf_info.only_0_miss && io.toIbuffer.fire() ), 5741d8f4dcbSJay ("hit_0_hit_1 ", f3_perf_info.hit_0_hit_1 && io.toIbuffer.fire() ), 5751d8f4dcbSJay ("hit_0_miss_1 ", f3_perf_info.hit_0_miss_1 && io.toIbuffer.fire() ), 5761d8f4dcbSJay ("miss_0_hit_1 ", f3_perf_info.miss_0_hit_1 && io.toIbuffer.fire() ), 5771d8f4dcbSJay ("miss_0_miss_1 ", f3_perf_info.miss_0_miss_1 && io.toIbuffer.fire() ), 5786ce52296SJinYue // ("cross_line_block ", io.toIbuffer.fire() && f3_situation(0) ), 5796ce52296SJinYue // ("fall_through_is_cacheline_end", io.toIbuffer.fire() && f3_situation(1) ), 580cd365d4cSrvcoresjw ) 5811ca0e4f3SYinan Xu generatePerfEvent() 58209c6f1ddSLingrui98 583f7c29b0aSJinYue XSPerfAccumulate("ifu_req", io.toIbuffer.fire() ) 584f7c29b0aSJinYue XSPerfAccumulate("ifu_miss", io.toIbuffer.fire() && !f3_hit ) 585f7c29b0aSJinYue XSPerfAccumulate("ifu_req_cacheline_0", f3_req_0 ) 586f7c29b0aSJinYue XSPerfAccumulate("ifu_req_cacheline_1", f3_req_1 ) 587f7c29b0aSJinYue XSPerfAccumulate("ifu_req_cacheline_0_hit", f3_hit_0 ) 588f7c29b0aSJinYue XSPerfAccumulate("ifu_req_cacheline_1_hit", f3_hit_1 ) 5892a3050c2SJay XSPerfAccumulate("frontendFlush", wb_redirect ) 5901d8f4dcbSJay XSPerfAccumulate("only_0_hit", f3_perf_info.only_0_hit && io.toIbuffer.fire() ) 5911d8f4dcbSJay XSPerfAccumulate("only_0_miss", f3_perf_info.only_0_miss && io.toIbuffer.fire() ) 5921d8f4dcbSJay XSPerfAccumulate("hit_0_hit_1", f3_perf_info.hit_0_hit_1 && io.toIbuffer.fire() ) 5931d8f4dcbSJay XSPerfAccumulate("hit_0_miss_1", f3_perf_info.hit_0_miss_1 && io.toIbuffer.fire() ) 5941d8f4dcbSJay XSPerfAccumulate("miss_0_hit_1", f3_perf_info.miss_0_hit_1 && io.toIbuffer.fire() ) 5951d8f4dcbSJay XSPerfAccumulate("miss_0_miss_1", f3_perf_info.miss_0_miss_1 && io.toIbuffer.fire() ) 5966ce52296SJinYue // XSPerfAccumulate("cross_line_block", io.toIbuffer.fire() && f3_situation(0) ) 5976ce52296SJinYue // XSPerfAccumulate("fall_through_is_cacheline_end", io.toIbuffer.fire() && f3_situation(1) ) 59809c6f1ddSLingrui98} 599