package.scala 1.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
import chisel3._
import chisel3.util._

package object xiangshan {
  object SrcType {
    def reg = "b00".U
    def pc  = "b01".U
    def imm = "b01".U
    def fp  = "b10".U
    def apply() = UInt(2.W)
  }

  object SrcState {
    def busy    = "b00".U
    def rdy     = "b01".U
    def specRdy = "b10".U // speculative ready, for future use
    def apply() = UInt(2.W)
  }

  object FuType extends HasXSParameter {
    def num           = exuConfig.NRFuType
    def bru          = "b0000".U
    def alu          = "b0001".U
    def mul          = "b0010".U
    def mdu          = "b0011".U
    def fmac         = "b0100".U
    def fmisc        = "b0101".U
    def fmiscDivSqrt = "b0110".U
    def ldu          = "b1001".U
    def stu          = "b1000".U

    def apply() = UInt(log2Up(num).W)

    def isIntExu(fuType: UInt) =  fuType(3, 2) === "b00".U
    def isFpExu(fuType: UInt) = fuType(2)
    def isMemExu(fuType: UInt) = fuType(3)
  }

  object FuOpType extends HasXSParameter {
    def apply() = UInt(exuConfig.FuOpWidth.W)
  }
}