Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-V implementations of vector units, with Zve/Zvl extensions #3652

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/scala/rocket/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ class CSRFile(
(if (usingAtomics) "A" else "") +
(if (fLen >= 32) "F" else "") +
(if (fLen >= 64) "D" else "") +
(if (usingVector) "V" else "") +
(if (coreParams.hasV) "V" else "") +
(if (usingCompressed) "C" else "")
val isaString = (if (coreParams.useRVE) "E" else "I") +
isaMaskString +
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/rocket/RocketCore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ case class RocketCoreParams(
override val useVector = vector.isDefined
override val vectorUseDCache = vector.map(_.useDCache).getOrElse(false)
override def vLen = vector.map(_.vLen).getOrElse(0)
override def eLen = vector.map(_.eLen).getOrElse(0)
override def vfLen = vector.map(_.vfLen).getOrElse(0)
override def vMemDataBits = vector.map(_.vMemDataBits).getOrElse(0)
override val customIsaExt = Option.when(haveCease)("xrocket") // CEASE instruction
override def minFLen: Int = fpu.map(_.minFLen).getOrElse(32)
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/rocket/VectorUnit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import freechips.rocketchip.tilelink._
case class RocketCoreVectorParams(
build: Parameters => RocketVectorUnit,
vLen: Int,
eLen: Int,
vfLen: Int,
vMemDataBits: Int,
decoder: Parameters => RocketVectorDecoder,
useDCache: Boolean,
Expand Down
13 changes: 12 additions & 1 deletion src/main/scala/tile/BaseTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,17 @@ 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 v = if (tileParams.core.useVector) "v" else ""
val v = if (tileParams.core.useVector && tileParams.core.vLen >= 128 && tileParams.core.eLen == 64 && tileParams.core.vfLen == 64) "v" else ""
jerryz123 marked this conversation as resolved.
Show resolved Hide resolved
val h = if (usingHypervisor) "h" else ""
val zvl = Option.when(tileParams.core.useVector) { Seq(s"zvl${tileParams.core.vLen}b") }
jerryz123 marked this conversation as resolved.
Show resolved Hide resolved
val zve = Option.when(tileParams.core.useVector) {
val c = tileParams.core.vfLen match {
case 64 => "d"
case 32 => "f"
case 0 => "x"
}
Seq(s"zve${tileParams.core.eLen}$c")
}
val multiLetterExt = (
// rdcycle[h], rdinstret[h] is implemented
// rdtime[h] is not implemented, and could be provided by software emulation
Expand All @@ -114,6 +123,8 @@ trait HasNonDiplomaticTileParameters {
Option.when(tileParams.core.useConditionalZero)(Seq("zicond")) ++
Some(Seq("zicsr", "zifencei", "zihpm")) ++
Option.when(tileParams.core.fpu.nonEmpty && tileParams.core.fpu.get.fLen >= 16 && tileParams.core.fpu.get.minFLen <= 16)(Seq("zfh")) ++
zvl ++
zve ++
tileParams.core.customIsaExt.map(Seq(_))
).flatten
val multiLetterString = multiLetterExt.mkString("_")
Expand Down
12 changes: 8 additions & 4 deletions src/main/scala/tile/Core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ trait CoreParams {
def dcacheReqTagBits: Int = 6

def minFLen: Int = 32

def vLen: Int = 0
def sLen: Int = 0
def eLen(xLen: Int, fLen: Int): Int = xLen max fLen
def eLen: Int = 0
def vfLen: Int = 0
def hasV: Boolean = vLen >= 128 && eLen >= 64 && vfLen >= 64
def vMemDataBits: Int = 0
}

Expand Down Expand Up @@ -106,14 +108,16 @@ trait HasCoreParameters extends HasTileParameters {
val traceHasWdata = coreParams.traceHasWdata

def vLen = coreParams.vLen
def sLen = coreParams.sLen
def eLen = coreParams.eLen(xLen, fLen)
def eLen = coreParams.eLen
def vfLen = coreParams.vfLen
def vMemDataBits = if (usingVector) coreParams.vMemDataBits else 0
def maxVLMax = vLen

if (usingVector) {
require(isPow2(vLen), s"vLen ($vLen) must be a power of 2")
require(eLen >= 32 && vLen % eLen == 0, s"eLen must divide vLen ($vLen) and be no less than 32")
require(eLen == 32 || eLen == 64)
require(vfLen <= eLen)
}

lazy val hartIdLen: Int = p(MaxHartIdBits)
Expand Down
Loading