From d8389673fca04ae6df2072edca5274b078dfe198 Mon Sep 17 00:00:00 2001 From: Luis Vega Date: Sun, 9 Jun 2019 16:41:22 -0700 Subject: [PATCH] add another default location to verilator (#3324) --- vta/apps/tsim_example/cmake/modules/hw.cmake | 8 +++++++- vta/hardware/chisel/Makefile | 16 +++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/vta/apps/tsim_example/cmake/modules/hw.cmake b/vta/apps/tsim_example/cmake/modules/hw.cmake index 019be129f243..102df9987752 100644 --- a/vta/apps/tsim_example/cmake/modules/hw.cmake +++ b/vta/apps/tsim_example/cmake/modules/hw.cmake @@ -113,7 +113,13 @@ else() # Build shared library (.so) set(VTA_HW_DPI_DIR ${VTA_DIR}/hardware/dpi) - set(VERILATOR_INC_DIR /usr/local/share/verilator/include) + if (EXISTS /usr/local/share/verilator/include) + set(VERILATOR_INC_DIR /usr/local/share/verilator/include) + elseif (EXISTS /usr/share/verilator/include) + set(VERILATOR_INC_DIR /usr/share/verilator/include) + else() + message(FATAL_ERROR "[TSIM_HW] Verilator include directory not found") + endif() set(VERILATOR_LIB_SRC ${VERILATOR_INC_DIR}/verilated.cpp ${VERILATOR_INC_DIR}/verilated_dpi.cpp) if (NOT TSIM_USE_TRACE STREQUAL "off") diff --git a/vta/hardware/chisel/Makefile b/vta/hardware/chisel/Makefile index 91e40a022337..7e90168c21c6 100644 --- a/vta/hardware/chisel/Makefile +++ b/vta/hardware/chisel/Makefile @@ -15,15 +15,21 @@ # specific language governing permissions and limitations # under the License. -# Change this variable if Verilator is installed on a different location -VERILATOR_INC_DIR ?= /usr/local/share/verilator/include - ifeq (, $(shell which verilator)) $(error "No Verilator in $(PATH), consider doing apt-get install verilator") endif -ifeq (, $(wildcard $(VERILATOR_INC_DIR)/*)) - $(error "Verilator include directory is not set properly") +# Change VERILATOR_INC_DIR if Verilator is installed on a different location +ifeq (, $(VERILATOR_INC_DIR)) + ifeq (, $(wildcard /usr/local/share/verilator/include/*)) + ifeq (, $(wildcard /usr/share/verilator/include/*)) + $(error "Verilator include directory is not set properly") + else + VERILATOR_INC_DIR := /usr/share/verilator/include + endif + else + VERILATOR_INC_DIR := /usr/local/share/verilator/include + endif endif CONFIG = DefaultF1Config