Lab4 Environment Setup
Student entry · Required tasks · Bonus
This guide sets up the Chipyard/Gemmini environment for required Parts A/B/C. Part A does not need a completed B mesh or a RISC-V bare-metal program. The standalone Bonus checks need only completed Lab3 RTL and Verilator; see the Bonus guide for the supplied testbenches.
Use the assigned course environment and follow the shared environment guide
(docs/environment.md) when selecting a compute node. Disk usage of a fully
initialized Chipyard checkout is large; plan for several tens of GB.
1. Unpack the provided Chipyard environment
Download the course-provided chipyard.tar.gz and extract it from Lab4/:
cd Lab4
tar -xzvf /path/to/chipyard.tar.gz
We strongly recommend extracting the package inside Lab4/, so that the
resulting directory is Lab4/chipyard, beside the Lab4 Makefile. The commands
below assume this layout. The archive already contains a top-level chipyard/
directory; extracting it from Lab4/ creates the recommended layout directly.
Gemmini is the generators/gemmini submodule inside that worktree.
2. Initialize the unpacked environment
From Lab4/, run the setup script once after extraction, then load the environment:
bash chipyard/setup.sh
source chipyard/env.sh
make integration-check
setup.sh fixes tool paths for this installation directory. Extract the package
at its final location before running it; if the directory is moved afterwards,
extract the original package again and rerun setup. Sourcing env.sh alone does
not perform this one-time initialization.
make integration-check verifies the pinned Gemmini revision and integration
seams. The package includes software/gemmini-rocc-tests and its gemmini.h
headers for the benchmark targets.
3. Toolchain environment: Java, SBT, Verilator, RISC-V GCC
In each new terminal, source Chipyard's environment script from Lab4/.
It exports the packaged conda-based toolchain (Java, SBT, Verilator, RISC-V GCC,
and friends) that the Lab4 Makefile expects:
source chipyard/env.sh
Verify the tools are on PATH:
java -version # JDK 17 from the packaged Chipyard env
sbt --version # Scala Build Tool, used to compile Gemmini
verilator --version # cycle-accurate simulator backend
riscv64-unknown-elf-gcc --version # bare-metal RISC-V cross compiler
Notes:
- The Lab4 Makefile derives
JAVA_HOMEfrom thejavafound onPATHand prepends itsbin/toPATHbefore invoking SBT, so activate the Chipyard environment before runningmake gemmini-compileormake benchmark. - If your site provides its own Verilator (Lab3 also needs one), a recent
version on
PATHis sufficient for the standalone checks; the Gemmini integration uses the Chipyard-provided one. - The package includes the required SBT/Coursier dependency caches. Sourcing
env.shkeeps the caches inLab4/chipyard/cache/and Lab4 build outputs inLab4/chipyard/build/lab4/. No dependency download is needed; the first course compile can still take time.
4. Set CHIPYARD_HOME and GEMMINI_HOME
The Lab4 Makefile defaults match the layout above:
CHIPYARD_HOME = Lab4/chipyard (default)
GEMMINI_HOME = $(CHIPYARD_HOME)/generators/gemmini (default)
CHIPYARD_ENV = $(CHIPYARD_HOME)/env.sh (default)
GEMMINI_TESTS = $(GEMMINI_HOME)/software/gemmini-rocc-tests (default)
If your Chipyard checkout lives elsewhere (for example a shared course checkout), override the variables on the command line:
make gemmini-test \
CHIPYARD_HOME=/path/to/chipyard \
GEMMINI_HOME=/path/to/chipyard/generators/gemmini \
CHIPYARD_ENV=/path/to/chipyard/env.sh
make benchmark \
CHIPYARD_HOME=/path/to/chipyard \
GEMMINI_HOME=/path/to/chipyard/generators/gemmini \
GEMMINI_TESTS=/path/to/chipyard/generators/gemmini/software/gemmini-rocc-tests \
CHIPYARD_ENV=/path/to/chipyard/env.sh
CHIPYARD_ENV must point to an initialized Chipyard env.sh; a standalone
Gemmini checkout is not enough for gemmini-test or the benchmark.
Benchmark logs and cleanup
After loading the packaged environment, benchmark logs are saved under
Lab4/chipyard/build/lab4/. From Lab4/, parse a saved baseline log with:
make benchmark-parse LOG=chipyard/build/lab4/baseline.log
make clean removes Lab4/chipyard/build/lab4/. The preloaded dependency caches
in chipyard/cache/ and the generated system simulator under
chipyard/sims/verilator/ are retained.
Validate the setup
Continue with the Quick Start for the setup checks,
A/B validation, and Part C run commands. Plain make runs scheduler-test.
All hardware commands share gemmini-install, which verifies the pin and installs
the overlay only if pristine; installed student changes are preserved.
After changing files in student/, synchronize the installed copies as described
in the Overlay guide. Test coverage and benchmark acceptance
criteria are defined in TASKS.md.