diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 98694056..0f4297bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,9 +33,6 @@ jobs: cp -r $GITHUB_WORKSPACE $GITHUB_WORKSPACE/../xs-env cd $GITHUB_WORKSPACE/../xs-env source ./env.sh - wget https://github.com/llvm/circt/releases/download/firtool-1.56.1/firrtl-bin-linux-x64.tar.gz - tar -xzf firrtl-bin-linux-x64.tar.gz - echo "FIRTOOL_BIN=$(pwd)/firtool-1.56.1/bin/firtool" >> $GITHUB_ENV cd $GITHUB_WORKSPACE/../xs-env/NutShell source ./env.sh make init @@ -47,7 +44,7 @@ jobs: cd $GITHUB_WORKSPACE/../xs-env/NutShell source ./env.sh make clean - make verilog FIRTOOL=${FIRTOOL_BIN} + make verilog - name: Microbench - Nutshell run: | @@ -56,7 +53,7 @@ jobs: cd $GITHUB_WORKSPACE/../xs-env/NutShell source ./env.sh make clean - make emu FIRTOOL=${FIRTOOL_BIN} + make emu ./build/emu -b 0 -e 0 -i ./ready-to-run/microbench.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so - name: Linux - Nutshell @@ -66,7 +63,7 @@ jobs: cd $GITHUB_WORKSPACE/../xs-env/NutShell source ./env.sh make clean - make emu FIRTOOL=${FIRTOOL_BIN} + make emu ./build/emu -b 0 -e 0 -i ./ready-to-run/linux.bin -C 200000000 --diff ./ready-to-run/riscv64-nemu-interpreter-so # - name: Microbench - Argo diff --git a/Makefile b/Makefile index 4b295439..33416c6b 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,22 @@ CORE ?= inorder # inorder ooo embedded MILL_ARGS = -td $(@D) BOARD=$(BOARD) CORE=$(CORE) FPGA_ARGS = +# If firtool is not specified and not found in PATH, download and cache it. +ifeq ($(FIRTOOL),) +ifeq ($(shell which firtool 2>/dev/null),) +FIRTOOL_VERSION = 1.61.0 +FIRTOOL_DIR = $(HOME)/.cache/firtool +FIRTOOL_BIN = $(FIRTOOL_DIR)/firtool-$(FIRTOOL_VERSION)/bin/firtool +ifeq ($(wildcard $(HOME)/.cache/firtool/firtool-$(FIRTOOL_VERSION)/bin),) +$(info [INFO] Firtool not found.) +FIRTOOL_URL = https://github.com/llvm/circt/releases/download/firtool-$(FIRTOOL_VERSION)/firrtl-bin-linux-x64.tar.gz +$(info [INFO] Downloading from $(FIRTOOL_URL) to $(FIRTOOL_BIN)) +$(shell mkdir -p $(FIRTOOL_DIR) && curl -L $(FIRTOOL_URL) | tar -xzC $(FIRTOOL_DIR)) +endif +FIRTOOL = $(FIRTOOL_BIN) +endif +endif + ifneq ($(FIRTOOL),) MILL_ARGS += --firtool-binary-path $(FIRTOOL) endif