Skip to content

Commit

Permalink
Initial release of NVDLA virtual platform
Browse files Browse the repository at this point in the history
  • Loading branch information
jarodw0723 committed Dec 1, 2017
0 parents commit 225f102
Show file tree
Hide file tree
Showing 58 changed files with 3,331 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*README.md
**/*.git*
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*~
CMakeCache.txt
CMakeFiles/
CPackConfig.cmake
CPackSourceConfig.cmake
Makefile
aarch64_toplevel
build/
cmake_install.cmake
install_manifest.txt
libs/log.build/
libs/qbox.build/
libs/tlm2c.build/
make.log
models/cpu.build/
models/memory.build/
models/nvdla.build/
images/
7 changes: 7 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
before_script:
- export SC_SIGNAL_WRITE_CHECK=DISABLE
variables:
GIT_SUBMODULE_STRATEGY: recursive
Build_Runtests:
script:
- ./scripts/build.sh
18 changes: 18 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[submodule "libs/tlm2c"]
path = libs/tlm2c
url = https://git.greensocs.com/tlm/tlm2c.git
[submodule "models/cpu"]
path = models/cpu
url = ../simple_cpu.git
branch = nvdla_vp
[submodule "models/memory"]
path = models/memory
url = https://git.greensocs.com/models/simple_memory.git
[submodule "libs/greenlib"]
path = libs/greenlib
url = ../greenlib.git
branch = nvdla_vp
[submodule "libs/qbox"]
path = libs/qbox
url = ../qbox.git
branch = nvdla_vp
163 changes: 163 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#
# CMakeLists.txt
#
# Copyright (C) 2015, GreenSocs ltd.
#
# Developped by Frederic Konrad <[email protected]>
# and Guillaume Delbrgue <[email protected]>
#

cmake_minimum_required(VERSION 2.8)
include(ExternalProject)

project(NVDLA_VIRTUAL_PLATFORM)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})

set(INCLUDE_DIRS include)

include_directories(${INCLUDE_DIRS})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSC_INCLUDE_DYNAMIC_PROCESSES -Wall -Werror")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSC_INCLUDE_DYNAMIC_PROCESSES -Wall -Werror -DDEBUG_LOG=1")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DSC_INCLUDE_DYNAMIC_PROCESSES -Wall -Werror")

set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

#REQUIRED LIBRARIES.
find_package(SystemC)
if(SystemC_FOUND)
include_directories(${SystemC_INCLUDE_DIRS})
else()
message( FATAL_ERROR "SystemC library not found." )
endif()

find_package(TLM)
if(TLM_FOUND)
include_directories(${TLM_INCLUDE_DIRS})
else()
message( FATAL_ERROR "TLM library not found." )
endif()

find_package(Lua REQUIRED)
if(LUA_FOUND)
include_directories(${LUA_INCLUDE_DIR})
else()
message( FATAL_ERROR "LUA library not found." )
endif()

find_package(NvdlaCmod)
if(NVDLA_CMOD_FOUND)
link_directories(${NVDLA_CMOD_LIBRARY_DIR})
else()
message( FATAL_ERROR "NVDLA CMOD library not found." )
endif()

add_subdirectory(libs/greenlib)
include_directories(libs/greenlib/greencontrol/include
libs/greenlib/greenmemory/include
libs/greenlib/greenscript/include
libs/greenlib/greensignalbus/include
libs/greenlib/greensocket/include
libs/greenlib/greenmessage/include
libs/greenlib/greenrouter/include
libs/greenlib/greenserialsocket/include
libs/greenlib/greensignalsocket/include
libs/greenlib/gsgpsocket/include
libs/greenlib/greenreg/include
libs/greenlib/include
)
link_directories(${CMAKE_SOURCE_DIR}/libs/greenlib/greenreg/lib
${CMAKE_SOURCE_DIR}/libs/greenlib/greencontrol/lib
${CMAKE_SOURCE_DIR}/libs/greenlib/greenmemory/lib
${CMAKE_SOURCE_DIR}/libs/greenlib/greenscript/lib
${CMAKE_SOURCE_DIR}/libs/greenlib/greensignalbus/lib
${CMAKE_SOURCE_DIR}/libs/greenlib/greensocket/lib
${CMAKE_SOURCE_DIR}/libs/greenlib/greenmessage/lib
${CMAKE_SOURCE_DIR}/libs/greenlib/greenrouter/lib
${CMAKE_SOURCE_DIR}/libs/greenlib/greenserialsocket/lib
${CMAKE_SOURCE_DIR}/libs/greenlib/greensignalsocket/lib
${CMAKE_SOURCE_DIR}/libs/greenlib/gsgpsocket/lib
)

set(GREENLIB_FOUND TRUE)
set(GREENLIB_LIBRARY_DIRS ${CMAKE_SOURCE_DIR}/libs/greenlib/greenreg/lib)
set(GREENLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/greenlib/greencontrol/include)

add_subdirectory(libs/tlm2c libs/tlm2c.build/lib)
include_directories(libs/tlm2c/include)
link_directories(${CMAKE_SOURCE_DIR}/libs/tlm2c.build)
file(COPY libs/tlm2c/include DESTINATION libs/tlm2c.build/)

set(TLM2C_FOUND TRUE)
set(TLM2C_LIBRARY_DIRS ${CMAKE_SOURCE_DIR}/libs/tlm2c.build)
set(TLM2C_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/tlm2c/include)

add_subdirectory(libs/log libs/log.build/lib)
include_directories(libs/log/include)
link_directories(${CMAKE_SOURCE_DIR}/libs/log.build)
file(COPY libs/log/include DESTINATION libs/log.build/)

set(LOG_FOUND TRUE)
set(LOG_LIBRARY_DIRS ${CMAKE_SOURCE_DIR}/libs/log.build)
set(LOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/log/include)

add_subdirectory(models/cpu models/cpu.build)
include_directories(models/cpu/include)
link_directories(${CMAKE_SOURCE_DIR}/models/cpu.build)

add_subdirectory(models/memory models/memory.build)
include_directories(models/memory/include)
link_directories(${CMAKE_SOURCE_DIR}/models/memory.build)

add_subdirectory(models/nvdla models/nvdla.build)
include_directories(models/nvdla/include)
link_directories(${CMAKE_SOURCE_DIR}/models/nvdla.build)

### QBOX ###
if (CMAKE_BUILD_TYPE MATCHES Debug)
set(QBOX_DEBUG_BUILD --enable-debug)
else ()
set(QBOX_DEBUG_BUILD --disable-debug-info)
endif ()
ExternalProject_Add(qbox
SOURCE_DIR ${CMAKE_SOURCE_DIR}/libs/qbox
INSTALL_DIR ${CMAKE_SOURCE_DIR}/libs/qbox.build
BINARY_DIR ${CMAKE_SOURCE_DIR}/libs/qbox.build
TMP_DIR ${CMAKE_SOURCE_DIR}/libs/qbox.build/tmp
STAMP_DIR ${CMAKE_SOURCE_DIR}/libs/qbox.build/stampdir
CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/libs/qbox/configure --target-list=aarch64-softmmu --disable-xfsctl ${QBOX_DEBUG_BUILD} --library --qbox --nvdla --with-tlm2c=${CMAKE_SOURCE_DIR}/libs/tlm2c.build --prefix=${CMAKE_SOURCE_DIR}/libs/qbox.build --disable-pie --extra-cflags=-fPIC\ -fpic\ -ftls-model=initial-exec\ -DNVDLA_HW_VERSION=${NVDLA_HW_VERSION}
PREFIX ${CMAKE_SOURCE_DIR}/libs/qbox.build
BUILD_COMMAND $(MAKE)
)
ExternalProject_Add_Step(qbox force-build
DEPENDEES update
DEPENDERS build
ALWAYS 1
)
add_dependencies(qbox tlm2c)
link_directories(${CMAKE_SOURCE_DIR}/libs/qbox.build/aarch64-softmmu)
install(FILES ${CMAKE_SOURCE_DIR}/libs/qbox.build/aarch64-softmmu/libqbox-nvdla${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION lib)

### Toplevel ###
add_executable(aarch64_toplevel src/aarch64_toplevel.cpp)
add_dependencies(aarch64_toplevel
simplecpu
qbox
nvdla
)

target_link_libraries(aarch64_toplevel ${SystemC_LIBRARIES}
${LUA_LIBRARIES}
qbox-nvdla
greenreg
greenscript
simplecpu
dl
tlm2c
log
nvdla
)
install(TARGETS aarch64_toplevel DESTINATION bin)
Loading

0 comments on commit 225f102

Please sign in to comment.