1
0

Fix description of LR/SC test suites

This commit is contained in:
Andrew Waterman 2017-04-17 21:31:06 -07:00 committed by Andrew Waterman
parent a956b78dd2
commit 5934c7b4b9
2 changed files with 22 additions and 28 deletions

View File

@ -67,9 +67,13 @@ object Generator extends util.GeneratorApp {
} }
} }
} }
if (coreParams.useAtomics) TestGeneration.addSuites(env.map(if (xlen == 64) rv64ua else rv32ua)) if (coreParams.useAtomics) {
if (tileParams.dcache.flatMap(_.scratch).isEmpty)
TestGeneration.addSuites(env.map(if (xlen == 64) rv64ua else rv32ua))
else
TestGeneration.addSuites(env.map(if (xlen == 64) rv64uaSansLRSC else rv32uaSansLRSC))
}
if (coreParams.useCompressed) TestGeneration.addSuites(env.map(if (xlen == 64) rv64uc else rv32uc)) if (coreParams.useCompressed) TestGeneration.addSuites(env.map(if (xlen == 64) rv64uc else rv32uc))
if (coreParams.useAtomics && tileParams.dcache.flatMap(_.scratch).isEmpty) TestGeneration.addSuites(env.map(if (xlen == 64) rv64lrsc else rv32lrsc))
val (rvi, rvu) = val (rvi, rvu) =
if (xlen == 64) ((if (vm) rv64i else rv64pi), rv64u) if (xlen == 64) ((if (vm) rv64i else rv64pi), rv64u)
else ((if (vm) rv32i else rv32pi), rv32u) else ((if (vm) rv32i else rv32pi), rv32u)

View File

