1package xiangshan 2 3import chisel3._ 4import chisel3.util._ 5 6// Fetch FetchWidth x 32-bit insts from Icache 7class FetchPacket extends XSBundle { 8 val instrs = Vec(FetchWidth, UInt(32.W)) 9 val mask = UInt(FetchWidth.W) 10 val pc = UInt(VAddrBits.W) // the pc of first inst in the fetch group 11} 12 13// Dequeue DecodeWidth insts from Ibuffer 14class CtrlFlow extends XSBundle { 15 val instr = UInt(32.W) 16 val pc = UInt(VAddrBits.W) 17 val exceptionVec = Vec(16, Bool()) 18 val intrVec = Vec(12, Bool()) 19 val isRVC = Bool() 20 val isBr = Bool() 21} 22 23// Decode DecodeWidth insts at Decode Stage 24class CtrlSignals extends XSBundle { 25 val src1Type, src2Type, src3Type = SrcType() 26 val lsrc1, lsrc2, lsrc3 = UInt(5.W) 27 val ldest = UInt(5.W) 28 val fuType = FuType() 29 val fuOpType = FuOpType() 30 val rfWen = Bool() 31 val fpWen = Bool() 32 val isXSTrap = Bool() 33 val noSpecExec = Bool() // This inst can not be speculated 34 val isBlocked = Bool() // This inst requires pipeline to be blocked 35 val isRVF = Bool() 36 val imm = UInt(XLEN.W) 37} 38 39class CfCtrl extends XSBundle { 40 val cf = new CtrlFlow 41 val ctrl = new CtrlSignals 42 val brMask = UInt(BrqSize.W) 43 val brTag = UInt(BrTagWidth.W) 44} 45 46// CfCtrl -> MicroOp at Rename Stage 47class MicroOp extends CfCtrl { 48 49 val psrc1, psrc2, psrc3, pdest, old_pdest = UInt(PhyRegIdxWidth.W) 50 val src1State, src2State, src3State = SrcState() 51 52 val roqIdx = UInt(RoqIdxWidth.W) 53} 54 55class Redirect extends XSBundle { 56 val target = UInt(VAddrBits.W) 57 val brTag = UInt(BrTagWidth.W) 58 val isException = Bool() 59 val roqIdx = UInt(RoqIdxWidth.W) 60} 61 62class Dp1ToDp2IO extends XSBundle { 63 val intDqToDp2 = Vec(IntDqDeqWidth, DecoupledIO(new MicroOp)) 64 val fpDqToDp2 = Vec(FpDqDeqWidth, DecoupledIO(new MicroOp)) 65 val lsDqToDp2 = Vec(LsDqDeqWidth, DecoupledIO(new MicroOp)) 66} 67 68 69class ExuInput extends XSBundle { 70 val uop = new MicroOp 71 val src1, src2, src3 = UInt(XLEN.W) 72} 73 74class ExuOutput extends XSBundle { 75 val uop = new MicroOp 76 val data = UInt(XLEN.W) 77} 78 79class ExuIO extends XSBundle { 80 val in = Flipped(DecoupledIO(new ExuInput)) 81 val out = DecoupledIO(new ExuOutput) 82} 83 84class RoqCommit extends XSBundle { 85 val uop = new MicroOp 86 val isWalk = Bool() 87} 88 89class FrontendToBackendIO extends XSBundle { 90 // to backend end 91 val cfVec = Vec(DecodeWidth, DecoupledIO(new CtrlFlow)) 92 // from backend 93 val redirect = Flipped(ValidIO(new Redirect)) 94 val commits = Vec(CommitWidth, Flipped(ValidIO(new RoqCommit))) // update branch pred 95}