36 Commits

Author SHA1 Message Date
9248b7f246 update README 2020-11-27 17:05:11 +01:00
8d4d099f3a replace selfmade seasocks package with official one 2020-08-17 11:51:34 +02:00
2b6d7530e3 update seasocks package 2020-08-11 16:39:27 +02:00
c50da08b18 build on ubuntu20.04 2020-08-11 11:22:05 +02:00
59545434d3 update to Boost 1.70 via conan 2020-08-10 21:28:51 +02:00
a82d6e408b add ubuntu-20.04 in Jenkins setup 2020-08-07 09:44:47 +02:00
95419571c3 update dbt-core to solve TCC issue 2020-06-25 15:38:22 +02:00
7402a19732 fix help switch 2020-06-25 08:27:29 +02:00
3cdc7431ad „Jenkinsfile“ ändern 2020-06-23 18:24:55 +02:00
744db33d41 parallel jenkins setup 2020-06-23 18:19:12 +02:00
2552973c15 Initial Jenkins setup 2020-06-23 16:46:24 +02:00
6fceee3724 update submodules 2020-06-22 08:45:35 +02:00
6f53970c40 add backend selection and improve logging 2020-06-18 09:59:09 +02:00
ea4657b77c Merge branch 'master' into develop 2020-06-18 07:42:10 +02:00
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
84e73c04a1 update submodule pointers 2020-06-18 06:20:04 +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
31c4d467ee [WIP] implement basic infrastructure 2020-04-12 12:46:20 +02:00
a66c2c5dca [WIP] integrate tcc via conan pkg 2020-04-10 17:15:35 +02:00
086021da31 fxi inconsitency in CLI parser 2020-04-10 17:14:29 +02:00
3b9fdfde0a update scc 2020-04-05 20:06:42 +02:00
f928ad5814 „README.md“ ändern 2020-03-30 19:41:35 +00:00
7769d26f20 Moved dbt-core and riscv submodules 2020-01-12 21:14:37 +01:00
6e751ac2b4 „README.md“ ändern 2020-01-11 09:07:02 +00:00
d6c6d181aa Merge branch 'develop' of https://git.minres.com/VP/RISCV-VP.git into
develop

Conflicts:
	conanfile.txt
	dbt-core
	platform/src/CLIParser.cpp
	riscv
	scc
2020-01-09 19:47:23 +01:00
ad1804d23e Updated to latest scc version 2020-01-09 19:40:19 +01:00
6b85f42c3e Updated submodules 2020-01-07 16:40:36 +01:00
be0c930879 Adapted to latest changes in SCC and DBT_RISE(-RISCV) repos 2019-12-09 00:45:25 +00:00
27 changed files with 323 additions and 399 deletions

View File

@ -13,11 +13,11 @@
</extensions>
</storageModule>
<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="">
<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"/>
<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.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"/>

1
.gitignore vendored
View File

