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} 36 37class CfCtrl extends XSBundle { 38 val cf = new CtrlFlow 39 val ctrl = new CtrlSignals 40 val brMask = UInt(BrqSize.W) 41 val brTag = UInt(BrTagWidth.W) 42} 43 44// CfCtrl -> MicroOp at Rename Stage 45class MicroOp extends CfCtrl { 46 47 val psrc1, psrc2, psrc3, pdest, old_pdest = UInt(PhyRegIdxWidth.W) 48 val src1State, src2State, src3State = SrcState() 49 50 val roqIdx = UInt(RoqIdxWidth.W) 51} 52 53class Redirect extends XSBundle { 54 val target = UInt(VAddrBits.W) 55 val brTag = UInt(BrTagWidth.W) 56 val isException = Bool() 57} 58 59class Dp1ToDp2IO extends XSBundle { 60 val intDqToDp2 = Vec(IntDqDeqWidth, DecoupledIO(new MicroOp)) 61 val fpDqToDp2 = Vec(FpDqDeqWidth, DecoupledIO(new MicroOp)) 62 val lsDqToDp2 = Vec(LsDqDeqWidth, DecoupledIO(new MicroOp)) 63} 64 65 66class ExuInput extends XSBundle { 67 val uop = new MicroOp 68 val src1, src2, src3 = UInt(XLEN.W) 69 val isRVF = Bool() 70} 71 72class ExuOutput extends XSBundle { 73 val uop = new MicroOp 74 val data = UInt(XLEN.W) 75} 76 77class ExuIO extends XSBundle { 78 val in = Flipped(DecoupledIO(new ExuInput)) 79 val out = DecoupledIO(new ExuOutput) 80} 81 82class RoqCommit extends XSBundle { 83 val uop = new MicroOp 84 val isWalk = Bool() 85} 86 87class FrontendToBackendIO extends XSBundle { 88 // to backend end 89 val cfVec = Vec(DecodeWidth, DecoupledIO(new CtrlFlow)) 90 // from backend 91 val redirect = Flipped(ValidIO(new Redirect)) 92 val commits = Vec(CommitWidth, Flipped(ValidIO(new RoqCommit))) // update branch pred 93}