Shave a few gate delays off IBuf control logic
It takes a while for the pipeline to compute the stall signal, so avoid using it until the last logic levels in the clock cycle.
This commit is contained in:
parent
82ff81e40d
commit
ecc2ee366c
@ -43,9 +43,10 @@ class IBuf(implicit p: Parameters) extends CoreModule {
|
|||||||
val nIC = Mux(io.imem.bits.btb.valid && io.imem.bits.btb.bits.taken, io.imem.bits.btb.bits.bridx +& 1, UInt(fetchWidth)) - pcWordBits
|
val nIC = Mux(io.imem.bits.btb.valid && io.imem.bits.btb.bits.taken, io.imem.bits.btb.bits.bridx +& 1, UInt(fetchWidth)) - pcWordBits
|
||||||
val nICReady = nReady - nBufValid
|
val nICReady = nReady - nBufValid
|
||||||
val nValid = Mux(io.imem.valid, nIC, UInt(0)) + nBufValid
|
val nValid = Mux(io.imem.valid, nIC, UInt(0)) + nBufValid
|
||||||
io.imem.ready := nReady >= nBufValid && (nICReady >= nIC || n >= nIC - nICReady)
|
io.imem.ready := io.inst(0).ready && nReady >= nBufValid && (nICReady >= nIC || n >= nIC - nICReady)
|
||||||
|
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
|
when (io.inst(0).ready) {
|
||||||
nBufValid := Mux(nReady >= nBufValid, UInt(0), nBufValid - nReady)
|
nBufValid := Mux(nReady >= nBufValid, UInt(0), nBufValid - nReady)
|
||||||
if (n > 1) when (nReady > 0 && nReady < nBufValid) {
|
if (n > 1) when (nReady > 0 && nReady < nBufValid) {
|
||||||
val shiftedBuf = shiftInsnRight(buf.data(n*coreInstBits-1, coreInstBits), (nReady-1)(log2Ceil(n-1)-1,0))
|
val shiftedBuf = shiftInsnRight(buf.data(n*coreInstBits-1, coreInstBits), (nReady-1)(log2Ceil(n-1)-1,0))
|
||||||
@ -60,7 +61,6 @@ class IBuf(implicit p: Parameters) extends CoreModule {
|
|||||||
buf.data := shiftInsnRight(io.imem.bits.data, shamt)(n*coreInstBits-1,0)
|
buf.data := shiftInsnRight(io.imem.bits.data, shamt)(n*coreInstBits-1,0)
|
||||||
buf.pc := io.imem.bits.pc & ~pcWordMask | (io.imem.bits.pc + (nICReady << log2Ceil(coreInstBytes))) & pcWordMask
|
buf.pc := io.imem.bits.pc & ~pcWordMask | (io.imem.bits.pc + (nICReady << log2Ceil(coreInstBytes))) & pcWordMask
|
||||||
ibufBTBHit := io.imem.bits.btb.valid
|
ibufBTBHit := io.imem.bits.btb.valid
|
||||||
when (io.imem.bits.btb.valid) {
|
|
||||||
ibufBTBResp := io.imem.bits.btb.bits
|
ibufBTBResp := io.imem.bits.btb.bits
|
||||||
ibufBTBResp.bridx := io.imem.bits.btb.bits.bridx + nICReady
|
ibufBTBResp.bridx := io.imem.bits.btb.bits.bridx + nICReady
|
||||||
}
|
}
|
||||||
@ -97,18 +97,19 @@ class IBuf(implicit p: Parameters) extends CoreModule {
|
|||||||
|
|
||||||
if (usingCompressed) {
|
if (usingCompressed) {
|
||||||
val replay = ic_replay(j) || (!exp.io.rvc && (btbHitMask(j) || ic_replay(j+1)))
|
val replay = ic_replay(j) || (!exp.io.rvc && (btbHitMask(j) || ic_replay(j+1)))
|
||||||
io.inst(i).valid := valid(j) && (exp.io.rvc || valid(j+1) || xcpt(j+1).asUInt.orR || replay)
|
val full_insn = exp.io.rvc || valid(j+1) || xcpt(j+1).asUInt.orR || replay
|
||||||
|
io.inst(i).valid := valid(j) && full_insn
|
||||||
io.inst(i).bits.xcpt0 := xcpt(j)
|
io.inst(i).bits.xcpt0 := xcpt(j)
|
||||||
io.inst(i).bits.xcpt1 := Mux(exp.io.rvc, 0.U, xcpt(j+1).asUInt).asTypeOf(new FrontendExceptions)
|
io.inst(i).bits.xcpt1 := Mux(exp.io.rvc, 0.U, xcpt(j+1).asUInt).asTypeOf(new FrontendExceptions)
|
||||||
io.inst(i).bits.replay := replay
|
io.inst(i).bits.replay := replay
|
||||||
io.inst(i).bits.btb_hit := btbHitMask(j) || (!exp.io.rvc && btbHitMask(j+1))
|
io.inst(i).bits.btb_hit := btbHitMask(j) || (!exp.io.rvc && btbHitMask(j+1))
|
||||||
io.inst(i).bits.rvc := exp.io.rvc
|
io.inst(i).bits.rvc := exp.io.rvc
|
||||||
|
|
||||||
when (io.inst(i).fire()) { nReady := Mux(exp.io.rvc, j+1, j+2) }
|
when (full_insn && (i == 0 || io.inst(i).ready)) { nReady := Mux(exp.io.rvc, j+1, j+2) }
|
||||||
|
|
||||||
expand(i+1, Mux(exp.io.rvc, j+1, j+2), Mux(exp.io.rvc, curInst >> 16, curInst >> 32))
|
expand(i+1, Mux(exp.io.rvc, j+1, j+2), Mux(exp.io.rvc, curInst >> 16, curInst >> 32))
|
||||||
} else {
|
} else {
|
||||||
when (io.inst(i).ready) { nReady := i+1 }
|
when (i == 0 || io.inst(i).ready) { nReady := i+1 }
|
||||||
io.inst(i).valid := valid(i)
|
io.inst(i).valid := valid(i)
|
||||||
io.inst(i).bits.xcpt0 := xcpt(i)
|
io.inst(i).bits.xcpt0 := xcpt(i)
|
||||||
io.inst(i).bits.xcpt1 := 0.U.asTypeOf(new FrontendExceptions)
|
io.inst(i).bits.xcpt1 := 0.U.asTypeOf(new FrontendExceptions)
|
||||||
|
Loading…
Reference in New Issue
Block a user