Merge remote-tracking branch 'origin/dev' into toolchains2

This commit is contained in:
alonamid
2019-07-17 20:34:53 +00:00
25 changed files with 482 additions and 310 deletions

View File

@@ -1,7 +1,7 @@
Chipyard CI Chipyard CI
=========== ===========
Website: https://circleci.com/gh/ucb-bar/project-template Website: https://circleci.com/gh/ucb-bar/chipyard
CircleCI Brief Explanation CircleCI Brief Explanation
--------------------------- ---------------------------
@@ -35,11 +35,12 @@ Here the key is built from a string where the `checksum` portion converts the fi
This directory contains all the collateral for the Chipyard CI to work. This directory contains all the collateral for the Chipyard CI to work.
The following is included: The following is included:
build-toolchains.sh # build either riscv-tools or esp-tools `build-toolchains.sh` # build either riscv-tools or esp-tools
build-verilator.sh # build verilator `build-verilator.sh` # build verilator (remotely)
create-hash.sh # create hashes of riscv-tools/esp-tools so circleci caching can work `create-hash.sh` # create hashes of riscv-tools/esp-tools so circleci caching can work
do-rtl-build.sh # use verilator to build a sim executable `do-rtl-build.sh` # use verilator to build a sim executable (remotely)
config.yml # main circleci config script to enumerate jobs/workflows `config.yml` # main circleci config script to enumerate jobs/workflows
`defaults.sh` # default variables used
How things are setup for Chipyard How things are setup for Chipyard
--------------------------------- ---------------------------------
@@ -52,3 +53,18 @@ The docker image sets up the `PATH` and `RISCV` variable so that `riscv-tools` i
This requires the `riscv-tools` for `fesvr` and `verilator` to be able to build the binary. This requires the `riscv-tools` for `fesvr` and `verilator` to be able to build the binary.
This stores all collateral for the tests (srcs, generated-srcs, sim binary, etc) to run "out of the gate" in the next job (make needs everything or else it will run again). This stores all collateral for the tests (srcs, generated-srcs, sim binary, etc) to run "out of the gate" in the next job (make needs everything or else it will run again).
4th, finally run the tests that were wanted. 4th, finally run the tests that were wanted.
Other CI Setup
--------------
To get the CI to work correctly you need to setup CircleCI environment variables to point to the remote directory to build files and the server user/ip.
In the project settings, you can find this under "Build Settings" "Environment Variables".
You need to add two variables like the following:
CI\_DIR = /path/to/where/you/want/to/store/remote/files
SERVER = username@myserver.coolmachine.berkeley.edu
Additionally, you need to add under the "PERMISSIONS" "SSH Permissions" section a private key that is on the build server that you are using.
After adding a private key, it will show a fingerprint that should be added under the jobs that need to be run.
Note: On the remote server you need to have the `*.pub` key file added to the `authorized_keys` file.

View File

@@ -6,10 +6,13 @@
# turn echo on and error on earliest command # turn echo on and error on earliest command
set -ex set -ex
if [ ! -d "$HOME/$1-install" ]; then # get shared variables
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh
cd $HOME/ if [ ! -d "$HOME/$1-install" ]; then
cd $HOME
# init all submodules including the tools # init all submodules including the tools
CHIPYARD_DIR=$HOME/project ./project/scripts/build-toolchains.sh $1 CHIPYARD_DIR=$LOCAL_CHIPYARD_DIR .$LOCAL_CHIPYARD_DIR/scripts/build-toolchains.sh $1
fi fi

View File

@@ -5,11 +5,31 @@
# turn echo on and error on earliest command # turn echo on and error on earliest command
set -ex set -ex
cd $HOME/project # get shared variables
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh
cd sims/verisim # call clean on exit
trap clean EXIT
if [ ! -d "$HOME/project/sims/verisim/verilator" ]; then run_script $LOCAL_CHIPYARD_DIR/.circleci/clean-old-files.sh $CI_DIR
# make verilator
make verilator_install if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then
# set stricthostkeychecking to no (must happen before rsync)
run "echo \"Ping $SERVER\""
clean
run "mkdir -p $REMOTE_CHIPYARD_DIR"
copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR
run "make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR verilator_install"
# copy so that circleci can cache
mkdir -p $LOCAL_CHIPYARD_DIR
mkdir -p $LOCAL_VERILATOR_DIR
copy $SERVER:$REMOTE_CHIPYARD_DIR/ $LOCAL_CHIPYARD_DIR
copy $SERVER:$REMOTE_VERILATOR_DIR/ $LOCAL_VERILATOR_DIR
cp -r $LOCAL_VERILATOR_DIR/install/bin/* $LOCAL_VERILATOR_DIR/install/share/verilator/bin/.
fi fi

View File

@@ -5,8 +5,12 @@
# turn echo on and error on earliest command # turn echo on and error on earliest command
set -ex set -ex
# get shared variables
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh
# enter bhd repo # enter bhd repo
cd $HOME/project cd $LOCAL_CHIPYARD_DIR
# initialize submodules and get the hashes # initialize submodules and get the hashes
git submodule update --init git submodule update --init
@@ -22,7 +26,7 @@ search () {
done done
} }
submodules=("boom" "hwacha" "rocket-chip" "sifive-blocks" "testchipip") submodules=("boom" "hwacha" "icenet" "rocket-chip" "sifive-blocks" "sifive-cache" "testchipip")
dir="generators" dir="generators"
search search

29
.circleci/clean-old-files.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
# clean directories that are older than 30 days
# argument is used as the directory to look in
age () {
local AGE_SEC
local CUR_SEC
local DIFF_SEC
local SEC_PER_DAY
SEC_PER_DAY=86400
CUR_SEC=$(date +%s)
AGE_SEC=$(stat -c %Y -- "$1")
DIFF_SEC=$(expr $CUR_SEC - $AGE_SEC)
echo $(expr $DIFF_SEC / $SEC_PER_DAY)
}
for d in $1/*/ ; do
DIR_AGE="$(age $d)"
if [ $DIR_AGE -ge 30 ]; then
echo "Deleting $d since is it $DIR_AGE old"
rm -rf $d
else
echo "Keep $d since it is $DIR_AGE old"
fi
done

View File

@@ -7,479 +7,405 @@ version: 2
jobs: jobs:
commit-on-master-check: commit-on-master-check:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code
- checkout - checkout
- run: - run:
name: Check commits of each submodule name: Check commits of each submodule
command: | command: |
.circleci/check-commit.sh .circleci/check-commit.sh
install-riscv-toolchain: install-riscv-toolchain:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- run: - run:
name: Building riscv-tools toolchain name: Building riscv-tools toolchain
command: | command: |
.circleci/build-toolchains.sh riscv-tools .circleci/build-toolchains.sh riscv-tools
no_output_timeout: 120m no_output_timeout: 120m
- save_cache: - save_cache:
key: riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} key: riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
paths: paths:
- "/home/riscvuser/riscv-tools-install" - "/home/riscvuser/riscv-tools-install"
install-esp-toolchain: install-esp-toolchain:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} - esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }}
- run: - run:
name: Building esp-tools toolchain name: Building esp-tools toolchain
command: | command: |
.circleci/build-toolchains.sh esp-tools .circleci/build-toolchains.sh esp-tools
no_output_timeout: 120m no_output_timeout: 120m
- save_cache: - save_cache:
key: esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} key: esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }}
paths: paths:
- "/home/riscvuser/esp-tools-install" - "/home/riscvuser/esp-tools-install"
install-verilator: install-verilator:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code - add_ssh_keys:
fingerprints:
- "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e"
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Build Verilator name: Build Verilator
command: | command: |
.circleci/build-verilator.sh .circleci/build-verilator.sh
no_output_timeout: 120m no_output_timeout: 120m
- save_cache: - save_cache:
key: verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} key: verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
paths: paths:
- "/home/riscvuser/project/sims/verisim/verilator" - "/home/riscvuser/verilator"
prepare-example: prepare-example:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code - add_ssh_keys:
fingerprints:
- "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e"
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Building the example subproject using Verilator name: Building the example subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=example command: .circleci/do-rtl-build.sh example
no_output_timeout: 120m no_output_timeout: 120m
- save_cache: - save_cache:
key: example-{{ .Branch }}-{{ .Revision }} key: example-{{ .Branch }}-{{ .Revision }}
paths: paths:
- "/home/riscvuser/project" - "/home/riscvuser/project"
prepare-boomexample: prepare-boomexample:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code - add_ssh_keys:
fingerprints:
- "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e"
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Building the boomexample subproject using Verilator name: Building the boomexample subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomConfig command: .circleci/do-rtl-build.sh boomexample
no_output_timeout: 120m no_output_timeout: 120m
- save_cache: - save_cache:
key: boomexample-{{ .Branch }}-{{ .Revision }} key: boomexample-{{ .Branch }}-{{ .Revision }}
paths: paths:
- "/home/riscvuser/project" - "/home/riscvuser/project"
prepare-boomrocketexample: prepare-boomrocketexample:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code - add_ssh_keys:
fingerprints:
- "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e"
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Building the boomrocketexample subproject using Verilator name: Building the boomrocketexample subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomAndRocketConfig command: .circleci/do-rtl-build.sh boomrocketexample
no_output_timeout: 120m no_output_timeout: 120m
- save_cache: - save_cache:
key: boomrocketexample-{{ .Branch }}-{{ .Revision }} key: boomrocketexample-{{ .Branch }}-{{ .Revision }}
paths: paths:
- "/home/riscvuser/project" - "/home/riscvuser/project"
prepare-boom: prepare-boom:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code - add_ssh_keys:
fingerprints:
- "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e"
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Building the boom subproject using Verilator name: Building the boom subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=boom command: .circleci/do-rtl-build.sh boom
no_output_timeout: 120m no_output_timeout: 120m
- save_cache: - save_cache:
key: boom-{{ .Branch }}-{{ .Revision }} key: boom-{{ .Branch }}-{{ .Revision }}
paths: paths:
- "/home/riscvuser/project" - "/home/riscvuser/project"
prepare-rocketchip: prepare-rocketchip:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code - add_ssh_keys:
fingerprints:
- "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e"
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Building the rocketchip subproject using Verilator name: Building the rocketchip subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=rocketchip command: .circleci/do-rtl-build.sh rocketchip
no_output_timeout: 120m no_output_timeout: 120m
- save_cache: - save_cache:
key: rocketchip-{{ .Branch }}-{{ .Revision }} key: rocketchip-{{ .Branch }}-{{ .Revision }}
paths: paths:
- "/home/riscvuser/project" - "/home/riscvuser/project"
prepare-hwacha:
prepare-hwacha-verilog-only:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code - add_ssh_keys:
fingerprints:
- "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e"
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Building the hwacha subproject using Verilator name: Building the hwacha subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=hwacha verilog command: .circleci/do-rtl-build.sh hwacha
no_output_timeout: 120m no_output_timeout: 120m
- save_cache: - save_cache:
key: hwacha-{{ .Branch }}-{{ .Revision }} key: hwacha-{{ .Branch }}-{{ .Revision }}
paths: paths:
- "/home/riscvuser/project" - "/home/riscvuser/project"
example-run-tests:
example-run-benchmark-tests:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- example-{{ .Branch }}-{{ .Revision }} - example-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Run example benchmark tests name: Run example tests
command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example command: .circleci/run-tests.sh example
boomexample-run-tests:
boomexample-run-benchmark-tests:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- boomexample-{{ .Branch }}-{{ .Revision }} - boomexample-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Run boomexample benchmark tests name: Run boomexample tests
command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example CONFIG=SmallDefaultBoomConfig command: .circleci/run-tests.sh boomexample
boomrocketexample-run-tests:
boomrocketexample-run-benchmark-tests:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- boomrocketexample-{{ .Branch }}-{{ .Revision }} - boomrocketexample-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Run boomrocketexample benchmark tests name: Run boomrocketexample tests
command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example CONFIG=SmallDefaultBoomAndRocketConfig command: .circleci/run-tests.sh boomrocketexample
boom-run-tests:
boom-run-benchmark-tests:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- boom-{{ .Branch }}-{{ .Revision }} - boom-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Run boom benchmark tests name: Run boom tests
command: make run-bmark-tests -C sims/verisim SUB_PROJECT=boom command: .circleci/run-tests.sh boom
rocketchip-run-tests:
rocketchip-run-benchmark-tests:
docker: docker:
- image: riscvboom/riscvboom-images:0.0.5 - image: riscvboom/riscvboom-images:0.0.10
environment: environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb TERM: dumb
steps: steps:
# Checkout the code
- checkout - checkout
- run: - run:
name: Create hash of toolchains name: Create hash of toolchains
command: | command: |
.circleci/create-hash.sh .circleci/create-hash.sh
- restore_cache: - restore_cache:
keys: keys:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- rocketchip-{{ .Branch }}-{{ .Revision }} - rocketchip-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run: - run:
name: Run rocketchip benchmark tests name: Run rocketchip tests
command: make run-bmark-tests -C sims/verisim SUB_PROJECT=rocketchip command: .circleci/run-tests.sh rocketchip
hwacha-run-tests:
# hwacha-run-benchmark-tests: docker:
# docker: - image: riscvboom/riscvboom-images:0.0.10
# - image: riscvboom/riscvboom-images:0.0.5 environment:
# environment: JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
# JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit TERM: dumb
# TERM: dumb steps:
# - checkout
# steps: - run:
# # Checkout the code name: Create hash of toolchains
# - checkout command: |
# .circleci/create-hash.sh
# - run: - restore_cache:
# name: Create hash of toolchains keys:
# command: | - esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }}
# .circleci/create-hash.sh - restore_cache:
# keys:
# - restore_cache: - hwacha-{{ .Branch }}-{{ .Revision }}
# keys: - restore_cache:
# - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} keys:
# - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
# - restore_cache: - run:
# keys: name: Run hwacha tests
# - hwacha-{{ .Branch }}-{{ .Revision }} command: .circleci/run-tests.sh hwacha
#
# - run:
# name: Run hwacha benchmark tests
# command: make run-bmark-tests -C sims/verisim SUB_PROJECT=hwacha
# Order and dependencies of jobs to run # Order and dependencies of jobs to run
workflows: workflows:
@@ -523,42 +449,34 @@ workflows:
- install-riscv-toolchain - install-riscv-toolchain
- install-verilator - install-verilator
- prepare-hwacha-verilog-only: - prepare-hwacha:
requires: requires:
- install-riscv-toolchain # TODO: Remove when esp-tools is used
- install-esp-toolchain - install-esp-toolchain
- install-verilator - install-verilator
# Run the respective tests # Run the respective tests
# Run the example tests # Run the example tests
- example-run-benchmark-tests: - example-run-tests:
requires: requires:
- install-riscv-toolchain
- prepare-example - prepare-example
- boomexample-run-benchmark-tests: - boomexample-run-tests:
requires: requires:
- install-riscv-toolchain
- prepare-boomexample - prepare-boomexample
- boomrocketexample-run-benchmark-tests: - boomrocketexample-run-tests:
requires: requires:
- install-riscv-toolchain
- prepare-boomrocketexample - prepare-boomrocketexample
- boom-run-benchmark-tests: - boom-run-tests:
requires: requires:
- install-riscv-toolchain
- prepare-boom - prepare-boom
- rocketchip-run-benchmark-tests: - rocketchip-run-tests:
requires: requires:
- install-riscv-toolchain
- prepare-rocketchip - prepare-rocketchip
# - hwacha-run-benchmark-tests: - hwacha-run-tests:
# requires: requires:
# - install-riscv-toolchain # TODO: Remove when esp-tools is used - prepare-hwacha
# - install-esp-toolchain
# - prepare-hwacha

View File

@@ -5,8 +5,12 @@
# turn echo on and error on earliest command # turn echo on and error on earliest command
set -ex set -ex
# get shared variables
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh
# enter bhd repo # enter bhd repo
cd $HOME/project cd $LOCAL_CHIPYARD_DIR
# get the version of riscv-tools from the git submodule hash # get the version of riscv-tools from the git submodule hash
git submodule status | grep "riscv-tools" | awk '{print$1}' | grep -o "[[:alnum:]]*" >> $HOME/riscv-tools.hash git submodule status | grep "riscv-tools" | awk '{print$1}' | grep -o "[[:alnum:]]*" >> $HOME/riscv-tools.hash

43
.circleci/defaults.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
copy () {
rsync -avzp -e 'ssh' $1 $2
}
run () {
ssh -o "StrictHostKeyChecking no" -t $SERVER $@
}
run_script () {
ssh -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 "$2"
}
clean () {
# remove remote work dir
run "rm -rf $REMOTE_WORK_DIR"
}
# remote variables
REMOTE_WORK_DIR=$CI_DIR/$CIRCLE_PROJECT_REPONAME-$CIRCLE_BRANCH-$CIRCLE_SHA1-$CIRCLE_JOB
REMOTE_RISCV_DIR=$REMOTE_WORK_DIR/riscv-tools-install
REMOTE_ESP_DIR=$REMOTE_WORK_DIR/esp-tools-install
REMOTE_CHIPYARD_DIR=$REMOTE_WORK_DIR/chipyard
REMOTE_VERILATOR_DIR=$REMOTE_WORK_DIR/verilator
REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verilator
# local variables (aka within the docker container)
LOCAL_CHECKOUT_DIR=$HOME/project
LOCAL_RISCV_DIR=$HOME/riscv-tools-install
LOCAL_ESP_DIR=$HOME/esp-tools-install
LOCAL_CHIPYARD_DIR=$LOCAL_CHECKOUT_DIR
LOCAL_VERILATOR_DIR=$HOME/verilator
LOCAL_SIM_DIR=$LOCAL_CHIPYARD_DIR/sims/verilator
# key value store to get the build strings
declare -A mapping
mapping["example"]="SUB_PROJECT=example"
mapping["boomexample"]="SUB_PROJECT=example CONFIG=DefaultBoomConfig"
mapping["boomrocketexample"]="SUB_PROJECT=example CONFIG=DefaultBoomAndRocketConfig"
mapping["boom"]="SUB_PROJECT=boom"
mapping["rocketchip"]="SUB_PROJECT=rocketchip"
mapping["hwacha"]="SUB_PROJECT=hwacha"

