Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker support #643

Open
wants to merge 1 commit into
base: sasha_ubuntu
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand All @@ -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 \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for RISC-V Tools. I would rather use BSG_MANYCORE as the path, than use /usr/bin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as with Verilator, BSG_MANYCORE lives in the user's filesystem, so this would be a bit difficult. We could again keep the RISCV_BIN_DIR in something like /riscv_install or similar.

--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
Expand Down
6 changes: 5 additions & 1 deletion environment.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this because Verilator is installed through a package manager? It is best to use the one provided/compiled by bladerunner for parity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, when building the Docker image it builds Verilator from source and installs it there.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to install it there? Can we just leave it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather be explicit that we're using the one in bladerunner, than install it in /usr/bin and be implicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the point is to not have the user build Verilator themselves - they just download the image and it'll be preinstalled. We could just not install it and keep the binary in /verilator in the image, so we'd still be explicit.

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
Expand Down
2 changes: 1 addition & 1 deletion machine.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert


# Convert the machine path to an abspath
override BSG_MACHINE_PATH := $(abspath $(BSG_MACHINE_PATH))
Expand Down