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 {
|
2012-11-25 13:24:25 +01:00
|
|
|
val SZ_BR = 3
|
2012-10-10 06:35:03 +02:00
|
|
|
val BR_X = Bits("b???", 3)
|
2012-11-05 01:40:14 +01:00
|
|
|
val BR_EQ = Bits(0, 3)
|
|
|
|
val BR_NE = Bits(1, 3)
|
|
|
|
val BR_J = Bits(2, 3)
|
|
|
|
val BR_N = Bits(3, 3)
|
|
|
|
val BR_LT = Bits(4, 3)
|
|
|
|
val BR_GE = Bits(5, 3)
|
|
|
|
val BR_LTU = Bits(6, 3)
|
|
|
|
val BR_GEU = Bits(7, 3)
|
2012-10-10 06:35:03 +02:00
|
|
|
|
2013-09-12 12:44:38 +02:00
|
|
|
val PC_EX = UInt(0, 2)
|
2014-04-08 00:58:49 +02:00
|
|
|
val PC_MEM = UInt(1, 2)
|
2013-08-12 19:39:11 +02:00
|
|
|
val PC_WB = UInt(2, 2)
|
|
|
|
val PC_PCR = UInt(3, 2)
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2013-09-12 12:44:38 +02:00
|
|
|
val A1_X = Bits("b??", 2)
|
2013-12-10 00:06:13 +01:00
|
|
|
val A1_ZERO = UInt(0, 2)
|
|
|
|
val A1_RS1 = UInt(1, 2)
|
2014-02-11 04:04:42 +01:00
|
|
|
val A1_PC = UInt(2, 2)
|
2013-09-12 12:44:38 +02:00
|
|
|
|
|
|
|
val IMM_X = Bits("b???", 3)
|
2014-01-14 06:43:56 +01:00
|
|
|
val IMM_S = UInt(0, 3)
|
|
|
|
val IMM_SB = UInt(1, 3)
|
|
|
|
val IMM_U = UInt(2, 3)
|
|
|
|
val IMM_UJ = UInt(3, 3)
|
|
|
|
val IMM_I = UInt(4, 3)
|
|
|
|
val IMM_Z = UInt(5, 3)
|
2013-09-12 12:44:38 +02:00
|
|
|
|
|
|
|
val A2_X = Bits("b??", 2)
|
2013-12-10 00:06:13 +01:00
|
|
|
val A2_ZERO = UInt(0, 2)
|
|
|
|
val A2_FOUR = UInt(1, 2)
|
|
|
|
val A2_RS2 = UInt(2, 2)
|
|
|
|
val A2_IMM = UInt(3, 2)
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2013-12-05 13:16:48 +01:00
|
|
|
val X = Bool.DC
|
|
|
|
val N = Bool(false)
|
|
|
|
val Y = Bool(true)
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2013-12-10 00:06:13 +01:00
|
|
|
val NBYP = 4
|
|
|
|
val SZ_BYP = log2Up(NBYP)
|
|
|
|
val BYP_0 = 0
|
|
|
|
val BYP_EX = 1
|
|
|
|
val BYP_MEM = 2
|
|
|
|
val BYP_DC = 3
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2012-11-18 02:24:08 +01:00
|
|
|
val SZ_DW = 1
|
2012-05-02 05:16:36 +02:00
|
|
|
val DW_X = X
|
|
|
|
val DW_32 = N
|
|
|
|
val DW_64 = Y
|
|
|
|
val DW_XPR = Y
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2014-01-14 06:43:56 +01:00
|
|
|
val RA = UInt(1, 5)
|
2012-10-08 05:15:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
trait VectorOpConstants {
|
2013-08-12 19:39:11 +02:00
|
|
|
val VEC_X = Bits("b??", 2).toUInt
|
|
|
|
val VEC_FN_N = UInt(0, 2)
|
|
|
|
val VEC_VL = UInt(1, 2)
|
|
|
|
val VEC_CFG = UInt(2, 2)
|
|
|
|
val VEC_CFGVL = UInt(3, 2)
|
2012-02-09 06:43:45 +01:00
|
|
|
|
2013-08-12 19:39:11 +02:00
|
|
|
val VCMD_I = UInt(0, 3)
|
|
|
|
val VCMD_F = UInt(1, 3)
|
|
|
|
val VCMD_TX = UInt(2, 3)
|
|
|
|
val VCMD_TF = UInt(3, 3)
|
|
|
|
val VCMD_MX = UInt(4, 3)
|
|
|
|
val VCMD_MF = UInt(5, 3)
|
|
|
|
val VCMD_A = UInt(6, 3)
|
|
|
|
val VCMD_X = UInt(0, 3)
|
2012-02-09 06:43:45 +01:00
|
|
|
|
2013-08-12 19:39:11 +02:00
|
|
|
val VIMM_VLEN = UInt(0, 1)
|
|
|
|
val VIMM_ALU = UInt(1, 1)
|
|
|
|
val VIMM_X = UInt(0, 1)
|
2012-02-26 07:05:30 +01:00
|
|
|
|
2013-08-12 19:39:11 +02:00
|
|
|
val VIMM2_RS2 = UInt(0, 1)
|
|
|
|
val VIMM2_ALU = UInt(1, 1)
|
|
|
|
val VIMM2_X = UInt(0, 1)
|
2012-10-08 05:15:54 +02:00
|
|
|
}
|