summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-09-26systemc: Make sc_process_b less hokey, and make WAIT* work.Gabe Black
This change puts sc_process_b into the inheritance hierarchy for the Process types. It also adds the nonstandard sc_set_location function and calls it from the nonstandard WAIT* macros. Change-Id: Ic997dcf74d262774dd7b53504146e372e03af2e0 Reviewed-on: https://gem5-review.googlesource.com/12259 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Handle null and omitted event names.Gabe Black
If the simulation isn't running, these should be replaced with versions generated by sc_gen_unique_name(). Change-Id: Idd515e73ba17d3dfa866ee5509369e9c4e3fb2f5 Reviewed-on: https://gem5-review.googlesource.com/12258 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Handle null sc_object names.Gabe Black
A null pointer for an sc_object name is supposed to be equivalent to an empty string. Change-Id: I6094577ad43f13d47a20bc67fa15f4c04d448fe5 Reviewed-on: https://gem5-review.googlesource.com/12257 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Check for time overflow in sc_start.Gabe Black
A regression tests checks this situation. Change-Id: I7716bf7c8cf219c372ab9722fc0ad52e7e674b17 Reviewed-on: https://gem5-review.googlesource.com/12256 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Handle sc_time_stamp before any sc_time is constructed.Gabe Black
The time resolution won't yet be fixed, so the scaling factor will still be set to zero. Change-Id: I1d1e58316ee05cc477a31ce90e2bbf56dcbc65c3 Reviewed-on: https://gem5-review.googlesource.com/12255 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Make the test config retrieve sc_main results.Gabe Black
Accellera's implementation prints any sc_report which is thrown and escapes sc_main, so we need to do the same to make some tests pass. Arguably gem5 should fail if sc_main reports an error, but verify.py would interpret that as the test failing too, and some tests purposefully generate errors. This change also stops using the logging module. It wasn't really providing any benefit, and added extra decoration to log messages which confused verify.py. Change-Id: I6850d0ada5e477b67527d99d421478586cda93b3 Reviewed-on: https://gem5-review.googlesource.com/12254 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Keep track of how sc_main completes and expose that to python.Gabe Black
That makes it possible for the config script to retrieve the result of running sc_main. sc_main (or at least the python front end for it) can't return results directly since it usually doesn't run to completion when it's first called. Change-Id: I9740e9688571e2ca824a684be70480f1eadddcdb Reviewed-on: https://gem5-review.googlesource.com/12253 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Make the report handler handle null messages.Gabe Black
It was checking the first character of the message for a null byte, but not whether the message string pointer itself was null. Change-Id: Iddef1e22c35b55c8c898670576ab416dd1023d7c Reviewed-on: https://gem5-review.googlesource.com/12252 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: If no sc_module_name was used, throw an error.Gabe Black
This is tested by the regression tests. Also make sure the handshake which sets up instances of sc_module is cleaned up if we bail partway through for some reason, for instance if an intermediate class throws an exception as part of its constructor. Change-Id: I89afe5f76832cc132aa2bb8f19916dea64546784 Reviewed-on: https://gem5-review.googlesource.com/12251 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: If an event is a delta notification, checked if it's timed.Gabe Black
If we're descheduling an event which is at the current time, it may have been scheduled as a delta notification, but it could have also been scheduled as a timed notification and we just got to that point in time. If an event is for the current time but isn't in the delta notifications, this change detects that and then treats it as a timed notification. Change-Id: I1d8f4c40325cc7f355b7f2e6f08611483ce11858 Reviewed-on: https://gem5-review.googlesource.com/12250 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: If sc_main returns, don't do any more systemc stuff.Gabe Black
When sc_main returns, clear out any pending work in the scheduler and also block the systemc kernel from doing actions which correspond with the start of simulation. It's most likely that work like oustanding timeouts might survive past the end of sc_main, especially if it never officially called sc_stop. It's also possible for sc_main to return and never actually call sc_start. In that case, the kernel should not call callbacks of the various objects (which may no longer even exist), or go through the initialization phase. If sc_main is never called at all, then the kernel's actions aren't gated. Change-Id: I49bf094be3283a92d846d2f3da224950bd893a5c Reviewed-on: https://gem5-review.googlesource.com/12249 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Clear out the scheduler more agressively and with common code.Gabe Black
It's be useful/necessary to flush pending activity even when not tearing down the scheduler, specifically when stopping. Change-Id: I6b3716a8ca1f8ca151222e08f30bd3c9a43364b9 Reviewed-on: https://gem5-review.googlesource.com/12248 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Override notifyWork for timeout/event_and_list sensitivities.Gabe Black
The notifyWork function for SensitivityEventAndList assumes it's being triggered by an event which is part of its list, but when SensitivityTimeoutAndEventAndList triggers it might be from an event or from a timeout. This change overrides notifyWork for that class and makes it delegate to notifyWork for the subclasses depending on whether there's an event pointer. Change-Id: I598af2b78d71ee9934edea10ca7ac5c88149e3f3 Reviewed-on: https://gem5-review.googlesource.com/12247 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Make sure no delta cycles are scheduled when stopping.Gabe Black
If the readyEvent is still scheduled when sc_main completes, gem5 will return to it's main fiber and keep executing events, including that one. That means a delta cycle will run even after sc_main is complete. This change ensures that the readyEvent has been descheduled as part of stopping. Change-Id: I9479ac4ebff3335477b371b02efa6d44c70cbc8e Reviewed-on: https://gem5-review.googlesource.com/12224 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Make sure an immediate notification overrides a delayed one.Gabe Black
If an event has a delayed notification pending, that should be cleared if it's later notified immediately. Change-Id: I4272f6b47a41d80756769f3fe69069a00016dbd6 Reviewed-on: https://gem5-review.googlesource.com/12223 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Improve scheduler cleanup.Gabe Black
Make the scheduler clear itself out when it's destructed to ensure that nobody will try to use it after it's gone away. Also make sure there are no pending events which might refer to it as well, either systemc events or gem5 events. Change-Id: I12dadc06bd9db7016a8dc0c1827b3e630b0d23d5 Reviewed-on: https://gem5-review.googlesource.com/12222 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Implement most of sc_inout.Gabe Black
Because sc_inout needs sc_dt::sc_logic and that probably calls functions from dt_sc_mempool.cc and because those hadn't yet been stubbed out. This change adds stubs for those as well. Change-Id: I544a1669575b594d4612558b8b6f47668ac94414 Reviewed-on: https://gem5-review.googlesource.com/12221 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Make sc_out delegate to its base class sc_inout.Gabe Black
The spec says these are essentially identical classes, they just have both so that users can show their intent. Change-Id: I51908edca89acea25891a52bfa7fca0681ccfc5c Reviewed-on: https://gem5-review.googlesource.com/12220 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Generalize gem5 style event scheduling.Gabe Black
These events are either scheduled directly, or if no event queue is yet available they're recorded in a map to schedule later. Since this was used in a few places (and should have been used for the ready event), this change moves it into some common functions which remove some duplication and abstract away this detail. Change-Id: I4320d7296f4f72344539b2b4b2564a6a27576dd8 Reviewed-on: https://gem5-review.googlesource.com/12219 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Make sure sc_start waits for simulation even when starving.Gabe Black
Even if the simulation would return from sc_start immediately because of starvation, this change ensures that sc_start gives control back to gem5 so that the scheduler will have a chance to set up sensitivities, etc., before things get torn down. Change-Id: I39b1fd704fcbe12c299cad9dbd30258e8fe9d032 Reviewed-on: https://gem5-review.googlesource.com/12218 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Rework the init phase for the new way delta notes are handled.Gabe Black
The initialization phase had been done in a somewhat adhoc way, partially because delta notifications were being handled as top level gem5 events which were ordered based on their priorities. This change makes the initialization phase happen more explicitly, and more in the order in the spec. Change-Id: I91d56b63fefcb81c845c52c97826a976a7559fad Reviewed-on: https://gem5-review.googlesource.com/12217 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Make a test use cout for all its messages.Gabe Black
This makes them end up in simout so verify.py can find them when it's checking output. Change-Id: I2b7b276b3e1816a257f58b0cfb13487d6296e6fd Reviewed-on: https://gem5-review.googlesource.com/12216 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Implement a significant portion of sc_clock.Gabe Black
Change-Id: Ic195f46ac13b46a02c86a5fc8d90ba66a415a9c8 Reviewed-on: https://gem5-review.googlesource.com/12215 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Don't run the ready event inline when unpausing.Gabe Black
Now that delta events are handled explicitly by the scheduler, there's no reason to run the readyEvent inline when returning from a pause. The delta events will necessarily be run after the evaluate and update phases. Change-Id: Iad6d431a87742354e3a46a0fb44c309aa785ea60 Reviewed-on: https://gem5-review.googlesource.com/12214 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-25systemc: Rework how delta and timed notifications/timeouts are tracked.Gabe Black
Rather than delegating them entirely to the gem5 event queue and using priorities to ensure the right thing happens, this change adds a few new structures which keep track of them and give the scheduler more control over what happens and in what order. The old scheme was mostly correct, but there were some competing situations which made it next to impossible to make everything happen at the right time. Change-Id: I43f4dd6ddfa488a31073c0318bb41369b1a6117d Reviewed-on: https://gem5-review.googlesource.com/12213 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-24mem-ruby: Fix a bug in MessageBuffer randomizationXianwei Zhang
In the previous implementation, messages are randomly inserted with delays only if both RubySystem and MessageBuffer randomization flags are set true. However, to find race conditions and cover more slicc transitions, ruby random testers rely on setting RubySystem flag to turn on randomization on all message buffers. As a fix, this patch enables a message buffer to have randomization when either RubySystem or its own flag is set. Change-Id: I1e076908ff07e5846ebad4f4fc1c8f28d40bbfd4 Reviewed-on: https://gem5-review.googlesource.com/12784 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2018-09-20systemc: When sc_start is told to run zero time, do one delta cycle.Gabe Black
This is a special case which is mentioned in the spec but hadn't yet been given any special handling in this implementation. Change-Id: I500d046f09d916a08e22821f8d3e2f490f8ba5bb Reviewed-on: https://gem5-review.googlesource.com/12212 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Don't run clocked thread processes during the init phase.Gabe Black
Change-Id: I170d67fef61dd5536a842a1f64682d90ae7a1507 Reviewed-on: https://gem5-review.googlesource.com/12211 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Track exports and prim channels, and call their callbacks.Gabe Black
Also call the callbacks on the ports which were already being tracked. Change-Id: I5ba8ea366e87fc48b58712f35b93c27bccf92cb3 Reviewed-on: https://gem5-review.googlesource.com/12210 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Fix the priority of the maximum time event.Gabe Black
Change-Id: I3e5e71165d06da77076f0e58012c575e24456182 Reviewed-on: https://gem5-review.googlesource.com/12209 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Implement a little more of sc_time.Gabe Black
This change implements a pair of constructors, and some conversion functions. Change-Id: Ibd0e9ec5bcc24f4a17896313996b3112b5ef1934 Reviewed-on: https://gem5-review.googlesource.com/12208 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Teach verify.py to ignore another deprecation warning.Gabe Black
Change-Id: I4c45431abebafd69f485f9d740da30f4b957f609 Reviewed-on: https://gem5-review.googlesource.com/12207 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Generalize ignoring info messages in the reference output.Gabe Black
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 Reviewed-on: https://gem5-review.googlesource.com/12086 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Implement the sc_in class.Gabe Black
Change-Id: I08174462cb650c7918a4e8f5284d4ee814cf595d Reviewed-on: https://gem5-review.googlesource.com/12085 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Implement port binding except positional binding.Gabe Black
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 Reviewed-on: https://gem5-review.googlesource.com/12084 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Make BindInfo track ports or interfaces.Gabe Black
Change-Id: I0ca0d5de8de59d92cb65af56c25f418ff32696f4 Reviewed-on: https://gem5-review.googlesource.com/12083 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Implement sc_event_finder.Gabe Black
Change-Id: I22aa0a34eabf13593986a92289155257fa26c7de Reviewed-on: https://gem5-review.googlesource.com/12082 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Exclude two more tests which have undefined functions.Gabe Black
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 Reviewed-on: https://gem5-review.googlesource.com/12081 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Ensure delta notifications happen at the right time after sc_pause.Gabe Black
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 Reviewed-on: https://gem5-review.googlesource.com/12080 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Implement sc_export.Gabe Black
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 Reviewed-on: https://gem5-review.googlesource.com/12079 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Don't schedule the update phase if the event queue is null.Gabe Black
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 Reviewed-on: https://gem5-review.googlesource.com/12078 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Use an std::list to track all modules.Gabe Black
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 Reviewed-on: https://gem5-review.googlesource.com/12077 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Track the module in the end_of_elaboration callback.Gabe Black
sc_objects constructed during that callback are considered children of the module the callback belongs to. Change-Id: I164863a10beef6d0e2c6d9c5e8f2642d80769dca Reviewed-on: https://gem5-review.googlesource.com/12076 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Partially implement the sc_signal class template.Gabe Black
There are a few details of this class that still need to be fleshed out, but this implements most of it. Change-Id: I6f8b546aacd8537d4341dc91e59b95864ae0f7c4 Reviewed-on: https://gem5-review.googlesource.com/12075 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Add a nonstandard sc_status pretty printer operator.Gabe Black
This operator exists in the Accellera implementation, and is necessary to make the test output match. Change-Id: I266629d6c936d4846e88e35af36555fb392b181c Reviewed-on: https://gem5-review.googlesource.com/12074 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Set the scheduler's event queue earlier.Gabe Black
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 Reviewed-on: https://gem5-review.googlesource.com/12073 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: "Implement" sc_interface's methods.Gabe Black
Most don't do anything. Make default_event() return a dummy event to avoid dereferencing a null pointer. Change-Id: I8d6d576d3a1f585029c387cd414bbebf2d670644 Reviewed-on: https://gem5-review.googlesource.com/12072 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Implement a few more member functions for sc_time.Gabe Black
Change-Id: I40a7fb278f2a0ec4124589e02e4441c1866c86ea Reviewed-on: https://gem5-review.googlesource.com/12071 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Use the new python interface to delay fixing the timescale.Gabe Black
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 Reviewed-on: https://gem5-review.googlesource.com/12070 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-09-20systemc: Generalize working with the systemc python module from C++.Gabe Black
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 Reviewed-on: https://gem5-review.googlesource.com/12069 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>