2016-11-28 01:16:37 +01:00
|
|
|
// See LICENSE.Berkeley for license details.
|
2014-09-13 03:06:41 +02:00
|
|
|
|
2012-02-26 02:09:26 +01:00
|
|
|
package rocket
|
2012-10-08 05:15:54 +02:00
|
|
|
package constants
|
2011-10-26 08:02:47 +02:00
|
|
|
|
|
|
|
import Chisel._
|
2011-12-09 09:42:43 +01:00
|
|
|
import scala.math._
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2012-10-08 05:15:54 +02:00
|
|
|
trait ScalarOpConstants {
|
2016-08-09 23:39:06 +02:00
|
|
|
val MT_SZ = 3
|
2017-01-31 22:54:02 +01:00
|
|
|
def MT_X = BitPat("b???")
|
|
|
|
def MT_B = UInt("b000")
|
|
|
|
def MT_H = UInt("b001")
|
|
|
|
def MT_W = UInt("b010")
|
|
|
|
def MT_D = UInt("b011")
|
|
|
|
def MT_BU = UInt("b100")
|
|
|
|
def MT_HU = UInt("b101")
|
|
|
|
def MT_WU = UInt("b110")
|
2016-08-09 23:39:06 +02:00
|
|
|
def mtSize(mt: UInt) = mt(MT_SZ-2, 0)
|
|
|
|
def mtSigned(mt: UInt) = !mt(MT_SZ-1)
|
|
|
|
|
2012-11-25 13:24:25 +01:00
|
|
|
val SZ_BR = 3
|
2017-01-31 22:54:02 +01:00
|
|
|
def BR_X = BitPat("b???")
|
|
|
|
def BR_EQ = UInt(0, 3)
|
|
|
|
def BR_NE = UInt(1, 3)
|
|
|
|
def BR_J = UInt(2, 3)
|
|
|
|
def BR_N = UInt(3, 3)
|
|
|
|
def BR_LT = UInt(4, 3)
|
|
|
|
def BR_GE = UInt(5, 3)
|
|
|
|
def BR_LTU = UInt(6, 3)
|
|
|
|
def BR_GEU = UInt(7, 3)
|
|
|
|
|
|
|
|
def A1_X = BitPat("b??")
|
|
|
|
def A1_ZERO = UInt(0, 2)
|
|
|
|
def A1_RS1 = UInt(1, 2)
|
|
|
|
def A1_PC = UInt(2, 2)
|
|
|
|
|
|
|
|
def IMM_X = BitPat("b???")
|
|
|
|
def IMM_S = UInt(0, 3)
|
|
|
|
def IMM_SB = UInt(1, 3)
|
|
|
|
def IMM_U = UInt(2, 3)
|
|
|
|
def IMM_UJ = UInt(3, 3)
|
|
|
|
def IMM_I = UInt(4, 3)
|
|
|
|
def IMM_Z = UInt(5, 3)
|
|
|
|
|
|
|
|
def A2_X = BitPat("b??")
|
|
|
|
def A2_ZERO = UInt(0, 2)
|
|
|
|
def A2_SIZE = UInt(1, 2)
|
|
|
|
def A2_RS2 = UInt(2, 2)
|
|
|
|
def A2_IMM = UInt(3, 2)
|
|
|
|
|
|
|
|
def X = BitPat("b?")
|
|
|
|
def N = BitPat("b0")
|
|
|
|
def Y = BitPat("b1")
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2012-11-18 02:24:08 +01:00
|
|
|
val SZ_DW = 1
|
2017-01-31 22:54:02 +01:00
|
|
|
def DW_X = X
|
|
|
|
def DW_32 = Bool(false)
|
|
|
|
def DW_64 = Bool(true)
|
|
|
|
def DW_XPR = DW_64
|
2012-10-08 05:15:54 +02:00
|
|
|
}
|