diff --git a/.cproject b/.cproject
index 1f4904f..82a9744 100644
--- a/.cproject
+++ b/.cproject
@@ -1,206 +1,296 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- make
-
- all VERBOSE=1
- true
- true
- true
-
-
- make
-
- clean
- true
- true
- true
-
-
- make
-
- all
- true
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
index b7eb8e8..d9e41be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,4 @@
/build/
/simple_system.txlog
+/my_db*
diff --git a/.gitmodules b/.gitmodules
index 2d6da2b..4b9b4da 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -2,3 +2,4 @@
path = sc-components
url = https://git.minres.com/SystemC/SystemC-Components.git
branch = master
+
\ No newline at end of file
diff --git a/.project b/.project
index 48a6ba2..63b8ead 100644
--- a/.project
+++ b/.project
@@ -1,6 +1,6 @@
- sc-components-test
+ SystemC-Components-Test
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index f58bb36..a6b251d 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -1,35 +1,54 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs
deleted file mode 100644
index eb4d582..0000000
--- a/.settings/org.eclipse.cdt.core.prefs
+++ /dev/null
@@ -1,11 +0,0 @@
-eclipse.preferences.version=1
-environment/project/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/SC_DEFAULT_WRITER_POLICY/delimiter=\:
-environment/project/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/SC_DEFAULT_WRITER_POLICY/operation=append
-environment/project/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/SC_DEFAULT_WRITER_POLICY/value=SC_MANY_WRITERS
-environment/project/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/append=true
-environment/project/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/appendContributed=true
-environment/project/cdt.managedbuild.config.macosx.exe.release.222902119/SC_DEFAULT_WRITER_POLICY/delimiter=\:
-environment/project/cdt.managedbuild.config.macosx.exe.release.222902119/SC_DEFAULT_WRITER_POLICY/operation=append
-environment/project/cdt.managedbuild.config.macosx.exe.release.222902119/SC_DEFAULT_WRITER_POLICY/value=SC_MANY_WRITERS
-environment/project/cdt.managedbuild.config.macosx.exe.release.222902119/append=true
-environment/project/cdt.managedbuild.config.macosx.exe.release.222902119/appendContributed=true
diff --git a/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/.settings/org.eclipse.cdt.managedbuilder.core.prefs
index 75aa130..1a45a6c 100644
--- a/.settings/org.eclipse.cdt.managedbuilder.core.prefs
+++ b/.settings/org.eclipse.cdt.managedbuilder.core.prefs
@@ -1,13 +1,25 @@
eclipse.preferences.version=1
-environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/CPATH/delimiter=\:
-environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/CPATH/operation=remove
-environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/CPLUS_INCLUDE_PATH/delimiter=\:
-environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/CPLUS_INCLUDE_PATH/operation=remove
-environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/C_INCLUDE_PATH/delimiter=\:
-environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/C_INCLUDE_PATH/operation=remove
-environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/append=true
-environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/appendContributed=true
-environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/LIBRARY_PATH/delimiter=\:
-environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/LIBRARY_PATH/operation=remove
-environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/append=true
-environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/appendContributed=true
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/CPATH/delimiter=\:
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/CPATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/CPLUS_INCLUDE_PATH/delimiter=\:
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/CPLUS_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/C_INCLUDE_PATH/delimiter=\:
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/append=true
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/appendContributed=true
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/CPATH/delimiter=\:
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/CPATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/CPLUS_INCLUDE_PATH/delimiter=\:
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/CPLUS_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/C_INCLUDE_PATH/delimiter=\:
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/append=true
+environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/appendContributed=true
+environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/LIBRARY_PATH/delimiter=\:
+environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/LIBRARY_PATH/operation=remove
+environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/append=true
+environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/appendContributed=true
+environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632/LIBRARY_PATH/delimiter=\:
+environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632/LIBRARY_PATH/operation=remove
+environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632/append=true
+environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632/appendContributed=true
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a892301..0868b82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,13 @@
-cmake_minimum_required(VERSION 3.3)
-set(CMAKE_MODULE_PATH
- ${CMAKE_MODULE_PATH}
- ${CMAKE_CURRENT_SOURCE_DIR}/cmake
- ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake
-)
+cmake_minimum_required(VERSION 3.12)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake)
+
+project(SCC_Test)
+
+set(ENABLE_SCV TRUE CACHE BOOL "Enable use of SCV")
+
+set(ENABLE_SHARED TRUE CACHE BOOL "Build shared libraries")
+
+set(NO_SUBMODULE_CHECK FALSE CACHE BOOL "Disable the submodule check")
include(GitFunctions)
get_branch_from_git()
@@ -17,21 +21,34 @@ set(GIT_SUBMODULE_DIR_sc-components .)
set(GIT_SUBMODULE_BRANCH_sc-components ${GIT_BRANCH})
include(GNUInstallDirs)
-include(Submodules)
+if(NOT NO_SUBMODULE_CHECK)
+ include(Submodules)
+endif()
include(Conan)
+include(BuildType)
#enable_testing()
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
+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 "")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
+ elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
+ endif()
+endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(warnings "-Wall -Wextra -Werror")
- set(CMAKE_CXX_FLAG_RELEASE "-O2 -DNDEBUG")
- set(CMAKE_C_FLAG_RELEASE "-O2 -DNDEBUG")
- set(CMAKE_CXX_FLAG_DEBUG "-Og")
- set(CMAKE_C_FLAG_DEBUG "-Og")
+ set(CMAKE_CXX_FLAG_RELEASE "-O3 -DNDEBUG")
+ set(CMAKE_C_FLAG_RELEASE "-O3 -DNDEBUG")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(warnings "/W4 /WX /EHsc")
endif()
@@ -40,36 +57,17 @@ setup_conan()
# 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.
-find_package(Boost COMPONENTS program_options system thread REQUIRED)
+find_package(Boost COMPONENTS program_options filesystem system thread REQUIRED)
# set-up SystemC and SCV
-find_package(SystemC)
-if(SystemC_FOUND)
- add_definitions(-DWITH_SYSTEMC)
- include_directories(${SystemC_INCLUDE_DIRS})
- link_directories(${SystemC_LIBRARY_DIRS})
-else()
+find_package(OSCISystemC)
+if(NOT SystemC_FOUND)
message( FATAL_ERROR "SystemC library not found." )
endif()
-if(CCI_FOUND)
- include_directories(${CCI_INCLUDE_DIRS})
- link_directories(${CCI_LIBRARY_DIRS})
-else()
- message( FATAL_ERROR "SystemC CCI library not found." )
-endif()
-
-if(SCV_FOUND)
- add_definitions(-DWITH_SCV)
- link_directories(${SCV_LIBRARY_DIRS})
-endif()
-
-set(PROJECT_3PARTY_DIRS external sr_report sr_signal)
-include(sc-components/cmake/clang-format.cmake)
-
add_subdirectory(sc-components)
add_subdirectory(examples)
-#add_subdirectory(test)
+add_subdirectory(tests)
#
# SYSTEM PACKAGING (RPM, TGZ, ...)
@@ -83,3 +81,5 @@ add_subdirectory(examples)
#include(PackageConfigurator)
+#include(FeatureSummary)
+#feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES PACKAGES_FOUND)
diff --git a/cmake/Conan.cmake b/cmake/Conan.cmake
index 5bd9930..946ccb9 100644
--- a/cmake/Conan.cmake
+++ b/cmake/Conan.cmake
@@ -1,5 +1,5 @@
macro(setup_conan)
- find_program(conan conan)
+ find_program(conan conan PATHS /usr/bin /usr/local/bin)
if(NOT EXISTS ${conan})
message(FATAL_ERROR "Conan is required. Please see README.md")
return()
diff --git a/conanfile.txt b/conanfile.txt
index 4a73fa6..31b07b3 100644
--- a/conanfile.txt
+++ b/conanfile.txt
@@ -1,6 +1,6 @@
[requires]
gsl_microsoft/20180102@bincrafters/stable
- SystemC/2.3.3@minres/stable
+ fmt/6.1.2
SystemCVerification/2.0.1@minres/stable
SystemC-CCI/1.0.0@minres/stable
@@ -9,7 +9,6 @@
txt
[options]
- SystemC:stdcxx=14
- SystemC:shared=True
- SystemCVerification:stdcxx=14
- SystemC-CCI:stdcxx=14
\ No newline at end of file
+ fmt:header_only=True
+ SystemCVerification:stdcxx=11
+ SystemC-CCI:stdcxx=11
\ No newline at end of file
diff --git a/etc/simple_system.launch b/etc/simple_system.launch
index a3c9e5d..0dd0585 100644
--- a/etc/simple_system.launch
+++ b/etc/simple_system.launch
@@ -1,9 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -16,5 +39,6 @@
+
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index af5419e..64f95c4 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,41 +1,8 @@
-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
-
-project (sc-components)
-
-# Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0)
-set(VERSION_MAJOR "0")
-set(VERSION_MINOR "0")
-set(VERSION_PATCH "1")
-set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
-
-include(Common)
-
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
-
-find_package(Threads)
-find_package(SystemC REQUIRED)
-find_package(ZLIB)
-if(SystemC_FOUND)
- include_directories(${SystemC_INCLUDE_DIRS})
- link_directories(${SystemC_LIBRARY_DIRS}
-)
-else()
- message( FATAL_ERROR "SystemC library not found." )
-endif()
-
-if(ZLIB_FOUND)
- include_directories( ${ZLIB_INCLUDE_DIRS} )
-endif(ZLIB_FOUND)
+cmake_minimum_required(VERSION 3.12)
if(SCV_FOUND)
- add_definitions(-DWITH_SCV)
- include_directories(${SCV_INCLUDE_DIRS})
- link_directories(${SCV_LIBRARY_DIRS})
add_subdirectory(transaction_recording)
-endif(SCV_FOUND)
+endif()
add_subdirectory(simple_system)
-add_subdirectory(transaction_recording)
add_subdirectory(ahb_bfm)
diff --git a/examples/simple_system/CMakeLists.txt b/examples/simple_system/CMakeLists.txt
index b2fd00e..4713ca6 100644
--- a/examples/simple_system/CMakeLists.txt
+++ b/examples/simple_system/CMakeLists.txt
@@ -1,6 +1,4 @@
-cmake_minimum_required(VERSION 3.3)
-# Add executable called "simple_system" that is built from the source files
-# "scv_tr_recording_example.cpp". The extensions are automatically found.
+cmake_minimum_required(VERSION 3.12)
add_executable (simple_system
plic.cpp
uart.cpp
@@ -10,9 +8,5 @@ add_executable (simple_system
simple_system.cpp
sc_main.cpp
)
-# Link the executable to the sc_components library. Since the sc_components library has
-# public include directories we will use those link directories when building
-# simple_system
target_link_libraries (simple_system LINK_PUBLIC scc)
target_link_libraries (simple_system LINK_PUBLIC ${Boost_LIBRARIES} )
-target_link_libraries (simple_system LINK_PUBLIC ${ZLIB_LIBRARY})
diff --git a/examples/simple_system/gen/e300_plat_t.h b/examples/simple_system/gen/e300_plat_t.h
index de361b1..57ce875 100644
--- a/examples/simple_system/gen/e300_plat_t.h
+++ b/examples/simple_system/gen/e300_plat_t.h
@@ -17,11 +17,11 @@
#define _E300_PLAT_MAP_H_
// need double braces, see
// https://stackoverflow.com/questions/6893700/how-to-construct-stdarray-object-with-initializer-list#6894191
-const std::array, 4> e300_plat_map = {{
- {i_plic.socket, 0x0c000000, 0x200008},
- {i_gpio.socket, 0x10012000, 0x1000},
- {i_uart.socket, 0x10013000, 0x1000},
- {i_spi.socket, 0x10014000, 0x1000},
+const std::array, 4> e300_plat_map = {{
+ {"plic", 0x0c000000, 0x200008},
+ {"gpio", 0x10012000, 0x1000},
+ {"uart", 0x10013000, 0x1000},
+ {"spi", 0x10014000, 0x1000},
}};
#endif /* _E300_PLAT_MAP_H_ */
diff --git a/examples/simple_system/gen/gpio_regs.h b/examples/simple_system/gen/gpio_regs.h
index 2c5c079..541adf9 100644
--- a/examples/simple_system/gen/gpio_regs.h
+++ b/examples/simple_system/gen/gpio_regs.h
@@ -44,7 +44,7 @@
namespace sysc {
class gpio_regs : public sc_core::sc_module, public scc::resetable {
-protected:
+public:
// storage declarations
uint32_t r_value;
diff --git a/examples/simple_system/gpio.cpp b/examples/simple_system/gpio.cpp
index 01f24d2..041f505 100644
--- a/examples/simple_system/gpio.cpp
+++ b/examples/simple_system/gpio.cpp
@@ -1,47 +1,224 @@
////////////////////////////////////////////////////////////////////////////////
-// Copyright 2017 eyck@minres.com
+// Copyright (C) 2017, MINRES Technologies GmbH
+// All rights reserved.
//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// Contributors:
+// eyck@minres.com - initial implementation
//
-// http://www.apache.org/licenses/LICENSE-2.0
//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
////////////////////////////////////////////////////////////////////////////////
#include "gpio.h"
-#include "gen/gpio_regs.h"
+#include "scc/report.h"
#include "scc/utilities.h"
+#include "gen/gpio_regs.h"
+#include
namespace sysc {
-gpio::gpio(sc_core::sc_module_name nm)
-: sc_core::sc_module(nm)
+using namespace sc_core;
+
+gpio::gpio(sc_module_name nm)
+: sc_module(nm)
, tlm_target<>(clk)
, NAMED(clk_i)
, NAMED(rst_i)
-, NAMEDD(regs, gpio_regs) {
+, NAMED(pins_o, 32)
+, NAMED(pins_i, 32)
+, NAMED(iof0_o, 32)
+, NAMED(iof1_o, 32)
+, NAMED(iof0_i, 32)
+, NAMED(iof1_i, 32)
+, NAMEDD(regs, gpio_regs)
+{
regs->registerResources(*this);
SC_METHOD(clock_cb);
sensitive << clk_i;
SC_METHOD(reset_cb);
sensitive << rst_i;
+ dont_initialize();
+ auto pins_i_cb =[this](unsigned int tag, tlm::tlm_signal_gp<>& gp,
+ tlm::tlm_phase& phase, sc_time& delay)->tlm::tlm_sync_enum{
+ this->pin_input(tag, gp, delay);
+ return tlm::TLM_COMPLETED;
+ };
+ auto i=0U;
+ for(auto& s:pins_i){
+ s.register_nb_transport(pins_i_cb, i);
+ ++i;
+ }
+ auto iof0_i_cb =[this](unsigned int tag, tlm::tlm_signal_gp<>& gp,
+ tlm::tlm_phase& phase, sc_time& delay)->tlm::tlm_sync_enum{
+ last_iof0[tag]=gp.get_value();
+ this->iof_input(tag, 0, gp, delay);
+ return tlm::TLM_COMPLETED;
+ };
+ i=0;
+ for(auto& s:iof0_i){
+ s.register_nb_transport(iof0_i_cb, i);
+ ++i;
+ }
+ auto iof1_i_cb =[this](unsigned int tag, tlm::tlm_signal_gp<>& gp,
+ tlm::tlm_phase& phase, sc_time& delay)->tlm::tlm_sync_enum{
+ last_iof1[tag]=gp.get_value();
+ this->iof_input(tag, 1, gp, delay);
+ return tlm::TLM_COMPLETED;
+ };
+ i=0;
+ for(auto& s:iof1_i){
+ s.register_nb_transport(iof1_i_cb, i);
+ ++i;
+ }
+ auto update_pins_cb = [this](scc::sc_register ®, uint32_t data, sc_time d) -> bool {
+ if (!this->regs->in_reset()) {
+ auto changed_bits = (reg.get()^data);
+ reg.put(data);
+ update_pins(changed_bits);
+ }
+ return true;
+ };
+ regs->port.set_write_cb(update_pins_cb);
+ regs->output_en.set_write_cb(update_pins_cb);
+ regs->out_xor.set_write_cb(update_pins_cb);
+ regs->iof_en.set_write_cb(update_pins_cb);
+ regs->iof_sel.set_write_cb(update_pins_cb);
}
gpio::~gpio() {}
-void gpio::clock_cb() {}
-
void gpio::reset_cb() {
- if (rst_i.read())
+ if (rst_i.read()){
regs->reset_start();
- else
+ } else {
regs->reset_stop();
+ }
+ update_pins(std::numeric_limits::max());
+}
+
+void gpio::clock_cb() {
+ this->clk = clk_i.read();
+}
+
+tlm::tlm_phase gpio::write_output(tlm::tlm_signal_gp& gp, size_t i, bool val) {
+ sc_time delay{SC_ZERO_TIME};
+ tlm::tlm_phase phase{ tlm::BEGIN_REQ };
+ gp.set_command(tlm::TLM_WRITE_COMMAND);
+ gp.set_response_status(tlm::TLM_OK_RESPONSE);
+ gp.set_value(val);
+ pins_o.at(i)->nb_transport_fw(gp, phase, delay);
+ return phase;
+}
+
+void gpio::update_pins(uint32_t changed_bits) {
+ sc_inout_rv<32>::data_type out_val;
+ tlm::tlm_signal_gp gp;
+ bool val;
+ for(size_t i=0, mask = 1; i<32; ++i, mask<<=1){
+ if(changed_bits&mask){
+ if((regs->r_iof_en&mask!=0) && (iof0_i[i].size()==0 || iof1_i[i].size()==0)){
+ if((regs->r_iof_sel&mask)==0 && iof0_i[i].size()>0){
+ val=last_iof0[i]?sc_dt::Log_1:sc_dt::Log_0;
+ } else if((regs->r_iof_sel&mask)==1 && iof1_i[i].size()>0)
+ val=last_iof1[i]?sc_dt::Log_1:sc_dt::Log_0;
+ } else {
+ if((regs->r_output_en&mask) && (regs->r_port&mask))
+ val=true;
+ else
+ val=false;
+ if(regs->r_out_xor&mask)
+ val=~val;
+ }
+ tlm::tlm_phase phase = write_output(gp, i, val);
+ }
+ }
+}
+
+void gpio::pin_input(unsigned int tag, tlm::tlm_signal_gp& gp, sc_time& delay) {
+ if(delay>SC_ZERO_TIME){
+ wait(delay);
+ delay=SC_ZERO_TIME;
+ }
+ auto mask = 1u<r_output_en&mask==0)
+ regs->r_value|=mask;
+ forward_pin_input(tag, gp);
+ break;
+ case false:
+ if(regs->r_output_en&mask==0) regs->r_value&=~mask;
+ forward_pin_input(tag, gp);
+ break;
+ }
+}
+
+void gpio::forward_pin_input(unsigned int tag, tlm::tlm_signal_gp& gp) {
+ const auto mask = 1U<iof_en&mask){
+ auto& socket = regs->iof_sel&mask?iof1_o[tag]:iof0_o[tag];
+ tlm::tlm_signal_gp<> new_gp;
+ for(size_t i=0; inb_transport_fw(new_gp, phase, delay); // we don't care about phase and sync enum
+ }
+ }
+}
+
+void gpio::iof_input(unsigned int tag, unsigned iof_idx, tlm::tlm_signal_gp<>& gp, sc_time& delay) {
+ if(delay>SC_ZERO_TIME){
+ wait(delay);
+ delay=SC_ZERO_TIME;
+ }
+ const auto mask = 1U<r_iof_en&mask){
+ const auto idx = regs->r_iof_sel&mask?1:0;
+ if(iof_idx == idx){
+ auto& socket = pins_o[tag];
+ for(size_t i=0; i new_gp;
+ new_gp.set_command(tlm::TLM_WRITE_COMMAND);
+ auto val = gp.get_value();
+ new_gp.set_value(val);
+ new_gp.copy_extensions_from(gp);
+ socket->nb_transport_fw(new_gp, phase, delay); // we don't care about phase and sync enum
+ gp.update_extensions_from(new_gp);
+ }
+ }
+ }
}
} /* namespace sysc */
+
diff --git a/examples/simple_system/gpio.h b/examples/simple_system/gpio.h
index a289abe..d61b9a6 100644
--- a/examples/simple_system/gpio.h
+++ b/examples/simple_system/gpio.h
@@ -1,41 +1,84 @@
-/*******************************************************************************
- * Copyright 2017 eyck@minres.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- ******************************************************************************/
+////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2017, MINRES Technologies GmbH
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// Contributors:
+// eyck@minres.com - initial implementation
+//
+//
+////////////////////////////////////////////////////////////////////////////////
#ifndef _GPIO_H_
#define _GPIO_H_
-#include
+#include "scc/tlm_target.h"
+#include "scc/signal_target_mixin.h"
+#include "scc/signal_initiator_mixin.h"
+#include
namespace sysc {
class gpio_regs;
+class WsHandler;
class gpio : public sc_core::sc_module, public scc::tlm_target<> {
public:
SC_HAS_PROCESS(gpio);
sc_core::sc_in clk_i;
sc_core::sc_in rst_i;
+ // sc_core::sc_inout_rv<32> pins_io;
+
+ sc_core::sc_vector pins_o;
+ sc_core::sc_vector pins_i;
+
+ sc_core::sc_vector iof0_o;
+ sc_core::sc_vector iof1_o;
+ sc_core::sc_vector iof0_i;
+ sc_core::sc_vector iof1_i;
+
gpio(sc_core::sc_module_name nm);
- virtual ~gpio();
+ virtual ~gpio() override; // need to keep it in source file because of fwd declaration of gpio_regs
protected:
void clock_cb();
void reset_cb();
+ void update_pins(uint32_t changed_bits);
+ void pin_input(unsigned int tag, tlm::tlm_signal_gp<>& gp, sc_core::sc_time& delay);
+ void forward_pin_input(unsigned int tag, tlm::tlm_signal_gp<>& gp);
+ void iof_input(unsigned int tag, unsigned iof_idx, tlm::tlm_signal_gp<>& gp, sc_core::sc_time& delay);
sc_core::sc_time clk;
+ std::array last_iof0, last_iof1;
std::unique_ptr regs;
+ std::shared_ptr handler;
+
+private:
+ tlm::tlm_phase write_output(tlm::tlm_signal_gp<>& gp, size_t i, bool val);
};
} /* namespace sysc */
diff --git a/examples/simple_system/plic.cpp b/examples/simple_system/plic.cpp
index f6c13a9..4bbfb45 100644
--- a/examples/simple_system/plic.cpp
+++ b/examples/simple_system/plic.cpp
@@ -119,7 +119,7 @@ void plic::global_int_port_cb() {
if (enable && global_interrupts_i[i].read() == 1) {
regs->r_pending = regs->r_pending | (0x1 << i);
- LOG(INFO) << "pending interrupt identified: " << i;
+ SCDEBUG("plic") << "pending interrupt identified: " << i;
}
}
@@ -147,7 +147,7 @@ void plic::handle_pending_int() {
claim_prio = prio;
claim_int = i;
raise_int = 1;
- LOG(INFO) << "pending interrupt activated: " << i;
+ SCDEBUG("plic") << "pending interrupt activated: " << i;
}
}
}
@@ -158,14 +158,14 @@ void plic::handle_pending_int() {
// todo: evluate clock period
} else {
regs->r_claim_complete = 0;
- LOG(INFO) << "no further pending interrupt.";
+ SCDEBUG("plic") << "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.
- LOG(INFO) << "reset pending interrupt: " << irq;
+ SCDEBUG("plic") << "reset pending interrupt: " << irq;
// reset related pending bit
regs->r_pending &= ~(0x1 << irq);
core_interrupt_o.write(0);
diff --git a/examples/simple_system/sc_main.cpp b/examples/simple_system/sc_main.cpp
index dbef674..09da67b 100644
--- a/examples/simple_system/sc_main.cpp
+++ b/examples/simple_system/sc_main.cpp
@@ -24,9 +24,7 @@
#include
#include
#include
-#include
#include
-#include
using namespace sysc;
using namespace scc;
@@ -42,10 +40,6 @@ int sc_main(int argc, char *argv[]) {
sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated", sc_core::SC_DO_NOTHING );
sc_core::sc_report_handler::set_actions(sc_core::SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_, sc_core::SC_DO_NOTHING);
///////////////////////////////////////////////////////////////////////////
- // create global CCI broker
- ///////////////////////////////////////////////////////////////////////////
- cci::cci_register_broker(new cci_utils::broker("Global Broker"));
- ///////////////////////////////////////////////////////////////////////////
// CLI argument parsing
///////////////////////////////////////////////////////////////////////////
po::options_description desc("Options");
@@ -77,14 +71,13 @@ int sc_main(int argc, char *argv[]) {
///////////////////////////////////////////////////////////////////////////
// set up tracing & transaction recording
///////////////////////////////////////////////////////////////////////////
- tracer trace("simple_system", tracer::TEXT, vm.count("trace"));
+ tracer trace("simple_system", tracer::COMPRESSED, vm.count("trace"));
// todo: fix displayed clock period in VCD
///////////////////////////////////////////////////////////////////////////
// instantiate top level
///////////////////////////////////////////////////////////////////////////
simple_system i_simple_system("i_simple_system");
- // sr_report_handler::add_sc_object_to_filter(&i_simple_system.i_master, sc_core::SC_WARNING, sc_core::SC_MEDIUM);
///////////////////////////////////////////////////////////////////////////
// run simulation
@@ -93,7 +86,7 @@ int sc_main(int argc, char *argv[]) {
// todo: provide end-of-simulation macros
if (!sc_core::sc_end_of_simulation_invoked()) {
- LOG(ERROR) << "simulation timed out";
+ SCERR() << "simulation timed out";
sc_core::sc_stop();
}
return SUCCESS;
diff --git a/examples/simple_system/simple_system.cpp b/examples/simple_system/simple_system.cpp
index 6ad54fc..852d33f 100644
--- a/examples/simple_system/simple_system.cpp
+++ b/examples/simple_system/simple_system.cpp
@@ -35,17 +35,21 @@ simple_system::simple_system(sc_core::sc_module_name nm)
, NAMED(s_clk)
, NAMED(s_rst)
, NAMED(s_global_interrupts, 256)
-, NAMED(s_core_interrupt) {
+, NAMED(s_core_interrupt)
+, NAMED(s_gpio, 32)
+{
// todo: discuss naming conventions (s_ vs. _i/_o) --> covnert into _s
// bus connections
i_master.intor(i_router.target[0]);
- size_t i = 0;
- for (const auto &e : e300_plat_map) {
- i_router.initiator[i](e.target);
- i_router.set_target_range(i, e.start, e.size);
- i++;
- }
+ i_router.bind_target(i_plic.socket, 0, "plic");
+ i_router.bind_target(i_uart.socket, 1, "uart");
+ i_router.bind_target(i_spi.socket, 2, "spi");
+ i_router.bind_target(i_gpio.socket, 3, "gpio");
+
+ // target address ranges
+ for (const auto &e : e300_plat_map)
+ i_router.add_target_range(e.name, e.start, e.size);
// clock/reset connections
i_uart.clk_i(s_clk);
@@ -66,6 +70,11 @@ simple_system::simple_system(sc_core::sc_module_name nm)
i_master.global_interrupts_o(s_global_interrupts);
i_master.core_interrupt_i(s_core_interrupt);
+ for(auto i=0U; i s_clk;
sc_core::sc_signal s_rst;
sc_core::sc_vector> s_global_interrupts;
- sc_core::sc_signal s_core_interrupt;
+ sc_core::sc_signal s_core_interrupt;
+ sc_core::sc_vector> s_gpio;
simple_system(sc_core::sc_module_name nm);
diff --git a/examples/simple_system/test_initiator.cpp b/examples/simple_system/test_initiator.cpp
index fb8f6c8..e176afc 100644
--- a/examples/simple_system/test_initiator.cpp
+++ b/examples/simple_system/test_initiator.cpp
@@ -36,8 +36,10 @@
#define PLIC_CLAIM_COMPLETE_REG 0x0C200004
namespace sysc {
-test_initiator::test_initiator(sc_core::sc_module_name nm)
-: sc_core::sc_module(nm)
+using namespace sc_core;
+
+test_initiator::test_initiator(sc_module_name nm)
+: sc_module(nm)
, NAMED(intor)
, NAMED(rst_i)
, NAMED(global_interrupts_o, 256)
@@ -62,6 +64,8 @@ void test_initiator::run() {
test_irq_stress();
// todo: review irq sequences from FW point of view ... expected ???
+ wait(100_ns);
+ sc_stop();
}
void test_initiator::test_unique_irq() {
@@ -211,14 +215,14 @@ void test_initiator::write_bus(std::uint32_t adr, std::uint32_t dat) {
data[1] = 0xff & dat >> 8;
data[0] = 0xff & dat;
- LOG(INFO) << "write_bus(0x" << std::hex << adr << ") : " << dat;
+ SCDEBUG("test_initiator") << "write_bus(0x" << std::hex << adr << ") : " << dat;
gp.set_command(tlm::TLM_WRITE_COMMAND);
gp.set_address(adr);
gp.set_data_ptr(data.data());
gp.set_data_length(data.size());
gp.set_streaming_width(4);
- sc_core::sc_time delay;
+ sc_time delay;
intor->b_transport(gp, delay);
if (gp.get_response_status() != tlm::TLM_OK_RESPONSE) {
@@ -236,7 +240,7 @@ std::uint32_t test_initiator::read_bus(std::uint32_t adr) {
gp.set_data_ptr(data.data());
gp.set_data_length(data.size());
gp.set_streaming_width(4);
- sc_core::sc_time delay;
+ sc_time delay;
intor->b_transport(gp, delay);
if (gp.get_response_status() != tlm::TLM_OK_RESPONSE) {
@@ -248,21 +252,21 @@ std::uint32_t test_initiator::read_bus(std::uint32_t adr) {
// todo: use reinterpret_cast instead
std::uint32_t rdat = data[3] << 24 | data[2] << 16 | data[1] << 8 | data[0];
- LOG(INFO) << "read_bus(0x" << std::hex << adr << ") -> " << rdat;
+ SCDEBUG("test_initiator") << "read_bus(0x" << std::hex << adr << ") -> " << rdat;
return rdat;
}
void test_initiator::reg_check(std::uint32_t adr, std::uint32_t exp) {
uint32_t dat = read_bus(adr);
if (dat != exp) {
- LOG(ERROR) << "register check failed for address 0x" << std::hex << adr << ": " << dat << " != " << exp;
+ SCERR("test_initiator") << "register check failed for address 0x" << std::hex << adr << ": " << dat << " != " << exp;
} else {
- LOG(INFO) << "register check passed for address 0x" << std::hex << adr << ": " << dat;
+ SCDEBUG("test_initiator") << "register check passed for address 0x" << std::hex << adr << ": " << dat;
}
}
void test_initiator::core_irq_handler() {
- LOG(INFO) << "core_interrupt_i edge detected -> " << core_interrupt_i.read();
+ SCDEBUG("test_initiator") << "core_interrupt_i edge detected -> " << core_interrupt_i.read();
}
} /* namespace sysc */
diff --git a/examples/transaction_recording/CMakeLists.txt b/examples/transaction_recording/CMakeLists.txt
index e774cd4..f60d899 100644
--- a/examples/transaction_recording/CMakeLists.txt
+++ b/examples/transaction_recording/CMakeLists.txt
@@ -1,10 +1,5 @@
-cmake_minimum_required(VERSION 3.3)
-# Add executable called "transaction_recording" that is built from the source files
-# "scv_tr_recording_example.cpp". The extensions are automatically found.
+cmake_minimum_required(VERSION 3.12)
add_executable (transaction_recording
scv_tr_recording_example.cpp
)
-# Link the executable to the sc_components library. Since the sc_components library has
-# public include directories we will use those link directories when building
-# transaction_recording
-target_link_libraries (transaction_recording LINK_PUBLIC scc ${CONAN_LIBS})
+target_link_libraries (transaction_recording LINK_PUBLIC scc)
diff --git a/examples/transaction_recording/scv_tr_recording_example.cpp b/examples/transaction_recording/scv_tr_recording_example.cpp
index 7735e1a..329cc49 100644
--- a/examples/transaction_recording/scv_tr_recording_example.cpp
+++ b/examples/transaction_recording/scv_tr_recording_example.cpp
@@ -16,6 +16,15 @@
*****************************************************************************/
#include "scv.h"
+#include "scc/scv_tr_db.h"
+#include "scc/report.h"
+#include "scc/value_registry.h"
+
+// text 11308µs/11602µs
+// compressed 10365µs/ 9860µs
+// binary 13233µs/10698µs
+// SQLite 30363µs/30018µs
+// LeveDB 23898µs/22367µs
// hack to fake a true fifo_mutex
#define fifo_mutex sc_mutex
@@ -189,8 +198,7 @@ inline void test::main1() {
for (int i = 0; i < 3; i++) {
rw_task_if::addr_t addr = i;
rw_task_if::data_t data = transactor->read(&addr);
- cout << "at time " << sc_time_stamp() << ": ";
- cout << "received data : " << data << endl;
+ SCINFO(sc_get_current_object()->name()) << "received data : " << data;
}
scv_smart_ptr addr;
@@ -198,14 +206,14 @@ inline void test::main1() {
addr->next();
rw_task_if::data_t data = transactor->read(addr->get_instance());
- cout << "data for address " << *addr << " is " << data << endl;
+ SCINFO(sc_get_current_object()->name()) << "data for address " << *addr << " is " << data;
}
scv_smart_ptr write;
for (int i = 0; i < 3; i++) {
write->next();
transactor->write(write->get_instance());
- cout << "send data : " << write->data << endl;
+ SCINFO(sc_get_current_object()->name()) << "send data : " << write->data;
}
scv_smart_ptr data;
@@ -224,8 +232,7 @@ inline void test::main2() {
for (int i = 0; i < 3; i++) {
rw_task_if::addr_t addr = i;
rw_task_if::data_t data = transactor->read(&addr);
- cout << "at time " << sc_time_stamp() << ": ";
- cout << "received data : " << data << endl;
+ SCINFO(sc_get_current_object()->name()) << "received data : " << data;
}
scv_smart_ptr addr;
@@ -233,14 +240,14 @@ inline void test::main2() {
addr->next();
rw_task_if::data_t data = transactor->read(addr->get_instance());
- cout << "data for address " << *addr << " is " << data << endl;
+ SCINFO(sc_get_current_object()->name()) << "data for address " << *addr << " is " << data;
}
scv_smart_ptr write;
for (int i = 0; i < 3; i++) {
write->next();
transactor->write(write->get_instance());
- cout << "send data : " << write->data << endl;
+ SCINFO(sc_get_current_object()->name()) << "send data : " << write->data;
}
scv_smart_ptr data;
@@ -291,8 +298,7 @@ inline void design::addr_phase() {
outstandingAddresses.push_back(_addr);
outstandingType.push_back(_rw);
- cout << "at time " << sc_time_stamp() << ": ";
- cout << "received request for memory address " << _addr << endl;
+ SCINFO(sc_get_current_object()->name()) << "received request for memory address " << _addr;
}
}
@@ -306,15 +312,15 @@ inline void design::data_phase() {
wait(clk->posedge_event());
}
if (outstandingType.front() == false) {
- cout << "reading memory address " << outstandingAddresses.front() << " with value "
- << memory[outstandingAddresses.front().to_ulong()] << endl;
+ SCINFO(sc_get_current_object()->name()) << "reading memory address " << outstandingAddresses.front() << " with value "
+ << memory[outstandingAddresses.front().to_ulong()];
bus_data = memory[outstandingAddresses.front().to_ulong()];
data_rdy = 1;
wait(clk->posedge_event());
data_rdy = 0;
} else {
- cout << "writing memory address " << outstandingAddresses.front() << " with value " << bus_data << endl;
+ SCINFO(sc_get_current_object()->name()) << "writing memory address " << outstandingAddresses.front() << " with value " << bus_data;
memory[outstandingAddresses.front().to_ulong()] = bus_data;
data_rdy = 1;
wait(clk->posedge_event());
@@ -324,13 +330,30 @@ inline void design::data_phase() {
outstandingType.pop_front();
}
}
-extern void scv_tr_sqlite_init();
+
+inline const char* init_db(char type){
+ switch(type){
+ case '2':
+ scv_tr_compressed_init();
+ return "my_db.txlog";
+ break;
+ case '3':
+ scv_tr_sqlite_init();
+ return "my_db.txdb";
+ break;
+ default:
+ scv_tr_text_init();
+ return "my_db.txlog";
+ break;
+ }
+}
int sc_main(int argc, char *argv[]) {
+ auto start = std::chrono::system_clock::now();
scv_startup();
-
- scv_tr_text_init();
- const char* fileName = "my_db.txlog";
+ scc::init_logging(scc::LogConfig().logLevel(logging::DEBUG));
+ const char *fileName = argc==2? init_db(argv[1][0]): "my_db.txlog";
+ if(argc<2) scv_tr_text_init();
scv_tr_db db(fileName);
scv_tr_db::set_default_db(&db);
sc_trace_file *tf = sc_create_vcd_trace_file("my_db");
@@ -343,6 +366,7 @@ int sc_main(int argc, char *argv[]) {
sc_signal data_rdy;
sc_signal> bus_data;
+ scc::value_registry registry;
// create modules/channels
test t("t");
rw_pipelined_transactor tr("tr");
@@ -373,7 +397,9 @@ int sc_main(int argc, char *argv[]) {
// Disable check for bus simulation.
sc_report_handler::set_actions(SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_, SC_DO_NOTHING);
// run the simulation
- sc_start(1.0, SC_MS);
+ sc_start(10.0, SC_US);
sc_close_vcd_trace_file(tf);
+ auto int_us = std::chrono::duration_cast(std::chrono::system_clock::now()-start);
+ SCINFO() << "simulation duration "<
+#include
+#include
+#include
+
+int main(int arcg, char* argv[]){
+ IoRedirector::get().start();
+ auto result1 = IoRedirector::get().get_output();
+ assert(result1=="");
+ printf("Some output");
+ std::cout<<"Some other output"<