[gem5-dev] Change in gem5/gem5[master]: systemc: Make sc_main run in its own fiber.

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


Change subject: systemc: Make sc_main run in its own fiber.
..

systemc: Make sc_main run in its own fiber.

The fiber will run until either sc_main returns, or until sc_start is
called. If sc_start is called, then the fiber will only be paused and
waiting for simulation cycles to be run by gem5. Once sc_pause and
sc_stop are implemented, if those are called the sc_main fiber will
be re-entered and allowed to run further towards completion.

Change-Id: I4df94f4f6fed8d49471732619a203d734d9a13a6
Reviewed-on: https://gem5-review.googlesource.com/10849
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
---
M src/systemc/core/sc_main.cc
1 file changed, 29 insertions(+), 4 deletions(-)

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



diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc
index a7a77a4..2ca5ed4 100644
--- a/src/systemc/core/sc_main.cc
+++ b/src/systemc/core/sc_main.cc
@@ -29,8 +29,11 @@

 #include 

+#include "base/fiber.hh"
 #include "base/logging.hh"
+#include "base/types.hh"
 #include "python/pybind11/pybind.hh"
+#include "sim/eventq.hh"
 #include "sim/init.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
@@ -57,6 +60,17 @@
 int _argc = 0;
 char **_argv = NULL;

+class ScMainFiber : public Fiber
+{
+void
+main()
+{
+::sc_main(_argc, _argv);
+}
+};
+
+ScMainFiber scMainFiber;
+
 // This wrapper adapts the python version of sc_main to the c++ version.
 void
 sc_main(pybind11::args args)
@@ -94,8 +108,7 @@
 // again later.
 scMainCalled = true;

-//TODO Start a new fiber to call sc_main from.
-::sc_main(_argc, _argv);
+scMainFiber.run();
 }

 // Make our sc_main wrapper available in the internal _m5 python module  
under

@@ -111,6 +124,9 @@
 sc_stop_mode _stop_mode = SC_STOP_FINISH_DELTA;
 sc_status _status = SC_ELABORATION;

+Tick _max_tick = MaxTick;
+sc_starvation_policy _starvation = SC_EXIT_ON_STARVATION;
+
 uint64_t _deltaCycles = 0;

 } // anonymous namespace
@@ -130,7 +146,11 @@
 void
 sc_start()
 {
-warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+_max_tick = MaxTick;
+_starvation = SC_EXIT_ON_STARVATION;
+
+// Switch back gem5.
+Fiber::primaryFiber()->run();
 }

 void
@@ -142,7 +162,12 @@
 void
 sc_start(const sc_time , sc_starvation_policy p)
 {
-warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+Tick now = curEventQueue() ? curEventQueue()->getCurTick() : 0;
+_max_tick = now + time.value();
+_starvation = p;
+
+// Switch back to gem5.
+Fiber::primaryFiber()->run();
 }

 void

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/10849
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: I4df94f4f6fed8d49471732619a203d734d9a13a6
Gerrit-Change-Number: 10849
Gerrit-PatchSet: 8
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
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: Make sc_main run in its own fiber.

2018-06-29 Thread Gabe Black (Gerrit)

Hello Jason Lowe-Power, Matthias Jung, Andreas Sandberg,

I'd like you to reexamine a change. Please visit

https://gem5-review.googlesource.com/10849

