blob: 99c863b34e4968829cbe9984b870fd11c748e055 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#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
|