[gem5-dev] Change in gem5/gem5[master]: systemc: Add the nonstandard macro SC_NEW.

2018-08-21 Thread Gabe Black (Gerrit)
Gabe Black has submitted this change and it was merged. (  
https://gem5-review.googlesource.com/c/public/gem5/+/11255 )


Change subject: systemc: Add the nonstandard macro SC_NEW.
..

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 
Maintainer: Gabe Black 
---
M src/systemc/core/sc_module.cc
M src/systemc/ext/core/sc_module.hh
2 files changed, 17 insertions(+), 0 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved



diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc
index 6bbb9dc..646916f 100644
--- a/src/systemc/core/sc_module.cc
+++ b/src/systemc/core/sc_module.cc
@@ -27,6 +27,9 @@
  * Authors: Gabe Black
  */

+#include 
+#include 
+
 #include "base/logging.hh"
 #include "systemc/ext/core/sc_module.hh"

@@ -539,4 +542,12 @@
 return false;
 }

+sc_module *
+sc_module_sc_new(sc_module *mod)
+{
+static std::vector > modules;
+modules.emplace_back(mod);
+return mod;
+}
+
 } // namespace sc_core
diff --git a/src/systemc/ext/core/sc_module.hh  
b/src/systemc/ext/core/sc_module.hh

index 0600aa6..68d2174 100644
--- a/src/systemc/ext/core/sc_module.hh
+++ b/src/systemc/ext/core/sc_module.hh
@@ -244,6 +244,12 @@
 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__

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11255
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Id3d1ad82482b94a5d99f27e02d1e447ca1944797
Gerrit-Change-Number: 11255
Gerrit-PatchSet: 5
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Matthias Jung 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[master]: systemc: Add the nonstandard macro SC_NEW.

2018-06-16 Thread Gabe Black (Gerrit)
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/11255



Change subject: systemc: Add the nonstandard macro SC_NEW.
..

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
---
M src/systemc/core/sc_module.cc
M src/systemc/ext/core/sc_module.hh
2 files changed, 17 insertions(+), 0 deletions(-)



diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc
index 6bbb9dc..646916f 100644
--- a/src/systemc/core/sc_module.cc
+++ b/src/systemc/core/sc_module.cc
@@ -27,6 +27,9 @@
  * Authors: Gabe Black
  */

+#include 
+#include 
+
 #include "base/logging.hh"
 #include "systemc/ext/core/sc_module.hh"

@@ -539,4 +542,12 @@
 return false;
 }

+sc_module *
+sc_module_sc_new(sc_module *mod)
+{
+static std::vector > modules;
+modules.emplace_back(mod);
+return mod;
+}
+
 } // namespace sc_core
diff --git a/src/systemc/ext/core/sc_module.hh  
b/src/systemc/ext/core/sc_module.hh

index 0600aa6..68d2174 100644
--- a/src/systemc/ext/core/sc_module.hh
+++ b/src/systemc/ext/core/sc_module.hh
@@ -244,6 +244,12 @@
 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__

--
To view, visit https://gem5-review.googlesource.com/11255
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Id3d1ad82482b94a5d99f27e02d1e447ca1944797
Gerrit-Change-Number: 11255
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev