Skip to content

Commit

Permalink
Merge commit '577994e38' into create-targetDirKey
Browse files Browse the repository at this point in the history
Creating an intermediate commit for ucb-bar/chipyard#716 to use for CI
until ucb-bar/chipyard#742 is merged and this bump will be subsumed by
the larger bump.
  • Loading branch information
timsnyder-siv committed Dec 22, 2020
2 parents 9033a1d + 577994e commit 3c4e38a
Show file tree
Hide file tree
Showing 272 changed files with 7,000 additions and 2,148 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/apt-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
autoconf
automake
autotools-dev
bison
build-essential
device-tree-compiler
flex
g++-4.8
gawk
gcc-4.8
gperf
libgmp-dev
libmpc-dev
libmpfr-dev
libusb-1.0-0-dev
texinfo
54 changes: 10 additions & 44 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ jobs:
- uses: actions/checkout@v2

- id: cache
# We use an unreleased version of the cache action that adds support for
# multiple paths to cache. This can be changed to a normal version
# number (likely v2) once it is released. See
# https://github.com/actions/cache/pull/212
uses: actions/cache@9ab95382c899bf0953a0c6c1374373fc40456ffe
uses: actions/cache@v2
with:
path: |
./regression/install
Expand All @@ -44,24 +40,7 @@ jobs:

- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
sudo apt-get install -y \
autoconf \
automake \
autotools-dev \
bison \
build-essential \
device-tree-compiler \
flex \
g++-4.8 \
gawk \
gcc-4.8 \
gperf \
libgmp-dev \
libmpc-dev \
libmpfr-dev \
libusb-1.0-0-dev \
texinfo
run: sudo xargs apt-get install -y < .github/workflows/apt-packages.txt

- if: steps.cache.outputs.cache-hit != 'true'
env:
Expand All @@ -76,9 +55,7 @@ jobs:
steps:
- uses: actions/checkout@v2

# TODO: Use v2 once it is released. See the first occurrance of
# actions/cache in this file for more details.
- uses: actions/cache@9ab95382c899bf0953a0c6c1374373fc40456ffe
- uses: actions/cache@v2
with:
path: ./emulator/verilator
key: verilator-${{ hashFiles('./verilator.hash') }}-v1
Expand All @@ -88,7 +65,7 @@ jobs:
# some C struct not being ABI-compatible across gcc 4 and 5, which we have
# not debugged yet.
- name: Install Dependencies
run: sudo apt-get install -y autoconf bison flex g++-4.8 gcc-4.8
run: sudo xargs apt-get install -y < .github/workflows/apt-packages.txt

- env:
CXX: g++-4.8
Expand All @@ -103,9 +80,7 @@ jobs:
- uses: actions/checkout@v2

- name: Use SBT Cache
# TODO: Use v2 once it is released. See the first occurrance of
# actions/cache in this file for more details.
uses: actions/cache@9ab95382c899bf0953a0c6c1374373fc40456ffe
uses: actions/cache@v2
with:
path: |
~/.cache/coursier
Expand All @@ -123,32 +98,26 @@ jobs:
strategy:
fail-fast: false
matrix:
bucket: [1, 2, 3, 4, 5, 6, 7, 8]
bucket: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
steps:
- uses: actions/checkout@v2

- name: Use riscv-tools Cache
# TODO: Use v2 once it is released. See the first occurrance of
# actions/cache in this file for more details.
uses: actions/cache@9ab95382c899bf0953a0c6c1374373fc40456ffe
uses: actions/cache@v2
with:
path: |
./regression/install
./regression/stamps/rocket-tools_checkout.stamp
key: riscv-tools-${{ hashFiles('./riscv-tools.hash') }}-v1

- name: Use Verilator Cache
# TODO: Use v2 once it is released. See the first occurrance of
# actions/cache in this file for more details.
uses: actions/cache@9ab95382c899bf0953a0c6c1374373fc40456ffe
uses: actions/cache@v2
with:
path: ./emulator/verilator
key: verilator-${{ hashFiles('./verilator.hash') }}-v1

- name: Use SBT Cache
# TODO: Use v2 once it is released. See the first occurrance of
# actions/cache in this file for more details.
uses: actions/cache@9ab95382c899bf0953a0c6c1374373fc40456ffe
uses: actions/cache@v2
with:
path: |
~/.cache/coursier
Expand All @@ -157,10 +126,7 @@ jobs:

