12 Commits

Author SHA1 Message Date
d7772b5b05 Merge branch 'master' of https://git.minres.com/VP/RISCV-VP.git 2020-06-18 07:39:27 +02:00
6ee0cd1b29 update submodule pointers 2020-06-18 07:39:18 +02:00
7148f1caec Merge branch 'feature/tcc' into develop 2020-05-31 17:16:27 +02:00
01b3851112 fix memory access error reporting 2020-05-31 17:14:44 +02:00
48ffdd2d1b [WIP] 2020-05-31 16:41:33 +02:00
2099e61706 cleanup 2020-05-30 14:18:28 +02:00
d1a1fad361 modernize build system and cleanup dependencies 2020-05-30 14:16:27 +02:00
ad1d9463aa get all compile clean 2020-05-30 11:31:46 +02:00
518daf70f7 Merge branch 'feature/interpreter' into develop 2020-05-29 08:55:13 +02:00
61e386a700 [WIP] basic infrastructure working 2020-04-13 17:04:34 +02:00
f928ad5814 „README.md“ ändern 2020-03-30 19:41:35 +00:00
6e751ac2b4 „README.md“ ändern 2020-01-11 09:07:02 +00:00
15 changed files with 89 additions and 219 deletions

View File

@ -1,11 +1,14 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/scc/cmake) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/scc/cmake)
project(RISCV-VP LANGUAGES CXX) project(RISCV-VP VERSION 1.0.0 LANGUAGES CXX)
set(ENABLE_SCV TRUE CACHE BOOL "Enable use of SCV") set(ENABLE_SCV TRUE CACHE BOOL "Enable use of SCV")
set(ENABLE_SHARED TRUE CACHE BOOL "Build shared libraries") set(ENABLE_SHARED TRUE CACHE BOOL "Build shared libraries")
set(WITH_LLVM FALSE CACHE BOOL "Build LLVM based backend")
include(GitFunctions) include(GitFunctions)
get_branch_from_git() get_branch_from_git()
# if we are not on master or develop set the submodules to develop # if we are not on master or develop set the submodules to develop
@ -42,11 +45,11 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE) if(COMPILER_SUPPORTS_MARCH_NATIVE)
if("${CMAKE_BUILD_TYPE}" STREQUAL "") if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")) elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif() endif()
endif() endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@ -63,16 +66,6 @@ setup_conan(TARGETS)
# This line finds the boost lib and headers. # This line finds the boost lib and headers.
set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install. set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install.
if(DEFINED ENV{LLVM_HOME})
find_path (LLVM_DIR LLVM-Config.cmake $ENV{LLVM_HOME}/lib/cmake/llvm)
endif(DEFINED ENV{LLVM_HOME})
find_package(LLVM REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
llvm_map_components_to_libnames(llvm_libs support core mcjit x86codegen x86asmparser)
set(BUILD_SHARED_LIBS 1)
find_package(Threads) find_package(Threads)
find_package(Tcmalloc) find_package(Tcmalloc)
find_package(ZLIB) find_package(ZLIB)
@ -90,7 +83,6 @@ if(SystemC_FOUND)
endif() endif()
endif(SystemC_FOUND) endif(SystemC_FOUND)
set(PROJECT_3PARTY_DIRS external)
include(clang-format) include(clang-format)
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Add clang-tidy automatically to builds") set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Add clang-tidy automatically to builds")
@ -107,16 +99,8 @@ if (ENABLE_CLANG_TIDY)
endif() endif()
endif() endif()
# Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0)
set(VERSION_MAJOR "1")
set(VERSION_MINOR "0")
set(VERSION_PATCH "0")
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
add_subdirectory(external) add_subdirectory(external)
add_subdirectory(dbt-core) add_subdirectory(dbt-core)
add_subdirectory(riscv) add_subdirectory(riscv)
add_subdirectory(scc) add_subdirectory(scc)
add_subdirectory(platform) add_subdirectory(platform)
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")

View File