@ -30,3 +30,4 @@ language.settings.xml
/.gdbinit
/*.out
/dump.json
/*.c

View File

@ -5,11 +5,6 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
@ -28,7 +23,5 @@
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.linuxtools.tmf.project.nature</nature>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>

View File

@ -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>

View File

@ -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)
project(RISCV-VP VERSION 1.0.0 LANGUAGES CXX)
set(ENABLE_SCV TRUE CACHE BOOL "Enable use of SCV")
set(ENABLE_SHARED TRUE CACHE BOOL "Build shared libraries")
set(WITH_LLVM FALSE CACHE BOOL "Build LLVM based backend")
include(GitFunctions)
get_branch_from_git()
# if we are not on master or develop set the submodules to develop
IF(NOT ${GIT_BRANCH} MATCHES "master")
IF(NOT ${GIT_BRANCH} MATCHES "develop")
message(STATUS "main branch is '${GIT_BRANCH}', setting submodules to 'develop'")
set(GIT_BRANCH develop)
endif()
endif()
#IF(NOT ${GIT_BRANCH} MATCHES "master")
# IF(NOT ${GIT_BRANCH} MATCHES "develop")
# message(STATUS "main branch is '${GIT_BRANCH}', setting submodules to 'develop'")
# set(GIT_BRANCH develop)
# endif()
#endif()
### set the directory names of the submodules
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})
include(GNUInstallDirs)
include(Submodules)
#include(Submodules)
include(Conan)
#enable_testing()
@ -40,11 +45,11 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" 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")
elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
endif()
endif()
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")
endif()
setup_conan()
setup_conan(TARGETS)
# 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.
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)
set(BOOST_ROOT ${CONAN_BOOST_ROOT})
find_package(Threads)
find_package(Tcmalloc)
find_package(ZLIB)
find_package(SystemC)
find_package(OSCISystemC)
if(SystemC_FOUND)
message(STATUS "SystemC headers at ${SystemC_INCLUDE_DIRS}")
message(STATUS "SystemC library at ${SystemC_LIBRARY_DIRS}")
@ -88,7 +84,6 @@ if(SystemC_FOUND)
endif()
endif(SystemC_FOUND)
set(PROJECT_3PARTY_DIRS external)
include(clang-format)
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Add clang-tidy automatically to builds")
@ -105,16 +100,8 @@ if (ENABLE_CLANG_TIDY)
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(dbt-core)
add_subdirectory(riscv)
add_subdirectory(scc)
add_subdirectory(platform)
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")

108
Jenkinsfile vendored Normal file
View 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()}
}
}
}
}
}
}
}

View File

@ -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
* 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):
```
pip install conan
```
* 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 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
```
compiler.libcxx=libstdc++11
```
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
pip install --user conan
pip3 install --user conan
```
*** prepare Fedora 28 ***
***prepare Fedora 28***
```
#prepare system
@ -59,17 +58,14 @@ in $HOME/.conan/profiles/default
export PATH=${PATH}:$HOME/.local/bin
```
*** Build the ISS ***
***Build the ISS***
```
# configure conan
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 profile new default --detect
# clone and build DBT-RISE-RISCV
git clone --recursive https://github.com/Minres/DBT-RISE-RISCV.git
cd DBT-RISE-RISCV/
git checkout develop
# checkout source from git:
git clone --recursive https://git.minres.com/VP/HIFIVE1-VP.git
# build ISS:
cd HIFIVE1-VP
mkdir build;cd build
MAKE_FLAGS="-j4" cmake ..
make -j4

View File

@ -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")

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,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()

View File

@ -1,18 +1,23 @@
[requires]
gsl_microsoft/20180102@bincrafters/stable
spdlog/0.16.3@bincrafters/stable
#fmt/5.2.1@bincrafters/stable
fmt/4.1.0@bincrafters/stable
Seasocks/1.3.2@minres/stable
fmt/6.1.2
seasocks/1.4.4
SystemC/2.3.3@minres/stable
SystemCVerification/2.0.1@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]
cmake
[options]
Seasocks:shared=True
seasocks:shared=True
boost:fPIC=True
boost:shared=False
boost:header_only=False
fmt:header_only=True
SystemC:stdcxx=11
SystemC:shared=True
@ -20,3 +25,5 @@
SystemCVerification:shared=True
SystemC-CCI:stdcxx=11
SystemC-CCI:shared=True
#fbrdb:stdcxx=11

View 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&#10;${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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#10;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@ -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 the name of your project here

View File

@ -1,60 +1,3 @@
cmake_minimum_required(VERSION 3.3)
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)
cmake_minimum_required(VERSION 3.12)
add_subdirectory(src)
#
# SYSTEM PACKAGING (RPM, TGZ, ...)
# _____________________________________________________________________________
#include(CPackConfig)
#
# CMAKE PACKAGING (for other CMake projects to use this one easily)
# _____________________________________________________________________________
#include(PackageConfigurator)

View File

@ -30,8 +30,8 @@
*
*******************************************************************************/
#ifndef _SIFIVE_HIFIVE1_H_
#define _SIFIVE_HIFIVE1_H_
#ifndef _SYSC_TOP_HIFIVE1_H_
#define _SYSC_TOP_HIFIVE1_H_
#include <sysc/top/terminal.h>
#include <sysc/top/mcp_adc.h>
@ -65,4 +65,4 @@ protected:
}
#endif /* _SYSC_SIFIVE_HIFIVE1_H_ */
#endif /* _SYSC_TOP_HIFIVE1_H_ */

View File

