diff options
author | Gabe Black <gabeblack@google.com> | 2018-06-15 14:56:10 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-08-22 00:52:39 +0000 |
commit | 5d24b0a5adafa4ae09b29ec0e2cbc1a2ecd4126f (patch) | |
tree | 89986e2778f513b71693baace0a36297416b4ddf /src/systemc/ext | |
parent | d4f96ad97175e1c8cb598cdc6bd25171b1753912 (diff) | |
download | gem5-5d24b0a5adafa4ae09b29ec0e2cbc1a2ecd4126f.tar.xz |
systemc: Add the nonstandard macro SC_NEW.
This is in the Accellera implementation and in the regression tests.
The implementation here is a bit different than theirs in that it uses
std::unique_ptrs.
Change-Id: Id3d1ad82482b94a5d99f27e02d1e447ca1944797
Reviewed-on: https://gem5-review.googlesource.com/11255
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/ext')
-rw-r--r-- | src/systemc/ext/core/sc_module.hh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/systemc/ext/core/sc_module.hh b/src/systemc/ext/core/sc_module.hh index 0600aa6e6..68d2174b3 100644 --- a/src/systemc/ext/core/sc_module.hh +++ b/src/systemc/ext/core/sc_module.hh @@ -244,6 +244,12 @@ typedef sc_module sc_channel; bool sc_start_of_simulation_invoked(); bool sc_end_of_simulation_invoked(); +// Nonstandard +// Allocates a module of type x and records a pointer to it so that it gets +// destructed automatically at the end of the simulation. +sc_module *sc_module_sc_new(sc_module *); +#define SC_NEW(x) ::sc_core::sc_module_sc_new(new x); + } // namespace sc_core #endif //__SYSTEMC_EXT_CORE_SC_MODULE_HH__ |