View File

@@ -6,15 +6,44 @@
# turn echo on and error on earliest command # turn echo on and error on earliest command
set -ex set -ex
# init all submodules # get shared variables
cd $HOME/project SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh
# call clean on exit
trap clean EXIT
cd $LOCAL_CHIPYARD_DIR
./scripts/init-submodules-no-riscv-tools.sh ./scripts/init-submodules-no-riscv-tools.sh
# enter the verisim directory and build the specific config # set stricthostkeychecking to no (must happen before rsync)
cd sims/verisim run "echo \"Ping $SERVER\""
make clean
# run the particular build command clean
make JAVA_ARGS="-Xmx2G -Xss8M" $@
rm -rf ../../project # copy over riscv/esp-tools, verilator, and chipyard to remote
run "mkdir -p $REMOTE_CHIPYARD_DIR"
run "mkdir -p $REMOTE_VERILATOR_DIR"
copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR
copy $LOCAL_VERILATOR_DIR/ $SERVER:$REMOTE_VERILATOR_DIR
TOOLS_DIR=$REMOTE_RISCV_DIR
LD_LIB_DIR=$REMOTE_RISCV_DIR/lib
if [ $1 = "hwacha" ]; then
TOOLS_DIR=$REMOTE_ESP_DIR
LD_LIB_DIR=$REMOTE_ESP_DIR/lib
run "mkdir -p $REMOTE_ESP_DIR"
copy $LOCAL_ESP_DIR/ $SERVER:$REMOTE_ESP_DIR
else
run "mkdir -p $REMOTE_RISCV_DIR"
copy $LOCAL_RISCV_DIR/ $SERVER:$REMOTE_RISCV_DIR
fi
# enter the verisim directory and build the specific config on remote server
run "make -C $REMOTE_SIM_DIR clean"
run "export RISCV=\"$TOOLS_DIR\"; export LD_LIBRARY_PATH=\"$LD_LIB_DIR\"; export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR/install/share/verilator; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" ${mapping[$1]}"
run "rm -rf $REMOTE_CHIPYARD_DIR/project"
# copy back the final build
mkdir -p $LOCAL_CHIPYARD_DIR
copy $SERVER:$REMOTE_CHIPYARD_DIR/ $LOCAL_CHIPYARD_DIR

