From 0cfce458003c377878aad3b15cf5fa2860a5f8e7 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 26 Sep 2018 03:20:09 -0700 Subject: systemc: Implement signal based resets. The implementation is based on sc_event sensitivities. Also of note is that the way reset works in the Accellera implementation isn't consistent with the spec. That says that wait(int n) is supposed to be equivalent to calling wait() n times, assuming n is greater than 0. Instead, Accellera stores that count and then doesn't wake up the process until the count is 0, decrementing it otherwise. That means that when the process is in reset, it won't actually reset for those intermediate wait()s which it would if wait() was called repeatedly. Also, oddly, when a reset becomes asserted, it will clear the count to 0 explicitly. That may have been an attempt to make the behavior of wait(int n) match the spec, but it doesn't handle cases where the reset is already set when wait(int n) is called. Change-Id: I92f8e9a128e6618af94dc048ce570a4436e17e4b Reviewed-on: https://gem5-review.googlesource.com/c/13186 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/systemc/ext/core/sc_spawn.hh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/systemc/ext/core') diff --git a/src/systemc/ext/core/sc_spawn.hh b/src/systemc/ext/core/sc_spawn.hh index d97883035..50378e23d 100644 --- a/src/systemc/ext/core/sc_spawn.hh +++ b/src/systemc/ext/core/sc_spawn.hh @@ -130,6 +130,21 @@ class sc_spawn_options std::vector _interfaces; std::vector _finders; + template + struct Reset + { + Reset(T *t, bool v, bool s) : target(t), value(v), sync(s) {} + + T *target; + bool value; + bool sync; + }; + + std::vector > > _in_resets; + std::vector > > _inout_resets; + std::vector > > _out_resets; + std::vector > > _if_resets; + // Disabled sc_spawn_options(const sc_spawn_options &) {} sc_spawn_options &operator = (const sc_spawn_options &) { return *this; } -- cgit v1.2.3