Merge pull request #55 from ucb-bar/boom-add

[rebar] add BOOM, riscv-torture, and modify scripts
This commit is contained in:
Abraham Gonzalez
2019-04-19 16:06:23 -07:00
committed by GitHub
12 changed files with 100 additions and 21 deletions

13
.ctags Normal file
View File

@@ -0,0 +1,13 @@
--langdef=scala
--langmap=scala:.scala
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private[^ ]*|protected)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\4/c,classes/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private[^ ]*|protected)?[ \t]*object[ \t]+([a-zA-Z0-9_]+)/\4/o,objects/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private[^ ]*|protected)?[ \t]*((abstract|final|sealed|implicit|lazy)[ \t ]*)*case class[ \t ]+([a-zA-Z0-9_]+)/\6/C,case classes/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private[^ ]*|protected)?[ \t]*case object[ \t]+([a-zA-Z0-9_]+)/\4/O,case objects/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private[^ ]*|protected)?[ \t]*trait[ \t]+([a-zA-Z0-9_]+)/\4/t,traits/
--regex-scala=/^[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\1/T,types/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy|override|private[^ ]*(\[[a-z]*\])*|protected)[ \t]*)*def[ \t]+([a-zA-Z0-9_]+)/\4/m,methods/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy|override|private[^ ]*|protected)[ \t]*)*val[ \t]+([a-zA-Z0-9_]+)/\3/V,values/
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy|override|private[^ ]*|protected)[ \t]*)*var[ \t]+([a-zA-Z0-9_]+)/\3/v,variables/
--regex-scala=/^[ \t]*package[ \t]+([a-zA-Z0-9_.]+)/\1/p,packages/

6
.gitmodules vendored
View File

@@ -19,3 +19,9 @@
[submodule "esp-tools"]
path = toolchains/esp-tools
url = https://github.com/ucb-bar/esp-tools.git
[submodule "tools/torture"]
path = tools/torture
url = git@github.com:ucb-bar/riscv-torture.git
[submodule "generators/boom"]
path = generators/boom
url = git@github.com:riscv-boom/riscv-boom.git

View File

@@ -1,8 +1,8 @@
# RISC-V Project Template
**THIS BRANCH IS UNDER DEVELOPMENT**
**IT CURRENTLY HAS MANY SUBMODULES**
**PLEASE RUN ./build.sh TO UPDATE SUBMODULES, UNLESS YOU WANT TO SPEND A LONG TIME WAITING FOR SUBMODULE TO CLONE**
**This branch is under development**
**It currently has many submodules**
**Please run ./scripts/init-submodules-no-riscv-tools.sh to update submodules, unless you want to spend a long time waiting for submodule to clone**
This is a starter template for your custom RISC-V project. It will allow you
to leverage the Chisel HDL and RocketChip SoC generator to produce a
@@ -62,6 +62,26 @@ follows.
* bootrom - sources for the first-stage bootloader included in the Boot ROM
* src/main/scala - scala source files for your project go here
## For submodule developers
Depending on the submodule that you develop in, you might want to run things out of the submodule.
For example, `boom` has its own Generator, package, top module, and configurations separate from
the `example` package in `src/main/scala`. Thus, to build a `boom` project you do something like
the following:
make SBT_PROJECT=boom PROJECT=boom.system CONFIG=<BOOM Config to use> TOP=ExampleBoomSystem
However, that is very long to write everytime there is a compile. Thus, a shorthand way to build
the subproject is the following:
make SUB_PROJECT=boom CONFIG=<BOOM Config to use>
This sets the proper configuration flags for make to work correctly.
Currently, the supported `SUB_PROJECT` flags are:
* boom - to build and run `boom` subproject configurations
## Using the block device
The default example project just provides the Rocket coreplex, memory, and

View File

@@ -8,21 +8,25 @@ lazy val commonSettings = Seq(
case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard
case _ => MergeStrategy.first}},
scalacOptions ++= Seq("-deprecation","-unchecked","-Xsource:2.11"),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test",
libraryDependencies += "org.json4s" %% "json4s-native" % "3.5.3",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % "test",
libraryDependencies += "org.json4s" %% "json4s-native" % "3.6.1",
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
libraryDependencies += "edu.berkeley.cs" %% "firrtl-interpreter" % "1.2-SNAPSHOT",
libraryDependencies += "com.github.scopt" %% "scopt" % "3.7.1",
libraryDependencies += "com.github.scopt" %% "scopt" % "3.7.0",
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases"),
Resolver.mavenLocal))
lazy val rebarFirrtl = (project in file("tools/firrtl"))
.settings(commonSettings)
lazy val rocketchip = RootProject(file("generators/rocket-chip"))
lazy val testchipip = (project in file("generators/testchipip")).settings(commonSettings)
lazy val testchipip = (project in file("generators/testchipip"))
.dependsOn(rocketchip)
.settings(commonSettings)
// Checks for -DROCKET_USE_MAVEN.
// If it's there, use a maven dependency.
@@ -36,16 +40,22 @@ def conditionalDependsOn(prj: Project): Project = {
prj.dependsOn(testchipip)
}
}
lazy val example = conditionalDependsOn(project in file("."))
.settings(commonSettings)
lazy val boom = (project in file("generators/boom"))
.dependsOn(rocketchip)
.settings(commonSettings)
lazy val tapeout = conditionalDependsOn(project in file("./tools/barstools/tapeout/"))
.dependsOn(rebarFirrtl)
.settings(commonSettings)
lazy val mdf = (project in file("./tools/barstools/mdf/scalalib/"))
.settings(commonSettings)
lazy val `barstools-macros` = conditionalDependsOn(project in file("./tools/barstools/macros/"))
lazy val `barstools-macros` = (project in file("./tools/barstools/macros/"))
.dependsOn(mdf, rocketchip, rebarFirrtl)
.enablePlugins(sbtassembly.AssemblyPlugin)
.settings(commonSettings)
.dependsOn(mdf)

