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