- name: Install Dependencies
run: |
sudo apt-get install -y \
device-tree-compiler \
g++-4.8 \
gcc-4.8
sudo xargs apt-get install -y < .github/workflows/apt-packages.txt
python3 -m pip install pexpect==4.3.1
- env:
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
out/
target/
project/target
docs/generated
docs-target/
*.fir
*.v
*.anno.json
*.swp
*~
.addons-dont-touch
/lib/
/test_lib/
/testbuild/
rocketchip.jar
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
url = https://github.com/ucb-bar/riscv-torture.git
[submodule "chisel3"]
path = chisel3
url = https://github.com/ucb-bar/chisel3.git
url = https://github.com/freechipsproject/chisel3.git
[submodule "firrtl"]
path = firrtl
url = https://github.com/ucb-bar/firrtl.git
url = https://github.com/freechipsproject/firrtl.git
[submodule "api-config-chipsalliance"]
path = api-config-chipsalliance
url = https://github.com/chipsalliance/api-config-chipsalliance.git
2 changes: 2 additions & 0 deletions .sbtopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-Dsbt.sourcemode=true
-Dsbt.workspace=$PWD
8 changes: 8 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rules = [
RemoveUnused,
DisableSyntax,
LeakingImplicitClassVal,
NoAutoTupling,
NoValInForComprehension,
ProcedureSyntax,
]
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,7 @@ jobs:
name: Scala tests
script:
- ./regression/run-test-bucket 8
- <<: *test*
name: Scala tests
script:
- ./regression/run-test-bucket 9
46 changes: 41 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Thank you for your interest in contributing to Rocket Chip!
+ [Submitting a PR](#submitting)
+ [Conditions for Merging a PR](#merging)
+ [Bumping Submodules](#bumping)
+ [Bumping Chisel and FIRRTL](#bumping-chisel)

### <a name="submitting"></a> Submitting a PR

Expand All @@ -28,15 +29,13 @@ Currently, the requirements for merging a PR are:

Several projects are managed as git submodules as well as [Wit](https://github.com/sifive/wit) dependencies.

### When to bump
#### When to bump

Most projects will be bumped by developers as needed; however,
sometimes users may wish to speed up the bumping process.
For more stable projects like Chisel 3 and FIRRTL,
please only bump to stable branches as defined by the specific subproject.
As of March 2020 these branches are `3.2.x` in Chisel 3 and `1.2.x` in FIRRTL.
For Chisel 3 and FIRRTL, please see the instructions in [Bumping Chisel and FIRRTL](#bumping-chisel).

### How to bump
#### How to bump

1. Bump the Git submodule

Expand Down Expand Up @@ -72,3 +71,40 @@ major feature or performance improvements in your commit message.
4. Open a Pull Request on Github

Please see the Github documentation for [Pull Requests](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests)

### <a name="bumping-chisel"></a> Bumping Chisel and FIRRTL

Because Chisel and FIRRTL have mature release processes, Rocket Chip uses the published artifacts when possible.
However, Rocket Chip maintains the ability to easily switch to building Chisel and FIRRTL from source.
This support is useful for long-lived tapeout branches and forks that may stuck on old versions of Chisel or FIRRTL with tapeout-specific bugfixes or hacks.

_Whether Rocket Chip is building Chisel and FIRRTL from published artifacts or from source is a property of a given commit_.
Users should *not* be changing this behavior locally; it should only be changed as part of bumping the dependencies.

In order to support switching between building against both source and published version of Chisel 3 and FIRRTL,
Rocket Chip uses an SBT plugin that it configures via JVM system properties.
This flow is described in the [Chisel README](https://github.com/freechipsproject/chisel3#building-chisel-with-firrtl-in-the-same-sbt-project).

When a file named `.sbtopts` exists in the root of this repository, it means Rocket Chip is configured to build Chisel 3 and FIRRTL from source.
When this file does not exist, Rocket Chip is configured to use published artifacts for Chisel 3 and FIRRTL.

### How to bump

Due to supporting both published artifacts and building from source, we must bump both approaches.
To bump the source dependencies, bump the git submodules as described in the previous section: [Bumping Submodules](#bumping).
To bump the published dependencies, bump the versions at the top of the SBT build file: [build.sbt](build.sbt).
Typically, the SBT dependency will only list a version for Chisel 3 which itself depends on FIRRTL.

Imporantly, the git submodule dependency and published dependency should be kept in sync.
Each published version corresponds to a tag in the respective git repository.
For example, Chisel version `"3.4.0"` in `build.sbt` corresponds to tag `v3.4.0` in the `chisel3` git submodule.
Due to how Wit dependencies work, we do *not* want the submodules to point to release tags; rather, we want them to point to the merge-base with the stable release branch.

For Chisel `v3.4.0`, the stable release branch is `3.4.x`.
Thus, in bumping to Chisel `v3.4.0`, we would want to bump the submodule to the commit given by the command:

```bash
git merge-base v3.4.0 origin/3.4.x
```

Note that `origin/` is necessary for `3.4.x` because it is a branch so will not exist in your local clone by default.
60 changes: 26 additions & 34 deletions Makefrag
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,38 @@ EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
COMMA := ,

SBT ?= java -Xmx$(JVM_MEMORY) -Xss8M -XX:MaxPermSize=256M -jar $(base_dir)/sbt-launch.jar
# Running with sbt-launch.jar doesn't read .sbtopts by default
# Set if the file exists (if it exists, we're building chisel3 and firrtl from source)
sbtopts_file := $(base_dir)/.sbtopts
ifneq (,$(wildcard $(sbtopts_file)))
SBT_OPTS ?= $(shell cat $(sbtopts_file))
endif
SBT ?= java -Xmx$(JVM_MEMORY) -Xss8M -jar $(base_dir)/sbt-launch.jar
SHELL := /bin/bash

FIRRTL_TRANSFORMS := \
firrtl.passes.InlineInstances \

ROCKET_CLASS_DIRS ?= \
$(base_dir)/target/scala-2.12/classes \
$(base_dir)/chisel3/target/scala-2.12/classes \
$(base_dir)/chisel3/core/target/scala-2.12/classes \
$(base_dir)/chisel3/macros/target/scala-2.12/classes

ROCKET_CLASSES ?= $(subst $(SPACE),:,$(ROCKET_CLASS_DIRS))
FIRRTL_JAR ?= $(base_dir)/firrtl/utils/bin/firrtl.jar
FIRRTL_TEST_JAR ?= $(base_dir)/firrtl/utils/bin/firrtl-test.jar
FIRRTL ?= java -Xmx$(JVM_MEMORY) -Xss8M -XX:MaxPermSize=256M -cp "$(FIRRTL_JAR)":"$(ROCKET_CLASSES)" firrtl.Driver

# Build firrtl.jar and put it where chisel3 can find it.
$(FIRRTL_JAR): $(shell find $(base_dir)/firrtl/src/main/scala -iname "*.scala")
$(MAKE) -C $(base_dir)/firrtl SBT="$(SBT)" root_dir=$(base_dir)/firrtl build-scala
cd $(base_dir)/firrtl && $(SBT) "Test / assembly"
touch $(FIRRTL_JAR)
mkdir -p $(base_dir)/lib
cp -p $(FIRRTL_JAR) $(base_dir)/lib

mkdir -p $(base_dir)/test_lib
cp -p $(FIRRTL_JAR) $(base_dir)/test_lib
cp -p $(FIRRTL_TEST_JAR) $(base_dir)/test_lib
# When chisel3 pr 448 is merged, the following extraneous copy may be removed.
mkdir -p $(base_dir)/chisel3/lib
cp -p $(FIRRTL_JAR) $(base_dir)/chisel3/lib

src_path := src/main/scala
resources := $(base_dir)/src/main/resources
csrc := $(resources)/csrc
vsrc := $(resources)/vsrc
default_submodules := . hardfloat chisel3
default_submodule_src_paths := $(foreach submodule,$(default_submodules) $(ROCKETCHIP_ADDONS),$(base_dir)/$(submodule)/$(src_path))
other_src_paths := $(base_dir)/api-config-chipsalliance/design/craft/src
chisel_srcs := $(foreach path,$(default_submodule_src_paths) $(other_src_paths),$(shell find $(path) -name "*.scala"))

JAVA ?= java -Xmx$(JVM_MEMORY) -Xss8M
FIRRTL ?= $(JAVA) -cp $(ROCKET_CHIP_JAR) firrtl.stage.FirrtlMain
GENERATOR ?= $(JAVA) -cp $(ROCKET_CHIP_JAR) $(PROJECT).Generator

# Extracting this information from SBT would be more robust
# api-config-chipsalliance does not use standard SBT src/main/scala, but has no resources
scala_srcs := $(shell find $(base_dir) -name "*.scala" -o -name "*.sbt")
resource_dirs := $(shell find $(base_dir) -type d -path "*/src/main/resources")
resources := $(foreach d,$(resource_dirs),$(shell find $(d) -type f))
all_srcs := $(scala_srcs) $(resources)

ROCKET_CHIP_JAR := $(base_dir)/rocketchip.jar
$(ROCKET_CHIP_JAR): $(all_srcs)
cd $(base_dir) && $(SBT) $(SBT_OPTS) assembly

rc_resource_dir := $(base_dir)/src/main/resources
csrc := $(rc_resource_dir)/csrc
vsrc := $(rc_resource_dir)/vsrc

disasm := 2>
which_disasm := $(shell which spike-dasm 2> /dev/null)
Expand Down
Loading

0 comments on commit 3c4e38a

Please sign in to comment.