[gem5-dev] Change in gem5/gem5[master]: systemc: Don't schedule the update phase if the event queue is null.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12078 Change subject: systemc: Don't schedule the update phase if the event queue is null. .. systemc: Don't schedule the update phase if the event queue is null. That happens when an update is requested before the initialization phase has started. In that case, the update phase will be manually run and no event needs to be scheduled, even if that was possible. Change-Id: I2008e29064d282f82bd1935dbe5b94407aa925b0 --- M src/systemc/core/scheduler.cc 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 7d2e9ef..44c5646 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -143,7 +143,8 @@ Scheduler::requestUpdate(Channel *c) { updateList.pushLast(c); -scheduleReadyEvent(); +if (eq) +scheduleReadyEvent(); } void -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12078 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: I2008e29064d282f82bd1935dbe5b94407aa925b0 Gerrit-Change-Number: 12078 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Generalize ignoring info messages in the reference output.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12086 Change subject: systemc: Generalize ignoring info messages in the reference output. .. systemc: Generalize ignoring info messages in the reference output. Those messages are very implementation specific and don't (generally) affect correctness. This makes it easier to ignore info messages based on their number. This change also makes the output checker ignore a similarly styled message gem5 generates. We should consider making gem5 not generate that message and have it generate another message instead which is specific to gem5. We would need to filter that out too when comparing results. Change-Id: I93b9e2d547b6259512db091cfc557d21f86f4a3d --- M src/systemc/tests/verify.py 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index 6667b13..4c30773 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -184,27 +184,35 @@ with open(self.text) as test_f, open(self.ref) as ref_f: return test_f.read() == ref_f.read() +def tagged_filt(tag, num): +return (r'^\n{}: \({}{}\) .*\n(In file: .*\n)?' +r'(In process: [\w.]* @ .*\n)?').format(tag, tag[0], num) + +def warning_filt(num): +return tagged_filt('Warning', num) + +def info_filt(num): +return tagged_filt('Info', num) + class LogChecker(Checker): def merge_filts(*filts): filts = map(lambda f: '(' + f + ')', filts) filts = '|'.join(filts) return re.compile(filts, flags=re.MULTILINE) -def warning_filt(num): -return (r'^\nWarning: \(W{}\) .*\n(In file: .*\n)?' -r'(In process: [\w.]* @ .*\n)?').format(num) - ref_filt = merge_filts( r'^\nInfo: /OSCI/SystemC: Simulation stopped by user.\n', r'^SystemC Simulation\n', +r'^\nInfo: \(I804\) /IEEE_Std_1666/deprecated: ' + +r'You can turn off(.*\n){7}', warning_filt(540), warning_filt(569), warning_filt(571), -r'^\nInfo: \(I804\) /IEEE_Std_1666/deprecated: ' + -r'You can turn off(.*\n){7}' +info_filt(804), ) test_filt = merge_filts( -r'^Global frequency set at \d* ticks per second\n' +r'^Global frequency set at \d* ticks per second\n', +info_filt(804), ) def __init__(self, ref, test, tag, out_dir): -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12086 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: I93b9e2d547b6259512db091cfc557d21f86f4a3d Gerrit-Change-Number: 12086 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Exclude two more tests which have undefined functions.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12081 Change subject: systemc: Exclude two more tests which have undefined functions. .. systemc: Exclude two more tests which have undefined functions. It seems that implementing more of systemc makes the compiler think it wants an implementation, and so the build fails with linker errors. Change-Id: I6f0b031f300b0ad60dac8b4462b8f4d466aa7dfa --- M src/systemc/tests/working.filt 1 file changed, 4 insertions(+), 0 deletions(-) diff --git a/src/systemc/tests/working.filt b/src/systemc/tests/working.filt index 66dba3b..4553a55 100644 --- a/src/systemc/tests/working.filt +++ b/src/systemc/tests/working.filt @@ -29,6 +29,10 @@ # Another test which calls an undefined function. "systemc/misc/gnats/pr-480", +# Two more tests with undefined functions. +"systemc/misc/unit/extern", +"systemc/misc/unit/extern2", + # These tests rely on implicit FXVAL constructors based on primitive types, # but enabling that makes other operator overloads ambiguous so things # don't compile. It also seems dangerous to change what the headers look -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12081 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: I6f0b031f300b0ad60dac8b4462b8f4d466aa7dfa Gerrit-Change-Number: 12081 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Ensure delta notifications happen at the right time after sc...
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12080 Change subject: systemc: Ensure delta notifications happen at the right time after sc_pause. .. systemc: Ensure delta notifications happen at the right time after sc_pause. Normally delta notifications would be created during the evaluation or update phases, and so there isn't any problem with them cutting in front of those stages. When the simulation is paused however, those notifications could be waiting before the ready event starts and could preempt it. This change adds a check for that situation to the end of the pause event and runs the evalution and update stages inline if necessary. Change-Id: I4477b2ae8e7980406df00ba7320ae2a24ae2da9b --- M src/systemc/core/scheduler.cc 1 file changed, 8 insertions(+), 0 deletions(-) diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 44c5646..d2e87f2 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -210,6 +210,14 @@ _paused = true; kernel->status(::sc_core::SC_PAUSED); scMain->run(); + +// If the ready event is supposed to run now, run it inline so that it +// preempts any delta notifications which were scheduled while we were +// paused. +if (readyEvent.scheduled()) { +eq->deschedule(); +runReady(); +} } void -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12080 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: I4477b2ae8e7980406df00ba7320ae2a24ae2da9b Gerrit-Change-Number: 12080 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement sc_event_finder.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12082 Change subject: systemc: Implement sc_event_finder. .. systemc: Implement sc_event_finder. Change-Id: I22aa0a34eabf13593986a92289155257fa26c7de --- M src/systemc/ext/core/sc_event.hh 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/systemc/ext/core/sc_event.hh b/src/systemc/ext/core/sc_event.hh index c215496..f8a32f3 100644 --- a/src/systemc/ext/core/sc_event.hh +++ b/src/systemc/ext/core/sc_event.hh @@ -30,9 +30,11 @@ #ifndef __SYSTEMC_EXT_CORE_SC_EVENT_HH__ #define __SYSTEMC_EXT_CORE_SC_EVENT_HH__ +#include #include #include +#include "sc_port.hh" #include "sc_time.hh" namespace sc_gem5 @@ -58,6 +60,7 @@ { protected: void warn_unimpl(const char *func) const; +virtual ~sc_event_finder() {} public: // Should be "implementation defined" but used in the tests. @@ -68,18 +71,27 @@ class sc_event_finder_t : public sc_event_finder { public: -sc_event_finder_t(const sc_port_base &, - const sc_event & (IF::*event_method)() const) +sc_event_finder_t(const sc_port_base , + const sc_event & (IF::*_method)() const) : +_method(_method) { -warn_unimpl(__PRETTY_FUNCTION__); +_port = dynamic_cast *>(); +assert(_port); } +virtual ~sc_event_finder_t() {} + const sc_event & find_event(sc_interface *if_p=NULL) const override { -warn_unimpl(__PRETTY_FUNCTION__); -return *(const sc_event *)nullptr; +const IF *iface = if_p ? dynamic_cast(if_p) : +dynamic_cast(_port->get_interface()); +return (const_cast(iface)->*_method)(); } + + private: +const sc_port_b *_port; +const sc_event &(IF::*_method)() const; }; class sc_event_and_list -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12082 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: I22aa0a34eabf13593986a92289155257fa26c7de Gerrit-Change-Number: 12082 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement port binding except positional binding.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12084 Change subject: systemc: Implement port binding except positional binding. .. systemc: Implement port binding except positional binding. This change adds code which keeps track of ports and interfaces which are being bound to be finalized later, and the actual port binding of interfaces and recursive binding port ports. Change-Id: Ifa885ed44b667254762cc101580be4f0a7d7a131 --- M src/systemc/core/kernel.cc M src/systemc/core/module.hh M src/systemc/core/process.hh M src/systemc/core/sc_port.cc M src/systemc/ext/core/sc_port.hh 5 files changed, 89 insertions(+), 80 deletions(-) diff --git a/src/systemc/core/kernel.cc b/src/systemc/core/kernel.cc index 4eb0bb7..65a4445 100644 --- a/src/systemc/core/kernel.cc +++ b/src/systemc/core/kernel.cc @@ -77,6 +77,10 @@ void Kernel::regStats() { +for (auto m: sc_gem5::allModules) +for (auto p: m->ports) +p->_gem5Finalize(); + status(::sc_core::SC_END_OF_ELABORATION); for (auto m: sc_gem5::allModules) m->sc_mod()->end_of_elaboration(); diff --git a/src/systemc/core/module.hh b/src/systemc/core/module.hh index a5bf929..0a6d9b7 100644 --- a/src/systemc/core/module.hh +++ b/src/systemc/core/module.hh @@ -35,10 +35,18 @@ #include #include #include +#include #include "systemc/core/object.hh" #include "systemc/ext/core/sc_module.hh" +namespace sc_core +{ + +class sc_port_base; + +} // namespace sc_core + namespace sc_gem5 { @@ -101,6 +109,8 @@ void pop(); const char *uniqueName(const char *seed) { return nameGen.gen(seed); } + +std::vector<::sc_core::sc_port_base *> ports; }; Module *currentModule(); diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh index 5f0a72d..ad02d0c 100644 --- a/src/systemc/core/process.hh +++ b/src/systemc/core/process.hh @@ -221,7 +221,7 @@ { for (int i = 0; i < port->size(); i++) { const ::sc_core::sc_event *e = ->_gem5BindInfo[i]->interface->default_event(); +>_gem5Interface(0)->default_event(); s.push_back(new SensitivityEvent(process, e)); } } diff --git a/src/systemc/core/sc_port.cc b/src/systemc/core/sc_port.cc index ad22854..f5309dc 100644 --- a/src/systemc/core/sc_port.cc +++ b/src/systemc/core/sc_port.cc @@ -29,14 +29,18 @@ #include "base/logging.hh" #include "systemc/core/bindinfo.hh" +#include "systemc/core/module.hh" #include "systemc/ext/core/sc_port.hh" namespace sc_core { sc_port_base::sc_port_base(const char *name, int n, sc_port_policy p) : -sc_object(name) -{} +sc_object(name), _maxSize(n), _size(0) +{ +::sc_gem5::Module *m = ::sc_gem5::currentModule(); +m->ports.push_back(this); +} void sc_port_base::warn_unimpl(const char *func) const @@ -45,18 +49,41 @@ } int sc_port_base::maxSize() const { return _maxSize; } -int sc_port_base::size() const { return _gem5BindInfo.size(); } +int sc_port_base::size() const { return _size; } void -sc_port_base::bind(sc_interface &) +sc_port_base::bind(sc_interface ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +_gem5BindInfo.push_back(new ::sc_gem5::BindInfo()); } void -sc_port_base::bind(sc_port_base &) +sc_port_base::bind(sc_port_base ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +_gem5BindInfo.push_back(new ::sc_gem5::BindInfo()); +} + +void +sc_port_base::_gem5Finalize() +{ +if (finalized) +return; +finalized = true; + +for (auto : _gem5BindInfo) { +if (bi->interface) { +_gem5AddInterface(bi->interface); +} else { +sc_port_base *port = bi->port; +port->_gem5Finalize(); +int size = port->size(); +for (int i = 0; i < size; i++) +_gem5AddInterface(port->_gem5Interface(i)); +} +delete bi; +} + +_gem5BindInfo.clear(); } } // namespace sc_core diff --git a/src/systemc/ext/core/sc_port.hh b/src/systemc/ext/core/sc_port.hh index fb7b76d..6031d54 100644 --- a/src/systemc/ext/core/sc_port.hh +++ b/src/systemc/ext/core/sc_port.hh @@ -32,6 +32,7 @@ #include +#include "../utils/sc_report_handler.hh" #include "sc_module.hh" // for sc_gen_unique_name #include "sc_object.hh" @@ -76,87 +77,37 @@ private: friend class ::sc_gem5::PendingSensitivityPort; +friend class ::sc_gem5::Kernel; + +void _gem5Finalize(); + +virtual sc_interface *_gem5Interface(int n) const = 0; +virtual void _gem5AddInterface(sc_interface *i) = 0; std::vector<::sc_gem5::BindInfo *> _gem5BindInfo; int _maxSize; +int _size; +bool finalized; }; template class sc_port_b : public sc_port_base { public: -void -operator () (IF &) -{ -this->warn_unimpl(__PRETTY_FUNCTION__); -} +void
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement the sc_in class.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12085 Change subject: systemc: Implement the sc_in class. .. systemc: Implement the sc_in class. Change-Id: I08174462cb650c7918a4e8f5284d4ee814cf595d --- M src/systemc/ext/channel/sc_in.hh 1 file changed, 201 insertions(+), 266 deletions(-) diff --git a/src/systemc/ext/channel/sc_in.hh b/src/systemc/ext/channel/sc_in.hh index f691afe..b7170ae 100644 --- a/src/systemc/ext/channel/sc_in.hh +++ b/src/systemc/ext/channel/sc_in.hh @@ -32,6 +32,7 @@ #include +#include "../core/sc_event.hh" #include "../core/sc_port.hh" #include "sc_signal_in_if.hh" #include "sc_signal_inout_if.hh" @@ -41,119 +42,98 @@ { class sc_event; -class sc_event_finder; class sc_trace_file; template class sc_in : public sc_port, 1> { public: -sc_in() : sc_port, 1>() {} -explicit sc_in(const char *name) : sc_port, 1>(name) {} +sc_in() : sc_port, 1>(), +_valueChangedFinder(*this, _signal_in_if::value_changed_event) +{} +explicit sc_in(const char *name) : sc_port, 1>(name), +_valueChangedFinder(*this, _signal_in_if::value_changed_event) +{} virtual ~sc_in() {} // Deprecated binding constructors. explicit sc_in(const sc_signal_in_if ) : -sc_port, 1>(interface) +sc_port, 1>(interface), +_valueChangedFinder(*this, _signal_in_if::value_changed_event) {} sc_in(const char *name, const sc_signal_in_if ) : -sc_port, 1>(name, interface) +sc_port, 1>(name, interface), +_valueChangedFinder(*this, _signal_in_if::value_changed_event) {} explicit sc_in(sc_port_b > ) : -sc_port, 1>(parent) +sc_port, 1>(parent), +_valueChangedFinder(*this, _signal_in_if::value_changed_event) {} sc_in(const char *name, sc_port_b > ) : -sc_port, 1>(name, parent) +sc_port, 1>(name, parent), +_valueChangedFinder(*this, _signal_in_if::value_changed_event) {} explicit sc_in(sc_port, 1> ) : -sc_port, 1>(parent) +sc_port, 1>(parent), +_valueChangedFinder(*this, _signal_in_if::value_changed_event) {} sc_in(const char *name, sc_port, 1> ) : -sc_port, 1>(name, parent) +sc_port, 1>(name, parent), +_valueChangedFinder(*this, _signal_in_if::value_changed_event) {} virtual void -bind(const sc_signal_in_if &) +bind(const sc_signal_in_if ) { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +sc_port, 1>::bind( +const_cast &>(i)); +} +void operator () (const sc_signal_in_if ) { bind(i); } + +virtual void +bind(sc_port, 1> ) +{ +sc_port, 1>::bind(i); } void -operator () (const sc_signal_in_if &) +operator () (sc_port, 1> ) { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +bind(p); } virtual void -bind(sc_port, 1> &) +bind(sc_port, 1> ) { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +sc_port_base::bind(p); } void -operator () (sc_port, 1> &) +operator () (sc_port, 1> ) { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +bind(p); } -virtual void -bind(sc_port, 1> &) -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -} -void -operator () (sc_port, 1> &) -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -} +virtual void end_of_elaboration() { /* Implementation defined. */ } -virtual void -end_of_elaboration() -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -} +const T () const { return (*this)->read(); } +operator const T& () const { return (*this)->read(); } -const T & -read() const -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -return *(const T *)nullptr; -} -operator const T& () const -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -return *(const T *)nullptr; -} - -const sc_event & -default_event() const -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -return *(const sc_event *)nullptr; -} +const sc_event _event() const { return (*this)->default_event(); } const sc_event & value_changed_event() const { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -return *(const sc_event *)nullptr; +return (*this)->value_changed_event(); } -bool -event() const -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -return false; -} -sc_event_finder & -value_changed() const -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -return *(sc_event_finder *)nullptr; -} +bool event() const { return (*this)->event(); } +sc_event_finder _changed() const {
[gem5-dev] Change in gem5/gem5[master]: systemc: Make BindInfo track ports or interfaces.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12083 Change subject: systemc: Make BindInfo track ports or interfaces. .. systemc: Make BindInfo track ports or interfaces. Change-Id: I0ca0d5de8de59d92cb65af56c25f418ff32696f4 --- M src/systemc/core/bindinfo.hh 1 file changed, 9 insertions(+), 0 deletions(-) diff --git a/src/systemc/core/bindinfo.hh b/src/systemc/core/bindinfo.hh index 332fb13..9e636a6 100644 --- a/src/systemc/core/bindinfo.hh +++ b/src/systemc/core/bindinfo.hh @@ -38,7 +38,16 @@ class BindInfo { public: +BindInfo(::sc_core::sc_interface *interface) : +interface(interface), port(nullptr) +{} + +BindInfo(::sc_core::sc_port_base *port) : +interface(nullptr), port(port) +{} + ::sc_core::sc_interface *interface; +::sc_core::sc_port_base *port; }; } // namespace sc_gem5 -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12083 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: I0ca0d5de8de59d92cb65af56c25f418ff32696f4 Gerrit-Change-Number: 12083 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement a few more member functions for sc_time.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12071 Change subject: systemc: Implement a few more member functions for sc_time. .. systemc: Implement a few more member functions for sc_time. Change-Id: I40a7fb278f2a0ec4124589e02e4441c1866c86ea --- M src/systemc/core/sc_time.cc 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc index 93150aa..0a52a6a 100644 --- a/src/systemc/core/sc_time.cc +++ b/src/systemc/core/sc_time.cc @@ -176,8 +176,7 @@ double sc_time::to_double() const { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return 0.0; +return static_cast(val); } double sc_time::to_seconds() const @@ -244,16 +243,16 @@ } sc_time & -sc_time::operator *= (double) +sc_time::operator *= (double d) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +val = static_cast(static_cast(val) * d + 0.5); return *this; } sc_time & -sc_time::operator /= (double) +sc_time::operator /= (double d) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +val = static_cast(static_cast(val) / d + 0.5); return *this; } @@ -310,31 +309,30 @@ } const sc_time -operator * (const sc_time &, double) +operator * (const sc_time , double d) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return sc_time(); +volatile double tmp = static_cast(t.value()) * d + 0.5; +return sc_time::from_value(static_cast(tmp)); } const sc_time -operator * (double, const sc_time &) +operator * (double d, const sc_time ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return sc_time(); +volatile double tmp = d * static_cast(t.value()) + 0.5; +return sc_time::from_value(static_cast(tmp)); } const sc_time -operator / (const sc_time &, double) +operator / (const sc_time , double d) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return sc_time(); +volatile double tmp = static_cast(t.value()) / d + 0.5; +return sc_time::from_value(static_cast(tmp)); } double -operator / (const sc_time &, const sc_time &) +operator / (const sc_time , const sc_time ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return 0.0; +return t1.to_double() / t2.to_double(); } std::ostream & -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12071 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: I40a7fb278f2a0ec4124589e02e4441c1866c86ea Gerrit-Change-Number: 12071 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Make verify.py compare non output log reference files.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12060 Change subject: systemc: Make verify.py compare non output log reference files. .. systemc: Make verify.py compare non output log reference files. There are only a few of these which are vcd files. If there are reference files which aren't the log and which aren't in the gem5 output directory, mark those tests as failed as well. Change-Id: I2c880c13d0f90ccf16ac0439dbac68de9223cc90 --- M src/systemc/tests/verify.py 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index ad61319..062651d 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -227,6 +227,60 @@ os.unlink(diff_path) return True +class GoldenDir(object): +def __init__(self, path, platform): +self.path = path +self.platform = platform + +contents = os.listdir(path) +suffix = '.' + platform +suffixed = filter(lambda c: c.endswith(suffix), contents) +bases = map(lambda t: t[:-len(platform)], suffixed) +common = filter(lambda t: not t.startswith(tuple(bases)), contents) + +self.entries = {} +class Entry(object): +def __init__(self, e_path): +self.used = False +self.path = os.path.join(path, e_path) + +def use(self): +self.used = True + +for entry in contents: +self.entries[entry] = Entry(entry) + +def entry(self, name): +def match(n): +return (n == name) or n.startswith(name + '.') +matches = { n: e for n, e in self.entries.items() if match(n) } + +for match in matches.values(): +match.use() + +platform_name = '.'.join([ name, self.platform ]) +if platform_name in matches: +return matches[platform_name].path +if name in matches: +return matches[name].path +else: +return None + +def unused(self): +items = self.entries.items() +items = filter(lambda i: not i[1].used, items) + +items.sort() +sources = [] +i = 0 +while i < len(items): +root = items[i][0] +sources.append(root) +i += 1 +while i < len(items) and items[i][0].startswith(root): +i += 1 +return sources + class VerifyPhase(TestPhaseBase): name = 'verify' number = 3 @@ -321,14 +375,29 @@ diffs = [] +gd = GoldenDir(test.golden_dir(), 'linux64') + +missing = [] log_file = '.'.join([test.name, 'log']) -log_path = os.path.join(test.golden_dir(), log_file) +log_path = gd.entry(log_file) simout_path = os.path.join(out_dir, 'simout') if not os.path.exists(simout_path): -self.failed(test, 'no log output') -if os.path.exists(log_path): -diffs.append(LogChecker( -log_path, simout_path, log_file, out_dir)) +missing.append('log output') +elif log_path: +diffs.append(LogChecker(log_path, simout_path, +log_file, out_dir)) + +for name in gd.unused(): +test_path = os.path.join(out_dir, name) +ref_path = gd.entry(name) +if not os.path.exists(test_path): +missing.append(name) +else: +diffs.append(Checker(ref_path, test_path, name)) + +if missing: +self.failed(test, 'missing output', ' '.join(missing)) +continue failed_diffs = filter(lambda d: not d.check(), diffs) if failed_diffs: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12060 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: I2c880c13d0f90ccf16ac0439dbac68de9223cc90 Gerrit-Change-Number: 12060 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Fix a couple memory errors.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12039 Change subject: systemc: Fix a couple memory errors. .. systemc: Fix a couple memory errors. Because events are held in vectors, it doesn't make sense to keep an iterator into the parent to keep track of where that event is for easy removal since the iterator becomes invalid when the vector is changed. The events need to be stored in a vector because systemc defines an accessor which returns that vector, and building a vector on the fly would be cumbersome. Also, make sure the Event parent pointer is set to nullptr if there isn't a parent. Change-Id: I63a676190e7747e60baaca50009161d47bfc1c54 --- M src/systemc/core/event.cc M src/systemc/core/event.hh M src/systemc/core/object.cc M src/systemc/core/object.hh 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/systemc/core/event.cc b/src/systemc/core/event.cc index 1623cf9..05670fe 100644 --- a/src/systemc/core/event.cc +++ b/src/systemc/core/event.cc @@ -29,6 +29,7 @@ #include "systemc/core/event.hh" +#include #include #include @@ -51,12 +52,14 @@ parent = p->obj()->sc_obj(); else if (scheduler.current()) parent = scheduler.current(); +else +parent = nullptr; if (parent) { Object *obj = Object::getFromScObject(parent); -parentIt = obj->addChildEvent(_sc_event); +obj->addChildEvent(_sc_event); } else { -parentIt = topLevelEvents.emplace(topLevelEvents.end(), _sc_event); +topLevelEvents.emplace(topLevelEvents.end(), _sc_event); } if (parent) @@ -74,9 +77,12 @@ { if (parent) { Object *obj = Object::getFromScObject(parent); -obj->delChildEvent(parentIt); +obj->delChildEvent(_sc_event); } else { -std::swap(*parentIt, topLevelEvents.back()); +EventsIt it = find(topLevelEvents.begin(), topLevelEvents.end(), + _sc_event); +assert(it != topLevelEvents.end()); +std::swap(*it, topLevelEvents.back()); topLevelEvents.pop_back(); } diff --git a/src/systemc/core/event.hh b/src/systemc/core/event.hh index 6d2f46d..f9d3b20 100644 --- a/src/systemc/core/event.hh +++ b/src/systemc/core/event.hh @@ -103,7 +103,6 @@ bool _inHierarchy; sc_core::sc_object *parent; -EventsIt parentIt; void delayedNotify(); EventWrapper delayedNotifyEvent; diff --git a/src/systemc/core/object.cc b/src/systemc/core/object.cc index 39403ca..1347661 100644 --- a/src/systemc/core/object.cc +++ b/src/systemc/core/object.cc @@ -29,6 +29,8 @@ #include "systemc/core/object.hh" +#include + #include "base/logging.hh" #include "systemc/core/module.hh" #include "systemc/core/scheduler.hh" @@ -230,8 +232,10 @@ } void -Object::delChildEvent(EventsIt it) +Object::delChildEvent(sc_core::sc_event *e) { +EventsIt it = std::find(events.begin(), events.end(), e); +assert(it != events.end()); std::swap(*it, events.back()); events.pop_back(); } diff --git a/src/systemc/core/object.hh b/src/systemc/core/object.hh index c87a98b..cb759d8 100644 --- a/src/systemc/core/object.hh +++ b/src/systemc/core/object.hh @@ -88,7 +88,7 @@ sc_core::sc_object *sc_obj() { return _sc_obj; } EventsIt addChildEvent(sc_core::sc_event *e); -void delChildEvent(EventsIt it); +void delChildEvent(sc_core::sc_event *e); private: sc_core::sc_object *_sc_obj; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12039 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: I63a676190e7747e60baaca50009161d47bfc1c54 Gerrit-Change-Number: 12039 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Ensure the terminated event is notified in all cases.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12057 Change subject: systemc: Ensure the terminated event is notified in all cases. .. systemc: Ensure the terminated event is notified in all cases. The terminated event was being notified if a process was killed, but not if it was terminated in other ways. This change moves the notification into the helper which sets termination related state. Change-Id: I10aa5ad25875db992c8408dc60f087efc76b336b --- M src/systemc/core/process.cc 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc index a54d5c2..ef1cea6 100644 --- a/src/systemc/core/process.cc +++ b/src/systemc/core/process.cc @@ -220,8 +220,6 @@ // Inject the kill exception into this process if it's started. if (!_needsStart) injectException(killException); - -_terminatedEvent.notify(); } void @@ -384,6 +382,8 @@ for (auto s: staticSensitivities) delete s; staticSensitivities.clear(); + +_terminatedEvent.notify(); } Process *Process::_newest; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12057 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: I10aa5ad25875db992c8408dc60f087efc76b336b Gerrit-Change-Number: 12057 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Remove some junk test reference files.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12058 Change subject: systemc: Remove some junk test reference files. .. systemc: Remove some junk test reference files. These files have truncated names, and are identical to correct versions of the log files. Change-Id: I1e5e3c8c489d41dea21f62b4664b05bf6a742117 --- D src/systemc/tests/systemc/misc/unit/data/user_guide/ch9/std_ulogic_datatype/golden/std_ulogic_da D src/systemc/tests/systemc/misc/unit/data/user_guide/ch9/std_ulogic_vector_datatype/golden/std_ul D src/systemc/tests/systemc/misc/unit/methodology/file_io/input_char_sc_signed/golden/input_char_s 3 files changed, 0 insertions(+), 311 deletions(-) diff --git a/src/systemc/tests/systemc/misc/unit/data/user_guide/ch9/std_ulogic_datatype/golden/std_ulogic_da b/src/systemc/tests/systemc/misc/unit/data/user_guide/ch9/std_ulogic_datatype/golden/std_ulogic_da deleted file mode 100644 index 989b39e..000 --- a/src/systemc/tests/systemc/misc/unit/data/user_guide/ch9/std_ulogic_datatype/golden/std_ulogic_da +++ /dev/null @@ -1,106 +0,0 @@ -SystemC Simulation - -std_ulogic <=std_ulogic -UNINITIALIZED = X 'U' -UNKNOWN= X 'X' -ZERO = 0 '0' -ONE= 1 '1' -TRISTATE = Z 'Z' -WEAK-UNKNOWN = X 'W' -WEAK-ZERO = X 'L' -WEAK-ONE = X 'H' -DONT-CARE = X '-' -TRUE = 1 true -FALSE = 0 false - -std_ulogic <= literals -- -A = 1 true -B = 0 false -C = 1 1 -D = 0 0 - -std_ulogic <= bool -- -TRUE = 1 1 -FALSE = 0 0 -1 = 1 1 -0 = 0 0 - -std_ulogic <= char -- -SC1= X 'U' -SC2= X 'u' -SC3= X 'X' -SC4= X 'x' -SC5= 0 '0' -SC6= 1 '1' -SC7= Z 'Z' -SC8= Z 'z' -SC9= X 'W' -SC10 = X 'w' -SC11 = X 'L' -SC12 = X 'l' -SC13 = X 'H' -SC14 = X 'h' -SC15 = X '-' -SC16 = X 'D' -SC17 = X 'd' -SC18 = X 'B' -SC19 = X 'F' - -op1 operatorop2 result [All operands are std_ulogic] - -1 &= 1 = 1 -1 ^= 1 = 0 -1 |= 1 = 1 -~(1)= 0 -1 &1 = 1 -1 ^1 = 0 -1 |1 = 1 -1 == 1 -> true -1 != 1 -> false -0 =0 - -+-+ -| AND (&) | X | 0 | 1 | Z | -+-+ -|X| X | 0 | X | X | -+-+ -|0| 0 | 0 | 0 | 0 | -+-+ -|1| X | 0 | 1 | X | -+-+ -|Z| X | 0 | X | X | -+-+ - -+-+ -| OR (|) | X | 0 | 1 | Z | -+-+ -|X| X | X | 1 | X | -+-+ -|0| X | 0 | 1 | X | -+-+ -|1| 1 | 1 | 1 | 1 | -+-+ -|Z| X | X | 1 | X | -+-+ - -+-+ -| XOR (^) | X | 0 | 1 | Z | -+-+ -|X| X | X | X | X | -+-+ -|0| X | 0 | 1 | X | -+-+ -|1| X | 1 | 0 | X | -+-+ -|Z| X | X | X | X | -+-+ - -+-+ -| NOT (~) | X | 0 | 1 | Z | -+-+ -| | X | 1 | 0 | X | -+-+ diff --git a/src/systemc/tests/systemc/misc/unit/data/user_guide/ch9/std_ulogic_vector_datatype/golden/std_ul b/src/systemc/tests/systemc/misc/unit/data/user_guide/ch9/std_ulogic_vector_datatype/golden/std_ul deleted file mode 100644 index 7947cc4..000 --- a/src/systemc/tests/systemc/misc/unit/data/user_guide/ch9/std_ulogic_vector_datatype/golden/std_ul +++ /dev/null @@ -1,203 +0,0 @@ -SystemC Simulation - -INTEGER SIZE = 4 bytes -SHORT INTEGER SIZE = 2 bytes -LONG INTEGER SIZE = 4 bytes -UNSIGNED LONG SIZE = 4 bytes -SIGNED LONG SIZE = 4 bytes - -std_ulogic_vector <=C++ string -A = 01XZX "01XZUWLH-" -B = XX0XX1XXX "ZZ1XX0UU1WWW" -BIG = - "" -HUGE =
[gem5-dev] Change in gem5/gem5[master]: systemc: Adjust a warning to match Accellera.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12063 Change subject: systemc: Adjust a warning to match Accellera. .. systemc: Adjust a warning to match Accellera. This is to pass fix a diff in the regression tests. Change-Id: Id1b963df647224d7a3589febe7986353a4a8e440 --- M src/systemc/dt/bit/sc_bit.cc 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemc/dt/bit/sc_bit.cc b/src/systemc/dt/bit/sc_bit.cc index 7300b0d..7572a0e 100644 --- a/src/systemc/dt/bit/sc_bit.cc +++ b/src/systemc/dt/bit/sc_bit.cc @@ -119,7 +119,7 @@ static bool warn_sc_bit_deprecated = true; if (warn_sc_bit_deprecated) { warn_sc_bit_deprecated = false; -SC_REPORT_INFO("/IEEE_Std_1666/deprecated", +SC_REPORT_INFO("(I804) /IEEE_Std_1666/deprecated", "sc_bit is deprecated, use bool instead"); } } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12063 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: Id1b963df647224d7a3589febe7986353a4a8e440 Gerrit-Change-Number: 12063 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Fix the seed used with sc_gen_unique_name for sc_port.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12067 Change subject: systemc: Fix the seed used with sc_gen_unique_name for sc_port. .. systemc: Fix the seed used with sc_gen_unique_name for sc_port. The seed should only be "port" not "sc_port". Change-Id: Ia046103abc0a9ed283fcb7cf7d8069383a1e2b0d --- M src/systemc/ext/core/sc_port.hh 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemc/ext/core/sc_port.hh b/src/systemc/ext/core/sc_port.hh index 0f5a661..fb7b76d 100644 --- a/src/systemc/ext/core/sc_port.hh +++ b/src/systemc/ext/core/sc_port.hh @@ -165,7 +165,7 @@ virtual void end_of_simulation() {} explicit sc_port_b(int n, sc_port_policy p) : -sc_port_base(sc_gen_unique_name("sc_port"), n, p) +sc_port_base(sc_gen_unique_name("port"), n, p) {} sc_port_b(const char *name, int n, sc_port_policy p) : sc_port_base(name, n, p) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12067 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: Ia046103abc0a9ed283fcb7cf7d8069383a1e2b0d Gerrit-Change-Number: 12067 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Make verify.py ignore an Info: message.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12064 Change subject: systemc: Make verify.py ignore an Info: message. .. systemc: Make verify.py ignore an Info: message. This message is about how to disable a warning about sc_bit being deprecated. Change-Id: I1a0b12e2ca5b58328e37605ba3f7e3e1a384e351 --- M src/systemc/tests/verify.py 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index 0b903de..e98f219 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -198,7 +198,9 @@ r'^\nInfo: /OSCI/SystemC: Simulation stopped by user.\n', r'^SystemC Simulation\n', warning_filt(571), -warning_filt(540) +warning_filt(540), +r'^\nInfo: \(I804\) /IEEE_Std_1666/deprecated: ' + +r'You can turn off(.*\n){7}' ) test_filt = merge_filts( r'^Global frequency set at \d* ticks per second\n' -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12064 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: I1a0b12e2ca5b58328e37605ba3f7e3e1a384e351 Gerrit-Change-Number: 12064 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement sc_gen_unique_name.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12066 Change subject: systemc: Implement sc_gen_unique_name. .. systemc: Implement sc_gen_unique_name. The Accellera implementation statically allocates the buffer it uses to build the unique names and only allocates the name generator if it's going to be used for a particular module. I assume that's to avoid allocating a large buffer if it's not going to be used. In this implementation, I use an std::string which manages its own memory and so shouldn't need to be selectively allocated. I also use a string stream to construct the name instead of sprintf. Change-Id: If92c68586a85b5d27c067a75a6e9ebbf00d8c785 --- M src/systemc/core/module.hh M src/systemc/core/sc_module.cc 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/systemc/core/module.hh b/src/systemc/core/module.hh index 696d8c5..8aebff2 100644 --- a/src/systemc/core/module.hh +++ b/src/systemc/core/module.hh @@ -31,7 +31,10 @@ #define __SYSTEMC_CORE_MODULE_HH__ #include +#include #include +#include +#include #include "systemc/core/object.hh" #include "systemc/ext/core/sc_module.hh" @@ -39,6 +42,23 @@ namespace sc_gem5 { +class UniqueNameGen +{ + private: +std::map counts; +std::string buf; + + public: +const char * +gen(std::string seed) +{ +std::ostringstream os; +os << seed << "_" << counts[seed]++; +buf = os.str(); +return buf.c_str(); +} +}; + class Module { private: @@ -46,6 +66,8 @@ sc_core::sc_module *_sc_mod; Object *_obj; +UniqueNameGen nameGen; + public: Module(const char *name); @@ -77,6 +99,8 @@ } void pop(); + +const char *uniqueName(const char *seed) { return nameGen.gen(seed); } }; Module *currentModule(); diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc index bd0b2e1..1434f69 100644 --- a/src/systemc/core/sc_module.cc +++ b/src/systemc/core/sc_module.cc @@ -64,6 +64,8 @@ return p; } +UniqueNameGen nameGen; + } // namespace sc_gem5 namespace sc_core @@ -643,10 +645,11 @@ } const char * -sc_gen_unique_name(const char *) +sc_gen_unique_name(const char *seed) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return ""; +::sc_gem5::Module *mod = ::sc_gem5::currentModule(); +return mod ? mod->uniqueName(seed) : +::sc_gem5::nameGen.gen(seed); } bool -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12066 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: If92c68586a85b5d27c067a75a6e9ebbf00d8c785 Gerrit-Change-Number: 12066 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement much of events, event lists and event exprs.
Hello Jason Lowe-Power, Matthias Jung, Giacomo Travaglini, Andreas Sandberg, I'd like you to reexamine a change. Please visit https://gem5-review.googlesource.com/c/public/gem5/+/11711 to look at the new patch set (#2). Change subject: systemc: Implement much of events, event lists and event exprs. .. systemc: Implement much of events, event lists and event exprs. Three things aren't yet implemented, waking up processes which are sensitive to the event, triggering of events, and garbage collecting list objects which came from expression objects. The garbage collection aspect is problematic since there doesn't seem to be a correct way to implement it given the constraints in the spec, including the way that's implemented by Accellera. It's something that will need to be dealt with at some point, but in the interest of forward progress it's being ignored for now. Change-Id: Ic4e3c219ff482729f1f1302ab10181a798d48041 --- M src/systemc/core/SConscript A src/systemc/core/event.cc A src/systemc/core/event.hh M src/systemc/core/object.cc M src/systemc/core/object.hh M src/systemc/core/sc_event.cc M src/systemc/ext/core/sc_event.hh 7 files changed, 576 insertions(+), 170 deletions(-) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11711 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: Ic4e3c219ff482729f1f1302ab10181a798d48041 Gerrit-Change-Number: 11711 Gerrit-PatchSet: 2 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: newpatchset ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in gem5/gem5[master]: systemc: Fix a small bug in verify.py.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12029 Change subject: systemc: Fix a small bug in verify.py. .. systemc: Fix a small bug in verify.py. The src_dir method of the Test class was using the wrong attribute of the test from the json file. It should use path, but was using src_dir. Change-Id: Iaaaf31c31b11b68ecd7dd98807e6b78597cebb99 --- M src/systemc/tests/verify.py 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index aa9ec35..d46e3cc 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -70,7 +70,7 @@ return os.path.join(self.build_dir, tests_rel_path, self.path) def src_dir(self): -return os.path.join(script_path, self.path) +return os.path.join(script_dir, self.path) def golden_dir(self): return os.path.join(self.src_dir(), 'golden') -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12029 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: Iaaaf31c31b11b68ecd7dd98807e6b78597cebb99 Gerrit-Change-Number: 12029 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Use an std::list to track all modules.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12077 Change subject: systemc: Use an std::list to track all modules. .. systemc: Use an std::list to track all modules. This is less efficient when modules are destroyed since the list isn't sorted, and each module needs to find its own entry to remove. The benefit is that entries added to the end of the list while the list is being iterated over will still be included, and that the order the modules are added will be preserved so that it matches what the order in the regression tests. Change-Id: I5af5d15f316fa58561e8fd9ca77f667ddc8b2c5e --- M src/systemc/core/module.cc M src/systemc/core/module.hh 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/systemc/core/module.cc b/src/systemc/core/module.cc index 986ad25..b13b50d 100644 --- a/src/systemc/core/module.cc +++ b/src/systemc/core/module.cc @@ -30,7 +30,6 @@ #include "systemc/core/module.hh" #include -#include #include "base/logging.hh" @@ -53,7 +52,7 @@ _new_module = this; } -Module::~Module() { allModules.erase(this); } +Module::~Module() { allModules.remove(this); } void Module::finish(Object *this_obj) @@ -65,7 +64,7 @@ // This is called from the constructor of this_obj, so it can't use // dynamic cast. sc_mod(static_cast<::sc_core::sc_module *>(this_obj->sc_obj())); -allModules.insert(this); +allModules.emplace_back(this); } void @@ -95,6 +94,6 @@ void callbackModule(Module *m) { _callbackModule = m; } Module *callbackModule() { return _callbackModule; } -std::set allModules; +std::list allModules; } // namespace sc_gem5 diff --git a/src/systemc/core/module.hh b/src/systemc/core/module.hh index 7e54e29..a5bf929 100644 --- a/src/systemc/core/module.hh +++ b/src/systemc/core/module.hh @@ -31,8 +31,8 @@ #define __SYSTEMC_CORE_MODULE_HH__ #include +#include #include -#include #include #include @@ -109,7 +109,7 @@ void callbackModule(Module *m); Module *callbackModule(); -extern std::set allModules; +extern std::list allModules; } // namespace sc_gem5 -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12077 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: I5af5d15f316fa58561e8fd9ca77f667ddc8b2c5e Gerrit-Change-Number: 12077 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement pending activity related functions
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12032 Change subject: systemc: Implement pending activity related functions .. systemc: Implement pending activity related functions Track the number of notifications/timeouts that are scheduled at any given time. This lets us implement sc_pending_activity_at_current_time, sc_pending_activity_at_future_time, and sc_time_to_pending_activity. Change-Id: Ia3fcd29bdbfe1a6c77eb52ce4836982d4705263c --- M src/systemc/core/event.cc M src/systemc/core/event.hh M src/systemc/core/process.cc M src/systemc/core/process.hh M src/systemc/core/sc_main.cc M src/systemc/core/scheduler.cc M src/systemc/core/scheduler.hh 7 files changed, 110 insertions(+), 30 deletions(-) diff --git a/src/systemc/core/event.cc b/src/systemc/core/event.cc index 5008074..1623cf9 100644 --- a/src/systemc/core/event.cc +++ b/src/systemc/core/event.cc @@ -43,7 +43,7 @@ Event::Event(sc_core::sc_event *_sc_event) : Event(_sc_event, "") {} Event::Event(sc_core::sc_event *_sc_event, const char *_basename) : -_sc_event(_sc_event), _basename(_basename), delayedNotify(this) +_sc_event(_sc_event), _basename(_basename), delayedNotifyEvent(this) { Module *p = currentModule(); @@ -121,28 +121,34 @@ } void +Event::delayedNotify() +{ +scheduler.eventHappened(); +notify(); +} + +void Event::notify(const sc_core::sc_time ) { //XXX We're assuming the systemc time resolution is in ps. -Tick new_tick = t.value() * SimClock::Int::ps + -scheduler.eventQueue().getCurTick(); -if (delayedNotify.scheduled()) { -Tick old_tick = delayedNotify.when(); +Tick new_tick = t.value() * SimClock::Int::ps + scheduler.getCurTick(); +if (delayedNotifyEvent.scheduled()) { +Tick old_tick = delayedNotifyEvent.when(); if (new_tick >= old_tick) return; -scheduler.eventQueue().deschedule(); +scheduler.deschedule(); } -scheduler.eventQueue().schedule(, new_tick); +scheduler.schedule(, new_tick); } void Event::cancel() { -if (delayedNotify.scheduled()) -scheduler.eventQueue().deschedule(); +if (delayedNotifyEvent.scheduled()) +scheduler.deschedule(); } bool diff --git a/src/systemc/core/event.hh b/src/systemc/core/event.hh index a9d3183..6d2f46d 100644 --- a/src/systemc/core/event.hh +++ b/src/systemc/core/event.hh @@ -105,7 +105,8 @@ sc_core::sc_object *parent; EventsIt parentIt; -EventWrapper delayedNotify; +void delayedNotify(); +EventWrapper delayedNotifyEvent; mutable std::set sensitivities; }; diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc index 7ed187f..ad297a2 100644 --- a/src/systemc/core/process.cc +++ b/src/systemc/core/process.cc @@ -37,16 +37,23 @@ { SensitivityTimeout::SensitivityTimeout(Process *p, ::sc_core::sc_time t) : -Sensitivity(p), timeoutEvent(this), timeout(t) +Sensitivity(p), timeoutEvent(this), time(t) { -Tick when = scheduler.eventQueue().getCurTick() + timeout.value(); -scheduler.eventQueue().schedule(, when); +Tick when = scheduler.getCurTick() + time.value(); +scheduler.schedule(, when); } SensitivityTimeout::~SensitivityTimeout() { if (timeoutEvent.scheduled()) -scheduler.eventQueue().deschedule(); +scheduler.deschedule(); +} + +void +SensitivityTimeout::timeout() +{ +scheduler.eventHappened(); +notify(); } SensitivityEvent::SensitivityEvent( diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh index 7c75d62..afdbb37 100644 --- a/src/systemc/core/process.hh +++ b/src/systemc/core/process.hh @@ -66,8 +66,10 @@ class SensitivityTimeout : virtual public Sensitivity { private: -EventWrapper timeoutEvent; -::sc_core::sc_time timeout; +void timeout(); +EventWrapper timeoutEvent; +::sc_core::sc_time time; public: SensitivityTimeout(Process *p, ::sc_core::sc_time t); @@ -98,7 +100,7 @@ Process *p, const ::sc_core::sc_event_and_list *list); ~SensitivityEventAndList(); -virtual void notifyWork(Event *e) override; +void notifyWork(Event *e) override; }; class SensitivityEventOrList : virtual public Sensitivity diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc index 120bbf9..103b303 100644 --- a/src/systemc/core/sc_main.cc +++ b/src/systemc/core/sc_main.cc @@ -140,7 +140,7 @@ void sc_start() { -Tick now = curEventQueue() ? curEventQueue()->getCurTick() : 0; +Tick now = ::sc_gem5::scheduler.getCurTick(); sc_start(sc_time::from_value(MaxTick - now), SC_EXIT_ON_STARVATION); } @@ -156,7 +156,7 @@ { _status = SC_RUNNING; -Tick now = curEventQueue() ? curEventQueue()->getCurTick() : 0; +Tick now = ::sc_gem5::scheduler.getCurTick(); ::sc_gem5::scheduler.start(now + time.value(), p ==
[gem5-dev] Change in gem5/gem5[master]: systemc: Adjust some whitespace in a print out.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12062 Change subject: systemc: Adjust some whitespace in a print out. .. systemc: Adjust some whitespace in a print out. This makes a test output file diff successfully. Change-Id: Ia269b4b33f719a2559197d9296f9acc601ec65f7 --- M src/systemc/dt/int/sc_nbcommon.inc 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemc/dt/int/sc_nbcommon.inc b/src/systemc/dt/int/sc_nbcommon.inc index 90507ff..13317a6 100644 --- a/src/systemc/dt/int/sc_nbcommon.inc +++ b/src/systemc/dt/int/sc_nbcommon.inc @@ -2580,7 +2580,7 @@ os << "width = " << length() << ::std::endl; os << "value = " << *this << ::std::endl; -os << "bits = "; +os << "bits = "; int len = length(); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12062 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: Ia269b4b33f719a2559197d9296f9acc601ec65f7 Gerrit-Change-Number: 12062 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement sc_pause, sc_stop, and re-sc_start-ing.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12031 Change subject: systemc: Implement sc_pause, sc_stop, and re-sc_start-ing. .. systemc: Implement sc_pause, sc_stop, and re-sc_start-ing. This change further modifies the scheduler to implement the sc_pause and sc_stop functions, and to ensure that calling sc_start again works. Also, some small changes were made to how processes and contexts are hooked up. Now, rather than checking whether a process is running to determine wether it started on its own or needs to be started manually, there's a bool which explicitly tracks whether it needs this step. The problem was that once a thread finished, it wasn't considered running any more. In that case it had run but finished, but that was indistinguishable from it needing to run but not having been started. Change-Id: I3aefb5493f91d9efa1a1382586196339b67925fe --- M src/systemc/core/process.cc M src/systemc/core/process.hh M src/systemc/core/process_types.hh M src/systemc/core/sc_main.cc M src/systemc/core/scheduler.cc M src/systemc/core/scheduler.hh 6 files changed, 171 insertions(+), 28 deletions(-) diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc index 63d2ff9..7ed187f 100644 --- a/src/systemc/core/process.cc +++ b/src/systemc/core/process.cc @@ -277,7 +277,6 @@ void Process::run() { -_running = true; bool reset; do { reset = false; @@ -287,7 +286,7 @@ reset = exc.is_reset(); } } while (reset); -_running = false; +_terminated = true; } void @@ -323,9 +322,10 @@ scheduler.ready(this); } -Process::Process(const char *name, ProcessFuncWrapper *func, bool _dynamic) : +Process::Process(const char *name, ProcessFuncWrapper *func, +bool _dynamic, bool needs_start) : ::sc_core::sc_object(name), excWrapper(nullptr), func(func), -_running(false), _dynamic(_dynamic), _isUnwinding(false), +_needsStart(needs_start), _dynamic(_dynamic), _isUnwinding(false), _terminated(false), _suspended(false), _disabled(false), _syncReset(false), refCount(0), stackSize(::Fiber::DefaultStackSize), dynamicSensitivity(nullptr) diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh index 579ea60..7c75d62 100644 --- a/src/systemc/core/process.hh +++ b/src/systemc/core/process.hh @@ -246,7 +246,7 @@ { public: virtual ::sc_core::sc_curr_proc_kind procKind() const = 0; -bool running() const { return _running; } +bool needsStart() const { return _needsStart; } bool dynamic() const { return _dynamic; } bool isUnwinding() const { return _isUnwinding; } bool terminated() const { return _terminated; } @@ -298,7 +298,8 @@ static Process *newest() { return _newest; } protected: -Process(const char *name, ProcessFuncWrapper *func, bool _dynamic); +Process(const char *name, ProcessFuncWrapper *func, bool _dynamic, +bool needs_start); static Process *_newest; @@ -314,7 +315,7 @@ ProcessFuncWrapper *func; sc_core::sc_curr_proc_kind _procKind; -bool _running; +bool _needsStart; bool _dynamic; bool _isUnwinding; bool _terminated; diff --git a/src/systemc/core/process_types.hh b/src/systemc/core/process_types.hh index 6d13592..369fa72 100644 --- a/src/systemc/core/process_types.hh +++ b/src/systemc/core/process_types.hh @@ -40,7 +40,7 @@ { public: Method(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) : -Process(name, func, _dynamic) +Process(name, func, _dynamic, true) {} const char *kind() const override { return "sc_method_process"; } @@ -56,7 +56,7 @@ { public: Thread(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) : -Process(name, func, _dynamic), ctx(nullptr) +Process(name, func, _dynamic, false), ctx(nullptr) {} ~Thread() { delete ctx; } diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc index 0b385e9..120bbf9 100644 --- a/src/systemc/core/sc_main.cc +++ b/src/systemc/core/sc_main.cc @@ -123,9 +123,6 @@ 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; - } // anonymous namespace int @@ -143,28 +140,29 @@ void sc_start() { -_max_tick = MaxTick; -_starvation = SC_EXIT_ON_STARVATION; - -// Switch back gem5. -Fiber::primaryFiber()->run(); +Tick now = curEventQueue() ? curEventQueue()->getCurTick() : 0; +sc_start(sc_time::from_value(MaxTick - now), SC_EXIT_ON_STARVATION); } void sc_pause() { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +if (_status == SC_RUNNING) +::sc_gem5::scheduler.schedulePause(); } void sc_start(const sc_time , sc_starvation_policy p) { -
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement sc_export.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12079 Change subject: systemc: Implement sc_export. .. systemc: Implement sc_export. This change ignores the rule that sc_exports all have to be bound exactly once and only by the end of elaboration. If it's bound more than once, then the earlier binding will be overwritten, and if it's not bound at all then it will act like a null pointer. To accomodate doing those checks in the future, the sc_export_base constructor and destructor are in the .cc file even though they do very little so that they can be extended to track a list of all exports which exist. Change-Id: Ie9a3416b8fa87bca55bc9f87f3238c4de3c2e729 --- M src/systemc/core/sc_export.cc M src/systemc/ext/core/sc_export.hh 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/src/systemc/core/sc_export.cc b/src/systemc/core/sc_export.cc index 387b8a7..8340cf9 100644 --- a/src/systemc/core/sc_export.cc +++ b/src/systemc/core/sc_export.cc @@ -33,10 +33,7 @@ namespace sc_core { -void -sc_export_base::warn_unimpl(const char *func) const -{ -warn("%s not implemented.\n", func); -} +sc_export_base::sc_export_base(const char *n) : sc_object(n) {} +sc_export_base::~sc_export_base() {} } // namespace sc_core diff --git a/src/systemc/ext/core/sc_export.hh b/src/systemc/ext/core/sc_export.hh index 421e063..f3cf816 100644 --- a/src/systemc/ext/core/sc_export.hh +++ b/src/systemc/ext/core/sc_export.hh @@ -30,6 +30,7 @@ #ifndef __SYSTEMC_EXT_CORE_SC_EXPORT_HH__ #define __SYSTEMC_EXT_CORE_SC_EXPORT_HH__ +#include "sc_module.hh" // for sc_gen_unique_name #include "sc_object.hh" namespace sc_core @@ -40,7 +41,8 @@ class sc_export_base : public sc_object { public: -void warn_unimpl(const char *func) const; +sc_export_base(const char *n); +~sc_export_base(); virtual sc_interface *get_iterface() = 0; virtual const sc_interface *get_interface() const = 0; @@ -50,42 +52,26 @@ class sc_export : public sc_export_base { public: -sc_export() { warn_unimpl(__PRETTY_FUNCTION__); } -explicit sc_export(const char *) { warn_unimpl(__PRETTY_FUNCTION__); } -virtual ~sc_export() { warn_unimpl(__PRETTY_FUNCTION__); }; +sc_export() : +sc_export_base(sc_gen_unique_name("export")), interface(nullptr) +{} +explicit sc_export(const char *n) : +sc_export_base(n), interface(nullptr) +{} +virtual ~sc_export() {} virtual const char *kind() const { return "sc_export"; } -void operator () (IF &) { warn_unimpl(__PRETTY_FUNCTION__); }; -virtual void bind(IF &) { warn_unimpl(__PRETTY_FUNCTION__); }; -operator IF & () { warn_unimpl(__PRETTY_FUNCTION__); }; -operator const IF & () const { warn_unimpl(__PRETTY_FUNCTION__); }; +void operator () (IF ) { bind(i); } +virtual void bind(IF ) { interface = } +operator IF & () { return *interface; } +operator const IF & () const { return *interface; } -IF * -operator -> () -{ -warn_unimpl(__PRETTY_FUNCTION__); -return nullptr; -} -const IF * -operator -> () const -{ -warn_unimpl(__PRETTY_FUNCTION__); -return nullptr; -} +IF *operator -> () { return interface; } +const IF *operator -> () const { return interface; } -sc_interface * -get_iterface() override -{ -warn_unimpl(__PRETTY_FUNCTION__); -return nullptr; -} -const sc_interface * -get_interface() const override -{ -warn_unimpl(__PRETTY_FUNCTION__); -return nullptr; -} +sc_interface *get_iterface() override { return interface; } +const sc_interface *get_interface() const override { return interface; } protected: virtual void before_end_of_elaboration() {} @@ -94,6 +80,8 @@ virtual void end_of_simulation() {} private: +IF *interface; + // Disabled sc_export(const sc_export &); sc_export = (const sc_export &); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12079 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: Ie9a3416b8fa87bca55bc9f87f3238c4de3c2e729 Gerrit-Change-Number: 12079 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Track the module in the end_of_elaboration callback.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12076 Change subject: systemc: Track the module in the end_of_elaboration callback. .. systemc: Track the module in the end_of_elaboration callback. sc_objects constructed during that callback are considered children of the module the callback belongs to. Change-Id: I164863a10beef6d0e2c6d9c5e8f2642d80769dca --- M src/systemc/core/kernel.cc M src/systemc/core/module.cc M src/systemc/core/module.hh M src/systemc/core/object.cc 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/systemc/core/kernel.cc b/src/systemc/core/kernel.cc index 3e3bdbd..4eb0bb7 100644 --- a/src/systemc/core/kernel.cc +++ b/src/systemc/core/kernel.cc @@ -64,8 +64,11 @@ Kernel::init() { status(::sc_core::SC_BEFORE_END_OF_ELABORATION); -for (auto m: sc_gem5::allModules) +for (auto m: sc_gem5::allModules) { +callbackModule(m); m->sc_mod()->before_end_of_elaboration(); +} +callbackModule(nullptr); if (stopAfterCallbacks) stopWork(); diff --git a/src/systemc/core/module.cc b/src/systemc/core/module.cc index e41e932..986ad25 100644 --- a/src/systemc/core/module.cc +++ b/src/systemc/core/module.cc @@ -43,6 +43,8 @@ std::list _modules; Module *_new_module; +Module *_callbackModule = nullptr; + } // anonymous namespace Module::Module(const char *name) : _name(name), _sc_mod(nullptr), _obj(nullptr) @@ -90,6 +92,9 @@ return _new_module; } +void callbackModule(Module *m) { _callbackModule = m; } +Module *callbackModule() { return _callbackModule; } + std::set allModules; } // namespace sc_gem5 diff --git a/src/systemc/core/module.hh b/src/systemc/core/module.hh index 8aebff2..7e54e29 100644 --- a/src/systemc/core/module.hh +++ b/src/systemc/core/module.hh @@ -106,6 +106,9 @@ Module *currentModule(); Module *newModule(); +void callbackModule(Module *m); +Module *callbackModule(); + extern std::set allModules; } // namespace sc_gem5 diff --git a/src/systemc/core/object.cc b/src/systemc/core/object.cc index 1347661..e066a23 100644 --- a/src/systemc/core/object.cc +++ b/src/systemc/core/object.cc @@ -78,6 +78,8 @@ _basename = "object"; Module *p = currentModule(); +if (!p) +p = callbackModule(); Module *n = newModule(); if (n) { @@ -87,7 +89,7 @@ if (p) { // We're "within" a parent module, ie we're being created while its -// constructor is running. +// constructor or end_of_elaboration callback is running. parent = p->obj()->_sc_obj; addObject(>_gem5_object->children, _sc_obj); } else if (scheduler.current()) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12076 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: I164863a10beef6d0e2c6d9c5e8f2642d80769dca Gerrit-Change-Number: 12076 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Ignore direct requests to mark a process as ready.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12047 Change subject: systemc: Ignore direct requests to mark a process as ready. .. systemc: Ignore direct requests to mark a process as ready. That might happen when a process is being marked as ready at the start of simulation. Because the process might not end up on the ready list, displacing it from the init list, excplicitly pop it off the init list as well. Change-Id: Iebf972e3e1baedec17b9b99b4da9dd44cd8e6957 --- M src/systemc/core/process.cc M src/systemc/core/scheduler.cc 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc index ec5c57c..39ee9e0 100644 --- a/src/systemc/core/process.cc +++ b/src/systemc/core/process.cc @@ -325,6 +325,8 @@ void Process::ready() { +if (disabled()) +return; if (suspended()) _suspendedReady = true; else diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 085602d..7d2e9ef 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -59,6 +59,7 @@ for (Process *p = initList.getNext(); p; p = initList.getNext()) { p->finalize(); +p->popListNode(); p->ready(); } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12047 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: Iebf972e3e1baedec17b9b99b4da9dd44cd8e6957 Gerrit-Change-Number: 12047 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Make some functions of the kernel static.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12041 Change subject: systemc: Make some functions of the kernel static. .. systemc: Make some functions of the kernel static. This makes it possible to call them without having to have a kernel instance available. The kernel is a singleton anyway, so there should only ever be a single instance of any of these values. Change-Id: I3610d60cc72e9f3114997fe63db94b96ccaac3cd --- M src/systemc/core/kernel.cc M src/systemc/core/kernel.hh M src/systemc/core/sc_main.cc 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/systemc/core/kernel.cc b/src/systemc/core/kernel.cc index dac2229..9eed325 100644 --- a/src/systemc/core/kernel.cc +++ b/src/systemc/core/kernel.cc @@ -36,44 +36,58 @@ namespace sc_gem5 { +namespace +{ + +bool stopAfterCallbacks = false; +bool startComplete = false; +bool endComplete = false; + +sc_core::sc_status _status = sc_core::SC_ELABORATION; + +} // anonymous namespace + +bool Kernel::startOfSimulationComplete() { return startComplete; } +bool Kernel::endOfSimulationComplete() { return endComplete; } + +sc_core::sc_status Kernel::status() { return _status; } +void Kernel::status(sc_core::sc_status s) { _status = s; } + Kernel::Kernel(Params *params) : -SimObject(params), _stopAfterCallbacks(false), -_startComplete(false), _endComplete(false), -_status(sc_core::SC_ELABORATION), -t0Event(this, false, EventBase::Default_Pri - 1) {} +SimObject(params), t0Event(this, false, EventBase::Default_Pri - 1) {} void Kernel::init() { -kernel->status(::sc_core::SC_BEFORE_END_OF_ELABORATION); +status(::sc_core::SC_BEFORE_END_OF_ELABORATION); for (auto m: sc_gem5::allModules) m->sc_mod()->before_end_of_elaboration(); -if (_stopAfterCallbacks) +if (stopAfterCallbacks) stopWork(); } void Kernel::regStats() { -kernel->status(::sc_core::SC_END_OF_ELABORATION); +status(::sc_core::SC_END_OF_ELABORATION); for (auto m: sc_gem5::allModules) m->sc_mod()->end_of_elaboration(); -if (_stopAfterCallbacks) +if (stopAfterCallbacks) stopWork(); } void Kernel::startup() { -kernel->status(::sc_core::SC_START_OF_SIMULATION); +status(::sc_core::SC_START_OF_SIMULATION); for (auto m: sc_gem5::allModules) m->sc_mod()->start_of_simulation(); -_startComplete = true; +startComplete = true; -if (_stopAfterCallbacks) +if (stopAfterCallbacks) stopWork(); kernel->status(::sc_core::SC_RUNNING); @@ -89,7 +103,7 @@ Kernel::stop() { if (status() < ::sc_core::SC_RUNNING) -_stopAfterCallbacks = true; +stopAfterCallbacks = true; else stopWork(); } @@ -97,15 +111,15 @@ void Kernel::stopWork() { -kernel->status(::sc_core::SC_END_OF_SIMULATION); +status(::sc_core::SC_END_OF_SIMULATION); for (auto m: sc_gem5::allModules) m->sc_mod()->end_of_simulation(); -_endComplete = true; +endComplete = true; -kernel->status(::sc_core::SC_STOPPED); +status(::sc_core::SC_STOPPED); -if (_stopAfterCallbacks) +if (stopAfterCallbacks) fatal("Simulation called sc_stop during elaboration.\n"); } diff --git a/src/systemc/core/kernel.hh b/src/systemc/core/kernel.hh index 15641c5..b9a37d0 100644 --- a/src/systemc/core/kernel.hh +++ b/src/systemc/core/kernel.hh @@ -56,21 +56,16 @@ void t0Handler(); -sc_core::sc_status status() { return _status; } -void status(sc_core::sc_status s) { _status = s; } +static sc_core::sc_status status(); +static void status(sc_core::sc_status s); -void stop(); +static void stop(); -bool startOfSimulationComplete() { return _startComplete; } -bool endOfSimulationComplete() { return _endComplete; } +static bool startOfSimulationComplete(); +static bool endOfSimulationComplete(); private: -bool _stopAfterCallbacks; -void stopWork(); - -bool _startComplete; -bool _endComplete; -sc_core::sc_status _status; +static void stopWork(); EventWrapper t0Event; }; diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc index 8e92c94..45ca728 100644 --- a/src/systemc/core/sc_main.cc +++ b/src/systemc/core/sc_main.cc @@ -147,7 +147,7 @@ void sc_pause() { -if (::sc_gem5::kernel->status() == SC_RUNNING) +if (::sc_gem5::Kernel::status() == SC_RUNNING) ::sc_gem5::scheduler.schedulePause(); } @@ -178,14 +178,14 @@ void sc_stop() { -if (::sc_gem5::kernel->status() == SC_STOPPED) +if (::sc_gem5::Kernel::status() == SC_STOPPED) return; if (sc_is_running()) { bool finish_delta = (_stop_mode == SC_STOP_FINISH_DELTA); ::sc_gem5::scheduler.scheduleStop(finish_delta); } else { -::sc_gem5::kernel->stop(); +
[gem5-dev] Change in gem5/gem5[master]: systemc: Record the test's return code in the output directory.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12052 Change subject: systemc: Record the test's return code in the output directory. .. systemc: Record the test's return code in the output directory. verify.py will be able to use that value later to determine whether a test was successful. Change-Id: Ib499a4b6f202ee46e66e5de1b61a7e6309df9886 --- M src/systemc/tests/verify.py 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index cface47..eabdaf6 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -144,7 +144,14 @@ '--listener-mode=off', config_path ]) -subprocess.check_call(cmd) +try: +subprocess.check_call(cmd) +except subprocess.CalledProcessError, error: +returncode = error.returncode +else: +returncode = 0 +with open(os.path.join(test.m5out_dir(), 'returncode'), 'w') as rc: +rc.write('%d\n' % returncode) runnable = filter(lambda t: not t.compile_only, tests) if args.j == 1: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12052 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: Ib499a4b6f202ee46e66e5de1b61a7e6309df9886 Gerrit-Change-Number: 12052 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement the various sc_module stage callbacks.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12033 Change subject: systemc: Implement the various sc_module stage callbacks. .. systemc: Implement the various sc_module stage callbacks. This change also gets rid of the SystemC namespace which was deprecated in favor of sc_gem5. A few utility functions which check whether certain callbacks have finished were also implemented. status tracking moved from a global variable in sc_main.cc to a member of the kernel simobject. Change-Id: I50967fae9c576fbe45b1faff587aaa824857a289 --- M src/systemc/core/SystemC.py M src/systemc/core/kernel.cc M src/systemc/core/kernel.hh M src/systemc/core/module.cc M src/systemc/core/module.hh M src/systemc/core/sc_main.cc M src/systemc/core/sc_module.cc M src/systemc/core/scheduler.cc M src/systemc/ext/core/sc_module.hh 9 files changed, 131 insertions(+), 27 deletions(-) diff --git a/src/systemc/core/SystemC.py b/src/systemc/core/SystemC.py index 41fecb2..dff72e2 100644 --- a/src/systemc/core/SystemC.py +++ b/src/systemc/core/SystemC.py @@ -33,7 +33,7 @@ # It also acts as a collecting point for systemc related control functionality. class SystemC_Kernel(SimObject): type = 'SystemC_Kernel' -cxx_class = 'SystemC::Kernel' +cxx_class = 'sc_gem5::Kernel' cxx_header = 'systemc/core/kernel.hh' def sc_main(self, *args): diff --git a/src/systemc/core/kernel.cc b/src/systemc/core/kernel.cc index 3b75c2f..dac2229 100644 --- a/src/systemc/core/kernel.cc +++ b/src/systemc/core/kernel.cc @@ -28,17 +28,56 @@ */ #include "systemc/core/kernel.hh" + +#include "base/logging.hh" +#include "systemc/core/module.hh" #include "systemc/core/scheduler.hh" -namespace SystemC +namespace sc_gem5 { Kernel::Kernel(Params *params) : -SimObject(params), t0Event(this, false, EventBase::Default_Pri - 1) {} +SimObject(params), _stopAfterCallbacks(false), +_startComplete(false), _endComplete(false), +_status(sc_core::SC_ELABORATION), +t0Event(this, false, EventBase::Default_Pri - 1) {} + +void +Kernel::init() +{ +kernel->status(::sc_core::SC_BEFORE_END_OF_ELABORATION); +for (auto m: sc_gem5::allModules) +m->sc_mod()->before_end_of_elaboration(); + +if (_stopAfterCallbacks) +stopWork(); +} + +void +Kernel::regStats() +{ +kernel->status(::sc_core::SC_END_OF_ELABORATION); +for (auto m: sc_gem5::allModules) +m->sc_mod()->end_of_elaboration(); + +if (_stopAfterCallbacks) +stopWork(); +} void Kernel::startup() { +kernel->status(::sc_core::SC_START_OF_SIMULATION); +for (auto m: sc_gem5::allModules) +m->sc_mod()->start_of_simulation(); + +_startComplete = true; + +if (_stopAfterCallbacks) +stopWork(); + +kernel->status(::sc_core::SC_RUNNING); + schedule(t0Event, curTick()); // Install ourselves as the scheduler's event manager. ::sc_gem5::scheduler.setEventQueue(eventQueue()); @@ -47,6 +86,30 @@ } void +Kernel::stop() +{ +if (status() < ::sc_core::SC_RUNNING) +_stopAfterCallbacks = true; +else +stopWork(); +} + +void +Kernel::stopWork() +{ +kernel->status(::sc_core::SC_END_OF_SIMULATION); +for (auto m: sc_gem5::allModules) +m->sc_mod()->end_of_simulation(); + +_endComplete = true; + +kernel->status(::sc_core::SC_STOPPED); + +if (_stopAfterCallbacks) +fatal("Simulation called sc_stop during elaboration.\n"); +} + +void Kernel::t0Handler() { // Now that the event queue has started, mark all the processes that @@ -57,12 +120,19 @@ // in the spec. The delta phase will happen at normal priority, and then // the event which runs the processes which is at a lower priority. ::sc_gem5::scheduler.prepareForInit(); + +status(::sc_core::SC_RUNNING); } -} // namespace SystemC +Kernel *kernel; -SystemC::Kernel * +} // namespace sc_gem5 + +sc_gem5::Kernel * SystemC_KernelParams::create() { -return new SystemC::Kernel(this); +panic_if(sc_gem5::kernel, +"Only one systemc kernel object may be defined.\n"); +sc_gem5::kernel = new sc_gem5::Kernel(this); +return sc_gem5::kernel; } diff --git a/src/systemc/core/kernel.hh b/src/systemc/core/kernel.hh index 8cbf4fb..15641c5 100644 --- a/src/systemc/core/kernel.hh +++ b/src/systemc/core/kernel.hh @@ -32,8 +32,9 @@ #include "params/SystemC_Kernel.hh" #include "sim/sim_object.hh" +#include "systemc/ext/core/sc_main.hh" -namespace SystemC +namespace sc_gem5 { /* @@ -49,14 +50,33 @@ typedef SystemC_KernelParams Params; Kernel(Params *params); +void init() override; +void regStats() override; void startup() override; void t0Handler(); +sc_core::sc_status status() { return _status; } +void status(sc_core::sc_status s) { _status = s; } + +void stop(); + +bool
[gem5-dev] Change in gem5/gem5[master]: systemc: Make verify.py ignore a warning.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12055 Change subject: systemc: Make verify.py ignore a warning. .. systemc: Make verify.py ignore a warning. Change-Id: Ia887b7195d84d0ba9e77370d7b928e201ca78731 --- M src/systemc/tests/verify.py 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index c8167d6..822065c 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -192,7 +192,8 @@ ref_filt = merge_filts( r'^\nInfo: /OSCI/SystemC: Simulation stopped by user.\n', -r'^SystemC Simulation\n' +r'^SystemC Simulation\n', +r'^\nWarning: .*\nIn file: .*\n' ) test_filt = merge_filts( r'^Global frequency set at \d* ticks per second\n' -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12055 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: Ia887b7195d84d0ba9e77370d7b928e201ca78731 Gerrit-Change-Number: 12055 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Fix a "problem" with kill/reset exceptions.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12045 Change subject: systemc: Fix a "problem" with kill/reset exceptions. .. systemc: Fix a "problem" with kill/reset exceptions. Despite what it says in the spec, the proc_ctrl compliance test throws a copy of the reset exception it catches, not the original. Because of that, the code in the kernel which catches the exception gets the base class, not the derived class with overridden virtual methods, etc. This happens to work for the Accellera implementation because they manipulate members of the base class itself which are preserved despite this bug. To make the test work, we imitate their implementation, even though it exposes more implementation details through the header files. Change-Id: I7ed9818c0552869ec790cb7f7bfbe365ade5e49c --- M src/systemc/core/sc_process_handle.cc M src/systemc/ext/core/sc_process_handle.hh 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/systemc/core/sc_process_handle.cc b/src/systemc/core/sc_process_handle.cc index e0f6a81..256d649 100644 --- a/src/systemc/core/sc_process_handle.cc +++ b/src/systemc/core/sc_process_handle.cc @@ -39,17 +39,19 @@ const char * sc_unwind_exception::what() const throw() { -panic("%s for base class called.\n", __PRETTY_FUNCTION__); +return _isReset ? "RESET" : "KILL"; } bool sc_unwind_exception::is_reset() const { -panic("%s for base class called.\n", __PRETTY_FUNCTION__); +return _isReset; } -sc_unwind_exception::sc_unwind_exception() {} -sc_unwind_exception::sc_unwind_exception(const sc_unwind_exception &) {} +sc_unwind_exception::sc_unwind_exception() : _isReset(false) {} +sc_unwind_exception::sc_unwind_exception(const sc_unwind_exception ) : +_isReset(e._isReset) +{} sc_unwind_exception::~sc_unwind_exception() throw() {} diff --git a/src/systemc/ext/core/sc_process_handle.hh b/src/systemc/ext/core/sc_process_handle.hh index 2db553b..8186903 100644 --- a/src/systemc/ext/core/sc_process_handle.hh +++ b/src/systemc/ext/core/sc_process_handle.hh @@ -108,6 +108,7 @@ virtual ~sc_unwind_exception() throw(); protected: +bool _isReset; sc_unwind_exception(); }; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12045 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: I7ed9818c0552869ec790cb7f7bfbe365ade5e49c Gerrit-Change-Number: 12045 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Add a sensitivity type for exports.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12042 Change subject: systemc: Add a sensitivity type for exports. .. systemc: Add a sensitivity type for exports. Dynamic processes can be sensitive to exports, so we need a pending sensitivity to represent them. Change-Id: I87952f8bbb7847ad1f1d98d35cd5dd488e7b28ab --- M src/systemc/core/process.hh 1 file changed, 19 insertions(+), 0 deletions(-) diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh index afdbb37..3b1fb4e 100644 --- a/src/systemc/core/process.hh +++ b/src/systemc/core/process.hh @@ -39,6 +39,7 @@ #include "systemc/core/list.hh" #include "systemc/core/object.hh" #include "systemc/ext/core/sc_event.hh" +#include "systemc/ext/core/sc_export.hh" #include "systemc/ext/core/sc_interface.hh" #include "systemc/ext/core/sc_module.hh" #include "systemc/ext/core/sc_port.hh" @@ -224,6 +225,24 @@ } }; +class PendingSensitivityExport : public PendingSensitivity +{ + private: +const sc_core::sc_export_base *exp; + + public: +PendingSensitivityExport(Process *p, const sc_core::sc_export_base *exp) : +PendingSensitivity(p), exp(exp) +{} + +void +finalize(Sensitivities ) override +{ +s.push_back(new SensitivityEvent(process, +>get_interface()->default_event())); +} +}; + class PendingSensitivityFinder : public PendingSensitivity { private: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12042 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: I87952f8bbb7847ad1f1d98d35cd5dd488e7b28ab Gerrit-Change-Number: 12042 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Promote some functions to sc_export_base.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12043 Change subject: systemc: Promote some functions to sc_export_base. .. systemc: Promote some functions to sc_export_base. There are a few functions which return a generic sc_interface pointer which were (in the spec) defined to be in the interface type specific sc_export class. They don't need to be and aren't in the Accellera implementation, and without having them in the base class there's no good way to get at a generic interface pointer from an export. Change-Id: Iba692c79bf1d4f7684f28447d8b22c88ef4b804d --- M src/systemc/ext/core/sc_export.hh 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/systemc/ext/core/sc_export.hh b/src/systemc/ext/core/sc_export.hh index dc21764..421e063 100644 --- a/src/systemc/ext/core/sc_export.hh +++ b/src/systemc/ext/core/sc_export.hh @@ -41,6 +41,9 @@ { public: void warn_unimpl(const char *func) const; + +virtual sc_interface *get_iterface() = 0; +virtual const sc_interface *get_interface() const = 0; }; template @@ -71,14 +74,14 @@ return nullptr; } -virtual sc_interface * -get_iterface() +sc_interface * +get_iterface() override { warn_unimpl(__PRETTY_FUNCTION__); return nullptr; } -virtual const sc_interface * -get_interface() const +const sc_interface * +get_interface() const override { warn_unimpl(__PRETTY_FUNCTION__); return nullptr; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12043 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: Iba692c79bf1d4f7684f28447d8b22c88ef4b804d Gerrit-Change-Number: 12043 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Delete empty/misnamed test reference file.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12059 Change subject: systemc: Delete empty/misnamed test reference file. .. systemc: Delete empty/misnamed test reference file. The name of the reference file doesn't match the name of the test, and is empty. There's also a correctly named log file in the same directory which will be used instead. Change-Id: I6501b465b99af403ae4af6d43189280c4b45fc8f --- D src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/sc_join.log 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/sc_join.log b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/sc_join.log deleted file mode 100644 index e69de29..000 --- a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/golden/sc_join.log +++ /dev/null -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12059 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: I6501b465b99af403ae4af6d43189280c4b45fc8f Gerrit-Change-Number: 12059 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Adjust process status tracking to improve kill/reset support.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12049 Change subject: systemc: Adjust process status tracking to improve kill/reset support. .. systemc: Adjust process status tracking to improve kill/reset support. This change rearranges how process status is tracked so that the kill and reset mechanisms work in more circumstances and more like they're supposed to according to the spec. This makes another test or two pass. Change-Id: Ie2a683a796155a82092109d5bb45f07c84e06c76 --- M src/systemc/core/process.cc M src/systemc/core/process.hh M src/systemc/core/process_types.hh 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc index 6a0e7d5..6b4c427 100644 --- a/src/systemc/core/process.cc +++ b/src/systemc/core/process.cc @@ -32,6 +32,8 @@ #include "base/logging.hh" #include "systemc/core/event.hh" #include "systemc/core/scheduler.hh" +#include "systemc/ext/core/sc_process_handle.hh" +#include "systemc/ext/utils/sc_report_handler.hh" namespace sc_gem5 { @@ -201,14 +203,15 @@ return; // Update our state. -_terminated = true; +terminate(); _isUnwinding = true; -_suspendedReady = false; -_suspended = false; -_syncReset = false; -// Inject the kill exception into this process. -injectException(killException); +// Make sure this process isn't marked ready +popListNode(); + +// Inject the kill exception into this process if it's started. +if (!_needsStart) +injectException(killException); _terminatedEvent.notify(); } @@ -224,11 +227,13 @@ if (_isUnwinding) return; -// Update our state. -_isUnwinding = true; -// Inject the reset exception into this process. -injectException(resetException); +if (_needsStart) { +scheduler.runNow(this); +} else { +_isUnwinding = true; +injectException(resetException); +} _resetEvent.notify(); } @@ -238,6 +243,10 @@ { if (inc_kids) forEachKid([](Process *p) { p->throw_it(exc, true); }); + +// Only inject an exception into threads that have started. +if (!_needsStart) +injectException(exc); } void @@ -295,7 +304,6 @@ _isUnwinding = false; } } while (reset); -_terminated = true; } void @@ -346,10 +354,9 @@ ::sc_core::sc_report *Process::lastReport() const { return _lastReport.get(); } -Process::Process(const char *name, ProcessFuncWrapper *func, -bool _dynamic, bool needs_start) : +Process::Process(const char *name, ProcessFuncWrapper *func, bool _dynamic) : ::sc_core::sc_object(name), excWrapper(nullptr), func(func), -_needsStart(needs_start), _dynamic(_dynamic), _isUnwinding(false), +_needsStart(true), _dynamic(_dynamic), _isUnwinding(false), _terminated(false), _suspended(false), _disabled(false), _syncReset(false), refCount(0), stackSize(::Fiber::DefaultStackSize), dynamicSensitivity(nullptr) @@ -357,6 +364,20 @@ _newest = this; } +void +Process::terminate() +{ +_terminated = true; +_suspendedReady = false; +_suspended = false; +_syncReset = false; +delete dynamicSensitivity; +dynamicSensitivity = nullptr; +for (auto s: staticSensitivities) +delete s; +staticSensitivities.clear(); +} + Process *Process::_newest; void diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh index 8abafbd..5f0a72d 100644 --- a/src/systemc/core/process.hh +++ b/src/systemc/core/process.hh @@ -325,8 +325,7 @@ ::sc_core::sc_report *lastReport() const; protected: -Process(const char *name, ProcessFuncWrapper *func, bool _dynamic, -bool needs_start); +Process(const char *name, ProcessFuncWrapper *func, bool _dynamic); static Process *_newest; @@ -347,6 +346,8 @@ bool _isUnwinding; bool _terminated; +void terminate(); + bool _suspended; bool _suspendedReady; bool _disabled; diff --git a/src/systemc/core/process_types.hh b/src/systemc/core/process_types.hh index 369fa72..7617d41 100644 --- a/src/systemc/core/process_types.hh +++ b/src/systemc/core/process_types.hh @@ -40,7 +40,7 @@ { public: Method(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) : -Process(name, func, _dynamic, true) +Process(name, func, _dynamic) {} const char *kind() const override { return "sc_method_process"; } @@ -56,7 +56,7 @@ { public: Thread(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) : -Process(name, func, _dynamic, false), ctx(nullptr) +Process(name, func, _dynamic), ctx(nullptr) {} ~Thread() { delete ctx; } @@ -88,8 +88,15 @@ private: Thread *thread; -void main() override { thread->run();
[gem5-dev] Change in gem5/gem5[master]: systemc: Add return code verification to verify.py.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12053 Change subject: systemc: Add return code verification to verify.py. .. systemc: Add return code verification to verify.py. This just checks whether gem5 exited of its own accord with a successful error code, or in other words that it didn't hang or crash. More checking will need to be added to verify the output against the golden reference. Change-Id: I1ddef56aa73b5f700743830bd6212804531c484f --- M src/systemc/tests/verify.py 1 file changed, 109 insertions(+), 9 deletions(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index eabdaf6..0c47ce7 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -34,7 +34,6 @@ import inspect import itertools import json -import logging import multiprocessing.pool import os import subprocess @@ -50,8 +49,6 @@ -logging.basicConfig(level=logging.INFO) - def scons(*args): args = ['scons'] + list(args) subprocess.check_call(args) @@ -85,6 +82,9 @@ def m5out_dir(self): return os.path.join(self.dir(), 'm5out.' + self.suffix) +def returncode_file(self): +return os.path.join(self.m5out_dir(), 'returncode') + test_phase_classes = {} @@ -144,13 +144,16 @@ '--listener-mode=off', config_path ]) +# Ensure the output directory exists. +if not os.path.exists(test.m5out_dir()): +os.makedirs(test.m5out_dir()) try: subprocess.check_call(cmd) except subprocess.CalledProcessError, error: returncode = error.returncode else: returncode = 0 -with open(os.path.join(test.m5out_dir(), 'returncode'), 'w') as rc: +with open(test.returncode_file(), 'w') as rc: rc.write('%d\n' % returncode) runnable = filter(lambda t: not t.compile_only, tests) @@ -166,12 +169,109 @@ name = 'verify' number = 3 -def run(self, tests): -for test in tests: -if test.compile_only: -continue -logging.info("Would verify %s", test.m5out_dir()) +def reset_status(self): +self._passed = [] +self._failed = {} +def passed(self, test): +self._passed.append(test) + +def failed(self, test, cause): +self._failed.setdefault(cause, []).append(test) + +def print_status(self): +total_passed = len(self._passed) +total_failed = sum(map(len, self._failed.values())) +print() +print('Passed: {passed:4} - Failed: {failed:4}'.format( + passed=total_passed, failed=total_failed)) + +def write_result_file(self, path): +passed = map(lambda t: t.path, self._passed) +passed.sort() +failed = { +cause: map(lambda t: t.path, tests) for + cause, tests in self._failed.iteritems() +} +for tests in failed.values(): +tests.sort() +results = { 'passed': passed, 'failed': failed } +with open(path, 'w') as rf: +json.dump(results, rf) + +def print_results(self): +passed = map(lambda t: t.path, self._passed) +passed.sort() +failed = { +cause: map(lambda t: t.path, tests) for + cause, tests in self._failed.iteritems() +} +for tests in failed.values(): +tests.sort() + +print() +print('Passed:') +map(lambda t: print('', t), passed) + +print() +print('Failed:') +categories = failed.items() +categories.sort() + +def cat_str((cause, tests)): +heading = ' ' + cause.capitalize() + ':\n' +test_lines = ['' + test + '\n'for test in tests] +return heading + ''.join(test_lines) +blocks = map(cat_str, categories) + +print('\n'.join(blocks)) + +def run(self, tests): +parser = argparse.ArgumentParser() +result_opts = parser.add_mutually_exclusive_group() +result_opts.add_argument('--result-file', action='store_true', +help='Create a results.json file in the current directory.') +result_opts.add_argument('--result-file-at', metavar='PATH', +help='Create a results json file at the given path.') +parser.add_argument('--print-results', action='store_true', +help='Print a list of tests that passed or failed') +args = parser.parse_args(self.args) + +self.reset_status() + +runnable = filter(lambda t: not t.compile_only, tests) +compile_only = filter(lambda t: t.compile_only, tests) + +for test in compile_only: +if os.path.exists(test.full_path()): +
[gem5-dev] Change in gem5/gem5[master]: systemc: Teach verify.py to diff files when checking test results.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12054 Change subject: systemc: Teach verify.py to diff files when checking test results. .. systemc: Teach verify.py to diff files when checking test results. Currently it just diffs the stdout and ignores other reference files. It also doesn't filter out noise in the diffs from non test related simulator messages. These include startup messages, messages when the simulator finishes executing, and some non-standard warnings, etc. Change-Id: Idcb19edd893cd8818423c2c5ebb6cbfb278baffa --- M src/systemc/tests/verify.py 1 file changed, 106 insertions(+), 31 deletions(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index 0c47ce7..c8167d6 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -30,12 +30,15 @@ from __future__ import print_function import argparse +import collections +import difflib import functools import inspect import itertools import json import multiprocessing.pool import os +import re import subprocess import sys @@ -60,9 +63,14 @@ self.target = target self.suffix = suffix self.build_dir = build_dir +self.props = {} for key, val in props.iteritems(): -setattr(self, key, val) +self.set_prop(key, val) + +def set_prop(self, key, val): +setattr(self, key, val) +self.props[key] = val def dir(self): return os.path.join(self.build_dir, tests_rel_path, self.path) @@ -142,6 +150,7 @@ test.full_path(), '-red', test.m5out_dir(), '--listener-mode=off', +'--quiet', config_path ]) # Ensure the output directory exists. @@ -165,6 +174,55 @@ tp.close() tp.join() +class Checker(object): +def __init__(self, ref, test, tag): +self.ref = ref +self.test = test +self.tag = tag + +def check(self): +with open(self.text) as test_f, open(self.ref) as ref_f: +return test_f.read() == ref_f.read() + +class LogChecker(Checker): +def merge_filts(*filts): +filts = map(lambda f: '(' + f + ')', filts) +filts = '|'.join(filts) +return re.compile(filts, flags=re.MULTILINE) + +ref_filt = merge_filts( +r'^\nInfo: /OSCI/SystemC: Simulation stopped by user.\n', +r'^SystemC Simulation\n' +) +test_filt = merge_filts( +r'^Global frequency set at \d* ticks per second\n' +) + +def __init__(self, ref, test, tag, out_dir): +super(LogChecker, self).__init__(ref, test, tag) +self.out_dir = out_dir + +def apply_filters(self, data, filts): +re.sub(filt, '', data) + +def check(self): +test_file = os.path.basename(self.test) +ref_file = os.path.basename(self.ref) +with open(self.test) as test_f, open(self.ref) as ref_f: +test = re.sub(self.test_filt, '', test_f.read()) +ref = re.sub(self.ref_filt, '', ref_f.read()) +if test != ref: +diff_file = '.'.join([ref_file, 'diff']) +diff_path = os.path.join(self.out_dir, diff_file) +with open(diff_path, 'w') as diff_f: +for line in difflib.unified_diff( +ref.splitlines(True), test.splitlines(True), +fromfile=ref_file, +tofile=test_file): +diff_f.write(line) +return False +return True + class VerifyPhase(TestPhaseBase): name = 'verify' number = 3 @@ -176,7 +234,8 @@ def passed(self, test): self._passed.append(test) -def failed(self, test, cause): +def failed(self, test, cause, note=''): +test.set_prop('note', note) self._failed.setdefault(cause, []).append(test) def print_status(self): @@ -187,44 +246,36 @@ passed=total_passed, failed=total_failed)) def write_result_file(self, path): -passed = map(lambda t: t.path, self._passed) -passed.sort() -failed = { -cause: map(lambda t: t.path, tests) for +results = { +'passed': map(lambda t: t.props, self._passed), +'failed': { +cause: map(lambda t: t.props, tests) for cause, tests in self._failed.iteritems() +} } -for tests in failed.values(): -tests.sort() -results = { 'passed': passed, 'failed': failed } with open(path, 'w') as rf: json.dump(results, rf) def print_results(self): -passed = map(lambda t: t.path, self._passed) -passed.sort() -failed = { -cause: map(lambda t:
[gem5-dev] Change in gem5/gem5[master]: systemc: Partially implement the sc_signal class template.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12075 Change subject: systemc: Partially implement the sc_signal class template. .. systemc: Partially implement the sc_signal class template. There are a few details of this class that still need to be fleshed out, but this implements most of it. Change-Id: I6f8b546aacd8537d4341dc91e59b95864ae0f7c4 --- M src/systemc/ext/channel/sc_signal.hh 1 file changed, 134 insertions(+), 137 deletions(-) diff --git a/src/systemc/ext/channel/sc_signal.hh b/src/systemc/ext/channel/sc_signal.hh index 5da4116..55c5599 100644 --- a/src/systemc/ext/channel/sc_signal.hh +++ b/src/systemc/ext/channel/sc_signal.hh @@ -34,8 +34,10 @@ #include #include +#include "../core/sc_event.hh" #include "../core/sc_module.hh" // for sc_gen_unique_name #include "../core/sc_prim.hh" +#include "../dt/bit/sc_logic.hh" #include "sc_signal_inout_if.hh" #include "warn_unimpl.hh" // for warn_unimpl @@ -66,17 +68,17 @@ { public: sc_signal() : sc_signal_inout_if(), - sc_prim_channel(sc_gen_unique_name("signal")) + sc_prim_channel(sc_gen_unique_name("signal")), + m_cur_val(T()), m_new_val(T()) {} -explicit sc_signal(const char *name) : sc_signal_inout_if(), - sc_prim_channel(name) +explicit sc_signal(const char *name) : +sc_signal_inout_if(), sc_prim_channel(name), +m_cur_val(T()), m_new_val(T()) {} explicit sc_signal(const char *name, const T _value) : -sc_signal_inout_if(), sc_prim_channel(name) -{ -// Need to consume initial_value. -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -} +sc_signal_inout_if(), sc_prim_channel(name), +m_cur_val(initial_value), m_new_val(initial_value) +{} virtual ~sc_signal() {} virtual void @@ -85,17 +87,8 @@ sc_channel_warn_unimpl(__PRETTY_FUNCTION__); } -virtual const T& -read() const -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -return *(const T *)nullptr; -} -operator const T&() const -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -return *(const T *)nullptr; -} +virtual const T () const { return m_cur_val; } +operator const T&() const { return read(); } virtual sc_writer_policy get_writer_policy() const @@ -103,34 +96,36 @@ return WRITER_POLICY; } virtual void -write(const T&) +write(const T ) { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +m_new_val = t; +bool changed = !(m_cur_val == m_new_val); +//TODO check whether this write follows the write policy. +if (changed) +request_update(); } sc_signal & -operator = (const T&) +operator = (const T ) { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +write(t); return *this; } sc_signal & -operator = (const sc_signal &) +operator = (const sc_signal ) { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +write(s.read()); return *this; } virtual const sc_event & default_event() const { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -return *(sc_event *)nullptr; +return value_changed_event(); } virtual const sc_event & value_changed_event() const { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -return *(sc_event *)nullptr; +return _valueChangedEvent; } virtual bool event() const @@ -139,15 +134,13 @@ return false; } +virtual void print(std::ostream =std::cout) const { os << m_cur_val; } virtual void -print(std::ostream & =std::cout) const +dump(std::ostream =std::cout) const { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); -} -virtual void -dump(std::ostream & =std::cout) const -{ -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +os << " name = " << name() << ::std::endl; +os << "value = " << m_cur_val << ::std::endl; +os << "new value = " << m_new_val << ::std::endl; } virtual const char *kind() const { return "sc_signal"; } @@ -155,7 +148,11 @@ virtual void update() { -sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +if (m_new_val == m_cur_val) +return; + +m_cur_val = m_new_val; +_valueChangedEvent.notify(SC_ZERO_TIME); } // These members which store the current and future value of the signal @@ -165,6 +162,8 @@ T m_new_val; private: +sc_event _valueChangedEvent; + // Disabled sc_signal(const sc_signal &) : sc_signal_inout_if(), sc_prim_channel("") @@ -184,24 +183,19 @@ public sc_signal_inout_if,
[gem5-dev] Change in gem5/gem5[master]: systemc: Set the scheduler's event queue earlier.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12073 Change subject: systemc: Set the scheduler's event queue earlier. .. systemc: Set the scheduler's event queue earlier. The kernel can set the event queue during its own construction which will ensure that the scheduler can schedule events as early as possible. Change-Id: I0e47ca0a667e77d36c97860cd7c6b7577415c801 --- M src/systemc/core/kernel.cc 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/systemc/core/kernel.cc b/src/systemc/core/kernel.cc index 9eed325..3e3bdbd 100644 --- a/src/systemc/core/kernel.cc +++ b/src/systemc/core/kernel.cc @@ -54,7 +54,11 @@ void Kernel::status(sc_core::sc_status s) { _status = s; } Kernel::Kernel(Params *params) : -SimObject(params), t0Event(this, false, EventBase::Default_Pri - 1) {} +SimObject(params), t0Event(this, false, EventBase::Default_Pri - 1) +{ +// Install ourselves as the scheduler's event manager. +::sc_gem5::scheduler.setEventQueue(eventQueue()); +} void Kernel::init() @@ -93,8 +97,6 @@ kernel->status(::sc_core::SC_RUNNING); schedule(t0Event, curTick()); -// Install ourselves as the scheduler's event manager. -::sc_gem5::scheduler.setEventQueue(eventQueue()); // Run update once before the event queue starts. ::sc_gem5::scheduler.update(); } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12073 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: I0e47ca0a667e77d36c97860cd7c6b7577415c801 Gerrit-Change-Number: 12073 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Add a nonstandard sc_status pretty printer operator.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12074 Change subject: systemc: Add a nonstandard sc_status pretty printer operator. .. systemc: Add a nonstandard sc_status pretty printer operator. This operator exists in the Accellera implementation, and is necessary to make the test output match. Change-Id: I266629d6c936d4846e88e35af36555fb392b181c --- M src/systemc/core/sc_main.cc M src/systemc/ext/core/sc_main.hh 2 files changed, 64 insertions(+), 0 deletions(-) diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc index 446b737..641e0d0 100644 --- a/src/systemc/core/sc_main.cc +++ b/src/systemc/core/sc_main.cc @@ -244,4 +244,64 @@ return ::sc_gem5::kernel ? ::sc_gem5::kernel->status() : SC_ELABORATION; } +std::ostream & +operator << (std::ostream , sc_status s) +{ +switch (s) { + case SC_ELABORATION: +os << "SC_ELABORATION"; +break; + case SC_BEFORE_END_OF_ELABORATION: +os << "SC_BEFORE_END_OF_ELABORATION"; +break; + case SC_END_OF_ELABORATION: +os << "SC_END_OF_ELABORATION"; +break; + case SC_START_OF_SIMULATION: +os << "SC_START_OF_SIMULATION"; +break; + case SC_RUNNING: +os << "SC_RUNNING"; +break; + case SC_PAUSED: +os << "SC_PAUSED"; +break; + case SC_STOPPED: +os << "SC_STOPPED"; +break; + case SC_END_OF_SIMULATION: +os << "SC_END_OF_SIMULATION"; +break; + +// Nonstandard + case SC_END_OF_INITIALIZATION: +os << "SC_END_OF_INITIALIZATION"; +break; + case SC_END_OF_UPDATE: +os << "SC_END_OF_UPDATE"; +break; + case SC_BEFORE_TIMESTEP: +os << "SC_BEFORE_TIMESTEP"; +break; + + default: +if (s & SC_STATUS_ANY) { +const char *prefix = "("; +for (sc_status m = (sc_status)0x1; +m < SC_STATUS_ANY; m = (sc_status)(m << 1)) { +if (m & s) { +os << prefix; +prefix = "|"; +os << m; +} +} +os << ")"; +} else { +ccprintf(os, "%#x", s); +} +} + +return os; +} + } // namespace sc_core diff --git a/src/systemc/ext/core/sc_main.hh b/src/systemc/ext/core/sc_main.hh index b6f5ea1..10a68ca 100644 --- a/src/systemc/ext/core/sc_main.hh +++ b/src/systemc/ext/core/sc_main.hh @@ -30,6 +30,8 @@ #ifndef __SYSTEMC_EXT_CORE_SC_MAIN_HH__ #define __SYSTEMC_EXT_CORE_SC_MAIN_HH__ +#include + #include "../dt/int/sc_nbdefs.hh" #include "sc_time.hh" @@ -97,6 +99,8 @@ }; sc_status sc_get_status(); + +std::ostream << (std::ostream , sc_status s); } // namespace sc_core #endif //__SYSTEMC_EXT_CORE_SC_MAIN_HH__ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12074 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: I266629d6c936d4846e88e35af36555fb392b181c Gerrit-Change-Number: 12074 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement much of sc_spawn.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12044 Change subject: systemc: Implement much of sc_spawn. .. systemc: Implement much of sc_spawn. This doesn't implement reset signals, although those aren't implemented for static processes either yet. Change-Id: I748a7f75b9b91774c91d969bc1ff5b07e1711aa3 --- M src/systemc/core/process.cc M src/systemc/core/sc_module.cc M src/systemc/core/sc_spawn.cc M src/systemc/ext/core/sc_spawn.hh 4 files changed, 148 insertions(+), 29 deletions(-) diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc index ad297a2..678cb04 100644 --- a/src/systemc/core/process.cc +++ b/src/systemc/core/process.cc @@ -338,10 +338,6 @@ dynamicSensitivity(nullptr) { _newest = this; -if (_dynamic) -finalize(); -else -scheduler.reg(this); } Process *Process::_newest; diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc index 499a741..bd0b2e1 100644 --- a/src/systemc/core/sc_module.cc +++ b/src/systemc/core/sc_module.cc @@ -43,19 +43,25 @@ Process * newMethodProcess(const char *name, ProcessFuncWrapper *func) { -return new Method(name, func); +Process *p = new Method(name, func); +scheduler.reg(p); +return p; } Process * newThreadProcess(const char *name, ProcessFuncWrapper *func) { -return new Thread(name, func); +Process *p = new Thread(name, func); +scheduler.reg(p); +return p; } Process * newCThreadProcess(const char *name, ProcessFuncWrapper *func) { -return new CThread(name, func); +Process *p = new CThread(name, func); +scheduler.reg(p); +return p; } } // namespace sc_gem5 diff --git a/src/systemc/core/sc_spawn.cc b/src/systemc/core/sc_spawn.cc index fd7dc0a..ecb0bbc 100644 --- a/src/systemc/core/sc_spawn.cc +++ b/src/systemc/core/sc_spawn.cc @@ -28,64 +28,125 @@ */ #include "base/logging.hh" +#include "systemc/core/process.hh" +#include "systemc/core/process_types.hh" +#include "systemc/core/scheduler.hh" +#include "systemc/ext/core/sc_module.hh" #include "systemc/ext/core/sc_spawn.hh" +namespace sc_gem5 +{ + +Process * +spawnWork(ProcessFuncWrapper *func, const char *name, + const ::sc_core::sc_spawn_options *opts) +{ +bool method = false; +bool dontInitialize = false; +if (opts) { +if (opts->_spawnMethod) +method = true; +if (opts->_dontInitialize) +dontInitialize = true; +if (opts->_stackSize != -1) +warn("Ignoring request to set stack size.\n"); +} + +if (!name || name[0] == '\0') { +if (method) +name = ::sc_core::sc_gen_unique_name("method_p"); +else +name = ::sc_core::sc_gen_unique_name("thread_p"); +} + +Process *proc; +if (method) +proc = new Method(name, func, true); +else +proc = new Thread(name, func, true); + +if (opts) { +for (auto e: opts->_events) +proc->addStatic(new PendingSensitivityEvent(proc, e)); + +for (auto p: opts->_ports) +proc->addStatic(new PendingSensitivityPort(proc, p)); + +for (auto e: opts->_exports) +proc->addStatic(new PendingSensitivityExport(proc, e)); + +for (auto i: opts->_interfaces) +proc->addStatic(new PendingSensitivityInterface(proc, i)); + +for (auto f: opts->_finders) +proc->addStatic(new PendingSensitivityFinder(proc, f)); +} + +scheduler.reg(proc); + +if (dontInitialize) +scheduler.dontInitialize(proc); + +return proc; +} + +} // namespace sc_gem5 + namespace sc_core { -sc_spawn_options::sc_spawn_options() -{ -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} +sc_spawn_options::sc_spawn_options() : +_spawnMethod(false), _dontInitialize(false), _stackSize(-1) +{} void sc_spawn_options::spawn_method() { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +_spawnMethod = true; } void sc_spawn_options::dont_initialize() { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +_dontInitialize = true; } void -sc_spawn_options::set_stack_size(int) +sc_spawn_options::set_stack_size(int ss) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +_stackSize = ss; } void -sc_spawn_options::set_sensitivity(const sc_event *) +sc_spawn_options::set_sensitivity(const sc_event *e) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +_events.push_back(e); } void -sc_spawn_options::set_sensitivity(sc_port_base *) +sc_spawn_options::set_sensitivity(sc_port_base *p) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +_ports.push_back(p); } void -sc_spawn_options::set_sensitivity(sc_export_base *) +sc_spawn_options::set_sensitivity(sc_export_base *e) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement + and - for sc_time, and sc_max_time.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12040 Change subject: systemc: Implement + and - for sc_time, and sc_max_time. .. systemc: Implement + and - for sc_time, and sc_max_time. Change-Id: I294b63840e42e2afdef198229adc60ddbb60b9a1 --- M src/systemc/core/sc_time.cc 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc index f51b158..43d3900 100644 --- a/src/systemc/core/sc_time.cc +++ b/src/systemc/core/sc_time.cc @@ -28,6 +28,7 @@ */ #include "base/logging.hh" +#include "base/types.hh" #include "python/pybind11/pybind.hh" #include "systemc/ext/core/sc_time.hh" @@ -239,17 +240,15 @@ } const sc_time -operator + (const sc_time &, const sc_time &) +operator + (const sc_time , const sc_time ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return sc_time(); +return sc_time::from_value(a.value() + b.value()); } const sc_time -operator - (const sc_time &, const sc_time &) +operator - (const sc_time , const sc_time ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return sc_time(); +return sc_time::from_value(a.value() - b.value()); } const sc_time @@ -305,8 +304,8 @@ const sc_time & sc_max_time() { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return *(const sc_time *)nullptr; +static const sc_time MaxScTime = sc_time::from_value(MaxTick); +return MaxScTime; } void -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12040 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: I294b63840e42e2afdef198229adc60ddbb60b9a1 Gerrit-Change-Number: 12040 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement most of the sc_report_handler mechanism.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12048 Change subject: systemc: Implement most of the sc_report_handler mechanism. .. systemc: Implement most of the sc_report_handler mechanism. This doesn't include support for the deprecated integer message ids. Change-Id: I309d58df1cdc464428189eb0b7180edf41ca4f67 --- M src/systemc/core/process.cc M src/systemc/core/process.hh M src/systemc/ext/utils/sc_report.hh M src/systemc/ext/utils/sc_report_handler.hh M src/systemc/utils/sc_report.cc M src/systemc/utils/sc_report_handler.cc 6 files changed, 352 insertions(+), 156 deletions(-) diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc index 39ee9e0..6a0e7d5 100644 --- a/src/systemc/core/process.cc +++ b/src/systemc/core/process.cc @@ -333,6 +333,19 @@ scheduler.ready(this); } +void +Process::lastReport(::sc_core::sc_report *report) +{ +if (report) { +_lastReport = std::unique_ptr<::sc_core::sc_report>( +new ::sc_core::sc_report(*report)); +} else { +_lastReport = nullptr; +} +} + +::sc_core::sc_report *Process::lastReport() const { return _lastReport.get(); } + Process::Process(const char *name, ProcessFuncWrapper *func, bool _dynamic, bool needs_start) : ::sc_core::sc_object(name), excWrapper(nullptr), func(func), diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh index 3b1fb4e..8abafbd 100644 --- a/src/systemc/core/process.hh +++ b/src/systemc/core/process.hh @@ -31,6 +31,7 @@ #define __SYSTEMC_CORE_PROCESS_HH__ #include +#include #include #include "base/fiber.hh" @@ -44,6 +45,7 @@ #include "systemc/ext/core/sc_module.hh" #include "systemc/ext/core/sc_port.hh" #include "systemc/ext/core/sc_process_handle.hh" +#include "systemc/ext/utils/sc_report.hh" namespace sc_gem5 { @@ -270,6 +272,7 @@ bool needsStart() const { return _needsStart; } bool dynamic() const { return _dynamic; } bool isUnwinding() const { return _isUnwinding; } +void isUnwinding(bool v) { _isUnwinding = v; } bool terminated() const { return _terminated; } void forEachKid(const std::function ); @@ -318,6 +321,9 @@ static Process *newest() { return _newest; } +void lastReport(::sc_core::sc_report *report); +::sc_core::sc_report *lastReport() const; + protected: Process(const char *name, ProcessFuncWrapper *func, bool _dynamic, bool needs_start); @@ -355,6 +361,8 @@ PendingSensitivities pendingStaticSensitivities; Sensitivity *dynamicSensitivity; + +std::unique_ptr<::sc_core::sc_report> _lastReport; }; inline void diff --git a/src/systemc/ext/utils/sc_report.hh b/src/systemc/ext/utils/sc_report.hh index f0ed14f..6f652ce 100644 --- a/src/systemc/ext/utils/sc_report.hh +++ b/src/systemc/ext/utils/sc_report.hh @@ -31,12 +31,13 @@ #define __SYSTEMC_EXT_UTIL_SC_REPORT_HH__ #include +#include + +#include "systemc/ext/core/sc_time.hh" namespace sc_core { -class sc_time; - enum sc_severity { SC_INFO = 0, @@ -56,6 +57,8 @@ SC_DEBUG = 500 }; +class sc_report_handler; + class sc_report : public std::exception { public: @@ -63,15 +66,15 @@ sc_report = (const sc_report &); virtual ~sc_report() throw(); -sc_severity get_severity() const; -const char *get_msg_type() const; -const char *get_msg() const; -int get_verbosity() const; -const char *get_file_name() const; -int get_line_number() const; +sc_severity get_severity() const { return _severity; } +const char *get_msg_type() const { return _msgType; } +const char *get_msg() const { return _msg; } +int get_verbosity() const { return _verbosity; } +const char *get_file_name() const { return _fileName; } +int get_line_number() const { return _lineNumber; } -const sc_time _time() const; -const char *get_process_name() const; +const sc_time _time() const { return _time; } +const char *get_process_name() const { return _processName; } virtual const char *what() const throw(); @@ -83,7 +86,31 @@ static void suppress_id(int id, bool); // Only for info or warning. static void suppress_infos(bool); static void suppress_warnings(bool); -int get_id() const; +int get_id() const { return _id; } + + private: +friend class sc_report_handler; + +sc_report(sc_severity _severity, +const char *_msgType, +const char *_msg, +int _verbosity, +const char *_fileName, +int _lineNumber, +sc_time _time, +const char *_processName, +int _id); + +sc_severity _severity; +const char *_msgType; +const char *_msg; +int _verbosity; +const char *_fileName; +int _lineNumber; +sc_time _time; +const char *_processName; +int _id; +
[gem5-dev] Change in gem5/gem5[master]: systemc: Use the new python interface to delay fixing the timescale.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12070 Change subject: systemc: Use the new python interface to delay fixing the timescale. .. systemc: Use the new python interface to delay fixing the timescale. This is necessary if an sc_time object is constructed globally, either directly or indirectly, before python is available to fix the timescale. The call will be deferred until the interpretter is up and ready. Change-Id: I486c0a90d44a0e0f0ad8c530b7148e1cff04a5cc --- M src/systemc/core/sc_time.cc 1 file changed, 74 insertions(+), 16 deletions(-) diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc index 43d3900..93150aa 100644 --- a/src/systemc/core/sc_time.cc +++ b/src/systemc/core/sc_time.cc @@ -27,9 +27,12 @@ * Authors: Gabe Black */ +#include + #include "base/logging.hh" #include "base/types.hh" #include "python/pybind11/pybind.hh" +#include "systemc/core/python.hh" #include "systemc/ext/core/sc_time.hh" namespace sc_core @@ -56,19 +59,81 @@ [SC_SEC] = 1.0 }; -void -fixTimeResolution() -{ -static bool fixed = false; -if (fixed) -return; +bool timeFixed = false; +bool pythonReady = false; +struct SetInfo +{ +SetInfo(::sc_core::sc_time *time, double d, ::sc_core::sc_time_unit tu) : +time(time), d(d), tu(tu) +{} + +::sc_core::sc_time *time; +double d; +::sc_core::sc_time_unit tu; +}; +std::vector toSet; + +void +setWork(sc_time *time, double d, ::sc_core::sc_time_unit tu) +{ +//XXX Assuming the time resolution is 1ps. +double scale = TimeUnitScale[tu] / TimeUnitScale[SC_PS]; +// Accellera claims there is a linux bug, and that these next two +// lines work around them. +volatile double tmp = d * scale + 0.5; +*time = sc_time::from_value(static_cast(tmp)); +} + +void +fixTime() +{ auto ticks = pybind11::module::import("m5.ticks"); auto fix_global_frequency = ticks.attr("fixGlobalFrequency"); fix_global_frequency(); -fixed = true; + +for (auto : toSet) +setWork(t.time, t.d, t.tu); +toSet.clear(); } +void +set(::sc_core::sc_time *time, double d, ::sc_core::sc_time_unit tu) +{ +// Only fix time once. +if (!timeFixed) { +timeFixed = true; + +// If we've run, python is working and we haven't fixed time yet. +if (pythonReady) +fixTime(); +} +if (pythonReady) { +// Time should be working. Set up this sc_time. +setWork(time, d, tu); +} else { +// Time isn't set up yet. Defer setting up this sc_time. +toSet.emplace_back(time, d, tu); +} +} + +class TimeSetter : public ::sc_gem5::PythonReadyFunc +{ + public: +TimeSetter() : ::sc_gem5::PythonReadyFunc() {} + +void +run() override +{ +// Record that we've run and python/pybind should be usable. +pythonReady = true; + +// If time is already fixed, let python know. +if (timeFixed) +fixTime(); +} +} timeSetter; + } // anonymous namespace sc_time::sc_time() : val(0) {} @@ -76,15 +141,8 @@ sc_time::sc_time(double d, sc_time_unit tu) { val = 0; -if (d != 0) { -fixTimeResolution(); -//XXX Assuming the time resolution is 1ps. -double scale = TimeUnitScale[tu] / TimeUnitScale[SC_PS]; -// Accellera claims there is a linux bug, and that these next two -// lines work around them. -volatile double tmp = d * scale + 0.5; -val = static_cast(tmp); -} +if (d != 0) +set(this, d, tu); } sc_time::sc_time(const sc_time ) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12070 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: I486c0a90d44a0e0f0ad8c530b7148e1cff04a5cc Gerrit-Change-Number: 12070 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Detect a process control corner case and report an error.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12050 Change subject: systemc: Detect a process control corner case and report an error. .. systemc: Detect a process control corner case and report an error. This error reporting results in an exception being thrown, and one (or more) of the tests depend on that behavior. Change-Id: I858aa14fbb80b0648392179a6a8d2055c91aedf8 --- M src/systemc/core/process.cc 1 file changed, 8 insertions(+), 0 deletions(-) diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc index 6b4c427..a54d5c2 100644 --- a/src/systemc/core/process.cc +++ b/src/systemc/core/process.cc @@ -178,6 +178,14 @@ if (inc_kids) forEachKid([](Process *p) { p->disable(true); }); +if (!::sc_core::sc_allow_process_control_corners && +dynamic_cast(dynamicSensitivity)) { +std::string message("attempt to disable a thread with timeout wait: "); +message += name(); +SC_REPORT_ERROR("Undefined process control interaction", +message.c_str()); +} + _disabled = true; } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12050 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: I858aa14fbb80b0648392179a6a8d2055c91aedf8 Gerrit-Change-Number: 12050 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Fill out process handle kill and reset mechanisms.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12046 Change subject: systemc: Fill out process handle kill and reset mechanisms. .. systemc: Fill out process handle kill and reset mechanisms. Some flags were being updated too early, making the functions think what they were about to do had already been done. Also, actually check for and throw the exception installed in a process when it's next supposed to run, and when injecting an exception schedule that other process to run immediately. Change-Id: I0856b69903699b2c66f9dc7f44942bbfe3cfdcc4 --- M src/systemc/core/process.cc M src/systemc/core/scheduler.cc 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc index 678cb04..ec5c57c 100644 --- a/src/systemc/core/process.cc +++ b/src/systemc/core/process.cc @@ -108,15 +108,13 @@ class UnwindExceptionReset : public ::sc_core::sc_unwind_exception { public: -const char *what() const throw() override { return "RESET"; } -bool is_reset() const override { return true; } +UnwindExceptionReset() { _isReset = true; } }; class UnwindExceptionKill : public ::sc_core::sc_unwind_exception { public: -const char *what() const throw() override { return "KILL"; } -bool is_reset() const override { return false; } +UnwindExceptionKill() {} }; template @@ -194,10 +192,6 @@ void Process::kill(bool inc_kids) { -// Update our state. -_terminated = true; -_isUnwinding = true; - // Propogate the kill to our children no matter what happens to us. if (inc_kids) forEachKid([](Process *p) { p->kill(true); }); @@ -206,6 +200,13 @@ if (_isUnwinding) return; +// Update our state. +_terminated = true; +_isUnwinding = true; +_suspendedReady = false; +_suspended = false; +_syncReset = false; + // Inject the kill exception into this process. injectException(killException); @@ -215,9 +216,6 @@ void Process::reset(bool inc_kids) { -// Update our state. -_isUnwinding = true; - // Propogate the reset to our children no matter what happens to us. if (inc_kids) forEachKid([](Process *p) { p->reset(true); }); @@ -226,6 +224,9 @@ if (_isUnwinding) return; +// Update our state. +_isUnwinding = true; + // Inject the reset exception into this process. injectException(resetException); @@ -243,7 +244,7 @@ Process::injectException(ExceptionWrapperBase ) { excWrapper = -// Let this process preempt us. +scheduler.runNow(this); }; void @@ -289,8 +290,9 @@ reset = false; try { func->call(); -} catch(::sc_core::sc_unwind_exception exc) { +} catch(const ::sc_core::sc_unwind_exception ) { reset = exc.is_reset(); +_isUnwinding = false; } } while (reset); _terminated = true; diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index c2b5ec3..085602d 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -117,6 +117,13 @@ if (_current && _current->needsStart()) _current->run(); } +if (_current && _current->excWrapper) { +// Make sure this isn't a method process. +assert(!_current->needsStart()); +auto ew = _current->excWrapper; +_current->excWrapper = nullptr; +ew->throw_it(); +} } void -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12046 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: I0856b69903699b2c66f9dc7f44942bbfe3cfdcc4 Gerrit-Change-Number: 12046 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Always set USE_SYSTEMC=1 when compiling with verify.py.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12065 Change subject: systemc: Always set USE_SYSTEMC=1 when compiling with verify.py. .. systemc: Always set USE_SYSTEMC=1 when compiling with verify.py. It doesn't make sense not to have systemc enabled when building the systemc regression tests. Change-Id: I23b81fd4d7cbd0dbf5efbea773d816296d6492be --- M src/systemc/tests/verify.py 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index e98f219..26183b5 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -121,7 +121,7 @@ def run(self, tests): targets = list([test.full_path() for test in tests]) -scons_args = list(self.args) + targets +scons_args = [ 'USE_SYSTEMC=1' ] + list(self.args) + targets scons(*scons_args) class RunPhase(TestPhaseBase): -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12065 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: I23b81fd4d7cbd0dbf5efbea773d816296d6492be Gerrit-Change-Number: 12065 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Fill out sc_process_handle and create Process classes.
Hello Jason Lowe-Power, Matthias Jung, Giacomo Travaglini, Andreas Sandberg, I'd like you to reexamine a change. Please visit https://gem5-review.googlesource.com/c/public/gem5/+/11613 to look at the new patch set (#3). Change subject: systemc: Fill out sc_process_handle and create Process classes. .. systemc: Fill out sc_process_handle and create Process classes. The sc_process_handle class now primarily delegates to a Process object it points at. The Process object does book keeping as far as its internal state, but doesn't yet have a way to run its target function or to schedule itself or inject exceptions into its context of execution. Change-Id: I98389778abe29aa26e3e3a91bf02e6721acc8a9c --- M src/systemc/core/SConscript M src/systemc/core/object.cc A src/systemc/core/process.cc A src/systemc/core/process.hh M src/systemc/core/sc_module.cc M src/systemc/core/sc_process_handle.cc M src/systemc/core/sc_sensitive.cc M src/systemc/ext/core/sc_module.hh M src/systemc/ext/core/sc_process_handle.hh M src/systemc/ext/core/sc_sensitive.hh 10 files changed, 582 insertions(+), 95 deletions(-) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11613 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: I98389778abe29aa26e3e3a91bf02e6721acc8a9c Gerrit-Change-Number: 11613 Gerrit-PatchSet: 3 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: 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 orphans top level objects instead of panic-ing.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12035 Change subject: systemc: Make orphans top level objects instead of panic-ing. .. systemc: Make orphans top level objects instead of panic-ing. When a simulation ends, the sc_objects it contains are destroyed one by one, not necessarily in hierarchy order. That means that a parent object can legitimately be destroyed before its children. Instead of panic-ing when that inevitably happens, this change makes gem5 turn those children into top level objects. Change-Id: Icad9c99310fbc3ddcadbbb4f8a990b4fbfe35bdf --- M src/systemc/core/object.cc M src/systemc/core/object.hh 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/systemc/core/object.cc b/src/systemc/core/object.cc index 68c52eb..39403ca 100644 --- a/src/systemc/core/object.cc +++ b/src/systemc/core/object.cc @@ -118,7 +118,12 @@ Object::~Object() { -panic_if(!children.empty(), "Parent object still has children.\n"); +// Promote all children to be top level objects. +for (auto child: children) { +addObject(, child); +child->_gem5_object->parent = nullptr; +} +children.clear(); if (parent) popObject(>_gem5_object->children, _name); diff --git a/src/systemc/core/object.hh b/src/systemc/core/object.hh index 1317986..c87a98b 100644 --- a/src/systemc/core/object.hh +++ b/src/systemc/core/object.hh @@ -99,7 +99,6 @@ Objects children; Events events; sc_core::sc_object *parent; -ObjectsIt parentIt; sc_core::sc_attr_cltn cltn; }; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12035 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: Icad9c99310fbc3ddcadbbb4f8a990b4fbfe35bdf Gerrit-Change-Number: 12035 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement sc_get_current_process_handle's other personality.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12030 Change subject: systemc: Implement sc_get_current_process_handle's other personality. .. systemc: Implement sc_get_current_process_handle's other personality. When run during simulation, sc_get_current_process_handle returns a handle for the currently running process or a invalid handle if no process is running (ie sc_main is running). When run during elaboration, it returns a handle to the most recently created process. This second context is what this change handles. Change-Id: I3fb247b9b7bf83891c782966cfef474753159158 --- M src/systemc/core/sc_process_handle.cc 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/systemc/core/sc_process_handle.cc b/src/systemc/core/sc_process_handle.cc index c4014b7..e0f6a81 100644 --- a/src/systemc/core/sc_process_handle.cc +++ b/src/systemc/core/sc_process_handle.cc @@ -30,6 +30,7 @@ #include "base/logging.hh" #include "systemc/core/process.hh" #include "systemc/core/scheduler.hh" +#include "systemc/ext/core/sc_main.hh" #include "systemc/ext/core/sc_process_handle.hh" namespace sc_core @@ -292,7 +293,10 @@ sc_process_handle sc_get_current_process_handle() { -return sc_process_handle(::sc_gem5::scheduler.current()); +if (sc_is_running()) +return sc_process_handle(::sc_gem5::scheduler.current()); +else +return sc_process_handle(::sc_gem5::Process::newest()); } bool -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12030 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: I3fb247b9b7bf83891c782966cfef474753159158 Gerrit-Change-Number: 12030 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Ignore a warning in the reference test outputs.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12068 Change subject: systemc: Ignore a warning in the reference test outputs. .. systemc: Ignore a warning in the reference test outputs. The warning is about deprecated sc_module constructors which don't take an sc_module_name. Change-Id: I2ef864a5bdac93eb8104a842179ffe45a8335085 --- M src/systemc/tests/verify.py 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index 26183b5..6667b13 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -197,8 +197,9 @@ ref_filt = merge_filts( r'^\nInfo: /OSCI/SystemC: Simulation stopped by user.\n', r'^SystemC Simulation\n', -warning_filt(571), warning_filt(540), +warning_filt(569), +warning_filt(571), r'^\nInfo: \(I804\) /IEEE_Std_1666/deprecated: ' + r'You can turn off(.*\n){7}' ) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12068 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: I2ef864a5bdac93eb8104a842179ffe45a8335085 Gerrit-Change-Number: 12068 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement the sensitivity mechanism.
Hello Jason Lowe-Power, Matthias Jung, Giacomo Travaglini, Andreas Sandberg, I'd like you to reexamine a change. Please visit https://gem5-review.googlesource.com/c/public/gem5/+/11713 to look at the new patch set (#2). Change subject: systemc: Implement the sensitivity mechanism. .. systemc: Implement the sensitivity mechanism. This change lets processes be sensitive to events, timeouts, etc. Change-Id: If30a256dfa8a2e92192c1f9c96b48e2aa28ec27e --- A src/systemc/core/bindinfo.hh M src/systemc/core/event.cc M src/systemc/core/event.hh M src/systemc/core/kernel.cc M src/systemc/core/process.cc M src/systemc/core/process.hh M src/systemc/core/sc_port.cc M src/systemc/core/sc_sensitive.cc M src/systemc/core/scheduler.cc M src/systemc/core/scheduler.hh M src/systemc/ext/core/sc_event.hh M src/systemc/ext/core/sc_port.hh 12 files changed, 523 insertions(+), 26 deletions(-) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11713 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: If30a256dfa8a2e92192c1f9c96b48e2aa28ec27e Gerrit-Change-Number: 11713 Gerrit-PatchSet: 2 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: newpatchset ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in gem5/gem5[master]: systemc: Extend the execute phase of verify.py.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12051 Change subject: systemc: Extend the execute phase of verify.py. .. systemc: Extend the execute phase of verify.py. Add -j and --timeout options to the execute phase of verify.py. The --timeout option is implemented using the timeout utility program which is assumed to be available on the host system. Python 3.3 added a timeout argument to the subprocess module which is an alternative approach, but then we would be dependent on python 3.3. -j is implemented using the standard multiprocess.pool.ThreadPool class. Change-Id: I15b92f2b14de6710e2027a6a19984b2644b2a8df --- M src/systemc/tests/verify.py 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index 34ae931..cface47 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -35,6 +35,7 @@ import itertools import json import logging +import multiprocessing.pool import os import subprocess import sys @@ -120,16 +121,39 @@ number = 2 def run(self, tests): -for test in tests: -if test.compile_only: -continue -args = [ +parser = argparse.ArgumentParser() +parser.add_argument('--timeout', type=int, metavar='SECONDS', +help='Time limit for each run in seconds.', +default=0) +parser.add_argument('-j', type=int, default=1, +help='How many tests to run in parallel.') +args = parser.parse_args(self.args) + +timeout_cmd = [ +'timeout', +'--kill-after', str(args.timeout * 2), +str(args.timeout) +] +def run_test(test): +cmd = [] +if args.timeout: +cmd.extend(timeout_cmd) +cmd.extend([ test.full_path(), '-red', test.m5out_dir(), '--listener-mode=off', config_path -] -subprocess.check_call(args) +]) +subprocess.check_call(cmd) + +runnable = filter(lambda t: not t.compile_only, tests) +if args.j == 1: +map(run_test, runnable) +else: +tp = multiprocessing.pool.ThreadPool(args.j) +map(lambda t: tp.apply_async(run_test, (t,)), runnable) +tp.close() +tp.join() class VerifyPhase(TestPhaseBase): name = 'verify' -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12051 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: I15b92f2b14de6710e2027a6a19984b2644b2a8df Gerrit-Change-Number: 12051 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement the SC_EXIT_ON_STARVATION exit mode.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12038 Change subject: systemc: Implement the SC_EXIT_ON_STARVATION exit mode. .. systemc: Implement the SC_EXIT_ON_STARVATION exit mode. This mode implies checking whether there's any activity left either before starting a delta cycle, or processing delta or timed notification or timeout. Change-Id: I0780a1f720cf63f3d2907b8dd28685266b52d6b4 --- M src/systemc/core/scheduler.cc M src/systemc/core/scheduler.hh 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 5174627..c2b5ec3 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -42,7 +42,9 @@ eq(nullptr), readyEvent(this, false, ReadyPriority), pauseEvent(this, false, PausePriority), stopEvent(this, false, StopPriority), -scMain(nullptr), _started(false), _paused(false), _stopped(false), +scMain(nullptr), +starvationEvent(this, false, StarvationPriority), +_started(false), _paused(false), _stopped(false), maxTickEvent(this, false, MaxTickPriority), _numCycles(0), _current(nullptr), initReady(false) {} @@ -143,6 +145,20 @@ if (!readyEvent.scheduled()) { panic_if(!eq, "Need to schedule ready, but no event manager.\n"); eq->schedule(, eq->getCurTick()); +if (starvationEvent.scheduled()) +eq->deschedule(); +} +} + +void +Scheduler::scheduleStarvationEvent() +{ +if (!starvationEvent.scheduled()) { +panic_if(!eq, "Need to schedule starvation event, " +"but no event manager.\n"); +eq->schedule(, eq->getCurTick()); +if (readyEvent.scheduled()) +eq->deschedule(); } } @@ -162,6 +178,9 @@ // The update phase. update(); +if (starved() && !runToTime) +scheduleStarvationEvent(); + // The delta phase will happen naturally through the event queue. } @@ -202,9 +221,13 @@ _started = true; _paused = false; _stopped = false; +runToTime = run_to_time; maxTick = max_tick; +if (starved() && !runToTime) +return; + if (initReady) { kernel->status(::sc_core::SC_RUNNING); eq->schedule(, maxTick); @@ -219,6 +242,8 @@ eq->deschedule(); if (maxTickEvent.scheduled()) eq->deschedule(); +if (starvationEvent.scheduled()) +eq->deschedule(); } void diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh index 73d660e..0c755ed 100644 --- a/src/systemc/core/scheduler.hh +++ b/src/systemc/core/scheduler.hh @@ -215,6 +215,9 @@ auto it = pendingTicks.begin(); if (--it->second == 0) pendingTicks.erase(it); + +if (starved() && !runToTime) +scheduleStarvationEvent(); } // Pending activity ignores gem5 activity, much like how a systemc @@ -277,6 +280,7 @@ static Priority StopPriority = DefaultPriority - 1; static Priority PausePriority = DefaultPriority + 1; static Priority ReadyPriority = DefaultPriority + 2; +static Priority StarvationPriority = ReadyPriority; static Priority MaxTickPriority = DefaultPriority + 3; EventQueue *eq; @@ -292,6 +296,17 @@ EventWrapper stopEvent; Fiber *scMain; +bool +starved() +{ +return (readyList.empty() && updateList.empty() && +(pendingTicks.empty() || + pendingTicks.begin()->first > maxTick) && +initList.empty()); +} +EventWrapper starvationEvent; +void scheduleStarvationEvent(); + bool _started; bool _paused; bool _stopped; @@ -304,6 +319,7 @@ Process *_current; bool initReady; +bool runToTime; ProcessList initList; ProcessList toFinalize; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12038 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: I0780a1f720cf63f3d2907b8dd28685266b52d6b4 Gerrit-Change-Number: 12038 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Make verify.py ignore another warning.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12061 Change subject: systemc: Make verify.py ignore another warning. .. systemc: Make verify.py ignore another warning. Also make warning filters more general and easier to add by writing a function to generate them. Change-Id: I8d813ded9ad8a9ccac4e48e5ea80a3c9c23959da --- M src/systemc/tests/verify.py 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index 062651d..0b903de 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -190,10 +190,15 @@ filts = '|'.join(filts) return re.compile(filts, flags=re.MULTILINE) +def warning_filt(num): +return (r'^\nWarning: \(W{}\) .*\n(In file: .*\n)?' +r'(In process: [\w.]* @ .*\n)?').format(num) + ref_filt = merge_filts( r'^\nInfo: /OSCI/SystemC: Simulation stopped by user.\n', r'^SystemC Simulation\n', -r'^\nWarning: .*\nIn file: .*\n' +warning_filt(571), +warning_filt(540) ) test_filt = merge_filts( r'^Global frequency set at \d* ticks per second\n' -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12061 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: I8d813ded9ad8a9ccac4e48e5ea80a3c9c23959da Gerrit-Change-Number: 12061 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
[gem5-dev] Change in gem5/gem5[master]: systemc: "Implement" sc_interface's methods.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12072 Change subject: systemc: "Implement" sc_interface's methods. .. systemc: "Implement" sc_interface's methods. Most don't do anything. Make default_event() return a dummy event to avoid dereferencing a null pointer. Change-Id: I8d6d576d3a1f585029c387cd414bbebf2d670644 --- M src/systemc/core/sc_interface.cc M src/systemc/ext/core/sc_interface.hh 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/systemc/core/sc_interface.cc b/src/systemc/core/sc_interface.cc index e01bdcc..171422d 100644 --- a/src/systemc/core/sc_interface.cc +++ b/src/systemc/core/sc_interface.cc @@ -28,32 +28,17 @@ */ #include "base/logging.hh" +#include "systemc/ext/core/sc_event.hh" #include "systemc/ext/core/sc_interface.hh" namespace sc_core { -void -sc_interface::register_port(sc_port_base &, const char *) -{ -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - const sc_event & sc_interface::default_event() const { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return *(sc_event *)nullptr; -} - -sc_interface::~sc_interface() -{ -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_interface::sc_interface() -{ -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +static sc_event dummy; +return dummy; } } // namespace sc_core diff --git a/src/systemc/ext/core/sc_interface.hh b/src/systemc/ext/core/sc_interface.hh index 2073f53..3c6a27d 100644 --- a/src/systemc/ext/core/sc_interface.hh +++ b/src/systemc/ext/core/sc_interface.hh @@ -39,12 +39,11 @@ class sc_interface { public: -virtual void register_port(sc_port_base &, const char *); virtual const sc_event _event() const; -virtual ~sc_interface(); +virtual ~sc_interface() {}; protected: -sc_interface(); +sc_interface() {}; private: // Disabled -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12072 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: I8d6d576d3a1f585029c387cd414bbebf2d670644 Gerrit-Change-Number: 12072 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Make verify.py delete obsolete diff files.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12056 Change subject: systemc: Make verify.py delete obsolete diff files. .. systemc: Make verify.py delete obsolete diff files. If diff file exists but the underlying diff has been fixed, delete the diff file. Change-Id: Icadc21a61c084198a8a246ab6d00a9b885647cde --- M src/systemc/tests/verify.py 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py index 822065c..ad61319 100755 --- a/src/systemc/tests/verify.py +++ b/src/systemc/tests/verify.py @@ -212,9 +212,9 @@ with open(self.test) as test_f, open(self.ref) as ref_f: test = re.sub(self.test_filt, '', test_f.read()) ref = re.sub(self.ref_filt, '', ref_f.read()) +diff_file = '.'.join([ref_file, 'diff']) +diff_path = os.path.join(self.out_dir, diff_file) if test != ref: -diff_file = '.'.join([ref_file, 'diff']) -diff_path = os.path.join(self.out_dir, diff_file) with open(diff_path, 'w') as diff_f: for line in difflib.unified_diff( ref.splitlines(True), test.splitlines(True), @@ -222,6 +222,9 @@ tofile=test_file): diff_f.write(line) return False +else: +if os.path.exists(diff_path): +os.unlink(diff_path) return True class VerifyPhase(TestPhaseBase): -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12056 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: Icadc21a61c084198a8a246ab6d00a9b885647cde Gerrit-Change-Number: 12056 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Implement some of the basics of sc_time.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12034 Change subject: systemc: Implement some of the basics of sc_time. .. systemc: Implement some of the basics of sc_time. This is a very incomplete implementation, but is enough to unblock implementing some other dependent features. Change-Id: Ibd2f3476fe01389e277c6956d48337f551d14acd --- M src/systemc/core/sc_time.cc M src/systemc/ext/core/sc_time.hh 2 files changed, 79 insertions(+), 42 deletions(-) diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc index 167b374..002121e 100644 --- a/src/systemc/core/sc_time.cc +++ b/src/systemc/core/sc_time.cc @@ -33,19 +33,47 @@ namespace sc_core { -sc_time::sc_time() +namespace { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); + +const char *TimeUnitNames[] = { +[SC_FS] = "fs", +[SC_PS] = "ps", +[SC_NS] = "ns", +[SC_US] = "us", +[SC_MS] = "ms", +[SC_SEC] = "s" +}; + +double TimeUnitScale[] = { +[SC_FS] = 1.0e-15, +[SC_PS] = 1.0e-12, +[SC_NS] = 1.0e-9, +[SC_US] = 1.0e-6, +[SC_MS] = 1.0e-3, +[SC_SEC] = 1.0 +}; + +} // anonymous namespace + +sc_time::sc_time() : val(0) {} + +sc_time::sc_time(double d, sc_time_unit tu) +{ +val = 0; +if (d != 0) { +//XXX Assuming the time resolution is 1ps. +double scale = TimeUnitScale[tu] / TimeUnitScale[SC_PS]; +// Accellera claims there is a linux bug, and that these next two +// lines work around them. +volatile double tmp = d * scale + 0.5; +val = static_cast(tmp); +} } -sc_time::sc_time(double, sc_time_unit) +sc_time::sc_time(const sc_time ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_time::sc_time(const sc_time &) -{ -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +val = t.val; } sc_time::sc_time(double, bool) @@ -59,17 +87,16 @@ } sc_time & -sc_time::operator = (const sc_time &) +sc_time::operator = (const sc_time ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +val = t.val; return *this; } sc_dt::uint64 sc_time::value() const { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return 0; +return val; } double @@ -93,58 +120,52 @@ } bool -sc_time::operator == (const sc_time &) const +sc_time::operator == (const sc_time ) const { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return true; +return val == t.val; } bool -sc_time::operator != (const sc_time &) const +sc_time::operator != (const sc_time ) const { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return false; +return val != t.val; } bool -sc_time::operator < (const sc_time &) const +sc_time::operator < (const sc_time ) const { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return false; +return val < t.val; } bool -sc_time::operator <= (const sc_time &) const +sc_time::operator <= (const sc_time ) const { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return true; +return val <= t.val; } bool -sc_time::operator > (const sc_time &) const +sc_time::operator > (const sc_time ) const { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return false; +return val > t.val; } bool -sc_time::operator >= (const sc_time &) const +sc_time::operator >= (const sc_time ) const { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return true; +return val >= t.val; } sc_time & -sc_time::operator += (const sc_time &) +sc_time::operator += (const sc_time ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +val += t.val; return *this; } sc_time & -sc_time::operator -= (const sc_time &) +sc_time::operator -= (const sc_time ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +val -= t.val; return *this; } @@ -163,16 +184,29 @@ } void -sc_time::print(std::ostream &) const +sc_time::print(std::ostream ) const { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +if (val == 0) { +os << "0 s"; +} else { +//XXX Assuming the time resolution is 1ps. +sc_time_unit tu = SC_PS; +uint64_t scaled = val; +while (tu < SC_SEC && (scaled % 1000) == 0) { +tu = (sc_time_unit)((int)tu + 1); +scaled /= 1000; +} + +os << scaled << ' ' << TimeUnitNames[tu]; +} } sc_time -sc_time::from_value(sc_dt::uint64) +sc_time::from_value(sc_dt::uint64 u) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return sc_time(); +sc_time t; +t.val = u; +return t; } sc_time @@ -232,9 +266,9 @@ } std::ostream & -operator << (std::ostream , const sc_time &) +operator << (std::ostream , const sc_time ) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +t.print(os); return os; } diff --git
[gem5-dev] Change in gem5/gem5[master]: systemc: Generalize working with the systemc python module from C++.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12069 Change subject: systemc: Generalize working with the systemc python module from C++. .. systemc: Generalize working with the systemc python module from C++. This change pulls the systemc python module creation code out of sc_main and puts it into a more general purpose python.hh and python.cc which can be used by other code to add other entries into that module without having to track that in a central place. This change also adds a mechanism for notifying C++ code that the embedded python interpretter is up and ready to interact with in case it needs to call some python only functionality. An example of that is the code which tracks and then fixes the timescale for the simulator. Change-Id: I9afcd5a089b21d23ebc1b5fdb6f643ae2f7e5f11 --- M src/systemc/core/SConscript M src/systemc/core/SystemC.py A src/systemc/core/python.cc A src/systemc/core/python.hh M src/systemc/core/sc_main.cc 5 files changed, 157 insertions(+), 7 deletions(-) diff --git a/src/systemc/core/SConscript b/src/systemc/core/SConscript index 8996a7d..76327c8 100644 --- a/src/systemc/core/SConscript +++ b/src/systemc/core/SConscript @@ -37,6 +37,7 @@ Source('object.cc') Source('process.cc') Source('process_types.cc') +Source('python.cc') Source('scheduler.cc') Source('sc_attr.cc') diff --git a/src/systemc/core/SystemC.py b/src/systemc/core/SystemC.py index dff72e2..13ef4eb 100644 --- a/src/systemc/core/SystemC.py +++ b/src/systemc/core/SystemC.py @@ -61,3 +61,11 @@ locals().update({ method.name: (lambda *a, **k: None) for method in SimObject.cxx_exports }) + +try: +import _m5 +except: +pass +else: +import _m5.systemc +_m5.systemc.python_ready() diff --git a/src/systemc/core/python.cc b/src/systemc/core/python.cc new file mode 100644 index 000..5ab3f03 --- /dev/null +++ b/src/systemc/core/python.cc @@ -0,0 +1,85 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#include "systemc/core/python.hh" + +#include +#include +#include + +#include "base/fiber.hh" +#include "base/logging.hh" +#include "python/pybind11/pybind.hh" +#include "sim/init.hh" +#include "systemc/ext/core/sc_main.hh" + +// A weak symbol to detect if sc_main has been defined, and if so where it is. +[[gnu::weak]] int sc_main(int argc, char *argv[]); + +namespace sc_gem5 +{ + +namespace +{ + +std::vector pythonReadyFuncs; +std::vector pythonInitFuncs; + +void +python_ready(pybind11::args args) +{ +for (auto : pythonReadyFuncs) +func->run(); +} + +// Make our sc_main wrapper available in the internal _m5 python module under +// the systemc submodule. +void +systemc_pybind(pybind11::module _internal) +{ +pybind11::module m = m_internal.def_submodule("systemc"); +m.def("python_ready", _ready); +for (auto : pythonInitFuncs) +func->run(m); +} +EmbeddedPyBind embed_("systemc", _pybind); + +} // anonymous namespace + +PythonReadyFunc::PythonReadyFunc() +{ +pythonReadyFuncs.push_back(this); +} + +PythonInitFunc::PythonInitFunc() +{ +pythonInitFuncs.push_back(this); +} + +} // namespace sc_gem5 diff --git a/src/systemc/core/python.hh b/src/systemc/core/python.hh new file mode 100644 index 000..0d68c59 --- /dev/null +++ b/src/systemc/core/python.hh @@ -0,0 +1,54 @@ +/* + *
[gem5-dev] Change in gem5/gem5[master]: systemc: Handle event notifications scheduled before sc_start.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12036 Change subject: systemc: Handle event notifications scheduled before sc_start. .. systemc: Handle event notifications scheduled before sc_start. After sc_start is called, gem5 has run far enough to have an event queue to schedule the notification events on. Before then, it's still legal to request a timed notification. The scheduler should keep track of those requests, and once an event queue is available it should add them to it. Change-Id: Ie7445b1f2e616f4bd36044a09dbef9e1d12d7350 --- M src/systemc/core/scheduler.cc M src/systemc/core/scheduler.hh 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 6bb67d1..5174627 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -60,6 +60,10 @@ p->ready(); } +for (auto ets: eventsToSchedule) +eq->schedule(ets.first, ets.second); +eventsToSchedule.clear(); + if (_started) eq->schedule(, maxTick); diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh index 3ac7f41..73d660e 100644 --- a/src/systemc/core/scheduler.hh +++ b/src/systemc/core/scheduler.hh @@ -187,7 +187,11 @@ schedule(::Event *event, Tick tick) { pendingTicks[tick]++; -eq->schedule(event, tick); + +if (initReady) +eq->schedule(event, tick); +else +eventsToSchedule[event] = tick; } // For descheduling delayed/timed notifications/timeouts. @@ -197,7 +201,11 @@ auto it = pendingTicks.find(event->when()); if (--it->second == 0) pendingTicks.erase(it); -eq->deschedule(event); + +if (initReady) +eq->deschedule(event); +else +eventsToSchedule.erase(event); } // Tell the scheduler than an event fired for bookkeeping purposes. @@ -302,6 +310,8 @@ ProcessList readyList; ChannelList updateList; + +std::map<::Event *, Tick> eventsToSchedule; }; extern Scheduler scheduler; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12036 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: Ie7445b1f2e616f4bd36044a09dbef9e1d12d7350 Gerrit-Change-Number: 12036 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Fix the time resolution when constructing an sc_time.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12037 Change subject: systemc: Fix the time resolution when constructing an sc_time. .. systemc: Fix the time resolution when constructing an sc_time. This is (sort of) mandated by the spec. More specifically the spec says that the systemc API for changing the time resolution can only be called once, and can only be called before a non-zero sc_time is constructed. Because sc_time can be constructed during elaboration and the gem5 version of time resolution is generally not locked down until the actual simulation starts (after elaboration), the sc_time constructor needs to call the fixing function itself to ensure that, for instance, the scaling factors for various real life time units within gem5 are initialized. Change-Id: Ied4b43659834761b55b5ae49ea62779af891d9e3 --- M src/systemc/core/sc_time.cc 1 file changed, 15 insertions(+), 0 deletions(-) diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc index 002121e..f51b158 100644 --- a/src/systemc/core/sc_time.cc +++ b/src/systemc/core/sc_time.cc @@ -28,6 +28,7 @@ */ #include "base/logging.hh" +#include "python/pybind11/pybind.hh" #include "systemc/ext/core/sc_time.hh" namespace sc_core @@ -54,6 +55,19 @@ [SC_SEC] = 1.0 }; +void +fixTimeResolution() +{ +static bool fixed = false; +if (fixed) +return; + +auto ticks = pybind11::module::import("m5.ticks"); +auto fix_global_frequency = ticks.attr("fixGlobalFrequency"); +fix_global_frequency(); +fixed = true; +} + } // anonymous namespace sc_time::sc_time() : val(0) {} @@ -62,6 +76,7 @@ { val = 0; if (d != 0) { +fixTimeResolution(); //XXX Assuming the time resolution is 1ps. double scale = TimeUnitScale[tu] / TimeUnitScale[SC_PS]; // Accellera claims there is a linux bug, and that these next two -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12037 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: Ied4b43659834761b55b5ae49ea62779af891d9e3 Gerrit-Change-Number: 12037 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
[gem5-dev] Change in gem5/gem5[master]: systemc: Add some deprecated features to sc_clock.*.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/11183 ) Change subject: systemc: Add some deprecated features to sc_clock.*. .. systemc: Add some deprecated features to sc_clock.*. Add in two deprecated typedefs, and a deprecated constructor. These are necessary to get the regressions to build. Change-Id: Id8320a67c680acbca0abaee9898158ffd2678d67 Reviewed-on: https://gem5-review.googlesource.com/11183 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/channel/sc_clock.cc M src/systemc/ext/channel/_using.hh M src/systemc/ext/channel/sc_clock.hh 3 files changed, 17 insertions(+), 1 deletion(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/channel/sc_clock.cc b/src/systemc/channel/sc_clock.cc index ac1d336..891c666 100644 --- a/src/systemc/channel/sc_clock.cc +++ b/src/systemc/channel/sc_clock.cc @@ -65,6 +65,12 @@ warn("%s not implemented.\n", __PRETTY_FUNCTION__); } +sc_clock::sc_clock(const char *name, double period, double duty_cycle, + double start_time, bool posedge_first) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + sc_clock::~sc_clock() {} void diff --git a/src/systemc/ext/channel/_using.hh b/src/systemc/ext/channel/_using.hh index 089991f..307e89f 100644 --- a/src/systemc/ext/channel/_using.hh +++ b/src/systemc/ext/channel/_using.hh @@ -34,8 +34,10 @@ using sc_core::sc_buffer; -using sc_core::sc_in_clk; using sc_core::sc_clock; +using sc_core::sc_in_clk; +using sc_core::sc_inout_clk; +using sc_core::sc_out_clk; using sc_core::sc_event_queue; diff --git a/src/systemc/ext/channel/sc_clock.hh b/src/systemc/ext/channel/sc_clock.hh index 9ca160c..ae1f6c9 100644 --- a/src/systemc/ext/channel/sc_clock.hh +++ b/src/systemc/ext/channel/sc_clock.hh @@ -58,6 +58,10 @@ double duty_cycle, double start_time_v, sc_time_unit start_time_tu, bool posedge_first=true); +// Deprecated. +sc_clock(const char *name, double period, double duty_cycle=0.5, + double start_time=0.0, bool posedge_first=true); + virtual ~sc_clock(); virtual void write(const bool &); @@ -80,6 +84,10 @@ typedef sc_in sc_in_clk; +// Deprecated +typedef sc_inout sc_inout_clk; +typedef sc_out sc_out_clk; + } // namespace sc_core #endif //__SYSTEMC_EXT_CHANNEL_SC_CLOCK_HH__ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11183 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: Id8320a67c680acbca0abaee9898158ffd2678d67 Gerrit-Change-Number: 11183 Gerrit-PatchSet: 6 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: Partially implement SC_FORK and SC_JOIN.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/11184 ) Change subject: systemc: Partially implement SC_FORK and SC_JOIN. .. systemc: Partially implement SC_FORK and SC_JOIN. These macros need to expand to some minimal amount of wrapping code to make the regression tests syntactically legal and compile. Change-Id: I0b5569704b129d9c315526fc3363ef846a1b5c65 Reviewed-on: https://gem5-review.googlesource.com/11184 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/ext/core/sc_spawn.hh 1 file changed, 10 insertions(+), 2 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/ext/core/sc_spawn.hh b/src/systemc/ext/core/sc_spawn.hh index f1b110b..0463dc1 100644 --- a/src/systemc/ext/core/sc_spawn.hh +++ b/src/systemc/ext/core/sc_spawn.hh @@ -105,8 +105,16 @@ #define sc_ref(r) boost::ref(r) #define sc_cref(r) boost::cref(r) -#define SC_FORK /* Implementation defined */ -#define SC_JOIN /* Implementation defined */ +#define SC_FORK \ +{ \ +::sc_core::sc_process_handle forkees[] = { + +#define SC_JOIN \ +}; /* TODO wait for the forkees. */ \ +} + +// Non-standard +#define SC_CJOIN SC_JOIN } // namespace sc_core -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11184 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: I0b5569704b129d9c315526fc3363ef846a1b5c65 Gerrit-Change-Number: 11184 Gerrit-PatchSet: 6 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: Add some non-standard sc_trace variants.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/11182 ) Change subject: systemc: Add some non-standard sc_trace variants. .. systemc: Add some non-standard sc_trace variants. These overloads of sc_trace take the unsigned version of some primitive types. The compiler thought it was ambiguous how to convert an unsigned integer value into a signed one since there were several different functions which took signed integer parameters of various sizes. These versions of sc_trace aren't in the standard, but they are in the Accellera implementation and do fix building of the regression tests. Change-Id: I26fd06d90ae6bf5fc5aed24bc2ac826ad69eee31 Reviewed-on: https://gem5-review.googlesource.com/11182 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/ext/utils/sc_trace_file.hh M src/systemc/utils/sc_trace_file.cc 2 files changed, 85 insertions(+), 0 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/ext/utils/sc_trace_file.hh b/src/systemc/ext/utils/sc_trace_file.hh index ec4fd4d..9e9e75b 100644 --- a/src/systemc/ext/utils/sc_trace_file.hh +++ b/src/systemc/ext/utils/sc_trace_file.hh @@ -107,6 +107,26 @@ void sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast *, const std::string &); + +// Nonstandard - unsigned versions necessary to avoid ambiguous overload +// resolution. +void sc_trace(sc_trace_file *, const unsigned char &, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const unsigned char *, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const unsigned short &, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const unsigned short *, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const unsigned int &, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const unsigned int *, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const unsigned long &, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const unsigned long *, + const std::string &, int width=(8 * sizeof(char))); + void sc_trace(sc_trace_file *, const char &, const std::string &, int width=(8 * sizeof(char))); void sc_trace(sc_trace_file *, const char *, @@ -132,6 +152,10 @@ void sc_trace(sc_trace_file *, const sc_dt::uint64 *, const std::string &, int width=(8 * sizeof(char))); +// Nonstandard function for enums +void sc_trace(sc_trace_file *, const unsigned int &, + const std::string &, const char **enum_literals); + template void sc_trace(sc_trace_file *, const sc_signal_in_if &, const std::string &) diff --git a/src/systemc/utils/sc_trace_file.cc b/src/systemc/utils/sc_trace_file.cc index 3b09d95..66f7fef 100644 --- a/src/systemc/utils/sc_trace_file.cc +++ b/src/systemc/utils/sc_trace_file.cc @@ -221,6 +221,60 @@ } void +sc_trace(sc_trace_file *, const unsigned char &, + const std::string &, int width) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const unsigned char *, + const std::string &, int width) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const unsigned short &, + const std::string &, int width) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const unsigned short *, + const std::string &, int width) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const unsigned int &, const std::string &, int width) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const unsigned int *, const std::string &, int width) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const unsigned long &, + const std::string &, int width) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const unsigned long *, + const std::string &, int width) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void sc_trace(sc_trace_file *, const char &, const std::string &, int width) { warn("%s not implemented.\n", __PRETTY_FUNCTION__); @@ -322,4 +376,11 @@ warn("%s not implemented.\n", __PRETTY_FUNCTION__); } +void +sc_trace(sc_trace_file *, const unsigned int &, + const std::string &, const char **enum_literals) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + } // namespace
[gem5-dev] Change in gem5/gem5[master]: systemc: Remove references to internal constants from the tests.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/11181 ) Change subject: systemc: Remove references to internal constants from the tests. .. systemc: Remove references to internal constants from the tests. The tests were referring to constants defined in the Accellera systemc implementation which identified various log message types. This change replaces those (sometimes quite long) string constants with their actual value. This doesn't make that interface any more fragile since the constant value won't track between the Accellera version and this one, but it does make its fragility more explicit by using the value directly. If in the future we decide to hide the magical nature of those particular string constants, we could make them into our own constants in the implementation. Regardless, the tests shouldn't refer to internal details of the implementation. Change-Id: I116a7407fcac49367649b250683117f3ccf4f9ed Reviewed-on: https://gem5-review.googlesource.com/11181 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp M src/systemc/tests/systemc/communication/sc_buffer/test02/sc_buffer_edge_reset.cpp M src/systemc/tests/systemc/communication/sc_signal/check_writer/test16/test16.cpp M src/systemc/tests/systemc/kernel/phase_callbacks/test04/register_phase_callbacks.cpp M src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/sc_method_reset_throw.cpp M src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp 6 files changed, 11 insertions(+), 8 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp b/src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp index 560643b..5f5d990 100644 --- a/src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp +++ b/src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp @@ -72,7 +72,7 @@ { SC_CTOR(X) { -SC_REPORT_ERROR(SC_ID_SET_TIME_RESOLUTION_,""); +SC_REPORT_ERROR("set time resolution failed",""); } }; diff --git a/src/systemc/tests/systemc/communication/sc_buffer/test02/sc_buffer_edge_reset.cpp b/src/systemc/tests/systemc/communication/sc_buffer/test02/sc_buffer_edge_reset.cpp index 98fe8a5..863e64c 100644 --- a/src/systemc/tests/systemc/communication/sc_buffer/test02/sc_buffer_edge_reset.cpp +++ b/src/systemc/tests/systemc/communication/sc_buffer/test02/sc_buffer_edge_reset.cpp @@ -73,8 +73,9 @@ int sc_main(int, char*[]) { - sc_report_handler::set_actions( SC_ID_DISABLE_WILL_ORPHAN_PROCESS_ -, SC_DO_NOTHING ); + sc_report_handler::set_actions( "disable() or dont_initialize() " +"called on process with no static sensitivity, it will be " +"orphaned", SC_DO_NOTHING ); sc_signal sig_int; diff --git a/src/systemc/tests/systemc/communication/sc_signal/check_writer/test16/test16.cpp b/src/systemc/tests/systemc/communication/sc_signal/check_writer/test16/test16.cpp index a295b65..2d7b073 100644 --- a/src/systemc/tests/systemc/communication/sc_signal/check_writer/test16/test16.cpp +++ b/src/systemc/tests/systemc/communication/sc_signal/check_writer/test16/test16.cpp @@ -147,7 +147,7 @@ // report multiple writer errors as warnings sc_core::sc_report_handler::set_actions( -sc_core::SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_ +"sc_signal cannot have more than one driver" , sc_core::SC_DEFAULT_WARNING_ACTIONS ); diff --git a/src/systemc/tests/systemc/kernel/phase_callbacks/test04/register_phase_callbacks.cpp b/src/systemc/tests/systemc/kernel/phase_callbacks/test04/register_phase_callbacks.cpp index 5ed6dd4..a66c6a3 100644 --- a/src/systemc/tests/systemc/kernel/phase_callbacks/test04/register_phase_callbacks.cpp +++ b/src/systemc/tests/systemc/kernel/phase_callbacks/test04/register_phase_callbacks.cpp @@ -212,7 +212,7 @@ int sc_main(int, char*[]) { // don't run without callbacks enabled - sc_report_handler::set_actions( SC_ID_PHASE_CALLBACKS_UNSUPPORTED_ + sc_report_handler::set_actions( "simulation phase callbacks not enabled" , SC_DEFAULT_ERROR_ACTIONS ); phase_tracer pt; diff --git a/src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/sc_method_reset_throw.cpp b/src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/sc_method_reset_throw.cpp index c6596f0..ab7718a 100644 --- a/src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/sc_method_reset_throw.cpp +++ b/src/systemc/tests/systemc/kernel/process_control/reset/method_reset_throw/sc_method_reset_throw.cpp @@ -93,7 +93,9 @@ int sc_main
[gem5-dev] Change in gem5/gem5[master]: systemc: Turn some macros into enums to fix regression test building.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/11180 ) Change subject: systemc: Turn some macros into enums to fix regression test building. .. systemc: Turn some macros into enums to fix regression test building. The spec defines these constants to be macros, but the regression test refers to them using the sc_core namespace. That breaks things because the macros don't expand to an identifier, they expand to an expression. This change converts the macros into enums like in the Accellera implementation to get the regression tests to build. Change-Id: I3db7dc87a7a597907df658624a7343bc6ca1734e Reviewed-on: https://gem5-review.googlesource.com/11180 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/ext/utils/sc_report_handler.hh 1 file changed, 9 insertions(+), 11 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/ext/utils/sc_report_handler.hh b/src/systemc/ext/utils/sc_report_handler.hh index 7347e5f..d0eea77 100644 --- a/src/systemc/ext/utils/sc_report_handler.hh +++ b/src/systemc/ext/utils/sc_report_handler.hh @@ -47,18 +47,16 @@ SC_CACHE_REPORT = 0x0010, SC_INTERRUPT = 0x0020, SC_STOP = 0x0040, -SC_ABORT = 0x0080 -}; +SC_ABORT = 0x0080, -#define SC_DEFAULT_INFO_ACTIONS \ -(::sc_core::SC_LOG | ::sc_core::SC_DISPLAY) -#define SC_DEFAULT_WARNING_ACTIONS \ -(::sc_core::SC_LOG | ::sc_core::SC_DISPLAY) -#define SC_DEFAULT_ERROR_ACTIONS \ -(::sc_core::SC_LOG | ::sc_core::SC_CACHE_REPORT | ::sc_core::SC_THROW) -#define SC_DEFAULT_FATAL_ACTIONS \ -(::sc_core::SC_LOG | ::sc_core::SC_DISPLAY | \ - ::sc_core::SC_CACHE_REPORT | ::sc_core::SC_ABORT) +// The spec says these should be macros, but that breaks the build for the +// regression tests since they refer to, for instance, +// sc_core::SC_DEFAULT_INFO_ACTIONS. +SC_DEFAULT_INFO_ACTIONS = SC_LOG | SC_DISPLAY, +SC_DEFAULT_WARNING_ACTIONS = SC_LOG | SC_DISPLAY, +SC_DEFAULT_ERROR_ACTIONS = SC_LOG | SC_CACHE_REPORT | SC_THROW, +SC_DEFAULT_FATAL_ACTIONS = SC_LOG | SC_DISPLAY | SC_CACHE_REPORT | SC_ABORT +}; typedef void (*sc_report_handler_proc)(const sc_report &, const sc_actions &); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11180 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: I3db7dc87a7a597907df658624a7343bc6ca1734e Gerrit-Change-Number: 11180 Gerrit-PatchSet: 6 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: Remove more Accellera source specific include paths in tests.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/11179 ) Change subject: systemc: Remove more Accellera source specific include paths in tests. .. systemc: Remove more Accellera source specific include paths in tests. Some more tests were including Accellera headers specifically, even after including systemc.h which would bring those headers in alongside all the others. Change-Id: Ib2db0a410e0ecea0035b636e8dd04c85045b8578 Reviewed-on: https://gem5-review.googlesource.com/11179 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/test01.cpp M src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/test02.cpp M src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/test04.cpp M src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/test05.cpp 4 files changed, 0 insertions(+), 4 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/test01.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/test01.cpp index f82344b..29541f4 100644 --- a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/test01.cpp +++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test01/test01.cpp @@ -36,7 +36,6 @@ */ #include "systemc.h" -#include "sysc/kernel/sc_dynamic_processes.h" SC_MODULE(X) { diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/test02.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/test02.cpp index 8eba90a..1431d79 100644 --- a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/test02.cpp +++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test02/test02.cpp @@ -36,7 +36,6 @@ */ #include "systemc.h" -#include "sysc/kernel/sc_dynamic_processes.h" SC_MODULE(X) { diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/test04.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/test04.cpp index e9aa9ef..0ca50e2 100644 --- a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/test04.cpp +++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test04/test04.cpp @@ -37,7 +37,6 @@ */ #include "systemc.h" -#include "sysc/kernel/sc_dynamic_processes.h" SC_MODULE(X) { diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/test05.cpp b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/test05.cpp index 9a7f024..933b124 100644 --- a/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/test05.cpp +++ b/src/systemc/tests/systemc/kernel/dynamic_processes/sc_join/test05/test05.cpp @@ -36,7 +36,6 @@ */ #include "systemc.h" -#include "sysc/kernel/sc_dynamic_processes.h" SC_MODULE(X) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11179 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: Ib2db0a410e0ecea0035b636e8dd04c85045b8578 Gerrit-Change-Number: 11179 Gerrit-PatchSet: 6 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: Include boost/bind.hpp in the systemc header.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/11178 ) Change subject: systemc: Include boost/bind.hpp in the systemc header. .. systemc: Include boost/bind.hpp in the systemc header. The systemc spec says that sc_bind, sc_ref and sc_cref macros should expand to boost::bind, boost::ref, and boost::cref respectively, but that it's "use is not mandantory". Unfortunately, the regression tests use those macros without actually including the boost headers for themselves, and so they won't compile without dragging in these boost headers as a dependency. This should be mostly ok to include here since gem5 itself shouldn't include systemc, just the sub headers that systemc brings in. systemc code which includes systemc *will* have a dependency on boost, but that at least contains the new dependency somewhat. Change-Id: I1877a1b7dae2952f30a9d577d778739abbe7ac3b Reviewed-on: https://gem5-review.googlesource.com/11178 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/ext/systemc 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/ext/systemc b/src/systemc/ext/systemc index 1224a7e..e248550 100644 --- a/src/systemc/ext/systemc +++ b/src/systemc/ext/systemc @@ -30,6 +30,12 @@ #ifndef __SYSTEMC_EXT_SYSTEMC__ #define __SYSTEMC_EXT_SYSTEMC__ +// This include isn't supposed to be necessary, but some regression tests +// assume that the sc_bind macro will work without explicitly including the +// boost headers. This is in contradiction to the spec which says boost isn't +// a required dependency. +#include + #include "channel/_channel.hh" #include "core/_core.hh" #include "dt/_dt.hh" -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11178 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: I1877a1b7dae2952f30a9d577d778739abbe7ac3b Gerrit-Change-Number: 11178 Gerrit-PatchSet: 6 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: Fill out some of the sc_vector.hh classes.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/11177 ) Change subject: systemc: Fill out some of the sc_vector.hh classes. .. systemc: Fill out some of the sc_vector.hh classes. The iterator class needs to have some operators, etc., defined so that tests written against it can compile correctly. The implementations were heavily influenced by the Accellera implementation. Also it should be noted that the systemc spec is incorrect where it defines these classes. When implemented like they are in the Accellera version, the versions of bind in sc_vector_assembly which take sc_vector::iterator and iterator parameters are different, and so they can overload each other. If implemented as described by the spec however, those types are the same and the code won't compile. Change-Id: I62852adf7e6c0a2f3df076ba4e93d2501859c32d Reviewed-on: https://gem5-review.googlesource.com/11177 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/ext/utils/sc_vector.hh 1 file changed, 374 insertions(+), 62 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/ext/utils/sc_vector.hh b/src/systemc/ext/utils/sc_vector.hh index 073b17c..fea49c2 100644 --- a/src/systemc/ext/utils/sc_vector.hh +++ b/src/systemc/ext/utils/sc_vector.hh @@ -33,11 +33,102 @@ #include #include +#include #include #include "../core/sc_object.hh" #include "warn_unimpl.hh" +namespace sc_gem5 +{ + +// Goop for supporting sc_vector_iter, simplified from the Accellera version. + +#if __cplusplus >= 201103L + +using std::enable_if; +using std::remove_const; +using std::is_same; +using std::is_const; + +#else + +template +struct enable_if +{}; + +template +struct enable_if +{ +typedef T type; +}; + +template +struct remove_const +{ +typedef T type; +}; +template +struct remove_const +{ +typedef T type; +}; + +template +struct is_same +{ +static const bool value = false; +}; +template +struct is_same +{ +static const bool value = true; +}; + +template +struct is_const +{ +static const bool value = false; +}; +template +struct is_const +{ +static const bool value = true; +}; + +#endif + +template +struct is_more_const +{ +static const bool value = +is_same::type, +typename remove_const::type>::value && +is_const::value >= is_const::value; +}; + +struct special_result +{}; + +template +struct remove_special_fptr +{}; + +template +struct remove_special_fptr +{ +typedef T type; +}; + +#define SC_RPTYPE_(Type) \ +::sc_gem5::remove_special_fptr< \ +::sc_gem5::special_result & (*) Type>::type::value + +#define SC_ENABLE_IF_(Cond) \ +typename ::sc_gem5::enable_if::type * = NULL + +} // namespace sc_gem5 + namespace sc_core { @@ -61,14 +152,247 @@ const std::vector _elements() const; }; -template -class sc_vector_iter : -public std::iterator + +/* + * Non-standard iterator access adapters. Without using these, the classes as + * defined in the standard won't compile because of redundant bind() overloads. + */ + +template +class sc_direct_access { + public: +typedef Element ElementType; +typedef ElementType Type; +typedef typename sc_gem5::remove_const::type PlainType; + +typedef sc_direct_access Policy; +typedef sc_direct_access NonConstPolicy; +typedef sc_direct_access ConstPolicy; + +sc_direct_access() {} +sc_direct_access(const NonConstPolicy &) {} + +template +sc_direct_access(const U &, +SC_ENABLE_IF_(( +sc_gem5::is_more_const< +ElementType, typename U::Policy::ElementType> +)) +) +{} + +ElementType * +get(ElementType *this_) const +{ +return this_; +} +}; + +template +class sc_member_access +{ + public: +template +friend class sc_member_access; + +typedef Element ElementType; +typedef Access AccessType; +typedef AccessType (ElementType::*MemberType); +typedef AccessType Type; +typedef typename sc_gem5::remove_const::type PlainType; +typedef typename sc_gem5::remove_const::type PlainElemType; + +typedef sc_member_access Policy; +typedef sc_member_access NonConstPolicy; +typedef sc_member_access ConstPolicy; + +sc_member_access(MemberType ptr) : ptr_(ptr) {} +sc_member_access(const NonConstPolicy ) : ptr_(other.ptr_) {} + +AccessType *get(ElementType *this_) const { return &(this_->*ptr_); } + + private: +MemberType ptr_; +}; + +template > +class sc_vector_iter : +public std::iterator, +private AccessPolicy +{ + private: +typedef Element ElementType; +typedef typename AccessPolicy::Policy Policy; +typedef typename AccessPolicy::NonConstPolicy NonConstPolicy; +typedef typename
[gem5-dev] Change in gem5/gem5[master]: systemc: Make a test stop including an internal path for sc_vector.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/11176 ) Change subject: systemc: Make a test stop including an internal path for sc_vector. .. systemc: Make a test stop including an internal path for sc_vector. The sc_vector class is available through systemc.h already, so there's no reason to include an internal path which is only there on Accellera by coincidence of the implementation. Change-Id: I41cab4711c0837cd9b20c21871b79be5165bf498 Reviewed-on: https://gem5-review.googlesource.com/11176 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/tests/systemc/utils/sc_vector/test01/test01.cpp M src/systemc/tests/systemc/utils/sc_vector/test02/test02.cpp M src/systemc/tests/systemc/utils/sc_vector/test03/test03.cpp M src/systemc/tests/systemc/utils/sc_vector/test04/test04.cpp M src/systemc/tests/systemc/utils/sc_vector/test05/test05.cpp M src/systemc/tests/systemc/utils/sc_vector/test06/test06.cpp 6 files changed, 0 insertions(+), 8 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/tests/systemc/utils/sc_vector/test01/test01.cpp b/src/systemc/tests/systemc/utils/sc_vector/test01/test01.cpp index 47cc9d4..d03dfe4 100644 --- a/src/systemc/tests/systemc/utils/sc_vector/test01/test01.cpp +++ b/src/systemc/tests/systemc/utils/sc_vector/test01/test01.cpp @@ -37,7 +37,6 @@ #include "systemc.h" -#include "sysc/utils/sc_vector.h" using sc_core::sc_vector; SC_MODULE( sub_module ) diff --git a/src/systemc/tests/systemc/utils/sc_vector/test02/test02.cpp b/src/systemc/tests/systemc/utils/sc_vector/test02/test02.cpp index 7b827dd..25bae91 100644 --- a/src/systemc/tests/systemc/utils/sc_vector/test02/test02.cpp +++ b/src/systemc/tests/systemc/utils/sc_vector/test02/test02.cpp @@ -43,7 +43,6 @@ #include "systemc.h" -#include "sysc/utils/sc_vector.h" using sc_core::sc_vector; #ifdef USE_BOOST diff --git a/src/systemc/tests/systemc/utils/sc_vector/test03/test03.cpp b/src/systemc/tests/systemc/utils/sc_vector/test03/test03.cpp index 9feebdc..bc08cb6 100644 --- a/src/systemc/tests/systemc/utils/sc_vector/test03/test03.cpp +++ b/src/systemc/tests/systemc/utils/sc_vector/test03/test03.cpp @@ -37,7 +37,6 @@ #include "systemc.h" -#include "sysc/utils/sc_vector.h" using sc_core::sc_vector; SC_MODULE( sub_module ) diff --git a/src/systemc/tests/systemc/utils/sc_vector/test04/test04.cpp b/src/systemc/tests/systemc/utils/sc_vector/test04/test04.cpp index e8aa4df..378b77f 100644 --- a/src/systemc/tests/systemc/utils/sc_vector/test04/test04.cpp +++ b/src/systemc/tests/systemc/utils/sc_vector/test04/test04.cpp @@ -36,8 +36,6 @@ */ #include "systemc.h" -#include "sysc/utils/sc_vector.h" - SC_MODULE( mesh_node ) { diff --git a/src/systemc/tests/systemc/utils/sc_vector/test05/test05.cpp b/src/systemc/tests/systemc/utils/sc_vector/test05/test05.cpp index 551b4fa..fe36d3e 100644 --- a/src/systemc/tests/systemc/utils/sc_vector/test05/test05.cpp +++ b/src/systemc/tests/systemc/utils/sc_vector/test05/test05.cpp @@ -37,7 +37,6 @@ #include -#include "sysc/utils/sc_vector.h" using sc_core::sc_vector; typedef sc_vector< sc_fifo_out > port_vec; diff --git a/src/systemc/tests/systemc/utils/sc_vector/test06/test06.cpp b/src/systemc/tests/systemc/utils/sc_vector/test06/test06.cpp index 051d49c..e1db523 100644 --- a/src/systemc/tests/systemc/utils/sc_vector/test06/test06.cpp +++ b/src/systemc/tests/systemc/utils/sc_vector/test06/test06.cpp @@ -37,8 +37,6 @@ #include "systemc" -#include "sysc/utils/sc_vector.h" - using sc_core::sc_object; using sc_core::sc_vector; using sc_core::sc_mutex; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11176 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: I41cab4711c0837cd9b20c21871b79be5165bf498 Gerrit-Change-Number: 11176 Gerrit-PatchSet: 6 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: Add a script which automates building and running tests.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/10975 ) Change subject: systemc: Add a script which automates building and running tests. .. systemc: Add a script which automates building and running tests. The only required option for the script is the path to a build directory, for instance build/ARM. It uses that when running scons and when referring to generated files (like the built versions of the tests). It uses the location of the script itself to find source files, like the "golden" version of outputs. This script runs tests in three phases, compilation, running, and then verification. By default, all three phases are run for all tests, but which phases run and how they work can be customized by specifying them explicitly on the command line with the --phase option. Each time the --phase option shows up on the command line, it should be followed by the name of the phase being specified. That both declares that that phase should be run, and also that any subsequent options apply to that phase, at least until the next --phase option. Currently, only the "compile" and "execute" phases are implemented, and only the "compile" phase has been tested at all or has any options defined. The "compile" phase simply takes all the options it was given and pass them on to scons. The "verify" phase simply prints a message which says what it would have verified. The script can list the available tests with the --list option, as determined by the json systemc test manifest file which scons can generate, and which the script can refresh if passed the --update-json option. You can also specify what "flavor" of build you want to do, ie opt, debug, fast, etc., with the --flavor option. Only one flavor can be tested at a time, but that should be the desired behavior most of the time. If multiple flavors need to be tested, the script can be invoked multiple times. Finally, there is a --filter option which accepts a python expression as a string. That expression is evaluated in the namespace of the properties of each test in the json file, and if it returns true then that test is run. For instance, to verify only compile_only tests, you would use: systemc/tests/verify.py build/ARM --filter 'compile_only' To test only compile_only tests named bob, you would run this: systemc/tests/verify.py build/ARM --filter \ 'compile_only && name ="bob"' Also included is a simple config.py which is the beginning of a config which will run the systemc regression tests. Right now, all it knows how to do is run sc_main. Change-Id: I62666be8b1622d1355153e623b4274a939507e44 Reviewed-on: https://gem5-review.googlesource.com/10975 Reviewed-by: Gabe Black Maintainer: Gabe Black --- A src/systemc/tests/config.py A src/systemc/tests/verify.py 2 files changed, 261 insertions(+), 0 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/tests/config.py b/src/systemc/tests/config.py new file mode 100755 index 000..7e2dd55 --- /dev/null +++ b/src/systemc/tests/config.py @@ -0,0 +1,46 @@ +# Copyright 2018 Google, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Authors: Gabe Black + +from __future__ import print_function + +import logging + +import m5 + +from m5.objects import SystemC_Kernel, Root + +# pylint:disable=unused-variable + +kernel = SystemC_Kernel() +root = Root(full_system=True,
[gem5-dev] Change in gem5/gem5[master]: systemc, scons: Link systemc tests against the shared gem5 library.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/10959 ) Change subject: systemc, scons: Link systemc tests against the shared gem5 library. .. systemc, scons: Link systemc tests against the shared gem5 library. Otherwise, having hundreds of statically linked gem5s takes up a huge amount of space, and all those repeated linkings brings the mightiest workstation to its knees with sufficient parallelism, or will take forever without it. Change-Id: I4c358b1a50c5e2b0027ac72423f887e24c786b19 Reviewed-on: https://gem5-review.googlesource.com/10959 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/tests/SConscript 1 file changed, 10 insertions(+), 3 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/tests/SConscript b/src/systemc/tests/SConscript index cc7c476..81f122d 100644 --- a/src/systemc/tests/SConscript +++ b/src/systemc/tests/SConscript @@ -62,10 +62,9 @@ } ext_dir = Dir('..').Dir('ext') -class SystemCTestBin(UnitTest): +class SystemCTestBin(Executable): def __init__(self, test): -super(SystemCTestBin, self).__init__( -test.target, *test.sources, main=True) +super(SystemCTestBin, self).__init__(test.target, *test.sources) @classmethod def declare_all(cls, env): @@ -80,6 +79,14 @@ super(SystemCTestBin, cls).declare_all(env) +def declare(self, env): +sources = list(self.sources) +for f in self.filters: +sources = Source.all.apply_filter(f) +objs = self.srcs_to_objs(env, sources) +objs = objs + env['SHARED_LIB'] + env['MAIN_OBJS'] +return super(SystemCTestBin, self).declare(env, objs) + tests = [] def new_test(dirname, name): test = SystemCTest(dirname, name) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/10959 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: I4c358b1a50c5e2b0027ac72423f887e24c786b19 Gerrit-Change-Number: 10959 Gerrit-PatchSet: 7 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: Add in the deprecated binding port constructors.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/10958 ) Change subject: systemc: Add in the deprecated binding port constructors. .. systemc: Add in the deprecated binding port constructors. These are needed by... you guessed it, the regression tests. Change-Id: Id30e71944cc7f3faca7dcb197f37938368364fcd Reviewed-on: https://gem5-review.googlesource.com/10958 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/ext/channel/sc_fifo_in.hh M src/systemc/ext/channel/sc_fifo_out.hh M src/systemc/ext/channel/sc_in.hh M src/systemc/ext/channel/sc_inout.hh M src/systemc/ext/channel/sc_out.hh M src/systemc/ext/core/sc_port.hh 6 files changed, 236 insertions(+), 12 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/ext/channel/sc_fifo_in.hh b/src/systemc/ext/channel/sc_fifo_in.hh index 7f593c1..0952d77 100644 --- a/src/systemc/ext/channel/sc_fifo_in.hh +++ b/src/systemc/ext/channel/sc_fifo_in.hh @@ -49,6 +49,26 @@ {} virtual ~sc_fifo_in() {} +// Deprecated binding constructors. +explicit sc_fifo_in(const sc_fifo_in_if ) : +sc_port, 0>(interface) +{} +sc_fifo_in(const char *name, const sc_fifo_in_if ) : +sc_port, 0>(name, interface) +{} +explicit sc_fifo_in(sc_port_b > ) : +sc_port, 0>(parent) +{} +sc_fifo_in(const char *name, sc_port_b > ) : +sc_port, 0>(name, parent) +{} +explicit sc_fifo_in(sc_port, 0> ) : +sc_port, 0>(parent) +{} +sc_fifo_in(const char *name, sc_port, 0> ) : +sc_port, 0>(name, parent) +{} + void read(T &) { diff --git a/src/systemc/ext/channel/sc_fifo_out.hh b/src/systemc/ext/channel/sc_fifo_out.hh index 4beb15d..af2f6ef 100644 --- a/src/systemc/ext/channel/sc_fifo_out.hh +++ b/src/systemc/ext/channel/sc_fifo_out.hh @@ -50,6 +50,26 @@ {} virtual ~sc_fifo_out() {} +// Deprecated binding constructors. +explicit sc_fifo_out(const sc_fifo_out_if ) : +sc_port, 0>(interface) +{} +sc_fifo_out(const char *name, const sc_fifo_out_if ) : +sc_port, 0>(name, interface) +{} +explicit sc_fifo_out(sc_port_b > ) : +sc_port, 0>(parent) +{} +sc_fifo_out(const char *name, sc_port_b > ) : +sc_port, 0>(name, parent) +{} +explicit sc_fifo_out(sc_port, 0> ) : +sc_port, 0>(parent) +{} +sc_fifo_out(const char *name, sc_port, 0> ) : +sc_port, 0>(name, parent) +{} + void write(const T &) { diff --git a/src/systemc/ext/channel/sc_in.hh b/src/systemc/ext/channel/sc_in.hh index a283d0d..f691afe 100644 --- a/src/systemc/ext/channel/sc_in.hh +++ b/src/systemc/ext/channel/sc_in.hh @@ -52,6 +52,26 @@ explicit sc_in(const char *name) : sc_port, 1>(name) {} virtual ~sc_in() {} +// Deprecated binding constructors. +explicit sc_in(const sc_signal_in_if ) : +sc_port, 1>(interface) +{} +sc_in(const char *name, const sc_signal_in_if ) : +sc_port, 1>(name, interface) +{} +explicit sc_in(sc_port_b > ) : +sc_port, 1>(parent) +{} +sc_in(const char *name, sc_port_b > ) : +sc_port, 1>(name, parent) +{} +explicit sc_in(sc_port, 1> ) : +sc_port, 1>(parent) +{} +sc_in(const char *name, sc_port, 1> ) : +sc_port, 1>(name, parent) +{} + virtual void bind(const sc_signal_in_if &) { @@ -152,6 +172,26 @@ sc_port, 1>(name) {} virtual ~sc_in() {} +// Deprecated binding constructors. +explicit sc_in(const sc_signal_in_if ) : +sc_port, 1>(interface) +{} +sc_in(const char *name, const sc_signal_in_if ) : +sc_port, 1>(name, interface) +{} +explicit sc_in(sc_port_b > ) : +sc_port, 1>(parent) +{} +sc_in(const char *name, sc_port_b > ) : +sc_port, 1>(name, parent) +{} +explicit sc_in(sc_port, 1> ) : +sc_port, 1>(parent) +{} +sc_in(const char *name, sc_port, 1> ) : +sc_port, 1>(name, parent) +{} + virtual void bind(const sc_signal_in_if &) { @@ -292,6 +332,29 @@ {} virtual ~sc_in() {} +// Deprecated binding constructors. +explicit sc_in(const sc_signal_in_if ) : +sc_port, 1>(interface) +{} +sc_in(const char *name, +const sc_signal_in_if ) : +sc_port, 1>(name, interface) +{} +explicit sc_in(sc_port_b > ) : +sc_port, 1>(parent) +{} +sc_in(const char *name, +sc_port_b > ) : +sc_port, 1>(name, parent) +{} +explicit sc_in(sc_port, 1> ) : +sc_port, 1>(parent) +{} +sc_in(const char *name, +sc_port, 1> ) : +sc_port, 1>(name, parent) +{} + virtual void bind(const sc_signal_in_if &)
[gem5-dev] Change in gem5/gem5[master]: systemc: Add a non-standard default writer policy on sc_buffer.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/10957 ) Change subject: systemc: Add a non-standard default writer policy on sc_buffer. .. systemc: Add a non-standard default writer policy on sc_buffer. The standard says there's not supposed to be a default writer policy for the sc_buffer template class, but in the Accellera implementation there is, and the regression tests depend on it to compile. Change-Id: I31d17617441224e86c56c54e45364be8f4f45b00 Reviewed-on: https://gem5-review.googlesource.com/10957 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/ext/channel/sc_buffer.hh 1 file changed, 3 insertions(+), 1 deletion(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/ext/channel/sc_buffer.hh b/src/systemc/ext/channel/sc_buffer.hh index 153b60b..2208160 100644 --- a/src/systemc/ext/channel/sc_buffer.hh +++ b/src/systemc/ext/channel/sc_buffer.hh @@ -37,7 +37,9 @@ namespace sc_core { -template +// Having a default value for the WRITER_POLICY parameter is non-standard, but +// matches the Accellera implementation to enable the regression tests. +template class sc_buffer : public sc_signal { public: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/10957 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: I31d17617441224e86c56c54e45364be8f4f45b00 Gerrit-Change-Number: 10957 Gerrit-PatchSet: 7 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, scons: Add a mechanism to hook in the systemc tests.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/10956 ) Change subject: systemc, scons: Add a mechanism to hook in the systemc tests. .. systemc, scons: Add a mechanism to hook in the systemc tests. This mechanism scans the systemc test directories as described in their original distribution. It tells scons how to build each test executable, and also how to build a json manifest file which lists all the tests and some properties about them. Change-Id: I8ebc748c1aed71f0bb76e04a2040f15abd2837d9 Reviewed-on: https://gem5-review.googlesource.com/10956 Reviewed-by: Gabe Black Maintainer: Gabe Black --- A src/systemc/tests/SConscript 1 file changed, 154 insertions(+), 0 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/tests/SConscript b/src/systemc/tests/SConscript new file mode 100644 index 000..cc7c476 --- /dev/null +++ b/src/systemc/tests/SConscript @@ -0,0 +1,154 @@ +# Copyright 2018 Google, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Authors: Gabe Black + +from __future__ import print_function + +Import('*') + +if env['USE_SYSTEMC']: + +from gem5_scons import Transform + +import os.path +import json + +src = str(Dir('.').srcdir) + +class SystemCTest(object): +def __init__(self, dirname, name): +self.name = name +self.reldir = os.path.relpath(dirname, src) +self.target = os.path.join(self.reldir, name) +self.sources = [] + +self.compile_only = False + +def add_source(self, source): +self.sources.append(os.path.join(self.reldir, source)) + +def add_sources(self, sources): +for source in sources: +self.sources.append(os.path.join(self.reldir, '..', source)) + +def properties(self): +return { +'name' : self.name, +'path' : self.reldir, +'compile_only' : self.compile_only +} + +ext_dir = Dir('..').Dir('ext') +class SystemCTestBin(UnitTest): +def __init__(self, test): +super(SystemCTestBin, self).__init__( +test.target, *test.sources, main=True) + +@classmethod +def declare_all(cls, env): +env = env.Clone() + +# Turn off extra warnings and Werror for the tests. +to_remove = ['-Wall', '-Wundef', '-Wextra', '-Werror'] +env['CCFLAGS'] = \ +filter(lambda f: f not in to_remove, env['CCFLAGS']) + +env.Append(CPPPATH=ext_dir) + +super(SystemCTestBin, cls).declare_all(env) + +tests = [] +def new_test(dirname, name): +test = SystemCTest(dirname, name) +tests.append(test) +return test + + +def scan_dir_for_tests(subdir): +def visitor(arg, dirname, names): +# If there's a 'DONTRUN' file in this directory, skip it and any +# child directories. +if 'DONTRUN' in names: +del names[:] +return + +endswith = lambda sfx: filter(lambda n: n.endswith(sfx), names) + +cpps = endswith('.cpp') +if not cpps: +return + +# If there's only one source file, then that files name is the test +# name, and it's the source for that test. +
[gem5-dev] Change in gem5/gem5[master]: systemc: Add the deprecated sc_signal_out_if typedef.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/10955 ) Change subject: systemc: Add the deprecated sc_signal_out_if typedef. .. systemc: Add the deprecated sc_signal_out_if typedef. This is needed by the regression tests. Change-Id: I5666cf9ad445869e74edda857afd59ab7ece4f4c Reviewed-on: https://gem5-review.googlesource.com/10955 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/ext/channel/_using.hh M src/systemc/ext/channel/sc_signal_inout_if.hh 2 files changed, 5 insertions(+), 0 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/ext/channel/_using.hh b/src/systemc/ext/channel/_using.hh index 58269d5..089991f 100644 --- a/src/systemc/ext/channel/_using.hh +++ b/src/systemc/ext/channel/_using.hh @@ -87,6 +87,7 @@ using sc_core::SC_MANY_WRITERS; using sc_core::sc_signal_write_if; using sc_core::sc_signal_inout_if; +using sc_core::sc_signal_out_if; using sc_core::sc_signal_resolved; diff --git a/src/systemc/ext/channel/sc_signal_inout_if.hh b/src/systemc/ext/channel/sc_signal_inout_if.hh index c39c4a5..b272162 100644 --- a/src/systemc/ext/channel/sc_signal_inout_if.hh +++ b/src/systemc/ext/channel/sc_signal_inout_if.hh @@ -85,6 +85,10 @@ } }; +// Deprecated. +template +using sc_signal_out_if = sc_signal_inout_if; + } // namespace sc_core #endif //__SYSTEMC_EXT_CHANNEL_SC_SIGNAL_INOUT_IF_HH__ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/10955 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: I5666cf9ad445869e74edda857afd59ab7ece4f4c Gerrit-Change-Number: 10955 Gerrit-PatchSet: 7 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: Add the deprecated sc_module::end_module function.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/10854 ) Change subject: systemc: Add the deprecated sc_module::end_module function. .. systemc: Add the deprecated sc_module::end_module function. The regression tests use this function. In the Accellera implementation it seems to just do some error checking, so our version doesn't do anything for now. Change-Id: Icaad45e934bad69e301bc0234f73e69791940736 Reviewed-on: https://gem5-review.googlesource.com/10854 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/ext/core/sc_module.hh 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/ext/core/sc_module.hh b/src/systemc/ext/core/sc_module.hh index 4c4ebb2..0600aa6 100644 --- a/src/systemc/ext/core/sc_module.hh +++ b/src/systemc/ext/core/sc_module.hh @@ -141,6 +141,9 @@ sc_module(const sc_module_name &); sc_module(); +/* Deprecated, but used in the regression tests. */ +void end_module() {} + void reset_signal_is(const sc_in &, bool); void reset_signal_is(const sc_inout &, bool); void reset_signal_is(const sc_out &, bool); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/10854 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: Icaad45e934bad69e301bc0234f73e69791940736 Gerrit-Change-Number: 10854 Gerrit-PatchSet: 9 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: Construct and manage a module name stack.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/10850 ) Change subject: systemc: Construct and manage a module name stack. .. systemc: Construct and manage a module name stack. Change-Id: I5f7f64d6c3d7e08ec6d2529f3c5d84fbfc2c421b Reviewed-on: https://gem5-review.googlesource.com/10850 Reviewed-by: Gabe Black Maintainer: Gabe Black --- M src/systemc/core/SConscript A src/systemc/core/module.cc A src/systemc/core/module.hh M src/systemc/core/sc_module_name.cc M src/systemc/ext/core/sc_module_name.hh 5 files changed, 145 insertions(+), 4 deletions(-) Approvals: Gabe Black: Looks good to me, approved; Looks good to me, approved diff --git a/src/systemc/core/SConscript b/src/systemc/core/SConscript index e12ed59..8bff1b3 100644 --- a/src/systemc/core/SConscript +++ b/src/systemc/core/SConscript @@ -31,6 +31,7 @@ SimObject('SystemC.py') Source('kernel.cc') +Source('module.cc') Source('sc_attr.cc') Source('sc_event.cc') diff --git a/src/systemc/core/module.cc b/src/systemc/core/module.cc new file mode 100644 index 000..97a4a9f --- /dev/null +++ b/src/systemc/core/module.cc @@ -0,0 +1,70 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#include "systemc/core/module.hh" + +#include + +#include "base/logging.hh" + +namespace SystemC +{ + +namespace +{ + +std::list _modules; + +Module *_top_module = nullptr; + +} // anonymous namespace + +void +Module::push() +{ +if (!_top_module) +_top_module = this; +_modules.push_back(this); +} + +void +Module::pop() +{ +panic_if(_modules.size(), "Popping from empty module list.\n"); +panic_if(_modules.back() != this, +"Popping module which isn't at the end of the module list.\n"); +} + +Module * +topModule() +{ +return _top_module; +} + +} // namespace SystemC diff --git a/src/systemc/core/module.hh b/src/systemc/core/module.hh new file mode 100644 index 000..56e125e --- /dev/null +++ b/src/systemc/core/module.hh @@ -0,0 +1,61 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER
[gem5-dev] Change in gem5/gem5[master]: systemc: Make sc_main run in its own fiber.
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: Implement some simple accessor functions in sc_main.cc.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/10847 ) Change subject: systemc: Implement some simple accessor functions in sc_main.cc. .. systemc: Implement some simple accessor functions in sc_main.cc. These functions just read or write values with minimal amounts of logic. Change-Id: I22d5b49a2550a88a854d1619f08b0055c1312271 Reviewed-on: https://gem5-review.googlesource.com/10847 Reviewed-by: Jason Lowe-Power Maintainer: Gabe Black --- M src/systemc/core/sc_main.cc 1 file changed, 18 insertions(+), 11 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved Gabe Black: Looks good to me, approved diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc index 3c4fdbb..a7a77a4 100644 --- a/src/systemc/core/sc_main.cc +++ b/src/systemc/core/sc_main.cc @@ -33,6 +33,7 @@ #include "python/pybind11/pybind.hh" #include "sim/init.hh" #include "systemc/ext/core/sc_main.hh" +#include "systemc/ext/utils/sc_report_handler.hh" // A default version of this function in case one isn't otherwise defined. // This ensures everything will link properly whether or not the user defined @@ -107,6 +108,11 @@ } EmbeddedPyBind embed_("systemc", _pybind); +sc_stop_mode _stop_mode = SC_STOP_FINISH_DELTA; +sc_status _status = SC_ELABORATION; + +uint64_t _deltaCycles = 0; + } // anonymous namespace int @@ -142,14 +148,18 @@ void sc_set_stop_mode(sc_stop_mode mode) { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); +if (sc_is_running()) { +SC_REPORT_ERROR("attempt to set sc_stop mode " +"after start will be ignored", ""); +return; +} +_stop_mode = mode; } sc_stop_mode sc_get_stop_mode() { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return SC_STOP_FINISH_DELTA; +return _stop_mode; } void @@ -168,15 +178,13 @@ sc_dt::uint64 sc_delta_count() { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return 0; +return _deltaCycles; } bool sc_is_running() { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return false; +return _status & (SC_RUNNING | SC_PAUSED); } bool @@ -196,8 +204,8 @@ bool sc_pending_activity() { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return false; +return sc_pending_activity_at_current_time() || + sc_pending_activity_at_future_time(); } sc_time @@ -210,8 +218,7 @@ sc_status sc_get_status() { -warn("%s not implemented.\n", __PRETTY_FUNCTION__); -return SC_ELABORATION; +return _status; } } // namespace sc_core -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/10847 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: I22d5b49a2550a88a854d1619f08b0055c1312271 Gerrit-Change-Number: 10847 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: Add some missing functions which interact with the scheduler.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/10846 ) Change subject: systemc: Add some missing functions which interact with the scheduler. .. systemc: Add some missing functions which interact with the scheduler. Change-Id: Ifc8c8d4a7bb6e941485e80f4884cfa4bb648c17c Reviewed-on: https://gem5-review.googlesource.com/10846 Reviewed-by: Jason Lowe-Power Maintainer: Gabe Black --- M src/systemc/core/sc_main.cc M src/systemc/ext/core/_using.hh M src/systemc/ext/core/sc_main.hh 3 files changed, 179 insertions(+), 0 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved Gabe Black: Looks good to me, approved diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc index 5a6108a..3c4fdbb 100644 --- a/src/systemc/core/sc_main.cc +++ b/src/systemc/core/sc_main.cc @@ -121,4 +121,97 @@ return _argv; } +void +sc_start() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_pause() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_start(const sc_time , sc_starvation_policy p) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_set_stop_mode(sc_stop_mode mode) +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_stop_mode +sc_get_stop_mode() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +return SC_STOP_FINISH_DELTA; +} + +void +sc_stop() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const sc_time & +sc_time_stamp() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +return *(sc_time *)nullptr; +} + +sc_dt::uint64 +sc_delta_count() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +return 0; +} + +bool +sc_is_running() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +return false; +} + +bool +sc_pending_activity_at_current_time() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +return false; +} + +bool +sc_pending_activity_at_future_time() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +return false; +} + +bool +sc_pending_activity() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +return false; +} + +sc_time +sc_time_to_pending_activity() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +return sc_time(); +} + +sc_status +sc_get_status() +{ +warn("%s not implemented.\n", __PRETTY_FUNCTION__); +return SC_ELABORATION; +} + } // namespace sc_core diff --git a/src/systemc/ext/core/_using.hh b/src/systemc/ext/core/_using.hh index 3f8bfec..5f5a23a 100644 --- a/src/systemc/ext/core/_using.hh +++ b/src/systemc/ext/core/_using.hh @@ -53,6 +53,34 @@ using sc_core::sc_argc; using sc_core::sc_argv; +using sc_core::sc_starvation_policy; +using sc_core::SC_RUN_TO_TIME; +using sc_core::SC_EXIT_ON_STARVATION; +using sc_core::sc_start; +using sc_core::sc_pause; +using sc_core::sc_set_stop_mode; +using sc_core::sc_get_stop_mode; +using sc_core::sc_stop_mode; +using sc_core::SC_STOP_FINISH_DELTA; +using sc_core::SC_STOP_IMMEDIATE; +using sc_core::sc_stop; +using sc_core::sc_time_stamp; +using sc_core::sc_delta_count; +using sc_core::sc_is_running; +using sc_core::sc_pending_activity_at_current_time; +using sc_core::sc_pending_activity_at_future_time; +using sc_core::sc_pending_activity; +using sc_core::sc_time_to_pending_activity; +using sc_core::sc_get_status; +using sc_core::SC_ELABORATION; +using sc_core::SC_BEFORE_END_OF_ELABORATION; +using sc_core::SC_END_OF_ELABORATION; +using sc_core::SC_START_OF_SIMULATION; +using sc_core::SC_RUNNING; +using sc_core::SC_PAUSED; +using sc_core::SC_STOPPED; +using sc_core::SC_END_OF_SIMULATION; +using sc_core::sc_status; using sc_core::sc_bind_proxy; using sc_core::SC_BIND_PROXY_NIL; @@ -100,6 +128,12 @@ using sc_core::sc_spawn; using sc_core::sc_time_unit; +using sc_core::SC_FS; +using sc_core::SC_PS; +using sc_core::SC_NS; +using sc_core::SC_US; +using sc_core::SC_MS; +using sc_core::SC_SEC; using sc_core::sc_time; using sc_core::SC_ZERO_TIME; using sc_core::sc_set_time_resolution; diff --git a/src/systemc/ext/core/sc_main.hh b/src/systemc/ext/core/sc_main.hh index 9bf0d0a..24e9350 100644 --- a/src/systemc/ext/core/sc_main.hh +++ b/src/systemc/ext/core/sc_main.hh @@ -30,6 +30,9 @@ #ifndef __SYSTEMC_EXT_CORE_SC_MAIN_HH__ #define __SYSTEMC_EXT_CORE_SC_MAIN_HH__ +#include "../dt/int/sc_nbdefs.hh" +#include "sc_time.hh" + extern "C" int sc_main(int argc, char *argv[]); namespace sc_core @@ -39,6 +42,55 @@ // The standard version of this function doesn't have these "const" // qualifiers, but the canonical SystemC implementation does. extern "C" const char *const *sc_argv(); + +enum sc_starvation_policy +{ +SC_RUN_TO_TIME, +SC_EXIT_ON_STARVATION +}; + +void sc_start(); +void sc_start(const sc_time &,
Re: [gem5-dev] Gem5 Compile issue : Commit : e02ec0c24d56bce4a0d8636a340e15cd223d1930
I wonder if you're building on a 32 bit machine? It could be that somebody made an assumption about how big certain types are, and some function definitions which normally turn out to be the same thing are different if certain types are no longer equivalent. That would be my gut reaction to the second problem. Maybe add "override" in places where a virtual function is being overridden in the GPU code related to the error? I bet the compiler complains about at least one of them. Gabe On Tue, Aug 14, 2018 at 5:46 AM Sampad Mohapatra wrote: > I have tried building with both gcc 7.1 and gcc 5.4 and get the same set of > errors. > I am also using scons v3.1, Python 2.7.13, swig 3.0.12. All of these were > built from source. > > I use a cluster running Red Hat 4.4.7-18 (Linux version > 2.6.32-696.6.3.el6.x86_64). > > Thanks > Sampad > > > > On Tue, Aug 14, 2018 at 5:46 AM Ciro Santilli > wrote: > > > What is your compiler version? > > > > On Tue, Aug 14, 2018 at 12:53 AM, Sampad Mohapatra > wrote: > > > > > Hi All, > > > > > > I am facing compile issues while trying to compile > > > commit e02ec0c24d56bce4a0d8636a340e15cd223d1930 . > > > There are two types of errors in the Gem5 source: > > > > > > (1) *no matching function for call to : find(uint64_t&)* > > > > > > build/HSAIL_X86/gpu-compute/hsail_code.cc: In member function > > > 'StorageElement* StorageSpace::findSymbol(uint64_t)': > > > build/HSAIL_X86/gpu-compute/hsail_code.cc:336:41: error: no matching > > > function for call to 'AddrRangeMap::find(uint64_t&)' > > > auto se = elements_by_addr.find(addr); > > > ^ > > > In file included from build/HSAIL_X86/gpu-compute/hsail_code.hh:47:0, > > > from build/HSAIL_X86/gpu-compute/hsail_code.cc:36: > > > build/HSAIL_X86/base/addr_range_map.hh:225:5: note: candidate: > > > AddrRangeMap::const_iterator AddrRangeMap > > max_cache_size>::find(const AddrRange&, std::function) > > > const [with V = StorageElement*; int max_cache_size = 0; > AddrRangeMap > > max_cache_size>::const_iterator = > > > std::_Rb_tree_const_iterator StorageElement*> > > > >] > > > find(const AddrRange , std::function > cond) > > > const > > > ^ > > > build/HSAIL_X86/base/addr_range_map.hh:225:5: note: candidate > expects 2 > > > arguments, 1 provided > > > > > > > > > (2) *Multiple issues due to object creation from virtual classes. For > > > example:* > > > > > > In file included from > > build/HSAIL_X86/gpu-compute/gpu_static_inst.hh:53:0, > > > from > > > build/HSAIL_X86/arch/hsail/insts/gpu_static_inst.hh:46, > > > from build/HSAIL_X86/arch/hsail/insts/branch.hh:39, > > > from build/HSAIL_X86/arch/hsail/gpu_decoder.cc:2: > > > build/HSAIL_X86/gpu-compute/gpu_dyn_inst.hh: In instantiation of > > > 'AtomicOpFunctor* GPUDynInst::makeAtomicOpFunctor(c0*, c0*) [with c0 = > > > long > > > unsigned int]': > > > build/HSAIL_X86/arch/hsail/insts/mem.hh:1625:54: required from 'void > > > HsailISA::AtomicInst > > HasDst>::execAtomic(GPUDynInstPtr) [with MemDataType = > > > HsailISA::HsailDataType > > RegOrImmOperand >, long unsigned int, > > > (Enums::MemType)3u, (vgpr_type)1u, 1>; AddrOperandType = > > > RegAddrOperand; int NumSrcOperands = 1; bool HasDst = > true; > > > GPUDynInstPtr = std::shared_ptr]' > > > build/HSAIL_X86/arch/hsail/gpu_decoder.cc:887:1: required from here > > > build/HSAIL_X86/gpu-compute/gpu_dyn_inst.hh:358:45: error: invalid > > > new-expression of abstract class type 'AtomicOpAnd' > > > return new AtomicOpAnd(*reg0); > > > ^ > > > build/HSAIL_X86/gpu-compute/gpu_dyn_inst.hh:50:7: note: because the > > > following virtual functions are pure within 'AtomicOpAnd > > int>': > > > class AtomicOpAnd : public TypedAtomicOpFunctor > > > > > > > > > Any help or pointers is highly appreciated. > > > > > > > > > Thanks and Regards, > > > Sampad Mohapatra > > > ___ > > > gem5-dev mailing list > > > gem5-dev@gem5.org > > > > > > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fm5sim.org%2Fmailman%2Flistinfo%2Fgem5-devdata=02%7C01%7Csum94%40psu.edu%7Ce8c4c86e86d04874552408d601cad230%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C636698367962416116sdata=%2BMpSxLHBDda0f6iz2TBrGAmeaUwHLzAaMooGIB2kxMU%3Dreserved=0 > > ___ > > gem5-dev mailing list > > gem5-dev@gem5.org > > > > > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fm5sim.org%2Fmailman%2Flistinfo%2Fgem5-devdata=02%7C01%7Csum94%40psu.edu%7Ce8c4c86e86d04874552408d601cad230%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C636698367962416116sdata=%2BMpSxLHBDda0f6iz2TBrGAmeaUwHLzAaMooGIB2kxMU%3Dreserved=0 > ___ > gem5-dev mailing list > gem5-dev@gem5.org > http://m5sim.org/mailman/listinfo/gem5-dev
Re: [gem5-dev] Gem5 Compile issue : Commit : e02ec0c24d56bce4a0d8636a340e15cd223d1930
I have tried building with both gcc 7.1 and gcc 5.4 and get the same set of errors. I am also using scons v3.1, Python 2.7.13, swig 3.0.12. All of these were built from source. I use a cluster running Red Hat 4.4.7-18 (Linux version 2.6.32-696.6.3.el6.x86_64). Thanks Sampad On Tue, Aug 14, 2018 at 5:46 AM Ciro Santilli wrote: > What is your compiler version? > > On Tue, Aug 14, 2018 at 12:53 AM, Sampad Mohapatra wrote: > > > Hi All, > > > > I am facing compile issues while trying to compile > > commit e02ec0c24d56bce4a0d8636a340e15cd223d1930 . > > There are two types of errors in the Gem5 source: > > > > (1) *no matching function for call to : find(uint64_t&)* > > > > build/HSAIL_X86/gpu-compute/hsail_code.cc: In member function > > 'StorageElement* StorageSpace::findSymbol(uint64_t)': > > build/HSAIL_X86/gpu-compute/hsail_code.cc:336:41: error: no matching > > function for call to 'AddrRangeMap::find(uint64_t&)' > > auto se = elements_by_addr.find(addr); > > ^ > > In file included from build/HSAIL_X86/gpu-compute/hsail_code.hh:47:0, > > from build/HSAIL_X86/gpu-compute/hsail_code.cc:36: > > build/HSAIL_X86/base/addr_range_map.hh:225:5: note: candidate: > > AddrRangeMap::const_iterator AddrRangeMap > max_cache_size>::find(const AddrRange&, std::function) > > const [with V = StorageElement*; int max_cache_size = 0; AddrRangeMap > max_cache_size>::const_iterator = > > std::_Rb_tree_const_iterator > > >] > > find(const AddrRange , std::function cond) > > const > > ^ > > build/HSAIL_X86/base/addr_range_map.hh:225:5: note: candidate expects 2 > > arguments, 1 provided > > > > > > (2) *Multiple issues due to object creation from virtual classes. For > > example:* > > > > In file included from > build/HSAIL_X86/gpu-compute/gpu_static_inst.hh:53:0, > > from > > build/HSAIL_X86/arch/hsail/insts/gpu_static_inst.hh:46, > > from build/HSAIL_X86/arch/hsail/insts/branch.hh:39, > > from build/HSAIL_X86/arch/hsail/gpu_decoder.cc:2: > > build/HSAIL_X86/gpu-compute/gpu_dyn_inst.hh: In instantiation of > > 'AtomicOpFunctor* GPUDynInst::makeAtomicOpFunctor(c0*, c0*) [with c0 = > > long > > unsigned int]': > > build/HSAIL_X86/arch/hsail/insts/mem.hh:1625:54: required from 'void > > HsailISA::AtomicInst > HasDst>::execAtomic(GPUDynInstPtr) [with MemDataType = > > HsailISA::HsailDataType > RegOrImmOperand >, long unsigned int, > > (Enums::MemType)3u, (vgpr_type)1u, 1>; AddrOperandType = > > RegAddrOperand; int NumSrcOperands = 1; bool HasDst = true; > > GPUDynInstPtr = std::shared_ptr]' > > build/HSAIL_X86/arch/hsail/gpu_decoder.cc:887:1: required from here > > build/HSAIL_X86/gpu-compute/gpu_dyn_inst.hh:358:45: error: invalid > > new-expression of abstract class type 'AtomicOpAnd' > > return new AtomicOpAnd(*reg0); > > ^ > > build/HSAIL_X86/gpu-compute/gpu_dyn_inst.hh:50:7: note: because the > > following virtual functions are pure within 'AtomicOpAnd > int>': > > class AtomicOpAnd : public TypedAtomicOpFunctor > > > > > > Any help or pointers is highly appreciated. > > > > > > Thanks and Regards, > > Sampad Mohapatra > > ___ > > gem5-dev mailing list > > gem5-dev@gem5.org > > > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fm5sim.org%2Fmailman%2Flistinfo%2Fgem5-devdata=02%7C01%7Csum94%40psu.edu%7Ce8c4c86e86d04874552408d601cad230%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C636698367962416116sdata=%2BMpSxLHBDda0f6iz2TBrGAmeaUwHLzAaMooGIB2kxMU%3Dreserved=0 > ___ > gem5-dev mailing list > gem5-dev@gem5.org > > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fm5sim.org%2Fmailman%2Flistinfo%2Fgem5-devdata=02%7C01%7Csum94%40psu.edu%7Ce8c4c86e86d04874552408d601cad230%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C636698367962416116sdata=%2BMpSxLHBDda0f6iz2TBrGAmeaUwHLzAaMooGIB2kxMU%3Dreserved=0 ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
Re: [gem5-dev] Gem5 Compile issue : Commit : e02ec0c24d56bce4a0d8636a340e15cd223d1930
What is your compiler version? On Tue, Aug 14, 2018 at 12:53 AM, Sampad Mohapatra wrote: > Hi All, > > I am facing compile issues while trying to compile > commit e02ec0c24d56bce4a0d8636a340e15cd223d1930 . > There are two types of errors in the Gem5 source: > > (1) *no matching function for call to : find(uint64_t&)* > > build/HSAIL_X86/gpu-compute/hsail_code.cc: In member function > 'StorageElement* StorageSpace::findSymbol(uint64_t)': > build/HSAIL_X86/gpu-compute/hsail_code.cc:336:41: error: no matching > function for call to 'AddrRangeMap::find(uint64_t&)' > auto se = elements_by_addr.find(addr); > ^ > In file included from build/HSAIL_X86/gpu-compute/hsail_code.hh:47:0, > from build/HSAIL_X86/gpu-compute/hsail_code.cc:36: > build/HSAIL_X86/base/addr_range_map.hh:225:5: note: candidate: > AddrRangeMap::const_iterator AddrRangeMap max_cache_size>::find(const AddrRange&, std::function) > const [with V = StorageElement*; int max_cache_size = 0; AddrRangeMap max_cache_size>::const_iterator = > std::_Rb_tree_const_iterator > >] > find(const AddrRange , std::function cond) > const > ^ > build/HSAIL_X86/base/addr_range_map.hh:225:5: note: candidate expects 2 > arguments, 1 provided > > > (2) *Multiple issues due to object creation from virtual classes. For > example:* > > In file included from build/HSAIL_X86/gpu-compute/gpu_static_inst.hh:53:0, > from > build/HSAIL_X86/arch/hsail/insts/gpu_static_inst.hh:46, > from build/HSAIL_X86/arch/hsail/insts/branch.hh:39, > from build/HSAIL_X86/arch/hsail/gpu_decoder.cc:2: > build/HSAIL_X86/gpu-compute/gpu_dyn_inst.hh: In instantiation of > 'AtomicOpFunctor* GPUDynInst::makeAtomicOpFunctor(c0*, c0*) [with c0 = > long > unsigned int]': > build/HSAIL_X86/arch/hsail/insts/mem.hh:1625:54: required from 'void > HsailISA::AtomicInst HasDst>::execAtomic(GPUDynInstPtr) [with MemDataType = > HsailISA::HsailDataType RegOrImmOperand >, long unsigned int, > (Enums::MemType)3u, (vgpr_type)1u, 1>; AddrOperandType = > RegAddrOperand; int NumSrcOperands = 1; bool HasDst = true; > GPUDynInstPtr = std::shared_ptr]' > build/HSAIL_X86/arch/hsail/gpu_decoder.cc:887:1: required from here > build/HSAIL_X86/gpu-compute/gpu_dyn_inst.hh:358:45: error: invalid > new-expression of abstract class type 'AtomicOpAnd' > return new AtomicOpAnd(*reg0); > ^ > build/HSAIL_X86/gpu-compute/gpu_dyn_inst.hh:50:7: note: because the > following virtual functions are pure within 'AtomicOpAnd int>': > class AtomicOpAnd : public TypedAtomicOpFunctor > > > Any help or pointers is highly appreciated. > > > Thanks and Regards, > Sampad Mohapatra > ___ > gem5-dev mailing list > gem5-dev@gem5.org > http://m5sim.org/mailman/listinfo/gem5-dev ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Cron /z/m5/regression/do-regression quick
* build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64c/minor-timing: FAILED! --- quick/se/02.insttest/riscv/linux-rv64c/simple-timing ---* build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64c/o3-timing: FAILED! gem5 exited with non-zero status: 1* build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64c/simple-timing: FAILED! * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64c/simple-atomic: FAILED! * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64c/simple-timing-ruby: FAILED!*** gem5: OK * build/RISCV/tests/opt/quick/se/02.insttest/riscv/linux-rv64f/o3-timing: FAILED! * build/ALPHA/tests/opt/quick/se/00.hello/alpha/linux/minor-timing: CHANGED! * build/ALPHA/tests/opt/quick/se/00.hello/alpha/linux/o3-timing: CHANGED! * build/ALPHA/tests/opt/quick/se/00.hello/alpha/linux/simple-timing: CHANGED! * build/ALPHA/tests/opt/quick/se/01.hello-2T-smt/alpha/linux/o3-timing-mt: CHANGED!*** diff[simout]: SKIPPED*** diff[config.ini]: SKIPPED * build/ALPHA/tests/opt/quick/se/00.hello/alpha/linux/simple-timing-ruby: CHANGED! * build/ALPHA/tests/opt/quick/se/03.learning-gem5/alpha/linux/learning-gem5-p1-simple: CHANGED! * build/ALPHA/tests/opt/quick/se/03.learning-gem5/alpha/linux/learning-gem5-p1-two-level: CHANGED! * build/ALPHA/tests/opt/quick/fs/10.linux-boot/alpha/linux/tsunami-simple-atomic: CHANGED! * build/ALPHA/tests/opt/quick/fs/10.linux-boot/alpha/linux/tsunami-simple-atomic-dual: CHANGED! * build/ALPHA/tests/opt/quick/fs/10.linux-boot/alpha/linux/tsunami-simple-timing: CHANGED! * build/ALPHA/tests/opt/quick/fs/10.linux-boot/alpha/linux/tsunami-simple-timing-dual: CHANGED! * build/MIPS/tests/opt/quick/se/00.hello/mips/linux/simple-timing: CHANGED! * build/MIPS/tests/opt/quick/se/00.hello/mips/linux/o3-timing: CHANGED!Maximum error magnitude: +140.540541% *** diff[simerr]: SKIPPEDStatistics mismatch* build/MIPS/tests/opt/quick/se/03.learning-gem5/mips/linux/learning-gem5-p1-simple: CHANGED! *** diff[config.ini]: SKIPPED* build/MIPS/tests/opt/quick/se/00.hello/mips/linux/simple-timing-ruby: CHANGED! * build/MIPS/tests/opt/quick/se/03.learning-gem5/mips/linux/learning-gem5-p1-two-level: CHANGED! * build/NULL/tests/opt/quick/se/80.dram-closepage/null/none/dram-lowp: CHANGED! * build/NULL/tests/opt/quick/se/60.rubytest/null/none/rubytest-ruby: CHANGED!*** diff[simerr]: SKIPPED * build/NULL/tests/opt/quick/se/70.tgen/null/none/tgen-dram-ctrl: CHANGED! * build/NULL/tests/opt/quick/se/70.tgen/null/none/tgen-simple-mem: CHANGED! * build/NULL_MOESI_hammer/tests/opt/quick/se/60.rubytest/null/none/rubytest-ruby-MOESI_hammer: CHANGED! * build/NULL_MESI_Two_Level/tests/opt/quick/se/60.rubytest/null/none/rubytest-ruby-MESI_Two_Level: CHANGED! * build/NULL_MOESI_CMP_directory/tests/opt/quick/se/60.rubytest/null/none/rubytest-ruby-MOESI_CMP_directory: CHANGED! * build/NULL_MOESI_CMP_token/tests/opt/quick/se/60.rubytest/null/none/rubytest-ruby-MOESI_CMP_token: CHANGED! * build/POWER/tests/opt/quick/se/00.hello/power/linux/o3-timing: CHANGED! *** stat_diff: FAILURE: Statistics mismatch* build/SPARC/tests/opt/quick/se/00.hello/sparc/linux/simple-timing-ruby: CHANGED! *** gem5: OK* build/SPARC/tests/opt/quick/se/02.insttest/sparc/linux/o3-timing: CHANGED! * build/SPARC/tests/opt/quick/se/00.hello/sparc/linux/simple-timing: CHANGED! * build/SPARC/tests/opt/quick/se/03.learning-gem5/sparc/linux/learning-gem5-p1-two-level: CHANGED! * build/SPARC/tests/opt/quick/se/40.m5threads-test-atomic/sparc/linux/o3-timing-mp: CHANGED! * build/SPARC/tests/opt/quick/se/40.m5threads-test-atomic/sparc/linux/simple-atomic-mp: CHANGED! * build/SPARC/tests/opt/quick/se/02.insttest/sparc/linux/simple-timing: CHANGED! * build/SPARC/tests/opt/quick/se/03.learning-gem5/sparc/linux/learning-gem5-p1-simple: CHANGED! * build/SPARC/tests/opt/quick/se/40.m5threads-test-atomic/sparc/linux/simple-timing-mp: CHANGED! * build/SPARC/tests/opt/quick/se/50.vortex/sparc/linux/simple-timing: CHANGED! * build/SPARC/tests/opt/quick/se/70.twolf/sparc/linux/simple-timing: CHANGED! *** diff[simout]: SKIPPED* build/X86/tests/opt/quick/se/00.hello/x86/linux/simple-atomic: CHANGED! * build/X86/tests/opt/quick/se/00.hello/x86/linux/o3-timing: CHANGED! * build/X86/tests/opt/quick/se/00.hello/x86/linux/simple-timing: CHANGED! * build/X86/tests/opt/quick/se/00.hello/x86/linux/simple-timing-ruby: CHANGED! * build/X86/tests/opt/quick/se/03.learning-gem5/x86/linux/learning-gem5-p1-simple: CHANGED!Statistics mismatch * build/X86/tests/opt/quick/se/03.learning-gem5/x86/linux/learning-gem5-p1-two-level: CHANGED! * build/X86/tests/opt/quick/se/10.mcf/x86/linux/simple-atomic: CHANGED! * build/X86/tests/opt/quick/se/70.twolf/x86/linux/simple-atomic: CHANGED! *