@ -4,13 +4,14 @@
package rocketchip package rocketchip
import Chisel._ import Chisel._
import scala.collection.mutable.{LinkedHashSet, LinkedHashMap} import scala.collection.mutable.{LinkedHashSet, ArrayBuffer}
abstract class RocketTestSuite { abstract class RocketTestSuite {
val dir: String val dir: String
val makeTargetName: String val makeTargetName: String
val names: LinkedHashSet[String] val names: LinkedHashSet[String]
val envName: String val envName: String
def kind: String
def postScript = s""" def postScript = s"""
$$(addprefix $$(output_dir)/, $$(addsuffix .hex, $$($makeTargetName))): $$(output_dir)/%.hex: $dir/%.hex $$(addprefix $$(output_dir)/, $$(addsuffix .hex, $$($makeTargetName))): $$(output_dir)/%.hex: $dir/%.hex
@ -35,12 +36,14 @@ run-$makeTargetName-fst: $$(addprefix $$(output_dir)/, $$(addsuffix .fst, $$($ma
class AssemblyTestSuite(prefix: String, val names: LinkedHashSet[String])(val envName: String) extends RocketTestSuite { class AssemblyTestSuite(prefix: String, val names: LinkedHashSet[String])(val envName: String) extends RocketTestSuite {
val dir = "$(RISCV)/riscv64-unknown-elf/share/riscv-tests/isa" val dir = "$(RISCV)/riscv64-unknown-elf/share/riscv-tests/isa"
val makeTargetName = prefix + "-" + envName + "-asm-tests" val makeTargetName = prefix + "-" + envName + "-asm-tests"
def kind = "asm"
override def toString = s"$makeTargetName = \\\n" + names.map(n => s"\t$prefix-$envName-$n").mkString(" \\\n") + postScript override def toString = s"$makeTargetName = \\\n" + names.map(n => s"\t$prefix-$envName-$n").mkString(" \\\n") + postScript
} }
class BenchmarkTestSuite(makePrefix: String, val dir: String, val names: LinkedHashSet[String]) extends RocketTestSuite { class BenchmarkTestSuite(makePrefix: String, val dir: String, val names: LinkedHashSet[String]) extends RocketTestSuite {
val envName = "" val envName = ""
val makeTargetName = makePrefix + "-bmark-tests" val makeTargetName = makePrefix + "-bmark-tests"
def kind = "bmark"
override def toString = s"$makeTargetName = \\\n" + names.map(n => s"\t$n.riscv").mkString(" \\\n") + postScript override def toString = s"$makeTargetName = \\\n" + names.map(n => s"\t$n.riscv").mkString(" \\\n") + postScript
} }
@ -48,22 +51,14 @@ class RegressionTestSuite(val names: LinkedHashSet[String]) extends RocketTestSu
val envName = "" val envName = ""
val dir = "$(RISCV)/riscv64-unknown-elf/share/riscv-tests/isa" val dir = "$(RISCV)/riscv64-unknown-elf/share/riscv-tests/isa"
val makeTargetName = "regression-tests" val makeTargetName = "regression-tests"
def kind = "regression"
override def toString = s"$makeTargetName = \\\n" + names.mkString(" \\\n") override def toString = s"$makeTargetName = \\\n" + names.mkString(" \\\n")
} }
object TestGeneration { object TestGeneration {
import scala.collection.mutable.HashMap private val suites = ArrayBuffer[RocketTestSuite]()
val asmSuites = new LinkedHashMap[String,AssemblyTestSuite]()
val bmarkSuites = new LinkedHashMap[String,BenchmarkTestSuite]()
val regressionSuites = new LinkedHashMap[String,RegressionTestSuite]()
def addSuite(s: RocketTestSuite) { def addSuite(s: RocketTestSuite) { suites += s }
s match {
case a: AssemblyTestSuite => asmSuites += (a.makeTargetName -> a)
case b: BenchmarkTestSuite => bmarkSuites += (b.makeTargetName -> b)
case r: RegressionTestSuite => regressionSuites += (r.makeTargetName -> r)
}
}
def addSuites(s: Seq[RocketTestSuite]) { s.foreach(addSuite) } def addSuites(s: Seq[RocketTestSuite]) { s.foreach(addSuite) }
@ -98,11 +93,7 @@ run-$kind-tests-fast: $$(addprefix $$(output_dir)/, $$(addsuffix .run, $targets)
} else { "\n" } } else { "\n" }
} }
List( suites.groupBy(_.kind).map { case (kind, s) => gen(kind, s) }.mkString("\n")
gen("asm", asmSuites.values.toSeq),
gen("bmark", bmarkSuites.values.toSeq),
gen("regression", regressionSuites.values.toSeq)
).mkString("\n")
} }
} }
@ -120,11 +111,11 @@ object DefaultTestSuites {
val rv32umNames = LinkedHashSet("mul", "mulh", "mulhsu", "mulhu", "div", "divu", "rem", "remu") val rv32umNames = LinkedHashSet("mul", "mulh", "mulhsu", "mulhu", "div", "divu", "rem", "remu")
val rv32um = new AssemblyTestSuite("rv32um", rv32umNames)(_) val rv32um = new AssemblyTestSuite("rv32um", rv32umNames)(_)
val rv32uaNames = LinkedHashSet("amoadd_w", "amoand_w", "amoor_w", "amoxor_w", "amoswap_w", "amomax_w", "amomaxu_w", "amomin_w", "amominu_w") val rv32uaSansLRSCNames = LinkedHashSet("amoadd_w", "amoand_w", "amoor_w", "amoxor_w", "amoswap_w", "amomax_w", "amomaxu_w", "amomin_w", "amominu_w")
val rv32ua = new AssemblyTestSuite("rv32ua", rv32uaNames)(_) val rv32uaSansLRSC = new AssemblyTestSuite("rv32ua", rv32uaSansLRSCNames)(_)
val rv32lrscNames = LinkedHashSet("lrsc") val rv32uaNames = rv32uaSansLRSCNames + "lrsc"
val rv32lrsc = new AssemblyTestSuite("rv32ua", rv32lrscNames)(_) val rv32ua = new AssemblyTestSuite("rv32ua", rv32uaNames)(_)
val rv32siNames = LinkedHashSet("csr", "ma_fetch", "scall", "sbreak", "wfi", "dirty") val rv32siNames = LinkedHashSet("csr", "ma_fetch", "scall", "sbreak", "wfi", "dirty")
val rv32si = new AssemblyTestSuite("rv32si", rv32siNames)(_) val rv32si = new AssemblyTestSuite("rv32si", rv32siNames)(_)
@ -142,10 +133,11 @@ object DefaultTestSuites {
val rv64umNames = LinkedHashSet("divuw", "divw", "mulw", "remuw", "remw") val rv64umNames = LinkedHashSet("divuw", "divw", "mulw", "remuw", "remw")
val rv64um = new AssemblyTestSuite("rv64um", rv32umNames ++ rv64umNames)(_) val rv64um = new AssemblyTestSuite("rv64um", rv32umNames ++ rv64umNames)(_)
val rv64uaNames = rv32uaNames.map(_.replaceAll("_w","_d")) val rv64uaSansLRSCNames = rv32uaSansLRSCNames.map(_.replaceAll("_w","_d"))
val rv64ua = new AssemblyTestSuite("rv64ua", rv32uaNames ++ rv64uaNames)(_) val rv64uaSansLRSC = new AssemblyTestSuite("rv64ua", rv32uaSansLRSCNames ++ rv64uaSansLRSCNames)(_)
val rv64lrsc = new AssemblyTestSuite("rv64ua", rv32lrscNames)(_) val rv64uaNames = rv64uaSansLRSCNames + "lrsc"
val rv64ua = new AssemblyTestSuite("rv64ua", rv32uaNames ++ rv64uaNames)(_)
val rv64ucNames = rv32ucNames val rv64ucNames = rv32ucNames
val rv64uc = new AssemblyTestSuite("rv64uc", rv64ucNames)(_) val rv64uc = new AssemblyTestSuite("rv64uc", rv64ucNames)(_)
@ -170,8 +162,6 @@ object DefaultTestSuites {
val groundtest64 = new AssemblyTestSuite("rv64ui", groundtestNames)(_) val groundtest64 = new AssemblyTestSuite("rv64ui", groundtestNames)(_)
val groundtest32 = new AssemblyTestSuite("rv32ui", groundtestNames)(_) val groundtest32 = new AssemblyTestSuite("rv32ui", groundtestNames)(_)
// TODO: "rv64ui-pm-lrsc", "rv64mi-pm-ipi",
val rv64u = List(rv64ui, rv64um) val rv64u = List(rv64ui, rv64um)
val rv64i = List(rv64ui, rv64si, rv64mi) val rv64i = List(rv64ui, rv64si, rv64mi)
val rv64pi = List(rv64ui, rv64mi) val rv64pi = List(rv64ui, rv64mi)