Skip to content

Commit

Permalink
Merge pull request chipsalliance#135 from antmicro/mkurc/chipsallianc…
Browse files Browse the repository at this point in the history
…egh-133

Multiple Verilator versions support
  • Loading branch information
tmichalak committed Nov 21, 2023
2 parents 0faacff + 4cbb278 commit 97ffac3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-verilator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
commit: v5.010
- version: uvm
repo: antmicro/verilator-1
commit: df36e9ca2597aebe4b92c72461d945745b36c3e0
commit: vif-trigger
env:
TOOL_NAME: verilator
TOOL_VERSION: ${{ matrix.version }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Files under the [tools](tools/) directory may be available under a different lic

## Dependencies

- Verilator **(4.102 or later)** must be installed on the system if running with Verilator
- Verilator **(4.106 or later)** must be installed on the system if running with Verilator
- If adding/removing instructions, `espresso` must be installed (used by `tools/coredecode`)
- RISCV tool chain (based on gcc version 8.3 or higher) must be
installed so that it can be used to prepare RISCV binaries to run.
Expand Down Expand Up @@ -210,4 +210,4 @@ dhry - Run dhrystone. (Scale by 1757 to get DMIPS/MHZ)

The `$RV_ROOT/testbench/hex` directory contains precompiled hex files of the tests, ready for simulation in case RISC-V SW tools are not installed.

**Note**: The testbench has a simple synthesizable bridge that allows you to load the ICCM via load/store instructions. This is only supported for AXI4 builds.
**Note**: The testbench has a simple synthesizable bridge that allows you to load the ICCM via load/store instructions. This is only supported for AXI4 builds.
15 changes: 14 additions & 1 deletion tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ BUILD_DIR = snapshots/${snapshot}
TBDIR = ${RV_ROOT}/testbench
PICOLIBC_DIR = ${RV_ROOT}/third_party/picolibc/install

# Determine verilator version if possible. Set the flag accordingly. Since
# version v5.006 -Wno-IMPLICIT was renamed to -Wno-IMPLICITSTATIC
VERILATOR_NOIMPLICIT := -Wno-IMPLICITSTATIC
VERILATOR_VERSION := $(subst .,,$(word 2,$(shell $(VERILATOR) --version)))

ifeq ("$(.SHELLSTATUS)", "0")
$(shell test $(VERILATOR_VERSION) -lt 5006)
ifeq ("$(.SHELLSTATUS)", "0")
VERILATOR_NOIMPLICIT := -Wno-IMPLICIT
endif
endif

# Define test name
TEST = hello_world
TEST_DIR = ${TBDIR}/asm
Expand Down Expand Up @@ -123,7 +135,8 @@ verilator-build: ${TBFILES} ${BUILD_DIR}/defines.h test_tb_top.cpp
echo '`undef RV_ASSERT_ON' >> ${BUILD_DIR}/common_defines.vh
$(VERILATOR) --cc -CFLAGS ${CFLAGS} $(defines) \
$(includes) -I${RV_ROOT}/testbench -f ${RV_ROOT}/testbench/flist \
-Wno-WIDTH -Wno-UNOPTFLAT -Wno-IMPLICITSTATIC ${TBFILES} --top-module tb_top \
-Wno-WIDTH -Wno-UNOPTFLAT $(VERILATOR_NOIMPLICIT) \
${TBFILES} --top-module tb_top \
-exe test_tb_top.cpp --autoflush $(VERILATOR_DEBUG) $(VERILATOR_COVERAGE)
cp ${RV_ROOT}/testbench/test_tb_top.cpp obj_dir/
$(MAKE) -e -C obj_dir/ -f Vtb_top.mk $(VERILATOR_MAKE_FLAGS)
Expand Down

0 comments on commit 97ffac3

Please sign in to comment.