@ -42,11 +42,6 @@ using namespace sc_core;
CLIParser::CLIParser(int argc, char *argv[])
: desc("Options")
, valid(false) {
scc::init_logging();
LOGGER(DEFAULT)::reporting_level() = logging::WARNING;
LOGGER(connection)::reporting_level() = logging::WARNING;
LOGGER(SystemC)::reporting_level() = logging::WARNING;
build();
try {
// Variant 1: no non-options
@ -73,6 +68,7 @@ CLIParser::CLIParser(int argc, char *argv[])
// --help option
if (vm_.count("help")) {
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
valid = true;
@ -80,50 +76,57 @@ CLIParser::CLIParser(int argc, char *argv[])
std::cerr << "ERROR: " << e.what() << std::endl << 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
SC_LOW, // Logging::FATAL
SC_LOW, // Logging::ERROR
SC_LOW, // Logging::WARNING
SC_MEDIUM, // Logging::INFO
SC_HIGH, // logging::DEBUG
SC_FULL, // logging::TRACE
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]);
}
auto verbosity = !vm_["Verbose"].defaulted() ? vm_["Verbose"].as<unsigned>() : vm_.count("verbose") ? vm_["verbose"].as<unsigned>() : 3;
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>();
if (vm_.count("log-file")) {
// configure the connection logger
auto f = fopen(vm_["log-file"].as<std::string>().c_str(), "w");
LOG_OUTPUT(DEFAULT)::stream() = f;
LOG_OUTPUT(connection)::stream() = f;
LOG_OUTPUT(SystemC)::stream() = f;
auto log_file_name = vm_["log-file"].as<std::string>();
scc::init_logging(scc::LogConfig()
.logFileName(log_file_name)
.logLevel(dbg_level)
.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() {
// clang-format off
desc.add_options()
("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")
("Verbose,V", po::value<unsigned>()->default_value(logging::INFO), "Debug output level as with --verbose but print non-colored")
("debug-level,D", po::value<scc::log>(), "Debug output level (textual) as with --verbose")
("log-file", po::value<std::string>(), "Sets default log file.")
("log-filter", po::value<std::string>()->default_value(""), "log filter regular expression name")
("disass,d", po::value<std::string>()->implicit_value(""), "Enables disassembly")
("elf,l", po::value<std::string>(), "ELF file to load")
("gdb-port,g", po::value<unsigned short>()->default_value(0), "enable gdb server and specify port to use")
("dump-ir", "dump the intermediate representation")
("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-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")
("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");
// 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
FILE(GLOB RiscVSCHeaders ${PROJECT_SOURCE_DIR}/incl/sysc/*.h ${PROJECT_SOURCE_DIR}/incl/sysc/*/*.h)
set(LIB_HEADERS ${RiscVSCHeaders} )
set(LIB_SOURCES
sysc/aon.cpp
sysc/BLDC.cpp
@ -21,86 +29,30 @@ set(LIB_SOURCES
sysc/uart.cpp
CLIParser.cpp )
set(APP_SOURCES sc_main.cpp)
# Define two variables in order not to repeat ourselves.
set(LIBRARY_NAME platform)
## 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.
add_library(platform ${LIB_SOURCES})
target_include_directories(platform PUBLIC ../incl)
target_link_libraries(platform PUBLIC riscv_sc CONAN_PKG::seasocks external)
set_target_properties(platform PROPERTIES
VERSION ${PROJECT_VERSION} # ${VERSION} was defined in the main CMakeLists.
FRAMEWORK FALSE
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
)
# This is a make target, so you can do a "make riscv-sc"
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})
add_executable(riscv-vp sc_main.cpp)
# include files for this application
target_include_directories(${APPLICATION_NAME} SYSTEM PRIVATE ${LLVM_INCLUDE_DIRS})
# Links the target exe against the libraries
target_link_libraries(${APPLICATION_NAME} ${LIBRARY_NAME})
target_link_libraries(${APPLICATION_NAME} riscv_sc)
target_link_libraries(${APPLICATION_NAME} 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} )
target_include_directories(riscv-vp SYSTEM PRIVATE ${LLVM_INCLUDE_DIRS})
target_link_libraries(riscv-vp PUBLIC platform riscv_sc)
if (Tcmalloc_FOUND)
target_link_libraries(${APPLICATION_NAME} ${Tcmalloc_LIBRARIES})
target_link_libraries(riscv-vp PUBLIC ${Tcmalloc_LIBRARIES})
endif(Tcmalloc_FOUND)
# Says how and where to install software
# 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}
install(TARGETS platform riscv-vp
EXPORT ${PROJECT_NAME}Targets # for downstream dependencies
ARCHIVE DESTINATION lib COMPONENT libs # static lib
RUNTIME DESTINATION bin COMPONENT libs # binaries
LIBRARY DESTINATION lib COMPONENT libs # shared lib
FRAMEWORK DESTINATION bin COMPONENT libs # for mac
PUBLIC_HEADER DESTINATION incl/${PROJECT_NAME} COMPONENT devel # headers for mac (note the different component -> different package)
INCLUDES DESTINATION incl # headers
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # for mac
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} COMPONENT devel # headers for mac (note the different component -> different package)
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # headers
)

