From 72adc6981c995e2afd442def2674300b1ca3eb5b Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Wed, 21 Aug 2019 22:10:39 -0700 Subject: [PATCH] fix firesim test suite generation --- build.sbt | 5 ++- .../example/src/main/scala/Generator.scala | 1 + .../firechip/src/main/scala/Generator.scala | 38 ++----------------- .../src/main/scala/TargetConfigs.scala | 2 +- .../src/main/scala/TestSuites.scala | 2 +- 5 files changed, 10 insertions(+), 38 deletions(-) rename generators/{example => utilities}/src/main/scala/TestSuites.scala (99%) diff --git a/build.sbt b/build.sbt index c5562c45..d353a497 100644 --- a/build.sbt +++ b/build.sbt @@ -106,10 +106,11 @@ lazy val testchipip = (project in file("generators/testchipip")) .settings(commonSettings) lazy val example = conditionalDependsOn(project in file("generators/example")) - .dependsOn(boom, hwacha, sifive_blocks, sifive_cache) + .dependsOn(boom, hwacha, sifive_blocks, sifive_cache, utilities) .settings(commonSettings) lazy val utilities = conditionalDependsOn(project in file("generators/utilities")) + .dependsOn(rocketchip, boom) .settings(commonSettings) lazy val icenet = (project in file("generators/icenet")) @@ -165,7 +166,7 @@ lazy val midas = ProjectRef(firesimDir, "midas") lazy val firesimLib = ProjectRef(firesimDir, "firesimLib") lazy val firechip = (project in file("generators/firechip")) - .dependsOn(boom, icenet, testchipip, sifive_blocks, sifive_cache, midasTargetUtils, midas, firesimLib % "test->test;compile->compile") + .dependsOn(boom, icenet, testchipip, sifive_blocks, sifive_cache, utilities, midasTargetUtils, midas, firesimLib % "test->test;compile->compile") .settings( commonSettings, testGrouping in Test := isolateAllTests( (definedTests in Test).value ) diff --git a/generators/example/src/main/scala/Generator.scala b/generators/example/src/main/scala/Generator.scala index 34f16e4e..f164b481 100644 --- a/generators/example/src/main/scala/Generator.scala +++ b/generators/example/src/main/scala/Generator.scala @@ -4,6 +4,7 @@ import chisel3._ import freechips.rocketchip.config.{Parameters} import freechips.rocketchip.util.{GeneratorApp} +import utilities.TestSuiteHelper object Generator extends GeneratorApp { // add unique test suites diff --git a/generators/firechip/src/main/scala/Generator.scala b/generators/firechip/src/main/scala/Generator.scala index 06febd3a..0dd0e1eb 100644 --- a/generators/firechip/src/main/scala/Generator.scala +++ b/generators/firechip/src/main/scala/Generator.scala @@ -16,10 +16,10 @@ import freechips.rocketchip.config.Parameters import freechips.rocketchip.subsystem.RocketTilesKey import freechips.rocketchip.tile.XLen -import boom.system.{BoomTilesKey, BoomTestSuites} - import firesim.util.{GeneratorArgs, HasTargetAgnosticUtilites, HasFireSimGeneratorUtilities} +import utilities.TestSuiteHelper + trait HasTestSuites { val rv64RegrTestNames = collection.mutable.LinkedHashSet( "rv64ud-v-fcvt", @@ -58,38 +58,8 @@ trait HasTestSuites { "rv32ui-p-sll") def addTestSuites(targetName: String, params: Parameters) { - val coreParams = - if (params(RocketTilesKey).nonEmpty) { - params(RocketTilesKey).head.core - } else { - params(BoomTilesKey).head.core - } - val xlen = params(XLen) - val vm = coreParams.useVM - val env = if (vm) List("p","v") else List("p") - coreParams.fpu foreach { case cfg => - if (xlen == 32) { - TestGeneration.addSuites(env.map(rv32uf)) - if (cfg.fLen >= 64) - TestGeneration.addSuites(env.map(rv32ud)) - } else { - TestGeneration.addSuite(rv32udBenchmarks) - TestGeneration.addSuites(env.map(rv64uf)) - if (cfg.fLen >= 64) - TestGeneration.addSuites(env.map(rv64ud)) - } - } - if (coreParams.useAtomics) TestGeneration.addSuites(env.map(if (xlen == 64) rv64ua else rv32ua)) - if (coreParams.useCompressed) TestGeneration.addSuites(env.map(if (xlen == 64) rv64uc else rv32uc)) - val (rvi, rvu) = - if (params(BoomTilesKey).nonEmpty) ((if (vm) BoomTestSuites.rv64i else BoomTestSuites.rv64pi), rv64u) - else if (xlen == 64) ((if (vm) rv64i else rv64pi), rv64u) - else ((if (vm) rv32i else rv32pi), rv32u) - - TestGeneration.addSuites(rvi.map(_("p"))) - TestGeneration.addSuites((if (vm) List("v") else List()).flatMap(env => rvu.map(_(env)))) - TestGeneration.addSuite(benchmarks) - TestGeneration.addSuite(new RegressionTestSuite(if (xlen == 64) rv64RegrTestNames else rv32RegrTestNames)) + TestSuiteHelper.addRocketTestSuites(params) + TestSuiteHelper.addBoomTestSuites(params) TestGeneration.addSuite(FastBlockdevTests) TestGeneration.addSuite(SlowBlockdevTests) if (!targetName.contains("NoNIC")) diff --git a/generators/firechip/src/main/scala/TargetConfigs.scala b/generators/firechip/src/main/scala/TargetConfigs.scala index 9be95d89..c81fe843 100644 --- a/generators/firechip/src/main/scala/TargetConfigs.scala +++ b/generators/firechip/src/main/scala/TargetConfigs.scala @@ -137,7 +137,7 @@ class FireSimBoomConfig extends Config( new WithBoomL2TLBs(1024) ++ new WithoutClockGating ++ // Using a small config because it has 64-bit system bus, and compiles quickly - new boom.system.SmallBoomConfig) + new boom.common.SmallBoomConfig) // A safer implementation than the one in BOOM in that it // duplicates whatever BOOMTileKey.head is present N times. This prevents diff --git a/generators/example/src/main/scala/TestSuites.scala b/generators/utilities/src/main/scala/TestSuites.scala similarity index 99% rename from generators/example/src/main/scala/TestSuites.scala rename to generators/utilities/src/main/scala/TestSuites.scala index 11425bdb..ab0ff8d5 100644 --- a/generators/example/src/main/scala/TestSuites.scala +++ b/generators/utilities/src/main/scala/TestSuites.scala @@ -1,4 +1,4 @@ -package example +package utilities import scala.collection.mutable.{LinkedHashSet}