aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-02-26 21:18:56 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-02-26 21:18:56 +0100
commitebe4100f34d1899ced72f43ed055cc21a3e7e1e1 (patch)
treed208177a7e323eed5579ff3a80d803acfa7a39c3
parent85f498bc0749ba8479357d96994c9b46d36c5a52 (diff)
downloadsysc-playground-ebe4100f34d1899ced72f43ed055cc21a3e7e1e1.tar.gz
sysc-playground-ebe4100f34d1899ced72f43ed055cc21a3e7e1e1.zip
port to systemc-3.0.0 beta
-rw-r--r--Makefile4
-rw-r--r--src/event.cc4
-rw-r--r--src/lt_bus.cc2
-rw-r--r--src/minimal_socket.cc4
-rw-r--r--src/models/lt_bus.h5
-rw-r--r--src/sc_export.cc4
-rw-r--r--src/sc_export2.cc2
-rw-r--r--src/utils/sysc.h23
-rw-r--r--test/lt_bus_locked.cc2
9 files changed, 4 insertions, 46 deletions
diff --git a/Makefile b/Makefile
index 66d2662..bd9b8f0 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ BUILD/CMakeCache.txt: CMakeLists.txt
-G Ninja \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_BUILD_TYPE=DEBUG \
- -DCMAKE_CXX_STANDARD=14 \
+ -DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=OFF \
#-DCMAKE_FIND_DEBUG_MODE=ON
ln -sfn BUILD/compile_commands.json
@@ -49,7 +49,7 @@ targets:
ninja -C BUILD -t targets
fmt:
- clang-format -i $(shell shell find src test -type f -name \*.h -or -name \*.cc)
+ clang-format -i $(shell find src test -type f -name \*.h -or -name \*.cc)
# -- CLEAN ---------------------------------------------------------------------
diff --git a/src/event.cc b/src/event.cc
index 655beb2..efb617e 100644
--- a/src/event.cc
+++ b/src/event.cc
@@ -12,8 +12,6 @@ using sc_core::SC_ZERO_TIME;
// -- MOD_METHOD ---------------------------------------------------------------
struct mod_method : public sc_module {
- SC_HAS_PROCESS(mod_method);
-
explicit mod_method(sc_module_name nm) : sc_module(nm) {
SC_METHOD(ev_method);
// STATIC sensitivity for ev_method, the METHOD will become RUNNABLE when
@@ -70,8 +68,6 @@ struct mod_method : public sc_module {
// -- MOD_THREAD ---------------------------------------------------------------
struct mod_thread : public sc_module {
- SC_HAS_PROCESS(mod_thread);
-
explicit mod_thread(sc_module_name nm) : sc_module(nm) {
SC_THREAD(ev_thread);
// STATIC sensitivity for ev_thread.
diff --git a/src/lt_bus.cc b/src/lt_bus.cc
index a1637db..e5e61bc 100644
--- a/src/lt_bus.cc
+++ b/src/lt_bus.cc
@@ -27,8 +27,6 @@ struct target : public sc_core::sc_module {
// -- INITIATOR ----------------------------------------------------------------
struct initiator : public sc_core::sc_module {
- SC_HAS_PROCESS(initiator);
-
explicit initiator(sc_core::sc_module_name nm) : sc_module(std::move(nm)) {
p_sock.register_invalidate_direct_mem_ptr(this, &initiator::invalidate_dmi);
diff --git a/src/minimal_socket.cc b/src/minimal_socket.cc
index 21107fd..70100e8 100644
--- a/src/minimal_socket.cc
+++ b/src/minimal_socket.cc
@@ -70,8 +70,6 @@ struct target_socket : sc_export<fwd_if> {
// -- INITIATOR ----------------------------------------------------------------
struct initiator : public sc_module, public bwd_if {
- SC_HAS_PROCESS(initiator);
-
initiator_socket p_sock;
explicit initiator(sc_module_name nm) : sc_module(std::move(nm)) {
@@ -93,8 +91,6 @@ struct initiator : public sc_module, public bwd_if {
// -- TARGET -------------------------------------------------------------------
struct target : public sc_module, public fwd_if {
- SC_HAS_PROCESS(target);
-
target_socket p_sock;
explicit target(sc_module_name nm) : sc_module(std::move(nm)) {
diff --git a/src/models/lt_bus.h b/src/models/lt_bus.h
index 86b181e..4d8cb12 100644
--- a/src/models/lt_bus.h
+++ b/src/models/lt_bus.h
@@ -2,7 +2,6 @@
#define SYSC_PLAYGROUND_LT_BUS
#include "utils/range.h"
-#include "utils/sysc.h"
#include "utils/tlm_initiator_socket_tagged.h"
#include "utils/tlm_target_socket_tagged.h"
#include "utils/types.h"
@@ -61,7 +60,7 @@ class lt_bus : public sc_core::sc_module {
const std::string name = "init" + std::to_string(id);
{
// Add current module on top of module stack for tlm sockets.
- scoped_push_hierarchy h(*this);
+ auto h = get_hierarchy_scope();
// Add new target socket to connect BUS INITIATOR.
m_initiators.push_back(std::make_unique<target_socket>(
@@ -98,7 +97,7 @@ class lt_bus : public sc_core::sc_module {
const std::string name = "target" + std::to_string(id);
{
// Add current module on top of module stack for tlm sockets.
- scoped_push_hierarchy h(*this);
+ auto h = get_hierarchy_scope();
// Add new initiator socket to connect BUS TARGET.
m_targets.push_back(std::make_unique<initiator_socket>(
diff --git a/src/sc_export.cc b/src/sc_export.cc
index e3d475b..705ec72 100644
--- a/src/sc_export.cc
+++ b/src/sc_export.cc
@@ -12,8 +12,6 @@ using sc_core::sc_signal_inout_if;
// -- CLOCK_GEN ----------------------------------------------------------------
struct clock_gen : public sc_module {
- SC_HAS_PROCESS(clock_gen);
-
explicit clock_gen(sc_module_name nm, unsigned period_ns = 20)
: sc_module(nm), m_half_period(period_ns / 2) {
assert(period_ns == m_half_period * 2);
@@ -42,8 +40,6 @@ struct clock_gen : public sc_module {
// -- TICKTOCK -----------------------------------------------------------------
struct ticktock : public sc_module {
- SC_HAS_PROCESS(ticktock);
-
explicit ticktock(sc_module_name nm) : sc_module(nm) {
SC_METHOD(handle_clk);
sensitive << p_clk;
diff --git a/src/sc_export2.cc b/src/sc_export2.cc
index 42381d2..16ddc06 100644
--- a/src/sc_export2.cc
+++ b/src/sc_export2.cc
@@ -49,8 +49,6 @@ constexpr inline const char* to_str(msg_if::message msg) {
// -- SENDER -------------------------------------------------------------------
struct sender : public sc_module {
- SC_HAS_PROCESS(sender);
-
explicit sender(sc_module_name nm) : sc_module(nm) {
SC_METHOD(do_protocol);
}
diff --git a/src/utils/sysc.h b/src/utils/sysc.h
deleted file mode 100644
index 99c863b..0000000
--- a/src/utils/sysc.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef SYSC_PLAYGROUND_SYSC
-#define SYSC_PLAYGROUND_SYSC
-
-#include <sysc/kernel/sc_module.h>
-#include <sysc/kernel/sc_simcontext.h>
-
-struct [[nodiscard]] scoped_push_hierarchy {
- explicit scoped_push_hierarchy(sc_core::sc_module& mod) : m_mod{mod} {
- assert(m_simctx);
- m_simctx->hierarchy_push(&m_mod);
- }
-
- ~scoped_push_hierarchy() {
- const auto* top = m_simctx->hierarchy_pop();
- assert(top == &m_mod);
- }
-
- private:
- sc_core::sc_simcontext* m_simctx{sc_core::sc_get_curr_simcontext()};
- sc_core::sc_module& m_mod;
-};
-
-#endif
diff --git a/test/lt_bus_locked.cc b/test/lt_bus_locked.cc
index 55357a8..f845b55 100644
--- a/test/lt_bus_locked.cc
+++ b/test/lt_bus_locked.cc
@@ -41,8 +41,6 @@ struct target : public sc_core::sc_module {
// -- INITIATOR ----------------------------------------------------------------
struct initiator : public sc_core::sc_module {
- SC_HAS_PROCESS(initiator);
-
explicit initiator(sc_core::sc_module_name nm) : sc_module(std::move(nm)) {
SC_THREAD(run0);
SC_THREAD(run1);