View File

@ -36,6 +36,7 @@
#include <scc/configurable_tracer.h>
#include <scc/configurer.h>
#include <scc/perf_estimator.h>
#include <scc/report.h>
#include <scc/scv_tr_db.h>
#include <scc/tracer.h>
@ -44,10 +45,13 @@
#include <cci_utils/broker.h>
#include <boost/program_options.hpp>
#ifdef WITH_LLVM
#include <iss/llvm/jit_helper.h>
#endif
#include <fstream>
#include <sstream>
using namespace sc_core;
using namespace sysc;
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);
///////////////////////////////////////////////////////////////////////////
// create global CCI broker
///////////////////////////////////////////////////////////////////////////
cci::cci_register_broker(new cci_utils::broker("Global Broker"));
///////////////////////////////////////////////////////////////////////////
// CLI argument parsing & logging setup
///////////////////////////////////////////////////////////////////////////
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;
///////////////////////////////////////////////////////////////////////////
// set up infrastructure
///////////////////////////////////////////////////////////////////////////
#ifdef WITH_LLVM
iss::init_jit_debug(argc, argv);
#endif
///////////////////////////////////////////////////////////////////////////
// set up configuration
///////////////////////////////////////////////////////////////////////////
@ -90,6 +94,7 @@ int sc_main(int argc, char *argv[]) {
///////////////////////////////////////////////////////////////////////////
// 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");
///////////////////////////////////////////////////////////////////////////
// add non-implemented 'enableTracing' properties
@ -106,17 +111,18 @@ int sc_main(int argc, char *argv[]) {
///////////////////////////////////////////////////////////////////////////
// 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.dump_ir", parser.is_set("dump-ir"));
if (parser.is_set("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");
if(args.size())
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", args[0]);
}
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")) {
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);
@ -137,12 +143,22 @@ int sc_main(int argc, char *argv[]) {
///////////////////////////////////////////////////////////////////////////
try {
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
sc_core::sc_start();
if (!sc_core::sc_end_of_simulation_invoked()) sc_core::sc_stop();
} catch (sc_core::sc_report &rep) {
sc_core::sc_report_handler::get_handler()(rep, sc_core::SC_DISPLAY | sc_core::SC_STOP);
sc_start();
} catch(sc_report& e) {
SCCERR() << "Caught sc_report exception during simulation: " << e.what() << ":" << e.get_msg();
} 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;
}

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) {
sc_core::sc_time next_trigger =
(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_int_o.write(false);
} else {
SCTRACE() << "Timer fired at " << sc_time_stamp();
SCCTRACE() << "Timer fired at " << sc_time_stamp();
mtime_int_o.write(true);
}
}

View File

@ -111,7 +111,7 @@ gpio::~gpio() = default;
void gpio::before_end_of_elaboration() {
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>();
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 norm = 1024.0 * inp / vref;
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[2] = bit_sub<0, 8>(res);
} else {
@ -176,7 +176,7 @@ void mcp_3208::do_conversion() {
auto inp = ch_i[channel].read();
auto norm = 4096.0 * inp / vref;
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;
tx_bytes[1] = bit_sub<8, 4>(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) {
regs->r_pending[reg_idx] = regs->r_pending[reg_idx] | (0x1 << bit_ofs);
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_int = i;
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
} else {
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) {
// todo: evaluate enable register (see 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
auto reg_idx = irq >> 5;
auto bit_ofs = irq & 0x1F;

View File

@ -62,7 +62,7 @@ inline void die() {
sc_comm_singleton::sc_comm_singleton(sc_core::sc_module_name 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)
, client_started(false) {
m_serv->addPageHandler(std::make_shared<DefaultPageHandler>(*this));

View File

@ -57,7 +57,7 @@ terminal::~terminal() = default;
void terminal::before_end_of_elaboration() {
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>();
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());
});
else
SCINFO(this->name()) << " receive: '" << msg << "'";
SCCINFO(this->name()) << " receive: '" << msg << "'";
queue.clear();
}
}

2
riscv

Submodule riscv updated: d037141d98...18976e2ce4

2
scc

Submodule scc updated: 140a5a7067...529cb29a48