1package xiangshan.frontend 2 3import chisel3._ 4import chisel3.util._ 5import xiangshan._ 6import xiangshan.utils._ 7import xiangshan.backend.ALUOpType 8import utils._ 9 10class TableAddr(val idxBits: Int, val banks: Int) extends XSBundle { 11 def tagBits = VAddrBits - idxBits - 2 12 13 val tag = UInt(tagBits.W) 14 val idx = UInt(idxBits.W) 15 val offset = UInt(2.W) 16 17 def fromUInt(x: UInt) = x.asTypeOf(UInt(VAddrBits.W)).asTypeOf(this) 18 def getTag(x: UInt) = fromUInt(x).tag 19 def getIdx(x: UInt) = fromUInt(x).idx 20 def getBank(x: UInt) = getIdx(x)(log2Up(banks) - 1, 0) 21 def getBankIdx(x: UInt) = getIdx(x)(idxBits - 1, log2Up(banks)) 22} 23 24class Stage1To2IO extends XSBundle { 25 val pc = Output(UInt(VAddrBits.W)) 26 val btb = new Bundle { 27 val hits = Output(UInt(FetchWidth.W)) 28 val targets = Output(Vec(FetchWidth, UInt(VAddrBits.W))) 29 } 30 val jbtac = new Bundle { 31 val hitIdx = Output(UInt(FetchWidth.W)) 32 val target = Output(UInt(VAddrBits.W)) 33 } 34 val tage = new Bundle { 35 val hits = Output(UInt(FetchWidth.W)) 36 val takens = Output(Vec(FetchWidth, Bool())) 37 } 38 val hist = Output(Vec(FetchWidth, UInt(HistoryLength.W))) 39 val btbPred = ValidIO(new BranchPrediction) 40} 41 42class BPUStage1 extends XSModule { 43 val io = IO(new Bundle() { 44 val in = new Bundle { val pc = Flipped(Decoupled(UInt(VAddrBits.W))) } 45 // from backend 46 val redirectInfo = Input(new RedirectInfo) 47 // from Stage3 48 val flush = Input(Bool()) 49 val s3RollBackHist = Input(UInt(HistoryLength.W)) 50 val s3Taken = Input(Bool()) 51 // to ifu, quick prediction result 52 val s1OutPred = ValidIO(new BranchPrediction) 53 // to Stage2 54 val out = Decoupled(new Stage1To2IO) 55 }) 56 57 io.in.pc.ready := true.B 58 59 // flush Stage1 when io.flush 60 val flushS1 = BoolStopWatch(io.flush, io.in.pc.fire(), startHighPriority = true) 61 62 // global history register 63 val ghr = RegInit(0.U(HistoryLength.W)) 64 // modify updateGhr and newGhr when updating ghr 65 val updateGhr = WireInit(false.B) 66 val newGhr = WireInit(0.U(HistoryLength.W)) 67 when (updateGhr) { ghr := newGhr } 68 // use hist as global history!!! 69 val hist = Mux(updateGhr, newGhr, ghr) 70 71 // Tage predictor 72 // val tage = Module(new FakeTAGE) 73 val tage = if(EnableBPD) Module(new Tage) else Module(new FakeTAGE) 74 tage.io.req.valid := io.in.pc.fire() 75 tage.io.req.bits.pc := io.in.pc.bits 76 tage.io.req.bits.hist := hist 77 tage.io.redirectInfo <> io.redirectInfo 78 io.out.bits.tage <> tage.io.out 79 io.s1OutPred.bits.tageMeta := tage.io.meta 80 81 // latch pc for 1 cycle latency when reading SRAM 82 val pcLatch = RegEnable(io.in.pc.bits, io.in.pc.fire()) 83 84 val r = io.redirectInfo.redirect 85 val updateFetchpc = r.pc - r.fetchIdx << 2.U 86 // BTB 87 val btb = Module(new BTB) 88 btb.io.in.pc <> io.in.pc 89 btb.io.in.pcLatch := pcLatch 90 btb.io.redirectValid := io.redirectInfo.valid 91 btb.io.flush := io.flush 92 93 btb.io.update.fetchPC := updateFetchpc 94 btb.io.update.fetchIdx := r.fetchIdx 95 btb.io.update.hit := r.btbHitWay 96 btb.io.update.misPred := io.redirectInfo.misPred 97 btb.io.update.writeWay := r.btbVictimWay 98 btb.io.update.oldCtr := r.btbPredCtr 99 btb.io.update.taken := r.taken 100 btb.io.update.target := r.brTarget 101 btb.io.update._type := r._type 102 103 val btbHit = btb.io.out.hit 104 val btbTaken = btb.io.out.taken 105 val btbTakenIdx = btb.io.out.takenIdx 106 val btbTakenTarget = btb.io.out.target 107 val btbWriteWay = btb.io.out.writeWay 108 val btbNotTakens = btb.io.out.notTakens 109 val btbCtrs = VecInit(btb.io.out.dEntries.map(_.pred)) 110 val btbValids = VecInit(btb.io.out.dEntries.map(_.valid)) 111 val btbTargets = VecInit(btb.io.out.dEntries.map(_.target)) 112 val btbTypes = VecInit(btb.io.out.dEntries.map(_._type)) 113 114 // JBTAC, divided into 8 banks, makes prediction for indirect jump except ret. 115 val jbtacAddr = new TableAddr(log2Up(JbtacSize), JbtacBanks) 116 def jbtacEntry() = new Bundle { 117 val valid = Bool() 118 // TODO: don't need full length of tag and target 119 val tag = UInt(jbtacAddr.tagBits.W) 120 val target = UInt(VAddrBits.W) 121 val offset = UInt(log2Up(FetchWidth).W) 122 } 123 124 val jbtac = List.fill(JbtacBanks)(Module(new SRAMTemplate(jbtacEntry(), set = JbtacSize / JbtacBanks, shouldReset = true, holdRead = true, singlePort = false))) 125 126 val jbtacRead = Wire(Vec(JbtacBanks, jbtacEntry())) 127 128 val jbtacFire = Reg(Vec(JbtacBanks, Bool())) 129 // Only read one bank 130 val histXORAddr = io.in.pc.bits ^ Cat(hist, 0.U(2.W))(VAddrBits - 1, 0) 131 val histXORAddrLatch = RegEnable(histXORAddr, io.in.pc.valid) 132 jbtacFire := 0.U.asTypeOf(Vec(JbtacBanks, Bool())) 133 (0 until JbtacBanks).map( 134 b => { 135 jbtac(b).reset := reset.asBool 136 jbtac(b).io.r.req.valid := io.in.pc.fire() && b.U === jbtacAddr.getBank(histXORAddr) 137 jbtac(b).io.r.req.bits.setIdx := jbtacAddr.getBankIdx(histXORAddr) 138 jbtacFire(b) := jbtac(b).io.r.req.fire() 139 jbtacRead(b) := jbtac(b).io.r.resp.data(0) 140 } 141 ) 142 143 val jbtacBank = jbtacAddr.getBank(histXORAddrLatch) 144 // val jbtacHit = jbtacRead(jbtacBank).valid && jbtacRead(jbtacBank).tag === jbtacAddr.getTag(pcLatch) && !flushS1 && jbtacFire(jbtacBank) 145 val jbtacHit = jbtacRead(jbtacBank).valid && jbtacRead(jbtacBank).tag === jbtacAddr.getTag(pcLatch) && !io.flush && jbtacFire(jbtacBank) 146 val jbtacHitIdx = jbtacRead(jbtacBank).offset 147 val jbtacTarget = jbtacRead(jbtacBank).target 148 149 // calculate global history of each instr 150 val firstHist = RegNext(hist) 151 val histShift = Wire(Vec(FetchWidth, UInt(log2Up(FetchWidth).W))) 152 val shift = Wire(Vec(FetchWidth, Vec(FetchWidth, UInt(1.W)))) 153 (0 until FetchWidth).map(i => shift(i) := Mux(!btbNotTakens(i), 0.U, ~LowerMask(UIntToOH(i.U), FetchWidth)).asTypeOf(Vec(FetchWidth, UInt(1.W)))) 154 for (j <- 0 until FetchWidth) { 155 var tmp = 0.U 156 for (i <- 0 until FetchWidth) { 157 tmp = tmp + shift(i)(j) 158 } 159 histShift(j) := tmp 160 } 161 (0 until FetchWidth).map(i => io.s1OutPred.bits.hist(i) := firstHist << histShift(i)) 162 163 // update btb, jbtac, ghr 164 165 166 // 2. update jbtac 167 val jbtacWrite = Wire(jbtacEntry()) 168 // val updateHistXORAddr = updateFetchpc ^ Cat(r.hist, 0.U(2.W))(VAddrBits - 1, 0) 169 val updateHistXORAddr = updateFetchpc ^ Cat(r.hist, 0.U(2.W))(VAddrBits - 1, 0) 170 jbtacWrite.valid := true.B 171 // jbtacWrite.tag := jbtacAddr.getTag(updateFetchpc) 172 jbtacWrite.tag := jbtacAddr.getTag(updateFetchpc) 173 jbtacWrite.target := r.target 174 // jbtacWrite.offset := updateFetchIdx 175 jbtacWrite.offset := r.fetchIdx 176 for (b <- 0 until JbtacBanks) { 177 when (b.U === jbtacAddr.getBank(updateHistXORAddr)) { 178 jbtac(b).io.w.req.valid := io.redirectInfo.valid && io.redirectInfo.misPred && r._type === BTBtype.I 179 jbtac(b).io.w.req.bits.setIdx := jbtacAddr.getBankIdx(updateHistXORAddr) 180 jbtac(b).io.w.req.bits.data := jbtacWrite 181 }.otherwise { 182 jbtac(b).io.w.req.valid := false.B 183 jbtac(b).io.w.req.bits.setIdx := DontCare 184 jbtac(b).io.w.req.bits.data := DontCare 185 } 186 } 187 188 // 3. update ghr 189 updateGhr := io.s1OutPred.bits.redirect || io.flush 190 val brJumpIdx = Mux(!(btbHit && btbTaken), 0.U, UIntToOH(btbTakenIdx)) 191 val indirectIdx = Mux(!jbtacHit, 0.U, UIntToOH(jbtacHitIdx)) 192 //val newTaken = Mux(io.redirectInfo.flush(), !(r._type === BTBtype.B && !r.taken), ) 193 newGhr := Mux(io.redirectInfo.flush(), (r.hist << 1.U) | !(r._type === BTBtype.B && !r.taken), 194 Mux(io.flush, Mux(io.s3Taken, io.s3RollBackHist << 1.U | 1.U, io.s3RollBackHist), 195 Mux(io.s1OutPred.bits.redirect, PriorityMux(brJumpIdx | indirectIdx, io.s1OutPred.bits.hist) << 1.U | 1.U, 196 io.s1OutPred.bits.hist(0) << PopCount(btbNotTakens)))) 197 198 // redirect based on BTB and JBTAC 199 // io.out.valid := RegNext(io.in.pc.fire()) && !flushS1 200 io.out.valid := RegNext(io.in.pc.fire()) && !io.flush 201 202 io.s1OutPred.valid := io.out.valid 203 io.s1OutPred.bits.redirect := btbHit && btbTaken || jbtacHit 204 // io.s1OutPred.bits.instrValid := LowerMask(UIntToOH(btbTakenIdx), FetchWidth) & LowerMask(UIntToOH(jbtacHitIdx), FetchWidth) 205 io.s1OutPred.bits.instrValid := Mux(io.s1OutPred.bits.redirect, LowerMask(LowestBit(brJumpIdx | indirectIdx, FetchWidth), FetchWidth), Fill(FetchWidth, 1.U(1.W))).asTypeOf(Vec(FetchWidth, Bool())) 206 io.s1OutPred.bits.target := Mux(brJumpIdx === LowestBit(brJumpIdx | indirectIdx, FetchWidth), btbTakenTarget, jbtacTarget) 207 io.s1OutPred.bits.btbVictimWay := btbWriteWay 208 io.s1OutPred.bits.predCtr := btbCtrs 209 io.s1OutPred.bits.btbHitWay := btbHit 210 io.s1OutPred.bits.rasSp := DontCare 211 io.s1OutPred.bits.rasTopCtr := DontCare 212 213 io.out.bits.pc := pcLatch 214 io.out.bits.btb.hits := btbValids.asUInt 215 (0 until FetchWidth).map(i => io.out.bits.btb.targets(i) := btbTargets(i)) 216 io.out.bits.jbtac.hitIdx := UIntToOH(jbtacHitIdx) 217 io.out.bits.jbtac.target := jbtacTarget 218 // TODO: we don't need this repeatedly! 219 io.out.bits.hist := io.s1OutPred.bits.hist 220 io.out.bits.btbPred := io.s1OutPred 221 222 223 224 // debug info 225 XSDebug(true.B, "[BPUS1]in:(%d %d) pc=%x ghr=%b\n", io.in.pc.valid, io.in.pc.ready, io.in.pc.bits, hist) 226 XSDebug(true.B, "[BPUS1]outPred:(%d) redirect=%d instrValid=%b tgt=%x\n", 227 io.s1OutPred.valid, io.s1OutPred.bits.redirect, io.s1OutPred.bits.instrValid.asUInt, io.s1OutPred.bits.target) 228 XSDebug(io.flush && io.redirectInfo.flush(), 229 "[BPUS1]flush from backend: pc=%x tgt=%x brTgt=%x _type=%b taken=%d oldHist=%b fetchIdx=%d isExcpt=%d\n", 230 r.pc, r.target, r.brTarget, r._type, r.taken, r.hist, r.fetchIdx, r.isException) 231 XSDebug(io.flush && !io.redirectInfo.flush(), 232 "[BPUS1]flush from Stage3: s3Taken=%d s3RollBackHist=%b\n", io.s3Taken, io.s3RollBackHist) 233 234} 235 236class Stage2To3IO extends Stage1To2IO { 237} 238 239class BPUStage2 extends XSModule { 240 val io = IO(new Bundle() { 241 // flush from Stage3 242 val flush = Input(Bool()) 243 val in = Flipped(Decoupled(new Stage1To2IO)) 244 val out = Decoupled(new Stage2To3IO) 245 }) 246 247 // flush Stage2 when Stage3 or banckend redirects 248 val flushS2 = BoolStopWatch(io.flush, io.in.fire(), startHighPriority = true) 249 io.out.valid := !io.flush && !flushS2 && RegNext(io.in.fire()) 250 io.in.ready := !io.out.valid || io.out.fire() 251 252 // do nothing 253 io.out.bits := RegEnable(io.in.bits, io.in.fire()) 254 255 // debug info 256 XSDebug(true.B, "[BPUS2]in:(%d %d) pc=%x out:(%d %d) pc=%x\n", 257 io.in.valid, io.in.ready, io.in.bits.pc, io.out.valid, io.out.ready, io.out.bits.pc) 258 XSDebug(io.flush, "[BPUS2]flush!!!\n") 259} 260 261class BPUStage3 extends XSModule { 262 val io = IO(new Bundle() { 263 val flush = Input(Bool()) 264 val in = Flipped(Decoupled(new Stage2To3IO)) 265 val out = ValidIO(new BranchPrediction) 266 // from icache 267 val predecode = Flipped(ValidIO(new Predecode)) 268 // from backend 269 val redirectInfo = Input(new RedirectInfo) 270 // to Stage1 and Stage2 271 val flushBPU = Output(Bool()) 272 // to Stage1, restore ghr in stage1 when flushBPU is valid 273 val s1RollBackHist = Output(UInt(HistoryLength.W)) 274 val s3Taken = Output(Bool()) 275 }) 276 277 val flushS3 = BoolStopWatch(io.flush, io.in.fire(), startHighPriority = true) 278 val inLatch = RegInit(0.U.asTypeOf(io.in.bits)) 279 val validLatch = RegInit(false.B) 280 when (io.in.fire()) { inLatch := io.in.bits } 281 when (io.in.fire()) { 282 validLatch := !io.flush 283 }.elsewhen (io.out.valid) { 284 validLatch := false.B 285 } 286 io.out.valid := validLatch && io.predecode.valid && !flushS3 287 io.in.ready := !validLatch || io.out.valid 288 289 // RAS 290 // TODO: split retAddr and ctr 291 def rasEntry() = new Bundle { 292 val retAddr = UInt(VAddrBits.W) 293 val ctr = UInt(8.W) // layer of nested call functions 294 } 295 val ras = RegInit(VecInit(Seq.fill(RasSize)(0.U.asTypeOf(rasEntry())))) 296 val sp = Counter(RasSize) 297 val rasTop = ras(sp.value) 298 val rasTopAddr = rasTop.retAddr 299 300 // get the first taken branch/jal/call/jalr/ret in a fetch line 301 // brTakenIdx/jalIdx/callIdx/jalrIdx/retIdx/jmpIdx is one-hot encoded. 302 // brNotTakenIdx indicates all the not-taken branches before the first jump instruction. 303 val brIdx = inLatch.btb.hits & Reverse(Cat(io.predecode.bits.fuOpTypes.map { t => ALUOpType.isBranch(t) }).asUInt) & io.predecode.bits.mask 304 val brTakenIdx = LowestBit(brIdx & inLatch.tage.takens.asUInt, FetchWidth) 305 val jalIdx = LowestBit(inLatch.btb.hits & Reverse(Cat(io.predecode.bits.fuOpTypes.map { t => t === ALUOpType.jal }).asUInt) & io.predecode.bits.mask, FetchWidth) 306 val callIdx = LowestBit(inLatch.btb.hits & io.predecode.bits.mask & Reverse(Cat(io.predecode.bits.fuOpTypes.map { t => t === ALUOpType.call }).asUInt), FetchWidth) 307 val jalrIdx = LowestBit(inLatch.jbtac.hitIdx & io.predecode.bits.mask & Reverse(Cat(io.predecode.bits.fuOpTypes.map { t => t === ALUOpType.jalr }).asUInt), FetchWidth) 308 val retIdx = LowestBit(io.predecode.bits.mask & Reverse(Cat(io.predecode.bits.fuOpTypes.map { t => t === ALUOpType.ret }).asUInt), FetchWidth) 309 310 val jmpIdx = LowestBit(brTakenIdx | jalIdx | callIdx | jalrIdx | retIdx, FetchWidth) 311 val brNotTakenIdx = brIdx & ~inLatch.tage.takens.asUInt & LowerMask(jmpIdx, FetchWidth) & io.predecode.bits.mask 312 313 io.out.bits.redirect := jmpIdx.orR.asBool 314 io.out.bits.target := Mux(jmpIdx === retIdx, rasTopAddr, 315 Mux(jmpIdx === jalrIdx, inLatch.jbtac.target, 316 Mux(jmpIdx === 0.U, inLatch.pc + 32.U, // TODO: RVC 317 PriorityMux(jmpIdx, inLatch.btb.targets)))) 318 io.out.bits.instrValid := Mux(jmpIdx.orR, LowerMask(jmpIdx, FetchWidth), Fill(FetchWidth, 1.U(1.W))).asTypeOf(Vec(FetchWidth, Bool())) 319 io.out.bits.btbVictimWay := inLatch.btbPred.bits.btbVictimWay 320 io.out.bits.predCtr := inLatch.btbPred.bits.predCtr 321 io.out.bits.btbHitWay := inLatch.btbPred.bits.btbHitWay 322 io.out.bits.tageMeta := inLatch.btbPred.bits.tageMeta 323 //io.out.bits._type := Mux(jmpIdx === retIdx, BTBtype.R, 324 // Mux(jmpIdx === jalrIdx, BTBtype.I, 325 // Mux(jmpIdx === brTakenIdx, BTBtype.B, BTBtype.J))) 326 val firstHist = inLatch.btbPred.bits.hist(0) 327 // there may be several notTaken branches before the first jump instruction, 328 // so we need to calculate how many zeroes should each instruction shift in its global history. 329 // each history is exclusive of instruction's own jump direction. 330 val histShift = Wire(Vec(FetchWidth, UInt(log2Up(FetchWidth).W))) 331 val shift = Wire(Vec(FetchWidth, Vec(FetchWidth, UInt(1.W)))) 332 (0 until FetchWidth).map(i => shift(i) := Mux(!brNotTakenIdx(i), 0.U, ~LowerMask(UIntToOH(i.U), FetchWidth)).asTypeOf(Vec(FetchWidth, UInt(1.W)))) 333 for (j <- 0 until FetchWidth) { 334 var tmp = 0.U 335 for (i <- 0 until FetchWidth) { 336 tmp = tmp + shift(i)(j) 337 } 338 histShift(j) := tmp 339 } 340 (0 until FetchWidth).map(i => io.out.bits.hist(i) := firstHist << histShift(i)) 341 // save ras checkpoint info 342 io.out.bits.rasSp := sp.value 343 io.out.bits.rasTopCtr := rasTop.ctr 344 345 // flush BPU and redirect when target differs from the target predicted in Stage1 346 io.out.bits.redirect := inLatch.btbPred.bits.redirect ^ jmpIdx.orR.asBool || 347 inLatch.btbPred.bits.redirect && jmpIdx.orR.asBool && io.out.bits.target =/= inLatch.btbPred.bits.target 348 io.flushBPU := io.out.bits.redirect && io.out.valid 349 350 // speculative update RAS 351 val rasWrite = WireInit(0.U.asTypeOf(rasEntry())) 352 rasWrite.retAddr := inLatch.pc + OHToUInt(callIdx) << 2.U + 4.U 353 val allocNewEntry = rasWrite.retAddr =/= rasTopAddr 354 rasWrite.ctr := Mux(allocNewEntry, 1.U, rasTop.ctr + 1.U) 355 when (io.out.valid) { 356 when (jmpIdx === callIdx) { 357 ras(Mux(allocNewEntry, sp.value + 1.U, sp.value)) := rasWrite 358 when (allocNewEntry) { sp.value := sp.value + 1.U } 359 }.elsewhen (jmpIdx === retIdx) { 360 when (rasTop.ctr === 1.U) { 361 sp.value := Mux(sp.value === 0.U, 0.U, sp.value - 1.U) 362 }.otherwise { 363 ras(sp.value) := Cat(rasTop.ctr - 1.U, rasTopAddr).asTypeOf(rasEntry()) 364 } 365 } 366 } 367 // use checkpoint to recover RAS 368 val recoverSp = io.redirectInfo.redirect.rasSp 369 val recoverCtr = io.redirectInfo.redirect.rasTopCtr 370 when (io.redirectInfo.valid && io.redirectInfo.misPred) { 371 sp.value := recoverSp 372 ras(recoverSp) := Cat(recoverCtr, ras(recoverSp).retAddr).asTypeOf(rasEntry()) 373 } 374 375 // roll back global history in S1 if S3 redirects 376 io.s1RollBackHist := Mux(io.s3Taken, PriorityMux(jmpIdx, io.out.bits.hist), io.out.bits.hist(0) << PopCount(brIdx & ~inLatch.tage.takens.asUInt)) 377 // whether Stage3 has a taken jump 378 io.s3Taken := jmpIdx.orR.asBool 379 380 // debug info 381 XSDebug(io.in.fire(), "[BPUS3]in:(%d %d) pc=%x\n", io.in.valid, io.in.ready, io.in.bits.pc) 382 XSDebug(io.out.valid, "[BPUS3]out:%d pc=%x redirect=%d predcdMask=%b instrValid=%b tgt=%x\n", 383 io.out.valid, inLatch.pc, io.out.bits.redirect, io.predecode.bits.mask, io.out.bits.instrValid.asUInt, io.out.bits.target) 384 XSDebug(true.B, "[BPUS3]flushS3=%d\n", flushS3) 385 XSDebug(true.B, "[BPUS3]validLatch=%d predecode.valid=%d\n", validLatch, io.predecode.valid) 386 XSDebug(true.B, "[BPUS3]brIdx=%b brTakenIdx=%b brNTakenIdx=%b jalIdx=%d jalrIdx=%d callIdx=%d retIdx=%b\n", 387 brIdx, brTakenIdx, brNotTakenIdx, jalIdx, jalrIdx, callIdx, retIdx) 388} 389 390class BPU extends XSModule { 391 val io = IO(new Bundle() { 392 // from backend 393 // flush pipeline if misPred and update bpu based on redirect signals from brq 394 val redirectInfo = Input(new RedirectInfo) 395 396 val in = new Bundle { val pc = Flipped(Valid(UInt(VAddrBits.W))) } 397 398 val btbOut = ValidIO(new BranchPrediction) 399 val tageOut = ValidIO(new BranchPrediction) 400 401 // predecode info from icache 402 // TODO: simplify this after implement predecode unit 403 val predecode = Flipped(ValidIO(new Predecode)) 404 }) 405 406 val s1 = Module(new BPUStage1) 407 val s2 = Module(new BPUStage2) 408 val s3 = Module(new BPUStage3) 409 410 s1.io.redirectInfo <> io.redirectInfo 411 s1.io.flush := s3.io.flushBPU || io.redirectInfo.flush() 412 s1.io.in.pc.valid := io.in.pc.valid 413 s1.io.in.pc.bits <> io.in.pc.bits 414 io.btbOut <> s1.io.s1OutPred 415 s1.io.s3RollBackHist := s3.io.s1RollBackHist 416 s1.io.s3Taken := s3.io.s3Taken 417 418 s1.io.out <> s2.io.in 419 s2.io.flush := s3.io.flushBPU || io.redirectInfo.flush() 420 421 s2.io.out <> s3.io.in 422 s3.io.flush := io.redirectInfo.flush() 423 s3.io.predecode <> io.predecode 424 io.tageOut <> s3.io.out 425 s3.io.redirectInfo <> io.redirectInfo 426}