From 58a446e6bcc3421e1a8e3a5d5445e83bfa01388e Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Mon, 19 Nov 2018 20:39:11 +0100 Subject: [PATCH] Refoctored to to move SystemC wrapper into riscv library --- CMakeLists.txt | 1 - platform/CMakeLists.txt | 1 - platform/src/CMakeLists.txt | 1 - riscv.sc/CMakeLists.txt | 93 ------------------- {riscv.sc => riscv}/incl/sysc/core_complex.h | 0 riscv/src/CMakeLists.txt | 16 ++++ .../src => riscv/src/sysc}/core_complex.cpp | 0 7 files changed, 16 insertions(+), 96 deletions(-) delete mode 100644 riscv.sc/CMakeLists.txt rename {riscv.sc => riscv}/incl/sysc/core_complex.h (100%) rename {riscv.sc/src => riscv/src/sysc}/core_complex.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a80cb5..29243a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,6 @@ add_subdirectory(sc-components) add_subdirectory(softfloat) GET_DIRECTORY_PROPERTY(SOFTFLOAT_INCLUDE_DIRS DIRECTORY softfloat DEFINITION SOFTFLOAT_INCLUDE_DIRS) add_subdirectory(riscv) -add_subdirectory(riscv.sc) add_subdirectory(platform) message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}") diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt index 43054c9..a96449f 100644 --- a/platform/CMakeLists.txt +++ b/platform/CMakeLists.txt @@ -25,7 +25,6 @@ endif() add_dependent_subproject(dbt-core) add_dependent_subproject(sc-components) add_dependent_subproject(riscv) -add_dependent_subproject(riscv.sc) include_directories( ${PROJECT_SOURCE_DIR}/../external/elfio diff --git a/platform/src/CMakeLists.txt b/platform/src/CMakeLists.txt index b5b9a04..381aa6c 100644 --- a/platform/src/CMakeLists.txt +++ b/platform/src/CMakeLists.txt @@ -61,7 +61,6 @@ add_executable(${APPLICATION_NAME} ${APP_SOURCES}) target_include_directories(${APPLICATION_NAME} SYSTEM PRIVATE ${LLVM_INCLUDE_DIRS}) # Links the target exe against the libraries target_link_libraries(${APPLICATION_NAME} ${LIBRARY_NAME}) -target_link_libraries(${APPLICATION_NAME} riscv.sc) target_link_libraries(${APPLICATION_NAME} riscv) target_link_libraries(${APPLICATION_NAME} dbt-core) target_link_libraries(${APPLICATION_NAME} softfloat) diff --git a/riscv.sc/CMakeLists.txt b/riscv.sc/CMakeLists.txt deleted file mode 100644 index 73afb67..0000000 --- a/riscv.sc/CMakeLists.txt +++ /dev/null @@ -1,93 +0,0 @@ -cmake_minimum_required(VERSION 3.3) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) # main (top) cmake dir - -# CMake useful variables -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") - -# Set the name of your project here -project("riscv.sc") - -include(Common) - -# check that we have averything we need -if(!SystemC_FOUND) - message( FATAL_ERROR "SystemC library not found." ) -endif() - -if(!CCI_FOUND) - message( FATAL_ERROR "SystemC CCI library not found." ) -endif() - -add_definitions(-DWITH_SYSTEMC) -include_directories(${SystemC_INCLUDE_DIRS}) -link_directories(${SystemC_LIBRARY_DIRS}) - -include_directories(${CCI_INCLUDE_DIRS}) -link_directories(${CCI_LIBRARY_DIRS}) - -if(SCV_FOUND) - add_definitions(-DWITH_SCV) - include_directories(${SCV_INCLUDE_DIRS}) - link_directories(${SCV_LIBRARY_DIRS}) -endif() - -# This sets the include directory for the reference project. This is the -I flag in gcc. -include_directories( - ${PROJECT_SOURCE_DIR}/incl - ${LLVM_INCLUDE_DIRS} -) - -add_dependent_subproject(dbt-core) -add_dependent_subproject(sc-components) -add_dependent_subproject(riscv) - -include_directories( - ${PROJECT_SOURCE_DIR}/incl - ${PROJECT_SOURCE_DIR}/../riscv/incl - ${PROJECT_SOURCE_DIR}/../external/elfio - ${PROJECT_SOURCE_DIR}/../external/libGIS - ${Boost_INCLUDE_DIRS} -) - - -# Mac needed variables (adapt for your needs - http://www.cmake.org/Wiki/CMake_RPATH_handling#Mac_OS_X_and_the_RPATH) -set(CMAKE_MACOSX_RPATH ON) -set(CMAKE_SKIP_BUILD_RPATH FALSE) -set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - -## the following setting needs to be consistent with the library -#add_definitions(-DSC_DEFAULT_WRITER_POLICY=SC_MANY_WRITERS) - -# library files -FILE(GLOB RiscVSCHeaders *.h */*.h) - -set(LIB_HEADERS ${RiscVSCHeaders} ) -set(LIB_SOURCES src/core_complex.cpp ) - -# Define two variables in order not to repeat ourselves. -set(LIBRARY_NAME riscv.sc) - -# Define the library -add_library(${LIBRARY_NAME} ${LIB_SOURCES}) - -set_target_properties(${LIBRARY_NAME} PROPERTIES - VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists. - FRAMEWORK FALSE - PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers -) - -# -# SYSTEM PACKAGING (RPM, TGZ, ...) -# _____________________________________________________________________________ - -#include(CPackConfig) - -# -# CMAKE PACKAGING (for other CMake projects to use this one easily) -# _____________________________________________________________________________ - -#include(PackageConfigurator) \ No newline at end of file diff --git a/riscv.sc/incl/sysc/core_complex.h b/riscv/incl/sysc/core_complex.h similarity index 100% rename from riscv.sc/incl/sysc/core_complex.h rename to riscv/incl/sysc/core_complex.h diff --git a/riscv/src/CMakeLists.txt b/riscv/src/CMakeLists.txt index c10d28f..b16dbc1 100644 --- a/riscv/src/CMakeLists.txt +++ b/riscv/src/CMakeLists.txt @@ -12,6 +12,10 @@ set(LIB_SOURCES plugin/instruction_count.cpp plugin/cycle_estimate.cpp) +if(SystemC_FOUND) + set(LIB_SOURCES ${LIB_SOURCES} sysc/core_complex.cpp) +endif() + set(APP_HEADERS ) set(APP_SOURCES main.cpp) @@ -28,6 +32,18 @@ set_target_properties(${LIBRARY_NAME} PROPERTIES PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers ) +if(SystemC_FOUND) + add_definitions(-DWITH_SYSTEMC) + include_directories(${SystemC_INCLUDE_DIRS}) + + include_directories(${CCI_INCLUDE_DIRS}) + + if(SCV_FOUND) + add_definitions(-DWITH_SCV) + include_directories(${SCV_INCLUDE_DIRS}) + endif() +endif() + # This is a make target, so you can do a "make riscv-sc" set(APPLICATION_NAME riscv-sim) diff --git a/riscv.sc/src/core_complex.cpp b/riscv/src/sysc/core_complex.cpp similarity index 100% rename from riscv.sc/src/core_complex.cpp rename to riscv/src/sysc/core_complex.cpp