From 37ddad4bc3739cd9246c07ffeb847db05bb5d711 Mon Sep 17 00:00:00 2001 From: Sasha Krassovsky Date: Tue, 3 Nov 2020 21:55:36 -0800 Subject: [PATCH] Makes it work in docker container --- Makefile | 14 +++++++++++++- environment.mk | 6 +++++- machine.mk | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fe592caad..5b370efe8 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ # CL_DIR: Path to the directory of this AWS F1 Project include environment.mk -.PHONY: help build clean +.PHONY: help build clean docker-regression .DEFAULT_GOAL := help help: @@ -49,6 +49,8 @@ help: @echo " build: Runs Vivado and Generates the Design Checkpoint to" @echo " upload to AWS." @echo " regression: Runs all software regression tests on F1" + @echo " docker-regression: Runs all software regression tests in verilator" + @echo " in the Docker image" @echo " cosim: Runs all regression tests in C/C++ Co-simulation" @echo " on the machine specified by machine.mk" @echo " multiverse: Runs all regression tests on all machines" @@ -63,6 +65,16 @@ build: regression: $(MAKE) -C examples $@ +docker-regression: + docker run \ + -v $(realpath $(shell pwd))/../:/bsg_bladerunner \ + --env BSG_PLATFORM=dpi-verilator \ + --env BSG_DOCKER=1 \ + --env RISCV_BIN_DIR=/usr/bin \ + --env SHELL=/bin/bash \ + bsg/riscv_env:latest \ + /bin/bash -c "make -C /bsg_bladerunner/bsg_replicant regression" + __BSG_MACHINES += machines/16x8_fast_n_fake __BSG_MACHINES += machines/4x4_fast_n_fake __BSG_MACHINES += machines/4x4_blocking_dramsim3_hbm2_512mb diff --git a/environment.mk b/environment.mk index eb384d487..91d8aa409 100644 --- a/environment.mk +++ b/environment.mk @@ -98,8 +98,12 @@ endif # Matches: ifdef _BSG_MANYCORE_DIR # Undefine the temporary variable to prevent its use undefine _BSG_MANYCORE_DIR +# If we're in the docker container, verilator is installed in /usr/bin/verilator +ifdef BSG_DOCKER +VERILATOR_ROOT = /verilator +VERILATOR = /usr/bin/verilator # If we're inside bladerunner, check for verilator and define variables -ifneq ("$(wildcard $(BLADERUNNER_ROOT)/verilator/bin/verilator)","") +else ifneq ("$(wildcard $(BLADERUNNER_ROOT)/verilator/bin/verilator)","") VERILATOR_ROOT = $(BLADERUNNER_ROOT)/verilator VERILATOR = $(BLADERUNNER_ROOT)/verilator/bin/verilator else diff --git a/machine.mk b/machine.mk index e2f671f2c..662440e41 100644 --- a/machine.mk +++ b/machine.mk @@ -38,7 +38,7 @@ endif # To switch machines, simply switch the path of BSG_MACHINE_PATH to # another directory with a Makefile.machine.include file. -BSG_MACHINE_PATH ?= $(BSG_F1_DIR)/machines/baseline_v0_32_16 +BSG_MACHINE_PATH ?= $(BSG_F1_DIR)/machines/4x4_fast_n_fake # Convert the machine path to an abspath override BSG_MACHINE_PATH := $(abspath $(BSG_MACHINE_PATH))