Skip to content

Commit

Permalink
Add system Bender installer.
Browse files Browse the repository at this point in the history
  • Loading branch information
yvantor committed Feb 21, 2025
1 parent 1e05256 commit d1cc785
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Verify bender installation
run: |
make bender
./scripts/bender-install.sh
- name: Verify Python tools installation
run: |
Expand Down
27 changes: 18 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ SW ?= $(RootDir)sw
BUILD_DIR ?= $(SW)/build
SIM_DIR ?= $(RootDir)vsim
QUESTA ?= questa-2023.4
BENDER_DIR ?= .
BENDER ?= bender
Bender ?= $(CargoInstallDir)/bin/bender
Gcc ?= $(GccInstallDir)/bin/
ISA ?= riscv
ARCH ?= rv
Expand Down Expand Up @@ -104,17 +103,12 @@ SHELL := /bin/bash
# Generate instructions and data stimuli
sw-build: $(STIM_INSTR) $(STIM_DATA) dis

# Download bender
bender:
curl --proto '=https' \
--tlsv1.2 https://pulp-platform.github.io/bender/init -sSf | sh -s -- 0.24.0

$(SIM_DIR):
mkdir -p $(SIM_DIR)

synth-ips:
$(BENDER) update
$(BENDER) script synopsys \
$(Bender) update
$(Bender) script synopsys \
$(common_targs) $(common_defs) \
$(synth_targs) $(synth_defs) \
> ${compile_script_synth}
Expand Down Expand Up @@ -156,6 +150,11 @@ VerilatorInstallDir := $(InstallDir)/verilator
GccInstallDir := $(InstallDir)/riscv
RiscvTarDir := riscv.tar.gz
GccUrl := https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.08.28/riscv32-elf-ubuntu-20.04-gcc-nightly-2024.08.28-nightly.tar.gz
# Bender
RustupInit := $(ScriptsDir)/rustup-init.sh
CargoInstallDir := $(InstallDir)/cargo
RustupInstallDir := $(InstallDir)/rustup
Cargo := $(CargoInstallDir)/bin/cargo

verilator: $(InstallDir)/bin/verilator

Expand All @@ -177,3 +176,13 @@ $(GccInstallDir):
cd $(VendorDir) && \
wget $(GccUrl) -O $(RiscvTarDir) && \
tar -xzvf $(RiscvTarDir) -C $(InstallDir) riscv

bender: $(CargoInstallDir)/bin/bender

$(CargoInstallDir)/bin/bender:
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf > $(RustupInit)
mkdir -p $(InstallDir)
export CARGO_HOME=$(CargoInstallDir) && export RUSTUP_HOME=$(RustupInstallDir) && \
chmod +x $(RustupInit); source $(RustupInit) -y && \
$(Cargo) install bender
rm -rf $(RustupInit)
4 changes: 2 additions & 2 deletions target/sim/verilator/verilator.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ hw-clean:
rm -rf $(VerilatorAbsObjDir) $(VerilatorCompileScript) $(VerilatorWaves) $(VerilatorDir)/transcript

hw-script:
$(BENDER) update
$(BENDER) script $(target) \
$(Bender) update
$(Bender) script $(target) \
$(common_targs) $(common_defs) \
$(sim_targs) \
> $(VerilatorCompileScript)
Expand Down
4 changes: 2 additions & 2 deletions target/sim/vsim/vsim.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ hw-clean:
rm -rf $(VsimCompileScript) $(VsimDir)/transcript $(VsimDir)/modelsim.ini $(VsimDir)/*.wlf $(VsimDir)/work

hw-script:
$(BENDER) update
$(BENDER) script $(target) \
$(Bender) update
$(Bender) script $(target) \
--vlog-arg="$(CompileFlags)" \
--vcom-arg="-pedanticerrors" \
$(common_targs) $(common_defs) \
Expand Down

0 comments on commit d1cc785

Please sign in to comment.