Fixed multithreading and optimisation options for Verilator target (#574)

* Fixed multithreading and optimization options for verilator Makefile target

Signed-off-by: Shengjie Xu <shengjie.xu@mail.utoronto.ca>

* Dropped the -j option in the make commands of Travis CI's verilator tests

Signed-off-by: Shengjie Xu <shengjie.xu@mail.utoronto.ca>

* Limit the optimization flag to verilator target

Signed-off-by: Shengjie Xu <shengjie.xu@mail.utoronto.ca>

* Moved -O3 to CFLAGS from verilator-only flags

Signed-off-by: Shengjie Xu <shengjie.xu@mail.utoronto.ca>
This commit is contained in:
Shengjie Xu 2021-02-16 04:54:21 -05:00 committed by GitHub
parent 491f46799e
commit 27465f1489
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 14 deletions

View file

@ -71,27 +71,27 @@ jobs:
name: run riscv benchmarks (Write-Back Cache)
script:
- ci/build-riscv-tests.sh
- make -j${NUM_JOBS} run-benchmarks-verilator defines=WB_DCACHE
- make run-benchmarks-verilator defines=WB_DCACHE
# asm tests
- stage: test
name: run asm tests (Write-Back Cache)
script:
- ci/build-riscv-tests.sh
- make -j${NUM_JOBS} run-asm-tests-verilator defines=WB_DCACHE
- make run-asm-tests-verilator defines=WB_DCACHE
# rv64um-*-* tests
- stage: test
name: run mul tests (Write-Back Cache)
script:
- ci/build-riscv-tests.sh
- make -j${NUM_JOBS} run-mul-verilator defines=WB_DCACHE
- make run-mul-verilator defines=WB_DCACHE
- stage: test
name: run fp tests (Write-Back Cache)
script:
- ci/build-riscv-tests.sh
- make -j${NUM_JOBS} run-fp-verilator defines=WB_DCACHE
- make run-fp-verilator defines=WB_DCACHE
# amo tests
# rv64ua-v-* tests
@ -99,13 +99,13 @@ jobs:
name: run amo tests (Write-Back Cache)
script:
- ci/build-riscv-tests.sh
- travis_wait 60 make -j${NUM_JOBS} run-amo-verilator defines=WB_DCACHE
- travis_wait 60 make run-amo-verilator defines=WB_DCACHE
- stage: test
name: run riscv benchmarks (Write-through Cache)
script:
- ci/build-riscv-tests.sh
- make -j${NUM_JOBS} run-benchmarks-verilator defines=WT_DCACHE
- make run-benchmarks-verilator defines=WT_DCACHE
# asm tests
# rv64ui-v-* tests
@ -113,21 +113,21 @@ jobs:
name: run asm tests (Write-through Cache)
script:
- ci/build-riscv-tests.sh
- make -j${NUM_JOBS} run-asm-tests-verilator defines=WT_DCACHE
- make run-asm-tests-verilator defines=WT_DCACHE
# rv64um-*-* tests
- stage: test
name: run mul tests (Write-through Cache)
script:
- ci/build-riscv-tests.sh
- make -j${NUM_JOBS} run-mul-verilator defines=WT_DCACHE
- make run-mul-verilator defines=WT_DCACHE
# rv64ud-*-* tests
- stage: test
name: run fp tests (Write-through Cache)
script:
- ci/build-riscv-tests.sh
- make -j${NUM_JOBS} run-fp-verilator defines=WT_DCACHE
- make run-fp-verilator defines=WT_DCACHE
# amo tests
# rv64ua-v-* tests
@ -135,7 +135,7 @@ jobs:
name: run amo tests (Write-through Cache)
script:
- ci/build-riscv-tests.sh
- make -j${NUM_JOBS} run-amo-verilator defines=WT_DCACHE
- make run-amo-verilator defines=WT_DCACHE
# extra time during long builds
install: travis_wait

View file

@ -34,9 +34,15 @@ BOARD ?= genesys2
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
root-dir := $(dir $(mkfile_path))
support_verilator_4 := $(shell ($(verilator) --version | grep '4\.') &> /dev/null; echo $$?)
support_verilator_4 := $(shell ($(verilator) --version | grep '4\.') > /dev/null 2>&1 ; echo $$?)
ifeq ($(support_verilator_4), 0)
verilator_threads := 2
ifndef verilator_threads
ifeq ($(shell test `nproc` -ge 4; echo $$?),0)
verilator_threads := 4
else ifeq ($(shell test `nproc` -ge 2; echo $$?),0)
verilator_threads := 2
endif
endif
endif
ifndef RISCV
@ -124,7 +130,7 @@ CFLAGS := -I$(QUESTASIM_HOME)/include \
-I$(RISCV)/include \
-I$(SPIKE_ROOT)/include \
$(if $(DROMAJO), -I../tb/dromajo/src,) \
-std=c++11 -I../tb/dpi
-std=c++11 -I../tb/dpi -O3
ifdef spike-tandem
@ -407,7 +413,8 @@ verilate_command := $(verilator)
$(if $(PROFILE),--stats --stats-vars --profile-cfuncs,) \
$(if $(DEBUG),--trace --trace-structs,) \
-LDFLAGS "-L$(RISCV)/lib -L$(SPIKE_ROOT)/lib -Wl,-rpath,$(RISCV)/lib -Wl,-rpath,$(SPIKE_ROOT)/lib -lfesvr$(if $(PROFILE), -g -pg,) $(if $(DROMAJO), -L../tb/dromajo/src -ldromajo_cosim,) -lpthread" \
-CFLAGS "$(CFLAGS)$(if $(PROFILE), -g -pg,) $(if $(DROMAJO), -DDROMAJO=1,)" -Wall --cc --vpi \
-CFLAGS "$(CFLAGS)$(if $(PROFILE), -g -pg,) $(if $(DROMAJO), -DDROMAJO=1,) -DVL_DEBUG" \
-Wall --cc --vpi \
$(list_incdir) --top-module ariane_testharness \
--Mdir $(ver-library) -O3 \
--exe tb/ariane_tb.cpp tb/dpi/SimDTM.cc tb/dpi/SimJTAG.cc \