Compare commits
36 Commits
feature/py
...
9248b7f246
Author | SHA1 | Date | |
---|---|---|---|
9248b7f246 | |||
8d4d099f3a | |||
2b6d7530e3 | |||
c50da08b18 | |||
59545434d3 | |||
a82d6e408b | |||
95419571c3 | |||
7402a19732 | |||
3cdc7431ad | |||
744db33d41 | |||
2552973c15 | |||
6fceee3724 | |||
6f53970c40 | |||
ea4657b77c | |||
d7772b5b05 | |||
6ee0cd1b29 | |||
84e73c04a1 | |||
7148f1caec | |||
01b3851112 | |||
48ffdd2d1b | |||
2099e61706 | |||
d1a1fad361 | |||
ad1d9463aa | |||
518daf70f7 | |||
61e386a700 | |||
31c4d467ee | |||
a66c2c5dca | |||
086021da31 | |||
3b9fdfde0a | |||
f928ad5814 | |||
7769d26f20 | |||
6e751ac2b4 | |||
d6c6d181aa | |||
ad1804d23e | |||
6b85f42c3e | |||
be0c930879 |
@ -13,11 +13,11 @@
|
|||||||
</extensions>
|
</extensions>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1751741082" name="Debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="cdt.managedbuild.config.gnu.exe.debug">
|
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1751741082" name="Debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=" parent="cdt.managedbuild.config.gnu.exe.debug">
|
||||||
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1751741082." name="/" resourcePath="">
|
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1751741082." name="/" resourcePath="">
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1289745146" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
|
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1289745146" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
|
||||||
<targetPlatform binaryParser="org.eclipse.cdt.core.GNU_ELF;org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.exe.debug.1460698591" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
|
<targetPlatform binaryParser="org.eclipse.cdt.core.GNU_ELF;org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.exe.debug.1460698591" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
|
||||||
<builder buildPath="/RISCV-VP/build/Debug" id="de.marw.cdt.cmake.core.genscriptbuilder.2135578907" keepEnvironmentInBuildfile="false" name="CMake Builder (portable)" parallelBuildOn="true" parallelizationNumber="optimal" superClass="de.marw.cdt.cmake.core.genscriptbuilder"/>
|
<builder buildPath="/RISCV-VP/build/Debug" id="de.marw.cdt.cmake.core.genscriptbuilder.2135578907" keepEnvironmentInBuildfile="false" name="CMake Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="de.marw.cdt.cmake.core.genscriptbuilder"/>
|
||||||
<tool id="cdt.managedbuild.tool.gnu.archiver.base.366643800" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
|
<tool id="cdt.managedbuild.tool.gnu.archiver.base.366643800" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
|
||||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1510612390" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
|
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1510612390" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
|
||||||
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1768317780" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1768317780" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,3 +30,4 @@ language.settings.xml
|
|||||||
/.gdbinit
|
/.gdbinit
|
||||||
/*.out
|
/*.out
|
||||||
/dump.json
|
/dump.json
|
||||||
|
/*.c
|
||||||
|
7
.project
7
.project
@ -5,11 +5,6 @@
|
|||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
<buildCommand>
|
|
||||||
<name>org.python.pydev.PyDevBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
<triggers>clean,full,incremental,</triggers>
|
<triggers>clean,full,incremental,</triggers>
|
||||||
@ -28,7 +23,5 @@
|
|||||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
<nature>org.eclipse.linuxtools.tmf.project.nature</nature>
|
|
||||||
<nature>org.python.pydev.pythonNature</nature>
|
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<?eclipse-pydev version="1.0"?><pydev_project>
|
|
||||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
|
||||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
|
|
||||||
</pydev_project>
|
|
@ -1,18 +1,23 @@
|
|||||||
cmake_minimum_required(VERSION 3.3)
|
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 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
|
||||||
IF(NOT ${GIT_BRANCH} MATCHES "master")
|
#IF(NOT ${GIT_BRANCH} MATCHES "master")
|
||||||
IF(NOT ${GIT_BRANCH} MATCHES "develop")
|
# IF(NOT ${GIT_BRANCH} MATCHES "develop")
|
||||||
message(STATUS "main branch is '${GIT_BRANCH}', setting submodules to 'develop'")
|
# message(STATUS "main branch is '${GIT_BRANCH}', setting submodules to 'develop'")
|
||||||
set(GIT_BRANCH develop)
|
# set(GIT_BRANCH develop)
|
||||||
endif()
|
# endif()
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
### set the directory names of the submodules
|
### set the directory names of the submodules
|
||||||
set(GIT_SUBMODULES elfio libGIS scc dbt-core)
|
set(GIT_SUBMODULES elfio libGIS scc dbt-core)
|
||||||
@ -27,7 +32,7 @@ set(GIT_SUBMODULE_BRANCH_dbt-core ${GIT_BRANCH})
|
|||||||
set(GIT_SUBMODULE_BRANCH_riscv ${GIT_BRANCH})
|
set(GIT_SUBMODULE_BRANCH_riscv ${GIT_BRANCH})
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(Submodules)
|
#include(Submodules)
|
||||||
include(Conan)
|
include(Conan)
|
||||||
|
|
||||||
#enable_testing()
|
#enable_testing()
|
||||||
@ -40,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")
|
||||||
@ -56,25 +61,16 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|||||||
set(warnings "/W4 /WX /EHsc")
|
set(warnings "/W4 /WX /EHsc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
setup_conan()
|
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.
|
||||||
|
set(BOOST_ROOT ${CONAN_BOOST_ROOT})
|
||||||
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)
|
||||||
find_package(SystemC)
|
find_package(OSCISystemC)
|
||||||
if(SystemC_FOUND)
|
if(SystemC_FOUND)
|
||||||
message(STATUS "SystemC headers at ${SystemC_INCLUDE_DIRS}")
|
message(STATUS "SystemC headers at ${SystemC_INCLUDE_DIRS}")
|
||||||
message(STATUS "SystemC library at ${SystemC_LIBRARY_DIRS}")
|
message(STATUS "SystemC library at ${SystemC_LIBRARY_DIRS}")
|
||||||
@ -88,7 +84,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")
|
||||||
@ -105,16 +100,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}")
|
|
||||||
|
108
Jenkinsfile
vendored
Normal file
108
Jenkinsfile
vendored
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
void checkout_hifive_vp() {
|
||||||
|
checkout([
|
||||||
|
$class: 'GitSCM',
|
||||||
|
branches: [[name: '*/develop']],
|
||||||
|
browser: [$class: 'GogsGit', repoUrl: ''],
|
||||||
|
doGenerateSubmoduleConfigurations: false,
|
||||||
|
extensions: [
|
||||||
|
[
|
||||||
|
$class: 'SubmoduleOption',
|
||||||
|
disableSubmodules: false,
|
||||||
|
parentCredentials: false,
|
||||||
|
recursiveSubmodules: true,
|
||||||
|
reference: '',
|
||||||
|
trackingSubmodules: true
|
||||||
|
],
|
||||||
|
[$class: 'CleanBeforeCheckout'],
|
||||||
|
[$class: 'WipeWorkspace'],
|
||||||
|
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'HIFIVE1-VP']
|
||||||
|
],
|
||||||
|
submoduleCfg: [],
|
||||||
|
userRemoteConfigs: [[
|
||||||
|
credentialsId: 'gitea-jenkins',
|
||||||
|
url: 'https://git.minres.com/VP/HIFIVE1-VP.git'
|
||||||
|
]]
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
void build_hifive_vp() {
|
||||||
|
try {
|
||||||
|
sh("conan profile new default --detect --force")
|
||||||
|
sh("conan profile update settings.compiler.libcxx=libstdc++11 default")
|
||||||
|
sh("conan remote add minres https://api.bintray.com/conan/minres/conan-repo --force")
|
||||||
|
sh("conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan --force")
|
||||||
|
}
|
||||||
|
catch (exc) {
|
||||||
|
echo 'Conan configured'
|
||||||
|
}
|
||||||
|
sh("rm -rf HIFIVE1-VP/build-ubuntu")
|
||||||
|
sh("mkdir -p HIFIVE1-VP/build-ubuntu")
|
||||||
|
sh("cd HIFIVE1-VP && git submodule update --recursive")
|
||||||
|
sh("cd HIFIVE1-VP/build-ubuntu && MAKE_FLAGS='-j4' cmake .. && make -j4")
|
||||||
|
fingerprint 'HIFIVE1-VP/build-ubuntu/bin/riscv.vp'
|
||||||
|
}
|
||||||
|
|
||||||
|
void build_hifive_without_scv() {
|
||||||
|
try {
|
||||||
|
sh("conan profile new default --detect --force")
|
||||||
|
sh("conan profile update settings.compiler.libcxx=libstdc++11 default")
|
||||||
|
sh("conan remote add minres https://api.bintray.com/conan/minres/conan-repo --force")
|
||||||
|
sh("conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan --force")
|
||||||
|
}
|
||||||
|
catch (exc) {
|
||||||
|
echo 'Conan configured'
|
||||||
|
}
|
||||||
|
sh("rm -rf HIFIVE1-VP/build-ubuntu")
|
||||||
|
sh("mkdir -p HIFIVE1-VP/build-ubuntu")
|
||||||
|
sh("cd HIFIVE1-VP && git submodule update --recursive")
|
||||||
|
sh("cd HIFIVE1-VP/build-ubuntu && MAKE_FLAGS='-j4' cmake .. -DENABLE_SCV=FALSE && make -j4")
|
||||||
|
fingerprint 'HIFIVE1-VP/build-ubuntu/bin/riscv.vp'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent none
|
||||||
|
|
||||||
|
options {
|
||||||
|
// using the Timestamper plugin we can add timestamps to the console log
|
||||||
|
timestamps()
|
||||||
|
skipStagesAfterUnstable()
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('HiFive-VP pipeline') {
|
||||||
|
parallel {
|
||||||
|
stage('ubuntu18'){
|
||||||
|
agent {docker { image 'ubuntu-18.04' } }
|
||||||
|
stages {
|
||||||
|
stage('Checkout on Ubuntu18.04') { steps { checkout_hifive_vp() }}
|
||||||
|
stage('Build') { steps { build_hifive_vp() } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('ubuntu20'){
|
||||||
|
agent {docker { image 'ubuntu-20.04' } }
|
||||||
|
stages {
|
||||||
|
stage('Checkout on Ubuntu20.04') { steps { checkout_hifive_vp() }}
|
||||||
|
stage('Build') { steps { build_hifive_vp() } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Fedora28'){
|
||||||
|
agent {docker { image 'fedora28' } }
|
||||||
|
stages {
|
||||||
|
stage('Checkout on Fedora') { steps {checkout_hifive_vp()}}
|
||||||
|
stage('Build') { steps {build_hifive_vp() }}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('No SCV'){
|
||||||
|
agent {docker { image 'ubuntu-18.04' } }
|
||||||
|
stages {
|
||||||
|
stage('Checkout on Ubuntu') { steps {checkout_hifive_vp()}}
|
||||||
|
stage('Build without SCV') { steps {build_hifive_without_scv()}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
README.md
42
README.md
@ -16,40 +16,39 @@ 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 profile new default --detect --force
|
||||||
|
conan profile update settings.compiler.libcxx=libstdc++11 default
|
||||||
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
|
|
||||||
* start an out-of-source build:
|
|
||||||
```
|
|
||||||
cd RISCV-VP
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake ..
|
|
||||||
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/20.04***
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo apt-get install -y git python-pip build-essential cmake libloki-dev zlib1g-dev libncurses5-dev \
|
sudo apt-get install -y git python3-pip build-essential cmake libloki-dev zlib1g-dev libncurses5-dev \
|
||||||
libboost-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev llvm-dev llvm-doc
|
libboost-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev llvm-dev llvm-doc
|
||||||
pip install --user conan
|
pip3 install --user conan
|
||||||
```
|
```
|
||||||
|
|
||||||
*** prepare Fedora 28 ***
|
***prepare Fedora 28***
|
||||||
|
|
||||||
```
|
```
|
||||||
#prepare system
|
#prepare system
|
||||||
@ -59,17 +58,14 @@ 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
|
# checkout source from git:
|
||||||
conan remote add minres https://api.bintray.com/conan/minres/conan-repo
|
git clone --recursive https://git.minres.com/VP/HIFIVE1-VP.git
|
||||||
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
|
|
||||||
conan profile new default --detect
|
# build ISS:
|
||||||
# clone and build DBT-RISE-RISCV
|
cd HIFIVE1-VP
|
||||||
git clone --recursive https://github.com/Minres/DBT-RISE-RISCV.git
|
|
||||||
cd DBT-RISE-RISCV/
|
|
||||||
git checkout develop
|
|
||||||
mkdir build;cd build
|
mkdir build;cd build
|
||||||
MAKE_FLAGS="-j4" cmake ..
|
MAKE_FLAGS="-j4" cmake ..
|
||||||
make -j4
|
make -j4
|
||||||
|
48
RiscV_VP.py
48
RiscV_VP.py
@ -1,48 +0,0 @@
|
|||||||
import os.path
|
|
||||||
import logging
|
|
||||||
import cppyy
|
|
||||||
from cppyy import gbl as cpp
|
|
||||||
from array import array
|
|
||||||
import pysysc
|
|
||||||
from pysysc.structural import Connection, Module, Signal, Simulation
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# setup and load
|
|
||||||
###############################################################################
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
|
||||||
build_type='Debug'
|
|
||||||
###############################################################################
|
|
||||||
myDir = os.path.dirname( os.path.realpath(__file__))
|
|
||||||
pysysc.read_config_from_conan(os.path.join(myDir, 'conanfile.txt'), build_type)
|
|
||||||
pysysc.load_systemc()
|
|
||||||
###############################################################################
|
|
||||||
logging.debug("Loading Components lib")
|
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'scc/incl'))
|
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'dbt-core/incl'))
|
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'riscv/incl'))
|
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'platform/incl'))
|
|
||||||
pysysc.add_library('sysc/top/system.h', os.path.join(myDir, 'build/%s/lib/libplatform.so'%build_type))
|
|
||||||
cppyy.include("iss/llvm/jit_helper.h")
|
|
||||||
cppyy.include("scc/configurer.h")
|
|
||||||
cppyy.include("sysc/top/system.h")
|
|
||||||
###############################################################################
|
|
||||||
# configure
|
|
||||||
###############################################################################
|
|
||||||
Simulation.setup(logging.root.level)
|
|
||||||
cpp.iss.init_jit();
|
|
||||||
cfg=cpp.scc.configurer("system.json");
|
|
||||||
###############################################################################
|
|
||||||
# instantiate
|
|
||||||
###############################################################################
|
|
||||||
dut = Module(cpp.sysc.system).create("i_system")
|
|
||||||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", "../RISCV-Tests/hello/hello");
|
|
||||||
of=cpp.std.ofstream("hier.txt")
|
|
||||||
cfg.dump_configuration(of);
|
|
||||||
of.close()
|
|
||||||
###############################################################################
|
|
||||||
# run if it is standalone
|
|
||||||
###############################################################################
|
|
||||||
if __name__ == "__main__":
|
|
||||||
Simulation.configure(enable_vcd=False)
|
|
||||||
Simulation.run()
|
|
||||||
logging.debug("Done")
|
|
@ -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)
|
|
@ -1,51 +0,0 @@
|
|||||||
macro(setup_conan)
|
|
||||||
find_program(conan conan)
|
|
||||||
if(NOT EXISTS ${conan})
|
|
||||||
message(FATAL_ERROR "Conan is required. Please see README.md")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Darwin)
|
|
||||||
set(os Macos)
|
|
||||||
else()
|
|
||||||
set(os ${CMAKE_HOST_SYSTEM_NAME})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
|
||||||
set(compiler gcc)
|
|
||||||
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL AppleClang)
|
|
||||||
set(compiler apple-clang)
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 0 3 compiler_version)
|
|
||||||
|
|
||||||
set(conanfile ${CMAKE_SOURCE_DIR}/conanfile.txt)
|
|
||||||
set(conanfile_cmake ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
|
||||||
set(compiler_libcxx libstdc++11)
|
|
||||||
|
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
|
||||||
set(CONAN_BUILD_TYPE Debug)
|
|
||||||
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
|
||||||
set(CONAN_BUILD_TYPE Release)
|
|
||||||
else()
|
|
||||||
set(CONAN_BUILD_TYPE ${CMAKE_BUILD_TYPE})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_CXX_STANDARD} EQUAL 98)
|
|
||||||
execute_process(COMMAND ${conan} install --build=missing
|
|
||||||
-s build_type=${CONAN_BUILD_TYPE} -s compiler.libcxx=${compiler_libcxx}
|
|
||||||
${CMAKE_SOURCE_DIR} RESULT_VARIABLE return_code)
|
|
||||||
else()
|
|
||||||
execute_process(COMMAND ${conan} install --build=missing -s build_type=${CONAN_BUILD_TYPE}
|
|
||||||
${CMAKE_SOURCE_DIR} RESULT_VARIABLE return_code)
|
|
||||||
endif()
|
|
||||||
if(NOT ${return_code} EQUAL 0)
|
|
||||||
message(FATAL_ERROR "conan install command failed.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(${conanfile_cmake})
|
|
||||||
#conan_basic_setup(TARGETS)
|
|
||||||
conan_basic_setup()
|
|
||||||
endmacro()
|
|
@ -1,18 +1,23 @@
|
|||||||
[requires]
|
[requires]
|
||||||
gsl_microsoft/20180102@bincrafters/stable
|
gsl_microsoft/20180102@bincrafters/stable
|
||||||
spdlog/0.16.3@bincrafters/stable
|
fmt/6.1.2
|
||||||
#fmt/5.2.1@bincrafters/stable
|
seasocks/1.4.4
|
||||||
fmt/4.1.0@bincrafters/stable
|
|
||||||
Seasocks/1.3.2@minres/stable
|
|
||||||
SystemC/2.3.3@minres/stable
|
SystemC/2.3.3@minres/stable
|
||||||
SystemCVerification/2.0.1@minres/stable
|
SystemCVerification/2.0.1@minres/stable
|
||||||
SystemC-CCI/1.0.0@minres/stable
|
SystemC-CCI/1.0.0@minres/stable
|
||||||
|
#fbrdb/0.1.0@minres/testing
|
||||||
|
tcc/0.9.27@minres/stable
|
||||||
|
boost/1.71.0@conan/stable
|
||||||
|
zlib/1.2.11
|
||||||
|
|
||||||
[generators]
|
[generators]
|
||||||
cmake
|
cmake
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
Seasocks:shared=True
|
seasocks:shared=True
|
||||||
|
boost:fPIC=True
|
||||||
|
boost:shared=False
|
||||||
|
boost:header_only=False
|
||||||
fmt:header_only=True
|
fmt:header_only=True
|
||||||
SystemC:stdcxx=11
|
SystemC:stdcxx=11
|
||||||
SystemC:shared=True
|
SystemC:shared=True
|
||||||
@ -20,3 +25,5 @@
|
|||||||
SystemCVerification:shared=True
|
SystemCVerification:shared=True
|
||||||
SystemC-CCI:stdcxx=11
|
SystemC-CCI:stdcxx=11
|
||||||
SystemC-CCI:shared=True
|
SystemC-CCI:shared=True
|
||||||
|
#fbrdb:stdcxx=11
|
||||||
|
|
||||||
|
2
dbt-core
2
dbt-core
Submodule dbt-core updated: c1d65b863b...d87dfff430
42
etc/riscv-sim Release dhrystone.launch
Normal file
42
etc/riscv-sim Release dhrystone.launch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
|
||||||
|
<booleanAttribute key="de.toem.impulse.launchactivateLaunch" value="false"/>
|
||||||
|
<booleanAttribute key="de.toem.impulse.launchactivateTermination" value="false"/>
|
||||||
|
<intAttribute key="de.toem.impulse.launchdelayLaunch" value="0"/>
|
||||||
|
<intAttribute key="de.toem.impulse.launchlaunch" value="2"/>
|
||||||
|
<intAttribute key="de.toem.impulse.launchmode" value="3"/>
|
||||||
|
<stringAttribute key="de.toem.impulse.launchport" value=""/>
|
||||||
|
<booleanAttribute key="de.toem.impulse.launchrestart" value="true"/>
|
||||||
|
<intAttribute key="de.toem.impulse.launchterminate" value="1"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
|
||||||
|
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
|
||||||
|
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
|
||||||
|
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="1"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-v4 ${project_loc:dhrystone}/dhrystone"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build/Release/riscv/bin/riscv-sim"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RISCV-VP"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.config.gnu.exe.release.1745230171"/>
|
||||||
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||||
|
<listEntry value="/RISCV-VP"/>
|
||||||
|
</listAttribute>
|
||||||
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||||
|
<listEntry value="4"/>
|
||||||
|
</listAttribute>
|
||||||
|
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/>
|
||||||
|
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||||
|
</launchConfiguration>
|
2
external/CMakeLists.txt
vendored
2
external/CMakeLists.txt
vendored
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.3)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
|
||||||
|
|
||||||
# Set the name of your project here
|
# Set the name of your project here
|
||||||
|
@ -1,60 +1,3 @@
|
|||||||
cmake_minimum_required(VERSION 3.3)
|
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)
|
|
@ -30,8 +30,8 @@
|
|||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#ifndef _SIFIVE_HIFIVE1_H_
|
#ifndef _SYSC_TOP_HIFIVE1_H_
|
||||||
#define _SIFIVE_HIFIVE1_H_
|
#define _SYSC_TOP_HIFIVE1_H_
|
||||||
|
|
||||||
#include <sysc/top/terminal.h>
|
#include <sysc/top/terminal.h>
|
||||||
#include <sysc/top/mcp_adc.h>
|
#include <sysc/top/mcp_adc.h>
|
||||||
@ -65,4 +65,4 @@ protected:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _SYSC_SIFIVE_HIFIVE1_H_ */
|
#endif /* _SYSC_TOP_HIFIVE1_H_ */
|
||||||
|
@ -42,11 +42,6 @@ using namespace sc_core;
|
|||||||
CLIParser::CLIParser(int argc, char *argv[])
|
CLIParser::CLIParser(int argc, char *argv[])
|
||||||
: desc("Options")
|
: desc("Options")
|
||||||
, valid(false) {
|
, valid(false) {
|
||||||
scc::init_logging();
|
|
||||||
LOGGER(DEFAULT)::reporting_level() = logging::WARNING;
|
|
||||||
LOGGER(connection)::reporting_level() = logging::WARNING;
|
|
||||||
LOGGER(SystemC)::reporting_level() = logging::WARNING;
|
|
||||||
|
|
||||||
build();
|
build();
|
||||||
try {
|
try {
|
||||||
// Variant 1: no non-options
|
// Variant 1: no non-options
|
||||||
@ -73,6 +68,7 @@ CLIParser::CLIParser(int argc, char *argv[])
|
|||||||
// --help option
|
// --help option
|
||||||
if (vm_.count("help")) {
|
if (vm_.count("help")) {
|
||||||
std::cout << "DBT-RISE-RiscV simulator for RISC-V" << std::endl << desc << std::endl;
|
std::cout << "DBT-RISE-RiscV simulator for RISC-V" << std::endl << desc << std::endl;
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
po::notify(vm_); // throws on error, so do after help in case there are any problems
|
po::notify(vm_); // throws on error, so do after help in case there are any problems
|
||||||
valid = true;
|
valid = true;
|
||||||
@ -80,51 +76,58 @@ 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;
|
||||||
}
|
}
|
||||||
if (vm_.count("verbose")) { // NONE, FATAL, ERROR, WARNING, INFO, DEBUG, TRACE
|
|
||||||
const std::array<int, 8> verbosity = {SC_NONE, // Logging::NONE
|
auto verbosity = !vm_["Verbose"].defaulted() ? vm_["Verbose"].as<unsigned>() : vm_.count("verbose") ? vm_["verbose"].as<unsigned>() : 3;
|
||||||
SC_LOW, // Logging::FATAL
|
auto colored_output = vm_["Verbose"].defaulted();
|
||||||
SC_LOW, // Logging::ERROR
|
auto dbg_level = vm_.count("debug-level")
|
||||||
SC_LOW, // Logging::WARNING
|
? vm_["debug-level"].as<scc::log>()
|
||||||
SC_MEDIUM, // Logging::INFO
|
: static_cast<scc::log>(std::min<unsigned>(static_cast<unsigned>(scc::log::DBGTRACE), verbosity));
|
||||||
SC_HIGH, // logging::DEBUG
|
|
||||||
SC_FULL, // logging::TRACE
|
auto log_regex = vm_["log-filter"].as<std::string>();
|
||||||
SC_DEBUG}; // logging::TRACE+1
|
|
||||||
auto log_level = vm_["verbose"].as<int>();
|
|
||||||
auto l = logging::as_log_level(log_level > 6 ? 6 : log_level);
|
|
||||||
LOGGER(DEFAULT)::reporting_level() = l;
|
|
||||||
LOGGER(DEFAULT)::print_time() = false;
|
|
||||||
LOGGER(connection)::reporting_level() = l;
|
|
||||||
LOGGER(connection)::print_time() = false;
|
|
||||||
LOGGER(SystemC)::reporting_level() = l;
|
|
||||||
LOGGER(SystemC)::print_time() = false;
|
|
||||||
sc_report_handler::set_verbosity_level(verbosity[log_level]);
|
|
||||||
}
|
|
||||||
if (vm_.count("log-file")) {
|
if (vm_.count("log-file")) {
|
||||||
// configure the connection logger
|
auto log_file_name = vm_["log-file"].as<std::string>();
|
||||||
auto f = fopen(vm_["log-file"].as<std::string>().c_str(), "w");
|
scc::init_logging(scc::LogConfig()
|
||||||
LOG_OUTPUT(DEFAULT)::stream() = f;
|
.logFileName(log_file_name)
|
||||||
LOG_OUTPUT(connection)::stream() = f;
|
.logLevel(dbg_level)
|
||||||
LOG_OUTPUT(SystemC)::stream() = f;
|
.logFilterRegex(log_regex)
|
||||||
|
.coloredOutput(colored_output)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
scc::init_logging(scc::LogConfig()
|
||||||
|
.logLevel(dbg_level)
|
||||||
|
.logFilterRegex(log_regex)
|
||||||
|
.coloredOutput(colored_output)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
LOGGER(DEFAULT)::reporting_level()=static_cast<logging::log_level>(dbg_level);
|
||||||
|
LOGGER(DEFAULT)::print_time()=false;
|
||||||
|
LOGGER(DEFAULT)::print_severity()=false;
|
||||||
|
LOG_OUTPUT(DEFAULT)::ostream() = &std::cout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLIParser::build() {
|
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<int>()->implicit_value(3), "Sets logging verbosity")
|
("verbose,v", po::value<unsigned>()->implicit_value(4), "Sets logging verbosity")
|
||||||
("log-file", po::value<std::string>(), "Sets default log file.")
|
("Verbose,V", po::value<unsigned>()->default_value(logging::INFO), "Debug output level as with --verbose but print non-colored")
|
||||||
("disass,d", po::value<std::string>()->implicit_value(""), "Enables disassembly")
|
("debug-level,D", po::value<scc::log>(), "Debug output level (textual) as with --verbose")
|
||||||
("elf,l", po::value<std::string>(), "ELF file to load")
|
("log-file", po::value<std::string>(), "Sets default log file.")
|
||||||
("gdb-port,g", po::value<unsigned short>()->default_value(0), "enable gdb server and specify port to use")
|
("log-filter", po::value<std::string>()->default_value(""), "log filter regular expression name")
|
||||||
("dump-ir", "dump the intermediate representation")
|
("disass,d", po::value<std::string>()->implicit_value(""), "Enables disassembly")
|
||||||
("quantum", po::value<unsigned>(), "SystemC quantum time in ns")
|
("elf,l", po::value<std::string>(), "ELF file to load")
|
||||||
("reset,r", po::value<std::string>(), "reset address")
|
("gdb-port,g", po::value<unsigned short>()->default_value(0), "enable gdb server and specify port to use")
|
||||||
("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")
|
("ir-dump", "dump the intermediate representation")
|
||||||
|
("quantum", po::value<unsigned>(), "SystemC quantum time in ns")
|
||||||
|
("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")
|
("backend", po::value<std::string>()->default_value("tcc"), "ISS engine to use")
|
||||||
|
("heart-beat,b", "Enable heartbeat printing")
|
||||||
|
("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
|
||||||
}
|
}
|
||||||
|
@ -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_LIBS_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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include <scc/configurable_tracer.h>
|
#include <scc/configurable_tracer.h>
|
||||||
#include <scc/configurer.h>
|
#include <scc/configurer.h>
|
||||||
|
#include <scc/perf_estimator.h>
|
||||||
#include <scc/report.h>
|
#include <scc/report.h>
|
||||||
#include <scc/scv_tr_db.h>
|
#include <scc/scv_tr_db.h>
|
||||||
#include <scc/tracer.h>
|
#include <scc/tracer.h>
|
||||||
@ -44,10 +45,13 @@
|
|||||||
#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>
|
||||||
|
|
||||||
|
using namespace sc_core;
|
||||||
using namespace sysc;
|
using namespace sysc;
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
@ -63,18 +67,18 @@ 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);
|
||||||
|
scc::stream_redirection cout_redir(std::cout, scc::log::INFO);
|
||||||
|
scc::stream_redirection cerr_redir(std::cerr, scc::log::ERROR);
|
||||||
if (!parser.is_valid()) return ERROR_IN_COMMAND_LINE;
|
if (!parser.is_valid()) return ERROR_IN_COMMAND_LINE;
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 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
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -90,6 +94,7 @@ int sc_main(int argc, char *argv[]) {
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// instantiate top level
|
// instantiate top level
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
auto estimator = scc::make_unique<scc::perf_estimator>(parser.is_set("heart-beat") ? 10_us : SC_ZERO_TIME);
|
||||||
auto i_system = scc::make_unique<sysc::system>("i_system");
|
auto i_system = scc::make_unique<sysc::system>("i_system");
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// add non-implemented 'enableTracing' properties
|
// add non-implemented 'enableTracing' properties
|
||||||
@ -106,17 +111,18 @@ int sc_main(int argc, char *argv[]) {
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// overwrite config with command line settings
|
// overwrite config with command line settings
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.backend", parser.get<std::string>("backend"));
|
||||||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.gdb_server_port", parser.get<unsigned short>("gdb-port"));
|
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.gdb_server_port", parser.get<unsigned short>("gdb-port"));
|
||||||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.dump_ir", parser.is_set("dump-ir"));
|
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.dump_ir", parser.is_set("dump-ir"));
|
||||||
if (parser.is_set("elf"))
|
if (parser.is_set("elf"))
|
||||||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", parser.get<std::string>("elf"));
|
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", parser.get<std::string>("elf"));
|
||||||
else {
|
else if (parser.is_set("argv")){
|
||||||
auto args = parser.get<std::vector<std::string>>("argv");
|
auto args = parser.get<std::vector<std::string>>("argv");
|
||||||
if(args.size())
|
if(args.size())
|
||||||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", args[0]);
|
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", args[0]);
|
||||||
}
|
}
|
||||||
if (parser.is_set("quantum"))
|
if (parser.is_set("quantum"))
|
||||||
tlm::tlm_global_quantum::instance().set(sc_core::sc_time(parser.get<unsigned>("quantum"), sc_core::SC_NS));
|
tlm::tlm_global_quantum::instance().set(sc_time(parser.get<unsigned>("quantum"), SC_NS));
|
||||||
if (parser.is_set("reset")) {
|
if (parser.is_set("reset")) {
|
||||||
auto str = parser.get<std::string>("reset");
|
auto str = parser.get<std::string>("reset");
|
||||||
uint64_t start_address = str.find("0x") == 0 ? std::stoull(str.substr(2), nullptr, 16) : std::stoull(str, nullptr, 10);
|
uint64_t start_address = str.find("0x") == 0 ? std::stoull(str.substr(2), nullptr, 16) : std::stoull(str, nullptr, 10);
|
||||||
@ -137,12 +143,22 @@ int sc_main(int argc, char *argv[]) {
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
try {
|
try {
|
||||||
if (parser.is_set("max_time")) {
|
if (parser.is_set("max_time")) {
|
||||||
sc_core::sc_start(scc::parse_from_string(parser.get<std::string>("max_time")));
|
sc_start(scc::parse_from_string(parser.get<std::string>("max_time")));
|
||||||
} else
|
} else
|
||||||
sc_core::sc_start();
|
sc_start();
|
||||||
if (!sc_core::sc_end_of_simulation_invoked()) sc_core::sc_stop();
|
} catch(sc_report& e) {
|
||||||
} catch (sc_core::sc_report &rep) {
|
SCCERR() << "Caught sc_report exception during simulation: " << e.what() << ":" << e.get_msg();
|
||||||
sc_core::sc_report_handler::get_handler()(rep, sc_core::SC_DISPLAY | sc_core::SC_STOP);
|
} catch(std::exception& e) {
|
||||||
|
SCCERR() << "Caught exception during simulation: " << e.what();
|
||||||
|
} catch(...) {
|
||||||
|
SCCERR() << "Caught unspecified exception during simulation";
|
||||||
}
|
}
|
||||||
return 0;
|
if(sc_is_running()) {
|
||||||
|
SCCERR() << "Simulation timeout!"; // calls sc_stop
|
||||||
|
}
|
||||||
|
auto errcnt = sc_report_handler::get_count(SC_ERROR);
|
||||||
|
auto warncnt = sc_report_handler::get_count(SC_WARNING);
|
||||||
|
SCCINFO() << "Finished, there were " << errcnt << " error" << (errcnt == 1 ? "" : "s") << " and " << warncnt << " warning"
|
||||||
|
<< (warncnt == 1 ? "" : "s");
|
||||||
|
return errcnt + warncnt;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
@ -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;
|
||||||
|
@ -62,7 +62,7 @@ inline void die() {
|
|||||||
|
|
||||||
sc_comm_singleton::sc_comm_singleton(sc_core::sc_module_name nm)
|
sc_comm_singleton::sc_comm_singleton(sc_core::sc_module_name nm)
|
||||||
: sc_core::sc_module(nm)
|
: sc_core::sc_module(nm)
|
||||||
, m_serv(new Server(std::make_shared<PrintfLogger>(Logger::Level::WARNING)))
|
, m_serv(new Server(std::make_shared<PrintfLogger>(Logger::Level::Warning)))
|
||||||
, needs_client(false)
|
, needs_client(false)
|
||||||
, client_started(false) {
|
, client_started(false) {
|
||||||
m_serv->addPageHandler(std::make_shared<DefaultPageHandler>(*this));
|
m_serv->addPageHandler(std::make_shared<DefaultPageHandler>(*this));
|
||||||
|
@ -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
2
riscv
Submodule riscv updated: d037141d98...18976e2ce4
2
scc
2
scc
Submodule scc updated: 140a5a7067...529cb29a48
Reference in New Issue
Block a user