Skip to content

Commit

Permalink
Add a firtool downloader (#157)
Browse files Browse the repository at this point in the history
* Add a firtool downloader

The next version of Chisel will provide a native resolver for firtool.
We will remove the downloader after Chisel upgrades.

* CI: remove downloader for firtool
  • Loading branch information
poemonsense authored Dec 23, 2023
1 parent f5a608f commit c705951
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c705951

Please sign in to comment.