to look at the new patch set (#5).

Change subject: systemc: Make sc_main run in its own fiber.
..

systemc: Make sc_main run in its own fiber.

The fiber will run until either sc_main returns, or until sc_start is
called. If sc_start is called, then the fiber will only be paused and
waiting for simulation cycles to be run by gem5. Once sc_pause and
sc_stop are implemented, if those are called the sc_main fiber will
be re-entered and allowed to run further towards completion.

Change-Id: I4df94f4f6fed8d49471732619a203d734d9a13a6
---
M src/systemc/core/sc_main.cc
1 file changed, 29 insertions(+), 4 deletions(-)


--
To view, visit https://gem5-review.googlesource.com/10849
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: I4df94f4f6fed8d49471732619a203d734d9a13a6
Gerrit-Change-Number: 10849
Gerrit-PatchSet: 5
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Matthias Jung 
Gerrit-MessageType: newpatchset
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[master]: systemc: Make sc_main run in its own fiber.

2018-06-07 Thread Gabe Black (Gerrit)

Hello Jason Lowe-Power, Matthias Jung, Andreas Sandberg,

I'd like you to reexamine a change. Please visit

https://gem5-review.googlesource.com/10849

to look at the new patch set (#2).

Change subject: systemc: Make sc_main run in its own fiber.
..

systemc: Make sc_main run in its own fiber.

The fiber will run until either sc_main returns, or until sc_start is
called. If sc_start is called, then the fiber will only be paused and
waiting for simulation cycles to be run by gem5. Once sc_pause and
sc_stop are implemented, if those are called the sc_main fiber will
be re-entered and allowed to run further towards completion.

Change-Id: I4df94f4f6fed8d49471732619a203d734d9a13a6
---
M src/systemc/core/sc_main.cc
1 file changed, 29 insertions(+), 4 deletions(-)


--
To view, visit https://gem5-review.googlesource.com/10849
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: I4df94f4f6fed8d49471732619a203d734d9a13a6
Gerrit-Change-Number: 10849
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Matthias Jung 
Gerrit-MessageType: newpatchset
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[master]: systemc: Make sc_main run in its own fiber.

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



Change subject: systemc: Make sc_main run in its own fiber.
..

systemc: Make sc_main run in its own fiber.

The fiber will run until either sc_main returns, or until sc_start is
called. If sc_start is called, then the fiber will only be paused and
waiting for simulation cycles to be run by gem5. Once sc_pause and
sc_stop are implemented, if those are called the sc_main fiber will
be re-entered and allowed to run further towards completion.

Change-Id: I4df94f4f6fed8d49471732619a203d734d9a13a6
---
M src/systemc/core/sc_main.cc
1 file changed, 29 insertions(+), 4 deletions(-)



diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc
index 815be9b..737022b 100644
--- a/src/systemc/core/sc_main.cc
+++ b/src/systemc/core/sc_main.cc
@@ -30,8 +30,11 @@
 #include 

 #include "base/logging.hh"
+#include "base/types.hh"
 #include "python/pybind11/pybind.hh"
+#include "sim/eventq.hh"
 #include "sim/init.hh"
+#include "systemc/core/fiber.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"

@@ -57,6 +60,17 @@
 int _argc = 0;
 char **_argv = NULL;

+class ScMainFiber : public SystemC::Fiber
+{
+void
+main()
+{
+::sc_main(_argc, _argv);
+}
+};
+
+ScMainFiber scMainFiber;
+
 // This wrapper adapts the python version of sc_main to the c++ version.
 void
 sc_main(pybind11::args args)
@@ -94,8 +108,7 @@
 // again later.
 scMainCalled = true;

-//TODO Start a new fiber to call sc_main from.
-::sc_main(_argc, _argv);
+scMainFiber.run();
 }

 // Make our sc_main wrapper available in the internal _m5 python module  
under

@@ -111,6 +124,9 @@
 sc_stop_mode _stop_mode = SC_STOP_FINISH_DELTA;
 sc_status _status = SC_ELABORATION;

+Tick _max_tick = MaxTick;
+sc_starvation_policy _starvation = SC_EXIT_ON_STARVATION;
+
 uint64_t _deltaCycles = 0;

 } // anonymous namespace
@@ -130,13 +146,22 @@
 void
 sc_start()
 {
-warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+_max_tick = MaxTick;
+_starvation = SC_EXIT_ON_STARVATION;
+
+// Switch back gem5.
+SystemC::gem5Fiber()->run();
 }

 void
 sc_start(const sc_time , sc_starvation_policy p)
 {
-warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+Tick now = curEventQueue() ? curEventQueue()->getCurTick() : 0;
+_max_tick = now + time.value();
+_starvation = p;
+
+// Switch back to gem5.
+SystemC::gem5Fiber()->run();
 }

 void

--
To view, visit https://gem5-review.googlesource.com/10849
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: I4df94f4f6fed8d49471732619a203d734d9a13a6
Gerrit-Change-Number: 10849
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