Skip to content

Commit

Permalink
add another default location to verilator (apache#3324)
Browse files Browse the repository at this point in the history
  • Loading branch information
vegaluisjose authored and wweic committed Jun 27, 2019
1 parent 65ccf3c commit d838967
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
8 changes: 7 additions & 1 deletion vta/apps/tsim_example/cmake/modules/hw.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
16 changes: 11 additions & 5 deletions vta/hardware/chisel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d838967

Please sign in to comment.