1import chisel3._ 2import chisel3.util._ 3 4package object xiangshan { 5 object SrcType { 6 def reg = "b00".U 7 def pc = "b01".U 8 def imm = "b01".U 9 def fp = "b10".U 10 11 def isReg(srcType: UInt) = srcType===reg 12 def isPc(srcType: UInt) = srcType===pc 13 def isImm(srcType: UInt) = srcType===imm 14 def isFp(srcType: UInt) = srcType===fp 15 def isPcImm(srcType: UInt) = isPc(srcType) || isImm(srcType) 16 def isRegFp(srcType: UInt) = isReg(srcType) || isFp(srcType) 17 18 def apply() = UInt(2.W) 19 } 20 21 object SrcState { 22 def busy = "b00".U 23 def rdy = "b01".U 24 def specRdy = "b10".U // speculative ready, for future use 25 def apply() = UInt(2.W) 26 } 27 28 object FuType extends HasXSParameter { 29 def num = exuConfig.NRFuType 30 def bru = "b0000".U 31 def alu = "b0001".U 32 def mul = "b0010".U 33 def mdu = "b0011".U 34 def fmac = "b0100".U 35 def fmisc = "b0101".U 36 def fmiscDivSqrt = "b0110".U 37 def ldu = "b1001".U 38 def stu = "b1000".U 39 40 def apply() = UInt(log2Up(num).W) 41 42 def isIntExu(fuType: UInt) = fuType(3, 2) === "b00".U 43 def isFpExu(fuType: UInt) = fuType(2) 44 def isMemExu(fuType: UInt) = fuType(3) 45 } 46 47 object FuOpType extends HasXSParameter { 48 def apply() = UInt(exuConfig.FuOpWidth.W) 49 } 50} 51