Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTA cmake change to include Verilator header for building tsim library #8797

Merged
merged 9 commits into from
Aug 26, 2021
17 changes: 16 additions & 1 deletion cmake/modules/VTA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,30 @@ elseif(PYTHON)

# Cycle accurate simulator driver build
if(USE_VTA_TSIM)
if(NOT DEFINED ENV{VERILATOR_INC_DIR})
aasorokiin marked this conversation as resolved.
Show resolved Hide resolved
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(STATUS "Verilator not found in /usr/local/share/verilator/include")
message(STATUS "Verilator not found in /usr/share/verilator/include")
message(FATAL_ERROR "Cannot find Verilator, VERILATOR_INC_DIR is not defined")
endif()
else()
set(VERILATOR_INC_DIR $ENV{VERILATOR_INC_DIR})
endif()
aasorokiin marked this conversation as resolved.
Show resolved Hide resolved
# Add tsim driver sources
file(GLOB TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/*.cc)
file(GLOB TSIM_RUNTIME_SRCS vta/runtime/*.cc)
list(APPEND TSIM_RUNTIME_SRCS ${VERILATOR_INC_DIR}/verilated.cpp)
list(APPEND TSIM_RUNTIME_SRCS ${VERILATOR_INC_DIR}/verilated_dpi.cpp)
list(APPEND TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/tsim/tsim_driver.cc)
list(APPEND TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/dpi/module.cc)
list(APPEND TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/vmem/virtual_memory.cc)
# Target lib: vta_tsim
add_library(vta_tsim SHARED ${TSIM_RUNTIME_SRCS})
target_include_directories(vta_tsim SYSTEM PUBLIC ${VTA_HW_PATH}/include)
target_include_directories(vta_tsim SYSTEM PUBLIC ${VTA_HW_PATH}/include ${VERILATOR_INC_DIR} ${VERILATOR_INC_DIR}/vltstd)
target_compile_definitions(vta_tsim PUBLIC DMLC_USE_LOGGING_LIBRARY=<tvm/runtime/logging.h>)
foreach(__def ${VTA_DEFINITIONS})
string(SUBSTRING ${__def} 3 -1 __strip_def)
Expand Down