View File

@@ -8,7 +8,7 @@ SHELL=/bin/bash
#########################################################################################
lookup_scala_srcs = $(shell find -L $(1)/ -iname "*.scala" 2> /dev/null)
PACKAGES=rocket-chip testchipip
PACKAGES=rocket-chip testchipip boom
SCALA_SOURCES=$(foreach pkg,$(PACKAGES),$(call lookup_scala_srcs,$(base_dir)/generators/$(pkg)/src/main/scala)) $(call lookup_scala_srcs,$(base_dir)/src/main/scala)
#########################################################################################
@@ -22,10 +22,10 @@ TESTCHIPIP_CLASSES ?= "$(TESTCHIP_DIR)/target/scala-$(SCALA_VERSION_MAJOR)/class
#########################################################################################
FIRRTL_JAR ?= $(ROCKETCHIP_DIR)/lib/firrtl.jar
$(FIRRTL_JAR): $(call lookup_scala_srcs, $(ROCKETCHIP_DIR)/firrtl/src/main/scala)
$(MAKE) -C $(ROCKETCHIP_DIR)/firrtl SBT="$(SBT)" root_dir=$(ROCKETCHIP_DIR)/firrtl build-scala
$(FIRRTL_JAR): $(call lookup_scala_srcs, $(REBAR_FIRRTL_DIR)/src/main/scala)
$(MAKE) -C $(REBAR_FIRRTL_DIR) SBT="$(SBT)" root_dir=$(REBAR_FIRRTL_DIR) build-scala
mkdir -p $(dir $@)
cp -p $(ROCKETCHIP_DIR)/firrtl/utils/bin/firrtl.jar $@
cp -p $(REBAR_FIRRTL_DIR)/utils/bin/firrtl.jar $@
touch $@
#########################################################################################
@@ -41,7 +41,7 @@ CHISEL_ARGS ?=
$(FIRRTL_FILE) $(ANNO_FILE): $(SCALA_SOURCES) $(sim_dotf)
mkdir -p $(build_dir)
cd $(base_dir) && $(SBT) "runMain $(PROJECT).Generator $(CHISEL_ARGS) $(build_dir) $(PROJECT) $(MODEL) $(CFG_PROJECT) $(CONFIG)"
cd $(base_dir) && $(SBT) "project $(SBT_PROJECT)" "runMain $(PROJECT).Generator $(CHISEL_ARGS) $(build_dir) $(PROJECT) $(MODEL) $(CFG_PROJECT) $(CONFIG)"
#########################################################################################
# create verilog files rules and variables

1
generators/boom Submodule

Submodule generators/boom added at 4cd347ed51

View File

@@ -1,3 +1,17 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")
resolvers += Resolver.url("scalasbt", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases")) (Resolver.ivyStylePatterns)
resolvers += Classpaths.sbtPluginReleases
resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven"
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")
addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.9.3")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
addSbtPlugin("com.simplytyped" % "sbt-antlr4" % "0.8.1")
addSbtPlugin("com.github.gseitz" % "sbt-protobuf" % "0.6.3")
libraryDependencies += "com.github.os72" % "protoc-jar" % "3.5.1.1"

0
build.sh → scripts/init-submodules-no-riscv-tools.sh Normal file → Executable file
View File

View File

@@ -101,6 +101,7 @@ object GenerateSimFiles extends App with HasGenerateSimConfig {
def writeBootrom(): Unit = {
firrtl.FileUtils.makeDirectory("./bootrom/")
writeResource("/testchipip/bootrom/bootrom.rv64.img", "./bootrom/")
writeResource("/testchipip/bootrom/bootrom.rv32.img", "./bootrom/")
}
def writeFiles(cfg: GenerateSimConfig): Unit = {

1
tools/torture Submodule

Submodule tools/torture added at 59b0f0f224

View File

@@ -5,25 +5,38 @@
#########################################################################################
# default variables to invoke the generator
# descriptions:
# PROJECT = the scala package to find the MODEL in
# PROJECT = the scala package to find the MODEL/Generator in
# MODEL = the top level module of the project (normally the harness)
# CONFIG = the configuration class to give the parameters for the project
# CFG_PROJECT = the scala package to find the CONFIG class
# SBT_PROJECT = the SBT project that you should find the Generator class in
# TB = wrapper over the TestHarness needed to simulate in VCS
# TOP = top level module of the project (normally the module instantiated by the harness)
#
# project specific:
# SUB_PROJECT = use the specific subproject default variables
#########################################################################################
PROJECT ?= example
MODEL ?= TestHarness
CONFIG ?= DefaultExampleConfig
CFG_PROJECT ?= $(PROJECT)
SBT_PROJECT ?= $(PROJECT)
TB ?= TestDriver
TOP ?= ExampleTop
SUB_PROJECT ?= example
ifeq ($(SUB_PROJECT),boom) # make it so that you only change 1 param to change them all!
SBT_PROJECT=boom
PROJECT=boom.system
TOP=ExampleBoomSystem
endif
#########################################################################################
# path to rocket-chip and testchipip
#########################################################################################
ROCKETCHIP_DIR = $(base_dir)/generators/rocket-chip
TESTCHIP_DIR = $(base_dir)/generators/testchipip
ROCKETCHIP_DIR = $(base_dir)/generators/rocket-chip
TESTCHIP_DIR = $(base_dir)/generators/testchipip
REBAR_FIRRTL_DIR = $(base_dir)/tools/firrtl
#########################################################################################
# names of various files needed to compile and run things