xref: /XiangShan/src/main/scala/xiangshan/package.scala (revision 04b56283a565e53e190384ba3bc642ad5f76a836)
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
16    def apply() = UInt(2.W)
17  }
18
19  object SrcState {
20    def busy    = "b00".U
21    def rdy     = "b01".U
22    def specRdy = "b10".U // speculative ready, for future use
23    def apply() = UInt(2.W)
24  }
25
26  object FuType extends HasXSParameter {
27    def num           = exuConfig.NRFuType
28    def bru          = "b0000".U
29    def alu          = "b0001".U
30    def mul          = "b0010".U
31    def mdu          = "b0011".U
32    def fmac         = "b0100".U
33    def fmisc        = "b0101".U
34    def fmiscDivSqrt = "b0110".U
35    def ldu          = "b1001".U
36    def stu          = "b1000".U
37
38    def apply() = UInt(log2Up(num).W)
39
40    def isIntExu(fuType: UInt) =  fuType(3, 2) === "b00".U
41    def isFpExu(fuType: UInt) = fuType(2)
42    def isMemExu(fuType: UInt) = fuType(3)
43  }
44
45  object FuOpType extends HasXSParameter {
46    def apply() = UInt(exuConfig.FuOpWidth.W)
47  }
48}
49