@ -16,16 +16,21 @@ RISCV-VP uses libGIS (https://github.com/vsergeev/libGIS) as well as ELFIO (http
* you need to have a C++11 capable compiler (e.g. gcc >= 4.8), make, python, and cmake installed * you need to have a C++11 capable compiler (e.g. gcc >= 4.8), make, python, and cmake installed
* install LLVM >= 4.0 according to http://apt.llvm.org/ (if it is not already provided by your distribution e.g by Ubuntu 18.04) * install LLVM >= 4.0 according to http://apt.llvm.org/ (if it is not already provided by your distribution e.g by Ubuntu 18.04)
* install conan.io (see also http://docs.conan.io/en/latest/installation.html): * install conan.io (see also http://docs.conan.io/en/latest/installation.html):
``` ```
pip install conan pip install conan
``` ```
* setup conan to use the minres repo: * setup conan to use the minres repo:
``` ```
conan remote add minres https://api.bintray.com/conan/minres/conan-repo conan remote add minres https://api.bintray.com/conan/minres/conan-repo
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
``` ```
* checkout source from git * checkout source from git
* start an out-of-source build: * start an out-of-source build:
``` ```
cd RISCV-VP cd RISCV-VP
mkdir build mkdir build
@ -33,15 +38,18 @@ RISCV-VP uses libGIS (https://github.com/vsergeev/libGIS) as well as ELFIO (http
cmake .. cmake ..
cmake --build . cmake --build .
``` ```
* if you encounter issues when linking wrt. c++11 symbols you might have run into GCC ABI incompatibility introduced from GCC 5.0 onwards. You can fix this by adding '-s compiler.libcxx=libstdc++11' to the conan call or changing compiler.libcxx to * if you encounter issues when linking wrt. c++11 symbols you might have run into GCC ABI incompatibility introduced from GCC 5.0 onwards. You can fix this by adding '-s compiler.libcxx=libstdc++11' to the conan call or changing compiler.libcxx to
``` ```
compiler.libcxx=libstdc++11 compiler.libcxx=libstdc++11
``` ```
in $HOME/.conan/profiles/default in $HOME/.conan/profiles/default
** Detailed Setup steps** **Detailed Setup steps**
*** prepare Ubuntu 18.04 *** ***prepare Ubuntu 18.04***
``` ```
sudo apt-get install -y git python-pip build-essential cmake libloki-dev zlib1g-dev libncurses5-dev \ sudo apt-get install -y git python-pip build-essential cmake libloki-dev zlib1g-dev libncurses5-dev \
@ -49,7 +57,7 @@ in $HOME/.conan/profiles/default
pip install --user conan pip install --user conan
``` ```
*** prepare Fedora 28 *** ***prepare Fedora 28***
``` ```
#prepare system #prepare system
@ -59,7 +67,7 @@ in $HOME/.conan/profiles/default
export PATH=${PATH}:$HOME/.local/bin export PATH=${PATH}:$HOME/.local/bin
``` ```
*** Build the ISS *** ***Build the ISS***
``` ```
# configure conan # configure conan
@ -67,9 +75,10 @@ in $HOME/.conan/profiles/default
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
conan profile new default --detect conan profile new default --detect
# clone and build DBT-RISE-RISCV # clone and build DBT-RISE-RISCV
git clone --recursive https://github.com/Minres/DBT-RISE-RISCV.git git clone --recursive https://git.minres.com/VP/RISCV-VP.git
cd DBT-RISE-RISCV/ cd RISCV-VP/
git checkout develop git checkout develop
git submodule update --recursive
mkdir build;cd build mkdir build;cd build
MAKE_FLAGS="-j4" cmake .. MAKE_FLAGS="-j4" cmake ..
make -j4 make -j4

View File

@ -1,20 +0,0 @@
# Function to link between sub-projects
function(add_dependent_subproject subproject_name)
#if (NOT TARGET ${subproject_name}) # target unknown
if(NOT PROJECT_${subproject_name}) # var unknown because we build only this subproject
find_package(${subproject_name} CONFIG REQUIRED)
else () # we know the target thus we are doing a build from the top directory
include_directories(../${subproject_name}/incl)
endif ()
endfunction(add_dependent_subproject)
# Make sure we tell the topdir CMakeLists that we exist (if build from topdir)
get_directory_property(hasParent PARENT_DIRECTORY)
if(hasParent)
set(PROJECT_${PROJECT_NAME} true PARENT_SCOPE)
endif()
# Function to link between sub-projects
function(add_dependent_header subproject_name)
include_directories(../${subproject_name}/incl)
endfunction(add_dependent_header)

View File

@ -1,60 +1,3 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) # main (top) cmake dir
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # project specific 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("platform")
include(Common)
find_package(Boost COMPONENTS program_options system thread filesystem REQUIRED)
# 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()
# This sets the include directory for the reference project. This is the -I flag in gcc.
add_dependent_subproject(dbt-core)
add_dependent_subproject(scc)
add_dependent_subproject(riscv)
include_directories(
${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)
add_subdirectory(src) add_subdirectory(src)
#
# SYSTEM PACKAGING (RPM, TGZ, ...)
# _____________________________________________________________________________
#include(CPackConfig)
#
# CMAKE PACKAGING (for other CMake projects to use this one easily)
# _____________________________________________________________________________
#include(PackageConfigurator)

View File

@ -75,25 +75,26 @@ CLIParser::CLIParser(int argc, char *argv[])
std::cerr << "ERROR: " << e.what() << std::endl << std::endl; std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
std::cerr << desc << std::endl; std::cerr << desc << std::endl;
} }
auto log_level = vm_["verbose"].as<unsigned>();
auto verbosity = !vm_["Verbose"].defaulted()?vm_["Verbose"].as<unsigned>():vm_["verbose"].as<unsigned>();
auto colored_output = vm_["Verbose"].defaulted();
auto dbg_level = std::min<unsigned>(logging::DBGTRACE, verbosity);
auto l = logging::as_log_level(log_level > 6 ? 6 : log_level); auto verbosity = !vm_["Verbose"].defaulted() ? vm_["Verbose"].as<unsigned>() : vm_["verbose"].as<unsigned>();
auto colored_output = vm_["Verbose"].defaulted();
auto dbg_level = vm_.count("debug-level")
? vm_["debug-level"].as<scc::log>()
: static_cast<scc::log>(std::min<unsigned>(static_cast<unsigned>(scc::log::DBGTRACE), verbosity));
auto log_regex = vm_["log-filter"].as<std::string>(); auto log_regex = vm_["log-filter"].as<std::string>();
if (vm_.count("log-file")) { if (vm_.count("log-file")) {
auto log_file_name = vm_["log-file"].as<std::string>(); auto log_file_name = vm_["log-file"].as<std::string>();
scc::init_logging(scc::LogConfig() scc::init_logging(scc::LogConfig()
.logFileName(log_file_name) .logFileName(log_file_name)
.logLevel(static_cast<logging::log_level>(dbg_level)) .logLevel(static_cast<scc::log>(dbg_level))
.logFilterRegex(log_regex) .logFilterRegex(log_regex)
.coloredOutput(colored_output) .coloredOutput(colored_output)
); );
} else { } else {
scc::init_logging(scc::LogConfig() scc::init_logging(scc::LogConfig()
.logLevel(static_cast<logging::log_level>(dbg_level)) .logLevel(static_cast<scc::log>(dbg_level))
.logFilterRegex(log_regex) .logFilterRegex(log_regex)
.coloredOutput(colored_output) .coloredOutput(colored_output)
); );
@ -104,21 +105,22 @@ void CLIParser::build() {
// clang-format off // clang-format off
desc.add_options() desc.add_options()
("help,h", "Print help message") ("help,h", "Print help message")
("verbose,v", po::value<unsigned>()->implicit_value(3), "Sets logging verbosity") ("verbose,v", po::value<unsigned>()->implicit_value(3), "Sets logging verbosity")
("Verbose,V", po::value<unsigned>()->default_value(logging::INFO), "Debug output level as with --verbose but print non-colored") ("Verbose,V", po::value<unsigned>()->default_value(logging::INFO), "Debug output level as with --verbose but print non-colored")
("log-file", po::value<std::string>(), "Sets default log file.") ("debug-level,D", po::value<scc::log>(), "Debug output level (textual) as with --verbose")
("log-filter", po::value<std::string>()->default_value(""), "log filter regular expression name") ("log-file", po::value<std::string>(), "Sets default log file.")
("disass,d", po::value<std::string>()->implicit_value(""), "Enables disassembly") ("log-filter", po::value<std::string>()->default_value(""), "log filter regular expression name")
("elf,l", po::value<std::string>(), "ELF file to load") ("disass,d", po::value<std::string>()->implicit_value(""), "Enables disassembly")
("gdb-port,g", po::value<unsigned short>()->default_value(0), "enable gdb server and specify port to use") ("elf,l", po::value<std::string>(), "ELF file to load")
("dump-ir", "dump the intermediate representation") ("gdb-port,g", po::value<unsigned short>()->default_value(0), "enable gdb server and specify port to use")
("quantum", po::value<unsigned>(), "SystemC quantum time in ns") ("ir-dump", "dump the intermediate representation")
("reset,r", po::value<std::string>(), "reset address") ("quantum", po::value<unsigned>(), "SystemC quantum time in ns")
("trace-level,t", po::value<unsigned>()->default_value(0), "enable tracing, or combination of 1=signals and 2=TX text, 4=TX compressed text, 6=TX in SQLite") ("reset,r", po::value<std::string>(), "reset address")
("trace-level,t", po::value<unsigned>()->default_value(0), "enable tracing, or combination of 1=signals and 2=TX text, 4=TX compressed text, 6=TX in SQLite")
("trace-default-on", "enables tracing for all unspecified modules") ("trace-default-on", "enables tracing for all unspecified modules")
("trace-file", po::value<std::string>()->default_value("system"), "set th ename of the trace file") ("trace-file", po::value<std::string>()->default_value("system"), "set th ename of the trace file")
("max_time,m", po::value<std::string>(), "maximum time to run") ("max_time,m", po::value<std::string>(), "maximum time to run")
("config-file,c", po::value<std::string>()->default_value(""), "read configuration from file") ("config-file,c", po::value<std::string>()->default_value(""), "read configuration from file")
("dump-config,dc", po::value<std::string>()->default_value(""), "dump configuration to file file"); ("dump-config,dc", po::value<std::string>()->default_value(""), "dump configuration to file file");
// clang-format on // clang-format on
} }

View File

@ -1,6 +1,14 @@
cmake_minimum_required(VERSION 3.12)
project(platform VERSION 1.0.0)
include(GNUInstallDirs)
# library files # library files
FILE(GLOB RiscVSCHeaders ${PROJECT_SOURCE_DIR}/incl/sysc/*.h ${PROJECT_SOURCE_DIR}/incl/sysc/*/*.h) FILE(GLOB RiscVSCHeaders ${PROJECT_SOURCE_DIR}/incl/sysc/*.h ${PROJECT_SOURCE_DIR}/incl/sysc/*/*.h)
set(LIB_HEADERS ${RiscVSCHeaders} ) set(LIB_HEADERS ${RiscVSCHeaders} )
set(LIB_SOURCES set(LIB_SOURCES
sysc/aon.cpp sysc/aon.cpp
sysc/BLDC.cpp sysc/BLDC.cpp
@ -21,86 +29,30 @@ set(LIB_SOURCES
sysc/uart.cpp sysc/uart.cpp
CLIParser.cpp ) CLIParser.cpp )
set(APP_SOURCES sc_main.cpp) add_library(platform ${LIB_SOURCES})
target_include_directories(platform PUBLIC ../incl)
# Define two variables in order not to repeat ourselves. target_link_libraries(platform PUBLIC riscv_sc CONAN_PKG::Seasocks external)
set(LIBRARY_NAME platform) set_target_properties(platform PROPERTIES
VERSION ${PROJECT_VERSION} # ${VERSION} was defined in the main CMakeLists.
## the following setting needs to be consistent with the library
#add_definitions(-DSC_DEFAULT_WRITER_POLICY=SC_MANY_WRITERS)
# Define the library
add_library(${LIBRARY_NAME} ${LIB_SOURCES})
# Links the target exe against the libraries
target_link_libraries(${LIBRARY_NAME} riscv_sc)
target_link_libraries(${LIBRARY_NAME} dbt-core)
target_link_libraries(${LIBRARY_NAME} softfloat)
target_link_libraries(${LIBRARY_NAME} scc)
target_link_libraries(${LIBRARY_NAME} CONAN_PKG::Seasocks)
target_link_libraries(${LIBRARY_NAME} external)
target_link_libraries(${LIBRARY_NAME} ${llvm_libs})
target_link_libraries(${LIBRARY_NAME} ${Boost_LIBRARIES} )
set_target_properties(${LIBRARY_NAME} PROPERTIES
VERSION ${VERSION} # ${VERSION} was defined in the main CMakeLists.
FRAMEWORK FALSE FRAMEWORK FALSE
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
) )
# This is a make target, so you can do a "make riscv-sc" add_executable(riscv-vp sc_main.cpp)
set(APPLICATION_NAME riscv-vp)
include_directories(${PROJECT_SOURCE_DIR}/incl)
include_directories(${CONAN_INCLUDE_DIRS_SEASOCKS})
add_definitions(-DWITH_SYSTEMC) # or -DSC_NO_WRITE_CHECK
include_directories(${SystemC_INCLUDE_DIRS})
include_directories(${CCI_INCLUDE_DIRS})
if(SCV_FOUND)
add_definitions(-DWITH_SCV)
include_directories(${SCV_INCLUDE_DIRS})
endif()
link_directories(${SystemC_LIBRARY_DIRS})
link_directories(${CCI_LIBRARY_DIRS})
link_directories(${CONAN_LIB_DIRS_SEASOCKS})
add_executable(${APPLICATION_NAME} ${APP_SOURCES})
# include files for this application # include files for this application
target_include_directories(${APPLICATION_NAME} SYSTEM PRIVATE ${LLVM_INCLUDE_DIRS}) target_include_directories(riscv-vp SYSTEM PRIVATE ${LLVM_INCLUDE_DIRS})
# Links the target exe against the libraries target_link_libraries(riscv-vp PUBLIC platform riscv_sc)
target_link_libraries(${APPLICATION_NAME} ${LIBRARY_NAME})
target_link_libraries(${APPLICATION_NAME} riscv_sc)
target_link_libraries(${APPLICATION_NAME} dbt-core)
target_link_libraries(${APPLICATION_NAME} softfloat)
target_link_libraries(${APPLICATION_NAME} scc)
target_link_libraries(${APPLICATION_NAME} ${CONAN_LIBS_SEASOCKS})
target_link_libraries(${APPLICATION_NAME} external)
target_link_libraries(${APPLICATION_NAME} ${llvm_libs})
target_link_libraries(${APPLICATION_NAME} ${CCI_LIBRARIES} )
target_link_libraries(${APPLICATION_NAME} ${SystemC_LIBRARIES} )
if(SCV_FOUND)
link_directories(${SCV_LIBRARY_DIRS})
target_link_libraries (${APPLICATION_NAME} ${SCV_LIBRARIES})
endif()
target_link_libraries(${APPLICATION_NAME} ${Boost_LIBRARIES} )
if (Tcmalloc_FOUND) if (Tcmalloc_FOUND)
target_link_libraries(${APPLICATION_NAME} ${Tcmalloc_LIBRARIES}) target_link_libraries(riscv-vp PUBLIC ${Tcmalloc_LIBRARIES})
endif(Tcmalloc_FOUND) endif(Tcmalloc_FOUND)
# Says how and where to install software install(TARGETS platform riscv-vp
# Targets:
# * <prefix>/lib/<libraries>
# * header location after install: <prefix>/include/<project>/*.h
# * headers can be included by C++ code `#<project>/Bar.hpp>`
install(TARGETS ${LIBRARY_NAME} ${APPLICATION_NAME}
EXPORT ${PROJECT_NAME}Targets # for downstream dependencies EXPORT ${PROJECT_NAME}Targets # for downstream dependencies
ARCHIVE DESTINATION lib COMPONENT libs # static lib ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib
RUNTIME DESTINATION bin COMPONENT libs # binaries RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries
LIBRARY DESTINATION lib COMPONENT libs # shared lib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib
FRAMEWORK DESTINATION bin COMPONENT libs # for mac FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # for mac
PUBLIC_HEADER DESTINATION incl/${PROJECT_NAME} COMPONENT devel # headers for mac (note the different component -> different package) PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} COMPONENT devel # headers for mac (note the different component -> different package)
INCLUDES DESTINATION incl # headers INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # headers
) )

View File

@ -44,7 +44,9 @@
#include <cci_utils/broker.h> #include <cci_utils/broker.h>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#ifdef WITH_LLVM
#include <iss/llvm/jit_helper.h> #include <iss/llvm/jit_helper.h>
#endif
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
@ -63,10 +65,6 @@ int sc_main(int argc, char *argv[]) {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
sc_report_handler::set_actions(SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_, SC_DO_NOTHING); sc_report_handler::set_actions(SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_, SC_DO_NOTHING);
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// create global CCI broker
///////////////////////////////////////////////////////////////////////////
cci::cci_register_broker(new cci_utils::broker("Global Broker"));
///////////////////////////////////////////////////////////////////////////
// CLI argument parsing & logging setup // CLI argument parsing & logging setup
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
CLIParser parser(argc, argv); CLIParser parser(argc, argv);
@ -74,7 +72,9 @@ int sc_main(int argc, char *argv[]) {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// set up infrastructure // set up infrastructure
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifdef WITH_LLVM
iss::init_jit_debug(argc, argv); iss::init_jit_debug(argc, argv);
#endif
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// set up configuration // set up configuration
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

View File

@ -117,11 +117,11 @@ void clint::update_mtime(bool force) {
if (regs->r_mtimecmp > regs->r_mtime && clk > sc_core::SC_ZERO_TIME) { if (regs->r_mtimecmp > regs->r_mtime && clk > sc_core::SC_ZERO_TIME) {
sc_core::sc_time next_trigger = sc_core::sc_time next_trigger =
(clk * lfclk_mutiplier) * (regs->r_mtimecmp - regs->r_mtime) - cnt_fraction * clk; (clk * lfclk_mutiplier) * (regs->r_mtimecmp - regs->r_mtime) - cnt_fraction * clk;
SCTRACE() << "Timer fires at " << sc_time_stamp() + next_trigger; SCCTRACE() << "Timer fires at " << sc_time_stamp() + next_trigger;
mtime_evt.notify(next_trigger); mtime_evt.notify(next_trigger);
mtime_int_o.write(false); mtime_int_o.write(false);
} else { } else {
SCTRACE() << "Timer fired at " << sc_time_stamp(); SCCTRACE() << "Timer fired at " << sc_time_stamp();
mtime_int_o.write(true); mtime_int_o.write(true);
} }
} }

View File

@ -111,7 +111,7 @@ gpio::~gpio() = default;
void gpio::before_end_of_elaboration() { void gpio::before_end_of_elaboration() {
if (write_to_ws.get_value()) { if (write_to_ws.get_value()) {
SCTRACE() << "Adding WS handler for " << (std::string{"/ws/"} + name()); SCCTRACE() << "Adding WS handler for " << (std::string{"/ws/"} + name());
handler = std::make_shared<WsHandler>(); handler = std::make_shared<WsHandler>();
sc_comm_singleton::inst().registerWebSocketHandler((std::string{"/ws/"} + name()).c_str(), handler); sc_comm_singleton::inst().registerWebSocketHandler((std::string{"/ws/"} + name()).c_str(), handler);
} }

View File

@ -86,7 +86,7 @@ void mcp_3008::do_conversion() {
auto inp = ch_i[channel].read(); auto inp = ch_i[channel].read();
auto norm = 1024.0 * inp / vref; auto norm = 1024.0 * inp / vref;
auto res = static_cast<int>(norm); auto res = static_cast<int>(norm);
SCDEBUG(this->name()) << "Converting " << inp << " to " << norm << " as int " << res; SCCDEBUG(this->name()) << "Converting " << inp << " to " << norm << " as int " << res;
tx_bytes[1] = bit_sub<8, 2>(res); tx_bytes[1] = bit_sub<8, 2>(res);
tx_bytes[2] = bit_sub<0, 8>(res); tx_bytes[2] = bit_sub<0, 8>(res);
} else { } else {
@ -176,7 +176,7 @@ void mcp_3208::do_conversion() {
auto inp = ch_i[channel].read(); auto inp = ch_i[channel].read();
auto norm = 4096.0 * inp / vref; auto norm = 4096.0 * inp / vref;
auto res = static_cast<int>(norm); auto res = static_cast<int>(norm);
SCDEBUG(this->name()) << "Converting channel " << channel << " " << inp << "V to " << norm << " as int " SCCDEBUG(this->name()) << "Converting channel " << channel << " " << inp << "V to " << norm << " as int "
<< res; << res;
tx_bytes[1] = bit_sub<8, 4>(res); tx_bytes[1] = bit_sub<8, 4>(res);
tx_bytes[2] = bit_sub<0, 8>(res); tx_bytes[2] = bit_sub<0, 8>(res);

View File

@ -111,7 +111,7 @@ void plic::global_int_port_cb() {
if (enable && global_interrupts_i[i].read() == 1) { if (enable && global_interrupts_i[i].read() == 1) {
regs->r_pending[reg_idx] = regs->r_pending[reg_idx] | (0x1 << bit_ofs); regs->r_pending[reg_idx] = regs->r_pending[reg_idx] | (0x1 << bit_ofs);
handle_pending = true; handle_pending = true;
SCDEBUG(this->name()) << "pending interrupt identified: " << i; SCCDEBUG(this->name()) << "pending interrupt identified: " << i;
} }
} }
@ -138,7 +138,7 @@ void plic::handle_pending_int() {
claim_prio = prio; claim_prio = prio;
claim_int = i; claim_int = i;
raise_int = true; raise_int = true;
SCDEBUG(this->name()) << "pending interrupt activated: " << i; SCCDEBUG(this->name()) << "pending interrupt activated: " << i;
} }
} }
} }
@ -149,14 +149,14 @@ void plic::handle_pending_int() {
// todo: evluate clock period // todo: evluate clock period
} else { } else {
regs->r_claim_complete = 0; regs->r_claim_complete = 0;
SCDEBUG(this->name()) << "no further pending interrupt."; SCCDEBUG(this->name()) << "no further pending interrupt.";
} }
} }
void plic::reset_pending_int(uint32_t irq) { void plic::reset_pending_int(uint32_t irq) {
// todo: evaluate enable register (see spec) // todo: evaluate enable register (see spec)
// todo: make sure that pending is set, otherwise don't reset irq ... read spec. // todo: make sure that pending is set, otherwise don't reset irq ... read spec.
SCTRACE(this->name()) << "reset pending interrupt: " << irq; SCCTRACE(this->name()) << "reset pending interrupt: " << irq;
// reset related pending bit // reset related pending bit
auto reg_idx = irq >> 5; auto reg_idx = irq >> 5;
auto bit_ofs = irq & 0x1F; auto bit_ofs = irq & 0x1F;

View File

@ -57,7 +57,7 @@ terminal::~terminal() = default;
void terminal::before_end_of_elaboration() { void terminal::before_end_of_elaboration() {
if (write_to_ws.get_value()) { if (write_to_ws.get_value()) {
SCTRACE() << "Adding WS handler for " << (std::string{"/ws/"} + name()); SCCTRACE() << "Adding WS handler for " << (std::string{"/ws/"} + name());
handler = std::make_shared<WsHandler>(); handler = std::make_shared<WsHandler>();
sc_comm_singleton::inst().registerWebSocketHandler((std::string{"/ws/"} + name()).c_str(), handler); sc_comm_singleton::inst().registerWebSocketHandler((std::string{"/ws/"} + name()).c_str(), handler);
} }
@ -80,7 +80,7 @@ void terminal::receive(tlm::tlm_signal_gp<sc_dt::sc_logic> &gp, sc_core::sc_time
this->handler->send(os.str()); this->handler->send(os.str());
}); });
else else
SCINFO(this->name()) << " receive: '" << msg << "'"; SCCINFO(this->name()) << " receive: '" << msg << "'";
queue.clear(); queue.clear();
} }
} }

2
riscv

Submodule riscv updated: 8cdf50d69e...edeff7add8

2
scc

Submodule scc updated: d3d7c9f590...01458535fa