Skip to content

Commit

Permalink
Add B-extension opcodes and object model description
Browse files Browse the repository at this point in the history
  • Loading branch information
aswaterman committed Oct 22, 2020
1 parent 951c06b commit 42a58ab
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ object ISAExtensions {
F -> "F Standard Extension for Single-Precision Floating-Point",
D -> "D Standard Extension for Double-Precision Floating-Point",
C -> "C Standard Extension for Compressed Instruction",
B -> "B Standard Extension for Bit Manipulation",
U -> "The RISC‑V Instruction Set Manual, Volume II: Privileged Architecture",
S -> "Supervisor-Level ISA"
)
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/diplomaticobjectmodel/model/OMISA.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ case object A extends OMExtensionType
case object F extends OMExtensionType
case object D extends OMExtensionType
case object C extends OMExtensionType
case object B extends OMExtensionType
case object U extends OMExtensionType
case object S extends OMExtensionType

Expand Down Expand Up @@ -39,6 +40,7 @@ case class OMISA(
f: Option[OMSpecification],
d: Option[OMSpecification],
c: Option[OMSpecification],
b: Option[OMSpecification] = None,
v: Option[OMVectorExtension] = None,
u: Option[OMSpecification],
s: Option[OMSpecification],
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/rocket/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ class CSRFile(
(if (fLen >= 32) "F" else "") +
(if (fLen >= 64) "D" else "") +
(if (usingVector) "V" else "") +
(if (usingBitManip) "B" else "") +
(if (usingCompressed) "C" else "")
val isaString = (if (coreParams.useRVE) "E" else "I") +
isaMaskString +
Expand Down
113 changes: 113 additions & 0 deletions src/main/scala/rocket/Instructions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,118 @@ object Instructions {
def DIVUW = BitPat("b0000001??????????101?????0111011")
def REMW = BitPat("b0000001??????????110?????0111011")
def REMUW = BitPat("b0000001??????????111?????0111011")
def ANDN = BitPat("b0100000??????????111?????0110011")
def ORN = BitPat("b0100000??????????110?????0110011")
def XNOR = BitPat("b0100000??????????100?????0110011")
def SLO = BitPat("b0010000??????????001?????0110011")
def SRO = BitPat("b0010000??????????101?????0110011")
def ROL = BitPat("b0110000??????????001?????0110011")
def ROR = BitPat("b0110000??????????101?????0110011")
def SBCLR = BitPat("b0100100??????????001?????0110011")
def SBSET = BitPat("b0010100??????????001?????0110011")
def SBINV = BitPat("b0110100??????????001?????0110011")
def SBEXT = BitPat("b0100100??????????101?????0110011")
def GORC = BitPat("b0010100??????????101?????0110011")
def GREV = BitPat("b0110100??????????101?????0110011")
def SLOI = BitPat("b001000???????????001?????0010011")
def SROI = BitPat("b001000???????????101?????0010011")
def RORI = BitPat("b011000???????????101?????0010011")
def SBCLRI = BitPat("b010010???????????001?????0010011")
def SBSETI = BitPat("b001010???????????001?????0010011")
def SBINVI = BitPat("b011010???????????001?????0010011")
def SBEXTI = BitPat("b010010???????????101?????0010011")
def GORCI = BitPat("b001010???????????101?????0010011")
def GREVI = BitPat("b011010???????????101?????0010011")
def CMIX = BitPat("b?????11??????????001?????0110011")
def CMOV = BitPat("b?????11??????????101?????0110011")
def FSL = BitPat("b?????10??????????001?????0110011")
def FSR = BitPat("b?????10??????????101?????0110011")
def FSRI = BitPat("b?????1???????????101?????0010011")
def CLZ = BitPat("b011000000000?????001?????0010011")
def CTZ = BitPat("b011000000001?????001?????0010011")
def PCNT = BitPat("b011000000010?????001?????0010011")
def SEXT_B = BitPat("b011000000100?????001?????0010011")
def SEXT_H = BitPat("b011000000101?????001?????0010011")
def CRC32_B = BitPat("b011000010000?????001?????0010011")
def CRC32_H = BitPat("b011000010001?????001?????0010011")
def CRC32_W = BitPat("b011000010010?????001?????0010011")
def CRC32C_B = BitPat("b011000011000?????001?????0010011")
def CRC32C_H = BitPat("b011000011001?????001?????0010011")
def CRC32C_W = BitPat("b011000011010?????001?????0010011")
def SH1ADD = BitPat("b0010000??????????010?????0110011")
def SH2ADD = BitPat("b0010000??????????100?????0110011")
def SH3ADD = BitPat("b0010000??????????110?????0110011")
def CLMUL = BitPat("b0000101??????????001?????0110011")
def CLMULR = BitPat("b0000101??????????010?????0110011")
def CLMULH = BitPat("b0000101??????????011?????0110011")
def MIN = BitPat("b0000101??????????100?????0110011")
def MINU = BitPat("b0000101??????????101?????0110011")
def MAX = BitPat("b0000101??????????110?????0110011")
def MAXU = BitPat("b0000101??????????111?????0110011")
def SHFL = BitPat("b0000100??????????001?????0110011")
def UNSHFL = BitPat("b0000100??????????101?????0110011")
def BEXT = BitPat("b0000100??????????110?????0110011")
def BDEP = BitPat("b0100100??????????110?????0110011")
def PACK = BitPat("b0000100??????????100?????0110011")
def ZEXT_H_RV32 = BitPat("b000010000000?????100?????0110011")
def PACKU = BitPat("b0100100??????????100?????0110011")
def PACKH = BitPat("b0000100??????????111?????0110011")
def BFP = BitPat("b0100100??????????111?????0110011")
def SHFLI = BitPat("b0000100??????????001?????0010011")
def UNSHFLI = BitPat("b0000100??????????101?????0010011")
def REV_RV32 = BitPat("b011010011111?????101?????0010011")
def REV8_RV32 = BitPat("b011010011000?????101?????0010011")
def BMATFLIP = BitPat("b011000000011?????001?????0010011")
def CRC32_D = BitPat("b011000010011?????001?????0010011")
def CRC32C_D = BitPat("b011000011011?????001?????0010011")
def BMATOR = BitPat("b0000100??????????011?????0110011")
def BMATXOR = BitPat("b0100100??????????011?????0110011")
def ADDIWU = BitPat("b?????????????????100?????0011011")
def SLLIU_W = BitPat("b000010???????????001?????0011011")
def ADDWU = BitPat("b0000101??????????000?????0111011")
def SUBWU = BitPat("b0100101??????????000?????0111011")
def ADDU_W = BitPat("b0000100??????????000?????0111011")
def SLOW = BitPat("b0010000??????????001?????0111011")
def SROW = BitPat("b0010000??????????101?????0111011")
def ROLW = BitPat("b0110000??????????001?????0111011")
def RORW = BitPat("b0110000??????????101?????0111011")
def SBCLRW = BitPat("b0100100??????????001?????0111011")
def SBSETW = BitPat("b0010100??????????001?????0111011")
def SBINVW = BitPat("b0110100??????????001?????0111011")
def SBEXTW = BitPat("b0100100??????????101?????0111011")
def GORCW = BitPat("b0010100??????????101?????0111011")
def GREVW = BitPat("b0110100??????????101?????0111011")
def SLOIW = BitPat("b0010000??????????001?????0011011")
def SROIW = BitPat("b0010000??????????101?????0011011")
def RORIW = BitPat("b0110000??????????101?????0011011")
def SBCLRIW = BitPat("b0100100??????????001?????0011011")
def SBSETIW = BitPat("b0010100??????????001?????0011011")
def SBINVIW = BitPat("b0110100??????????001?????0011011")
def GORCIW = BitPat("b0010100??????????101?????0011011")
def GREVIW = BitPat("b0110100??????????101?????0011011")
def FSLW = BitPat("b?????10??????????001?????0111011")
def FSRW = BitPat("b?????10??????????101?????0111011")
def FSRIW = BitPat("b?????10??????????101?????0011011")
def CLZW = BitPat("b011000000000?????001?????0011011")
def CTZW = BitPat("b011000000001?????001?????0011011")
def PCNTW = BitPat("b011000000010?????001?????0011011")
def SH1ADDU_W = BitPat("b0010000??????????010?????0111011")
def SH2ADDU_W = BitPat("b0010000??????????100?????0111011")
def SH3ADDU_W = BitPat("b0010000??????????110?????0111011")
def CLMULW = BitPat("b0000101??????????001?????0111011")
def CLMULRW = BitPat("b0000101??????????010?????0111011")
def CLMULHW = BitPat("b0000101??????????011?????0111011")
def SHFLW = BitPat("b0000100??????????001?????0111011")
def UNSHFLW = BitPat("b0000100??????????101?????0111011")
def BEXTW = BitPat("b0000100??????????110?????0111011")
def BDEPW = BitPat("b0100100??????????110?????0111011")
def PACKW = BitPat("b0000100??????????100?????0111011")
def ZEXT_H = BitPat("b000010000000?????100?????0111011")
def PACKUW = BitPat("b0100100??????????100?????0111011")
def BFPW = BitPat("b0100100??????????111?????0111011")
def REV = BitPat("b011010111111?????101?????0010011")
def REV8 = BitPat("b011010111000?????101?????0010011")
def ORC_B = BitPat("b001010000111?????101?????0010011")
def AMOADD_W = BitPat("b00000????????????010?????0101111")
def AMOXOR_W = BitPat("b00100????????????010?????0101111")
def AMOOR_W = BitPat("b01000????????????010?????0101111")
Expand Down Expand Up @@ -728,6 +840,7 @@ object Instructions {
def SLLI_RV32 = BitPat("b0000000??????????001?????0010011")
def SRLI_RV32 = BitPat("b0000000??????????101?????0010011")
def SRAI_RV32 = BitPat("b0100000??????????101?????0010011")
def RORI_RV32 = BitPat("b0110000??????????101?????0010011")
def FRFLAGS = BitPat("b00000000000100000010?????1110011")
def FSFLAGS = BitPat("b000000000001?????001?????1110011")
def FSFLAGSI = BitPat("b000000000001?????101?????1110011")
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/tile/BaseTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ trait HasNonDiplomaticTileParameters {
val f = if (tileParams.core.fpu.nonEmpty) "f" else ""
val d = if (tileParams.core.fpu.nonEmpty && tileParams.core.fpu.get.fLen > 32) "d" else ""
val c = if (tileParams.core.useCompressed) "c" else ""
val b = if (tileParams.core.useBitManip) "b" else ""
val v = if (tileParams.core.useVector) "v" else ""
s"rv${p(XLen)}$ie$m$a$f$d$c$v"
s"rv${p(XLen)}$ie$m$a$f$d$c$b$v"
}

def tileProperties: PropertyMap = {
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/tile/Core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ trait CoreParams {
val useAtomics: Boolean
val useAtomicsOnlyForIO: Boolean
val useCompressed: Boolean
val useBitManip: Boolean = false
val useVector: Boolean = false
val useSCIE: Boolean
val useRVE: Boolean
Expand Down Expand Up @@ -73,6 +74,7 @@ trait HasCoreParameters extends HasTileParameters {
val usingAtomicsOnlyForIO = coreParams.useAtomicsOnlyForIO
val usingAtomicsInCache = usingAtomics && !usingAtomicsOnlyForIO
val usingCompressed = coreParams.useCompressed
val usingBitManip = coreParams.useBitManip
val usingVector = coreParams.useVector
val usingSCIE = coreParams.useSCIE

Expand Down

0 comments on commit 42a58ab

Please sign in to comment.