accellera-official / systemc

SystemC Reference Implementation
https://systemc.org/overview/systemc/
Apache License 2.0
476 stars 152 forks source link

Migrate global sc_event::none and sc_process_handle::non_event to internal fields in sc_simcontext #20

Closed AndrewGoodrich closed 3 years ago

AndrewGoodrich commented 3 years ago

This issue was originally one raised as a public pull request. However the proposed solution was accessing internal fields in sc_simcontext rather than using access methods. Basically the issue to specified in pull request 9 is:

Remove global sc_events (sc_event::none and sc_process_handle::non_event) by converting them to functions returning a reference to an sc_event in the current simulation context. This eases reset of the simulation context, as discussed in #8, as these sc_events no longer contain any reference to the initial simulation context.

The solution I propose is to move the sc_event locations to sc_simcontext using an internal method. const sc_event& non_event(); This leads to the following two static methods:

static const sc_event& sc_event::none() { return sc_get_curr_simcontext()->null_event(); }

static const sc_event& sc_process_handle::non_event() { return sc_get_curr_simcontext()->null_event(); }

The "null event" will be a field within sc_simcontext.