53
.circleci/run-tests.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/bin/bash
# run the different tests
# turn echo on and error on earliest command
set -ex
# get remote exec variables
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh
export VERILATOR_ROOT=$LOCAL_VERILATOR_DIR/install/share/verilator
run_bmark () {
make run-bmark-tests-fast -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR $@
}
run_asm () {
make run-asm-tests-fast -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR $@
}
run_both () {
run_bmark $@
run_asm $@
}
case $1 in
example)
run_bmark ${mapping[$1]}
;;
boomexample)
run_bmark ${mapping[$1]}
;;
boomrocketexample)
run_bmark ${mapping[$1]}
;;
boom)
run_bmark ${mapping[$1]}
;;
rocketchip)
run_bmark ${mapping[$1]}
;;
hwacha)
export RISCV=$LOCAL_ESP_DIR
export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib
export PATH=$RISCV/bin:$PATH
make run-rv64uv-p-asm-tests -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR ${mapping[$1]}
;;
*)
echo "No set of tests for $1. Did you spell it right?"
exit 1
;;
esac

View File

@@ -1,8 +1,8 @@
# Chipyard Framework [![CircleCI](https://circleci.com/gh/ucb-bar/project-template/tree/master.svg?style=svg)](https://circleci.com/gh/ucb-bar/chipyard/tree/master) # Chipyard Framework [![CircleCI](https://circleci.com/gh/ucb-bar/chipyard/tree/master.svg?style=svg)](https://circleci.com/gh/ucb-bar/chipyard/tree/master)
## Using Chipyard ## Using Chipyard
To get started using Chipyard, see the documentation on the Chipyard documentation site: https://bar-project-template.readthedocs.io/en/latest/ To get started using Chipyard, see the documentation on the Chipyard documentation site: https://chipyard.readthedocs.io/en/latest/
## What is Chipyard ## What is Chipyard
@@ -14,7 +14,7 @@ Chipyard is actively developed in the [Berkeley Architecture Research Group][ucb
## Resources ## Resources
* Chipyard Website: ...TBD at a later date... * Chipyard Website: ...TBD at a later date...
* Chipyard Documentation: https://bar-project-template.readthedocs.io/ * Chipyard Documentation: https://chipyard.readthedocs.io/
[hwacha]:http://hwacha.org [hwacha]:http://hwacha.org
[hammer]:https://github.com/ucb-bar/hammer [hammer]:https://github.com/ucb-bar/hammer

View File

@@ -73,10 +73,25 @@ $(HARNESS_SMEMS_FILE) $(HARNESS_SMEMS_FIR): $(HARNESS_SMEMS_CONF)
verilog: $(sim_vsrcs) verilog: $(sim_vsrcs)
######################################################################################### #########################################################################################
# helper rules to run simulator # helper rules to run simulations
######################################################################################### #########################################################################################
.PHONY: run-binary run-fast
run-binary: $(sim) run-binary: $(sim)
(set -o pipefail && $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out) (set -o pipefail && $(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out)
#########################################################################################
# helper rules to run simulator as fast as possible
#########################################################################################
run-binary-fast: $(sim)
(set -o pipefail && $(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out)
#########################################################################################
# helper rules to run simulator with as much debug info as possible
#########################################################################################
run-binary-debug: $(sim_debug)
(set -o pipefail && $(sim_debug) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(VERBOSE_FLAG) $(WAVEFORM_FLAG) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out)
run-fast: run-asm-tests-fast run-bmark-tests-fast
######################################################################################### #########################################################################################
# run assembly/benchmarks rules # run assembly/benchmarks rules
@@ -86,10 +101,10 @@ $(output_dir)/%: $(RISCV)/riscv64-unknown-elf/share/riscv-tests/isa/%
ln -sf $< $@ ln -sf $< $@
$(output_dir)/%.run: $(output_dir)/% $(sim) $(output_dir)/%.run: $(output_dir)/% $(sim)
$(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(PERMISSIVE_OFF) $< && touch $@ $(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(PERMISSIVE_OFF) $< && touch $@
$(output_dir)/%.out: $(output_dir)/% $(sim) $(output_dir)/%.out: $(output_dir)/% $(sim)
(set -o pipefail && $(sim) $(PERMISSIVE_ON) +verbose +max-cycles=$(timeout_cycles) $(PERMISSIVE_OFF) $< 3>&1 1>&2 2>&3 | spike-dasm > $@) (set -o pipefail && $(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $< 3>&1 1>&2 2>&3 | spike-dasm > $@)
######################################################################################### #########################################################################################
# include build/project specific makefrags made from the generator # include build/project specific makefrags made from the generator

View File

@@ -0,0 +1,57 @@
FPGA-Accelerated Simulators
==============================
FireSim
-----------------------
`FireSim <https://fires.im/>`__ is an open-source cycle-accurate FPGA-accelerated full-system hardware simulation platform that runs on cloud FPGAs (Amazon EC2 F1).
FireSim allows RTL-level simulation at orders-of-magnitude faster speeds than software RTL simulators.
FireSim also provides additional device models to allow full-system simulation, including memory models and network models.
FireSim currently supports running only on Amazon EC2 F1 FPGA-enabled virtual instances.
In order to simulate your Chipyard design using FireSim, if you have not
already, follow the initial EC2 setup instructions as detailed in the `FireSim
documentation <http://docs.fires.im/en/latest/Initial-Setup/index.html>`__.
Then clone Chipyard onto your FireSim manager
instance, and setup your Chipyard repository as you would normally.
Next, initalize FireSim as library in Chipyard by running:
.. code-block:: shell
# At the root of your chipyard repo
./scripts/firesim-setup.sh --fast
``firesim-setup.sh`` initializes additional submodules and then invokes
firesim's ``build-setup.sh`` script adding ``--library`` to properly
initialize FireSim as a library submodule in chipyard. You may run
``./sims/firesim/build-setup.sh --help`` to see more options.
Finally, source the following environment at the root of the firesim directory:
.. code-block:: shell
cd sims/firesim
# (Recommended) The default manager environment (includes env.sh)
source sourceme-f1-manager.sh
`Every time you want to use FireSim with a fresh shell, you must source this sourceme.sh`
At this point you're ready to use FireSim with Chipyard. If you're not already
familiar with FireSim, please return to the `FireSim Docs
<https://docs.fires.im/en/latest/Initial-Setup/Setting-up-your-Manager-Instance.html#completing-setup-using-the-manager>`__,
and proceed with the rest of the tutorial.
Current Limitations:
++++++++++++++++++++
FireSim integration in Chipyard is still a work in progress. Presently, you
cannot build a FireSim simulator from any generator project in Chipyard except ``firechip``,
which properly invokes MIDAS on the target RTL.
In the interim, workaround this limitation by importing Config and Module
classes from other generator projects into FireChip. You should then be able to
refer to those classes or an alias of them in your ``DESIGN`` or ``TARGET_CONFIG``
variables. Note that if your target machine has I/O not provided in the default
FireChip targets (see ``generators/firechip/src/main/scala/Targets.scala``) you may need
to write a custom endpoint.

View File

@@ -1,17 +0,0 @@
FPGA-Based Simulators
==============================
FireSim
-----------------------
`FireSim <https://fires.im/>`__ is an open-source cycle-accurate FPGA-accelerated full-system hardware simulation platform that runs on cloud FPGAs (Amazon EC2 F1).
FireSim allows RTL-level simulation at orders-of-magnitude faster speeds than software RTL simulators.
FireSim also provides additional device models to allow full-system simulation, including memory models and network models.
FireSim currently supports running only on Amazon EC2 F1 FPGA-enabled virtual instances on the public cloud.
In order to simulate your Chipyard design using FireSim, you should follow the following steps:
Follow the initial EC2 setup instructions as detailed in the `FireSim documentation <http://docs.fires.im/en/latest/Initial-Setup/index.html>`__.
Then clone your full Chipyard repository onto your Amazon EC2 FireSim manager instance.
Enter the ``sims/FireSim`` directory, and follow the FireSim instructions for `running a simulation <http://docs.fires.im/en/latest/Running-Simulations-Tutorial/index.html>`__.

View File

@@ -1,35 +0,0 @@
Open Source Software RTL Simulators
==============================
Verilator
-----------------------
`Verilator <https://www.veripool.org/wiki/verilator>`__ is an open-source LGPL-Licensed simulator maintained by `Veripool <https://www.veripool.org/>`__.
The Chipyard framework can download, build, and execute simulations using Verilator.
To run a simulation using Verilator, perform the following steps:
To compile the example design, run ``make`` in the ``sims/verisim`` directory.
This will elaborate the ``DefaultRocketConfig`` in the example project.
An executable called ``simulator-example-DefaultRocketConfig`` will be produced.
This executable is a simulator that has been compiled based on the design that was built.
You can then use this executable to run any compatible RV64 code.
For instance, to run one of the riscv-tools assembly tests.
.. code-block:: shell
./simulator-example-DefaultRocketConfig $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64ui-p-simple
If you later create your own project, you can use environment variables to build an alternate configuration.
.. code-block:: shell
make SUB_PROJECT=yourproject
./simulator-<yourproject>-<yourconfig> ...
If you would like to extract waveforms from the simulation, run the command ``make debug`` instead of just ``make``.
This will generate a vcd file (vcd is a standard waveform representation file format) that can be loaded to any common waveform viewer.
An open-source vcd-capable waveform viewer is `GTKWave <http://gtkwave.sourceforge.net/>`__.
Please refer to :ref:`Running A Simulation` for a step by step tutorial on how to get a simulator up and running.

View File

@@ -1,9 +1,43 @@
Commercial Software RTL Simulators Software RTL Simulators
============================== ===================================
VCS Verilator (Open-Source)
----------------------- -----------------------
`Verilator <https://www.veripool.org/wiki/verilator>`__ is an open-source LGPL-Licensed simulator maintained by `Veripool <https://www.veripool.org/>`__.
The Chipyard framework can download, build, and execute simulations using Verilator.
To run a simulation using Verilator, perform the following steps:
To compile the example design, run ``make`` in the ``sims/verisim`` directory.
This will elaborate the ``DefaultRocketConfig`` in the example project.
An executable called ``simulator-example-DefaultRocketConfig`` will be produced.
This executable is a simulator that has been compiled based on the design that was built.
You can then use this executable to run any compatible RV64 code.
For instance, to run one of the riscv-tools assembly tests.
.. code-block:: shell
./simulator-example-DefaultRocketConfig $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64ui-p-simple
If you later create your own project, you can use environment variables to build an alternate configuration.
.. code-block:: shell
make SUB_PROJECT=yourproject
./simulator-<yourproject>-<yourconfig> ...
If you would like to extract waveforms from the simulation, run the command ``make debug`` instead of just ``make``.
This will generate a vcd file (vcd is a standard waveform representation file format) that can be loaded to any common waveform viewer.
An open-source vcd-capable waveform viewer is `GTKWave <http://gtkwave.sourceforge.net/>`__.
Please refer to :ref:`Running A Simulation` for a step by step tutorial on how to get a simulator up and running.
Commercial Software RTL Simulators
Synopsys VCS (License Required)
--------------------------------
`VCS <https://www.synopsys.com/verification/simulation/vcs.html>`__ is a commercial RTL simulator developed by Synopsys. `VCS <https://www.synopsys.com/verification/simulation/vcs.html>`__ is a commercial RTL simulator developed by Synopsys.
It requires commercial licenses. It requires commercial licenses.
The Chipyard framework can compile and execute simulations using VCS. The Chipyard framework can compile and execute simulations using VCS.

View File

@@ -1,15 +1,20 @@
Simulators Simulators
======================= =======================
Chipyard provides support and integration for multiple simulation flows, for various user levels and requirements. Chipyard supports two classes of simulation:
In the majority of cases during a digital design development process, a simple software RTL simulation will do.
When more advanced full-system evaluation is required, with long running workloads, FPGA-accelerated simulation will then become a preferable solution. #. Software RTL simulation using commercial or open-source (Verilator) RTL simulators
The following pages provide detailed information about the simulation possibilities within the Chipyard framework. #. FPGA-accelerated full-system simulation using FireSim
Software RTL simulators of Chipyard designs run at O(1 KHz), but compile
quickly and provide full waveforms. Conversly, FPGA-accelerated simulators run
at O(100 MHz), making them appropriate for booting an operating system and
running a complete workload, but have multi-hour compile times and poorer debug
visability.
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
:caption: Simulators: :caption: Simulators:
Open-Source-Simulators Software-RTL-Simulators
Commercial-Simulators FPGA-Accelerated-Simulators
FPGA-Based-Simulators

View File

@@ -4,7 +4,7 @@
contain the root `toctree` directive. contain the root `toctree` directive.
Welcome to Chipyard's documentation! Welcome to Chipyard's documentation!
================================= ====================================
Chipyard is a a framework for designing and evaluating full-system hardware using agile teams. Chipyard is a a framework for designing and evaluating full-system hardware using agile teams.
It is composed of a collection of tools and libraries designed to provide an intergration between open-source and commercial tools for the development of systems-on-chip. It is composed of a collection of tools and libraries designed to provide an intergration between open-source and commercial tools for the development of systems-on-chip.

View File

@@ -28,6 +28,8 @@ sim_debug = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)-debug
PERMISSIVE_ON=+permissive PERMISSIVE_ON=+permissive
PERMISSIVE_OFF=+permissive-off PERMISSIVE_OFF=+permissive-off
WAVEFORM_FLAG=+vcdplusfile=$(sim_out_name).vpd
.PHONY: default debug .PHONY: default debug
default: $(sim) default: $(sim)
debug: $(sim_debug) debug: $(sim_debug)
@@ -54,6 +56,7 @@ VCS_NONCC_OPTS = \
-error=PCWM-L \ -error=PCWM-L \
-timescale=1ns/10ps \ -timescale=1ns/10ps \
-quiet \ -quiet \
-q \
+rad \ +rad \
+v2k \ +v2k \
+vcs+lic+wait \ +vcs+lic+wait \
@@ -93,17 +96,11 @@ $(sim_debug) : $(sim_vsrcs) $(sim_dotf) $(sim_vcs_blackboxes)
rm -rf csrc && $(VCS) $(VCS_OPTS) -o $@ \ rm -rf csrc && $(VCS) $(VCS_OPTS) -o $@ \
+define+DEBUG -debug_pp +define+DEBUG -debug_pp
#########################################################################################
# helper rules to run simulator with debug
#########################################################################################
run-binary-debug: $(sim_debug)
(set -o pipefail && $(sim_debug) $(PERMISSIVE_ON) $(SIM_FLAGS) +vcdplusfile=$(sim_out_name).vpd $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out)
######################################################################################### #########################################################################################
# create a vcs vpd rule # create a vcs vpd rule
######################################################################################### #########################################################################################
$(output_dir)/%.vpd: $(output_dir)/% $(sim_debug) $(output_dir)/%.vpd: $(output_dir)/% $(sim_debug)
$(sim_debug) $(PERMISSIVE_ON) +vcdplusfile=$@ +max-cycles=$(timeout_cycles) $(PERMISSIVE_OFF) $< $(sim_debug) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(VERBOSE_FLAGS) +vcdplusfile=$@ $(PERMISSIVE_OFF) $<
######################################################################################### #########################################################################################
# general cleanup rule # general cleanup rule

View File

@@ -28,6 +28,8 @@ sim_debug = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)-debug
PERMISSIVE_ON= PERMISSIVE_ON=
PERMISSIVE_OFF= PERMISSIVE_OFF=
WAVEFORM_FLAG=-v$(sim_out_name).vcd
.PHONY: default debug .PHONY: default debug
default: $(sim) default: $(sim)
debug: $(sim_debug) debug: $(sim_debug)
@@ -80,19 +82,13 @@ $(sim): $(model_mk)
$(sim_debug): $(model_mk_debug) $(sim_debug): $(model_mk_debug)
$(MAKE) VM_PARALLEL_BUILDS=1 -C $(build_dir)/$(long_name).debug -f V$(VLOG_MODEL).mk $(MAKE) VM_PARALLEL_BUILDS=1 -C $(build_dir)/$(long_name).debug -f V$(VLOG_MODEL).mk
#########################################################################################
# helper rules to run simulator with debug
#########################################################################################
run-binary-debug: $(sim_debug)
(set -o pipefail && $(sim_debug) $(SIM_FLAGS) -v$(sim_out_name).vcd $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out)
######################################################################################### #########################################################################################
# create a verisim vpd rule # create a verisim vpd rule
######################################################################################### #########################################################################################
$(output_dir)/%.vpd: $(output_dir)/% $(sim_debug) $(output_dir)/%.vpd: $(output_dir)/% $(sim_debug)
rm -f $@.vcd && mkfifo $@.vcd rm -f $@.vcd && mkfifo $@.vcd
vcd2vpd $@.vcd $@ > /dev/null & vcd2vpd $@.vcd $@ > /dev/null &
$(sim_debug) -v$@.vcd +max-cycles=$(timeout_cycles) $< $(sim_debug) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(VERBOSE_FLAGS) -v$@.vcd $(PERMISSIVE_OFF) $<
######################################################################################### #########################################################################################
# general cleanup rule # general cleanup rule

View File

@@ -36,7 +36,7 @@ $(VERILATOR_SRCDIR)/configure: $(VERILATOR_INSTALL_DIR)/verilator-$(VERILATOR_VE
$(VERILATOR_INSTALL_DIR)/verilator-$(VERILATOR_VERSION).tar.gz: $(VERILATOR_INSTALL_DIR)/verilator-$(VERILATOR_VERSION).tar.gz:
mkdir -p $(dir $@) mkdir -p $(dir $@)
wget http://www.veripool.org/ftp/verilator-$(VERILATOR_VERSION).tgz -O $@ wget https://www.veripool.org/ftp/verilator-$(VERILATOR_VERSION).tgz -O $@
######################################################################################### #########################################################################################
# verilator binary and flags # verilator binary and flags

View File

@@ -148,7 +148,8 @@ output_dir=$(sim_dir)/output/$(long_name)
# helper variables to run binaries # helper variables to run binaries
######################################################################################### #########################################################################################
BINARY ?= BINARY ?=
SIM_FLAGS ?= +max-cycles=$(timeout_cycles) SIM_FLAGS ?=
VERBOSE_FLAGS ?= +verbose
sim_out_name = $(notdir $(basename $(BINARY))).$(long_name) sim_out_name = $(notdir $(basename $(BINARY))).$(long_name)
######################################################################################### #########################################################################################