History log of /gem5/src/systemc/core/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
13901:b9329102b1d8 22-Apr-2019 Gabe Black <gabeblack@google.com>

systemc: Add a distinct async_request_update mechanism.

This mechanism had just been plumbed into the regular request_update,
but that doesn't have any thread safety which is the whole point of
async_request_update. This new mechanism puts async update requests
into their own list which is checked any time normal updates happen.

The delta cycle which triggers those updates must happen through some
other means which will usually be ok. The exact timing of the update
is undefined, so it would be legal for it to either not be recognized
before the impending end of the simulation, or for it to get picked up
by subsequent activity. If there isn't subsequent activity but the
simulation also doesn't end, for instance if there are only gem5 events
left, then that update could be lost. That is an unresolved issue.

It would be nice to schedule a "ready" event if async updates were
added which would ensure they wouldn't starve. Unfortunately that
requires the event queue lock, and in practice it's been found that a
systemc process might block, effectively holding the event queue lock,
while it waits for some asyncrhonous update to give it something to do.
This effectively deadlocks the system since the update is blocked on
the lock the main thread holds, and the main thread is blocked waiting
for the update.

Change-Id: I580303db01673faafc2e63545b6a69b3327a521c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18288
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>

13785:3280e13bf334 12-Mar-2019 Gabe Black <gabeblack@google.com>

systemc: Hook up gem5_getPort to the gem5 getPort mechanism.

Change-Id: I771607c4436f4c1ca9d355d1da52924308cfc3b3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17229
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

13729:8c67a3050a07 20-Feb-2019 Gabe Black <gabeblack@google.com>

systemc: Remove _m5.systemc passthroughs from SystemC_Kernel.

These functions are now exposed through m5.systemc and m5.tlm.

Change-Id: I9f519debbe7380ee38594badcc1146e66e15f8a8
Reviewed-on: https://gem5-review.googlesource.com/c/16570
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>

13723:c4e71f81c09b 15-Feb-2019 Gabe Black <gabeblack@google.com>

systemc: Export the tlm::tlm_global_quantum class to python.

This way the python code can set up the global quantum without having
an sc_main function to do it.

Change-Id: I96df4dea0f1bfe9e3e86d4784bbda8f5b6b74d0b
Reviewed-on: https://gem5-review.googlesource.com/c/16503
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>

13722:4f0de9b591df 15-Feb-2019 Gabe Black <gabeblack@google.com>

systemc: Export the sc_core::sc_time class to python.

This class isn't incredibly useful in python, but it's needed to call
some other functions which are more useful.

Change-Id: I5c23cca0b50f0455423399db8b009bdf86a6ec41
Reviewed-on: https://gem5-review.googlesource.com/c/16502
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

13703:bedf6da29c9b 14-Feb-2019 Gabe Black <gabeblack@google.com>

systemc: Make sc_(pause|stop) exit to python when not using sc_main.

In those cases, there's no sc_main to return control to. The python
config script is serving more or less the same purpose, so we can
return control to there instead.

Change-Id: I3cf0623ae51d989b883fb8556ebbf44651bbec99
Reviewed-on: https://gem5-review.googlesource.com/c/16445
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

13702:f2d184ad0886 14-Feb-2019 Gabe Black <gabeblack@google.com>

systemc: Init some values in the scheduler for running without sc_main.

When running without sc_main, sc_start won't be called, and therefore
runToTime and maxTick won't be initialized. To avoid the scheduler
getting confused and behaving erratically, those values should be
initialized to something that makes sense in situations where there's
no sc_main.

Change-Id: I6ddd7db9ecb36d716eb5ef75e1c38bb99a386092
Reviewed-on: https://gem5-review.googlesource.com/c/16443
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

13701:d84e5d2979a7 14-Feb-2019 Gabe Black <gabeblack@google.com>

systemc: Handle exceptions "correctly" even if sc_main hasn't been run.

If sc_main hasn't run, for instance if there isn't an sc_main and gem5
is orchestrating the simulation directly, then exceptions shouldn't be
thrown to the sc_main fiber since it isn't running and may not be able
to run since sc_main may not even exist.

Instead, we need to check whether it makes sense to throw to sc_main,
and if not pass the exception directly to the report handler since
there likely won't be anyone to catch it if we just throw it from the
scheduler or into general purpose gem5.

Since the name throwToScMain is no longer a complete description for
what that function does, this change renames it to throwUp, since it
will now throw exceptions up the stack, either to sc_main or to the
conceptual top level by going directly to the report handler.

Change-Id: Ibdc92c9cf213ec6aa15ad654862057b7bf2e1c8e
Reviewed-on: https://gem5-review.googlesource.com/c/16442
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

13518:6168e030b4c7 11-Dec-2018 Gabe Black <gabeblack@google.com>

systemc: Add an elaboration_done method to sc_simcontext.

The TLM headers rely on this non-standard function.

Change-Id: Iaedec35f1f363dcf3e1fcdb58a74eb2cdc05ddc0
Reviewed-on: https://gem5-review.googlesource.com/c/15061
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>

13489:8b0666946c20 05-Dec-2018 Gabe Black <gabeblack@google.com>

systemc: Ignore process control functions on terminated processes.

These functions can descend to the children of a terminated process,
but should have no effect on that process itself.

Change-Id: I6e4bdec8c492dd03d05bc1397aa080e8a51397c1
Reviewed-on: https://gem5-review.googlesource.com/c/14917
Reviewed-by: Matthias Jung <jungma@eit.uni-kl.de>
Maintainer: Gabe Black <gabeblack@google.com>

13488:2e12afaa6cc7 30-Nov-2018 Gabe Black <gabeblack@google.com>

systemc: Update signals before initing processes.

We were supposed to do one update phase before adding all processes
which didn't have dont_initialize() called to the run queue. We were
doing that in the opposite order.

Change-Id: I6dd4108040d455dc78029da029a2eb5e7af819cb
Reviewed-on: https://gem5-review.googlesource.com/c/14915
Reviewed-by: Matthias Jung <jungma@eit.uni-kl.de>
Maintainer: Gabe Black <gabeblack@google.com>

13436:e4498ecec979 16-Nov-2018 Gabe Black <gabeblack@google.com>

systemc: Increase the stack size for the sc_main fiber to 8MB.

This is a reasonable size for a stack, and the default size for a stack
on Linux as determined by some quick Googling. The sc_main fiber would
normally use the primary program stack if run under the standard
systemc implementation, and so might expect to have more room to play
with.

Change-Id: Ie12344939e7b249da203630ebc7dc773a387d716
Reviewed-on: https://gem5-review.googlesource.com/c/14396
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>

13411:bd873635bba6 09-Nov-2018 Giacomo Travaglini <giacomo.travaglini@arm.com>

systemc: Push python headers on top of sources

Some build failures has been seen after USE_SYSTEMC being True by
default and that has been caused by double definition of _XOPEN_SOURCE
and _POSIX_C_SOURCE in some python versions (like 2.7.5, 2.7.13) and
/usr/include/features.h (used by gcc)

Python definition should preceed features.h one, since the latter will
manually #undef them before #define them.

Change-Id: I774711aaf8145df9ad7677a393a60cf3662d6816
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/14095
Maintainer: Gabe Black <gabeblack@google.com>

13410:a03275d35b40 07-Nov-2018 Gabe Black <gabeblack@google.com>

systemc: Stop using python to set/manage the global time resolution.

Now that that's managed in c++, we can do that directly without having
to depend on the python code being available, the code which lets us
call from c++ to python, or for the embedded python interpretter to
have started running and have loaded the appropriate modules.

Change-Id: Ied110d8f22181095f8c0c645636a9bd67964263e
Reviewed-on: https://gem5-review.googlesource.com/c/14056
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>

13406:8458901278f3 08-Nov-2018 Gabe Black <gabeblack@google.com>

systemc: Add a missing "const" on one of the sc_event operators.

Change-Id: I073ccb0f2c6d1bfebadb95869d6acf7f4ce565af
Reviewed-on: https://gem5-review.googlesource.com/c/14135
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>

13405:7d430f2488e0 07-Nov-2018 Gabe Black <gabeblack@google.com>

systemc: Only build python utility code if python is enabled.

Change-Id: I58054ddd0d5ef0dbee18028c4218e7418347f959
Reviewed-on: https://gem5-review.googlesource.com/c/13979
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>

13404:5da37c38d749 07-Nov-2018 Gabe Black <gabeblack@google.com>

systemc: Separate and conditionalize exposing sc_main to python.

Change-Id: Ib39dd79c607b277ba94f90dee41c09c1b3b66481
Reviewed-on: https://gem5-review.googlesource.com/c/13978
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>

13403:cebee63981d3 07-Nov-2018 Gabe Black <gabeblack@google.com>

systemc: Seperate out the sc_main fiber and its bookkeeping.

By pulling out the sc_main fiber (scMainFiber), we can make it
available to different entities in the simulator and avoid having to
have parallel bookkeeping.

Also this will make it possible to hook into sc_main without putting
the code in sc_main.cc.

Change-Id: I7689441424238e9b2e4d2b48e945dea35fd8cc5d
Reviewed-on: https://gem5-review.googlesource.com/c/13977
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>

13382:7db1e345834c 02-Nov-2018 Gabe Black <gabeblack@google.com>

systemc: Change how SC_BIND_PROXY_NIL is initialized.

The previous implementation dereferenced a null pointer to create a
reference which would then have its address taken in the sc_bind_proxy
constructor. clang says that that uses undefined behavior, so this
change adds a default constructor which initializes the two contained
pointers to null explicitly.

We have to hope systemc code doesn't play around with sc_bind_proxy too
much and doesn't accidentally use this constructor unintentionally, but
it seems like the least bad possible solution which makes clang happy.

Change-Id: Ic59603495fe7a406586a18ce44de979f84089bcd
Reviewed-on: https://gem5-review.googlesource.com/c/13879
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13335:299a16ef8e3c 10-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Get rid of leftovers from unimplemented warnings past.

These warnings were removed when the functionality they warned about
was implemented, but there were some leftovers like unnecessary
includes and some helper functions which hid gem5 specific headers
from the ext directory.

Change-Id: Ic886ac0f1264687524e3a7b7eaab8836f318a5a2
Reviewed-on: https://gem5-review.googlesource.com/c/13398
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13334:b7b38ffa5863 10-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Implement Object::simcontext().

Implement it as a nonstandard alias for the also non-standard
sc_get_curr_simcontext.

Change-Id: Ic9a51efa93f687e4b57d622247a5510136fab221
Reviewed-on: https://gem5-review.googlesource.com/c/13397
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13332:03eec201e55a 10-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Warn about using deprecated sc_port constructors.

This gets rid of one of the last instances of a warning about
unimplemented functionality.

Change-Id: I3d8e50ea45554cba969118ce873ed3d2b041ec43
Reviewed-on: https://gem5-review.googlesource.com/c/13395
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13331:2e3f70431e60 10-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Add a python config class for sc_modules.

This class doesn't really add anything, but it provides a consistent
base class for sc_modules vs. generic sc_objects.

Change-Id: I3fbd4f6b5d1be0b5419f5cbd304aec61d404a341
Reviewed-on: https://gem5-review.googlesource.com/c/13355
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13329:a2d273c8e667 09-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Add an accessor for getting the current process.

This is to avoid having to expose the scheduler (which tracks the
current process) to header files which should be independent of gem5
and the underlying implementation.

Change-Id: I1b0810ab66c3ce52b5b94236d7df86da66a62472
Reviewed-on: https://gem5-review.googlesource.com/c/13335
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13328:d5f4e801436a 09-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Don't re-schedule a process which is already scheduled.

Change-Id: I8e12713c49aad03d0bfb779883adcbfa8fd4b42e
Reviewed-on: https://gem5-review.googlesource.com/c/13334
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13324:c8b709468e61 07-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Switch to using predefined messages for channels.

Create and use predefined messages for channels which match the ones
Accellera uses.

Change-Id: I179214838bbd83604e50225926cdc6b5b1b16923
Reviewed-on: https://gem5-review.googlesource.com/c/13330
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13323:1cfcaaf573b9 07-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Don't depend on the order of static initializers.

STL containers may need to be constructed before they're used. Don't
count on being able to insert into them during a static initializer.

Change-Id: Icb05d5084a470e1ebd976ae6e1954b1a78aabd6a
Reviewed-on: https://gem5-review.googlesource.com/c/13329
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13321:1c59e4a11e6f 07-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Remove a redundant error check.

If the check doesn't abort the port binding in progress, it will be
reported twice.

Change-Id: I691ebd0f1598193f861c6085341dcd2fb05dd210
Reviewed-on: https://gem5-review.googlesource.com/c/13327
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13320:9995d3de4a88 07-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Check the maximum port size when finializing bindings.

Change-Id: Ie7d704547bb8523a3c44479a89d2af4fcce6e8b6
Reviewed-on: https://gem5-review.googlesource.com/c/13326
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13319:94ab5f67a8c3 07-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Fix how the maximum size is computed for sc_ports.

Change-Id: I073eb16cbeb892f24ac3860daca056ed2fb09086
Reviewed-on: https://gem5-review.googlesource.com/c/13325
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13317:36c574a4036e 07-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Switch to using predefined messages for core.

Create and use predefined messages for core which match the ones
Accellera uses.

Change-Id: I05b1398933f753946d5917f39d0f39c7cb45ed9f
Reviewed-on: https://gem5-review.googlesource.com/c/13323
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13315:baeb753a3f10 06-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Add a warning about dont_initialize and cthreads.

Change-Id: I7cc3e571a7a63eed383ad7f897342a539318f961
Reviewed-on: https://gem5-review.googlesource.com/c/13321
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13312:a7685ffbead8 06-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Refactor reporting to prep for int based messages.

There's a deprecated reporting mechanism based on integer message ids,
and the reporting mechanism needs to be refactored a bit to make it
easier to support.

Some bookkeeping data structures were moved out to somewhere they
can be accessed by other code, obviating the non-standard get_handler
function.

Change-Id: Id427cd79be9ef0f3275fbac39ff047ab672fb3e0
Reviewed-on: https://gem5-review.googlesource.com/c/13318
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13310:160fb526ab4d 06-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: When resetting a process, clear suspended ready.

When resetting a process which is ready pending coming out of suspend,
clear that state since the process is about to run in service of the
reset.

Change-Id: Iade3ec4b2f3eadd372cce456dca66850d37ed5fd
Reviewed-on: https://gem5-review.googlesource.com/c/13316
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13308:30e825b4fd46 06-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: If a process hasn't started, still signal its reset event.

Change-Id: I9c8026cde455070841139d02955f5c083b9e0645
Reviewed-on: https://gem5-review.googlesource.com/c/13314
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13307:e30fee54d354 06-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Ignore attempts to throw a signal to a method.

Change-Id: I8c2b20525aa46955f4f2df34436b7424e706e410
Reviewed-on: https://gem5-review.googlesource.com/c/13313
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13306:2196f4a8201f 06-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Remove a redundant injectException for Thread's throw_it.

For some reason lost to the sands of time, the throw_it function was
virtual for the Thread class, and that class would call the base
class's throw_it, and then also injectException itself. That would
result in the exception being injected into the thread twice which is
incorrect.

Since it's not clear what the original intention of this code was, the
throw_it function is now no longer virtual, and the one useful aspect
of it, a check if the process is already terminated, was moved into the
base class function.

Change-Id: I7fb14baa7728bd1e9206011870b6ccaa9c4e8c64
Reviewed-on: https://gem5-review.googlesource.com/c/13312
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13305:c0cfd9454cdc 06-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Get rid of the unused Process::_procKind.

This seems to be a leftover from an earlier implementation.

Change-Id: I63d7e576fd3c11cf73769c34bbc97a4d3bbbdaeb
Reviewed-on: https://gem5-review.googlesource.com/c/13311
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13304:893e724efd57 06-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Ignore immediate self notifications.

Change-Id: If5140bd86159e9257eb9e6ccb8301dd6349dacff
Reviewed-on: https://gem5-review.googlesource.com/c/13310
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13303:045f002c325c 06-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Distinguish internal events from normal sc_events.

The internal events aren't supposed to show up in the namespace or as
children of objects.

Change-Id: Id04b9bfe2e1f8f216390dd989797558eaf33d715
Reviewed-on: https://gem5-review.googlesource.com/c/13309
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13301:0ef9dd4e1154 05-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Use the "catch action" and the handler func outside sc_main.

If an exception escapes sc_main, Accellera catches it and feeds it
into the report handler, telling it to run the catch actions. This
seems like it sets up lots of dangerous scenarios, and also makes a
vital error detecting path more complex and error prone.

On the other hand, it makes one of the tests pass.

Change-Id: I7f9d07e01e63c7abeee903febe2e434041ec49a4
Reviewed-on: https://gem5-review.googlesource.com/c/13307
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13299:6bde86615f6f 05-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Add an error check to the deprecated notify_delayed.

This can't override pending notifications like normal notify does.

Change-Id: Ie5f12a97ffdcc3dfca20fa7852f89687ee8bfca3
Reviewed-on: https://gem5-review.googlesource.com/c/13305
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13296:7f0348c6e8cf 05-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Add an error check to sc_gen_unique_name.

Accellera checks for a null pointer, and a test tries using that input.

Change-Id: I0f098f53de37ebbe481ea46e61fc0a9a404c29db
Reviewed-on: https://gem5-review.googlesource.com/c/13302
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13295:e71ae162b863 05-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Detach child events in the Object destructor.

This way they don't try to detach themselves from a parent object which
no longer exists.

Change-Id: Id4a3f3b2241cf8c67cae9b983bd4c1acbef083e3
Reviewed-on: https://gem5-review.googlesource.com/c/13301
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13293:60c727f33e16 04-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Implement port binding policies.

Change-Id: I585e34c4a666103af16ff1675701b61122822b55
Reviewed-on: https://gem5-review.googlesource.com/c/13299
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13292:0dc64d73b440 04-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Add some deprecated positional binding operators.

These are used in one of the tests, specifically the comma operator. It
didn't cause compilation to fail because of the default meaning of the
comma.

Change-Id: I7ce7fe74f02d4ad6a4ab896a2f0d6bd1ce635c2f
Reviewed-on: https://gem5-review.googlesource.com/c/13298
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13291:ccbae1f89cd3 04-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Keep track of progress when positionally binding.

Positionally binding more than once (like with the deprecated comma or
<< operators) should pick up where it left off the last time instead
of starting again from the beginning.

Change-Id: Ifc33520d6ce40544bd0ad80a5657b1a38a7914e4
Reviewed-on: https://gem5-review.googlesource.com/c/13297
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13290:1e720f971554 04-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Fill out some error reporting in sc_port.

Rather than just asserting some invariants are true, report errors if
they aren't.

Change-Id: Id361b8a13011e1a75289ddddb6b41c1d09dbf794
Reviewed-on: https://gem5-review.googlesource.com/c/13296
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13289:f32600676fe3 04-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Run delta notifications in reverse insertion order.

This is sort of pointless, except that it matches Accellera's behavior.

Change-Id: Ia63f2de998157aa68ce36fdc2ba39ca7a80fecbe
Reviewed-on: https://gem5-review.googlesource.com/c/13295
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13288:f1c04129f709 04-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Change how signal based resets work.

The previous implementation used the value changed event to track when
signals changed value, but there were a couple problems with this
approach. First, this piggybacked on the sensitivity mechanism in some
ways, but diverged in others. The sensitivity didn't notify a process
when it was satisfied like other sensitivity types would, and it also
ignored whether the process was disabled.

Second, the value_changed_event is notified by a signal instance as a
delta notification, but reset signals are supposed to act immediately.
That means they should happen before all delta notifications, or in
other words all delta notifications should see the reset status of a
given process. That's particularly important in the case of wait(int n)
where setting the reset clears the reset count, and the count is
checked when determining whether or not to wake up a process when its
sensitivity is satisfied, potentially by a delta notification.

Third, by removing the middle man and not trying to repurpose the
sensitivity mechanism, the code gets simpler and easier to understand.

Change-Id: I0d05d11437291d368b060f6a45a207813615f113
Reviewed-on: https://gem5-review.googlesource.com/c/13294
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13287:fa657c66fc83 03-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Increment the change stamp value before the timing phase.

It appears that events which are triggered during the timing phase
are considered triggered in the following evaluation phase. The
"triggered()" function on events is non-standard and not really
explained anywhere, but this appears to work in practice.

Change-Id: I2574dc4569bf148c55fbe2a4873d458fc507f2a5
Reviewed-on: https://gem5-review.googlesource.com/c/13293
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13285:86dc66ffac35 03-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Add an sc_gen_unique_name namespace to processes as well.

The standard says that there are namespaces for each module, and
one global namespace. Accellera also has namespaces for each process,
which shows up in the test output.

Change-Id: I4c8c5cecd5fb685d7bab521d9ae131aef23a6ab4
Reviewed-on: https://gem5-review.googlesource.com/c/13291
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13284:db01c2acd23f 03-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Add some error checks to the sc_module constructor.

These match error checks which are already in, for instance, the
sc_port constructor.

Change-Id: I8dfb4ce37bf0e59c6fa879f0afda5112af78b40b
Reviewed-on: https://gem5-review.googlesource.com/c/13290
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13283:362061d5b968 03-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Change how errors are handled in some constructors slightly.

Because SC_REPORT_ERROR usually causes an exception to be thrown, it's
easy to assume it will be the last thing executed in a function. It
might, however, be set up to do nothing, in which case the function
will continue to execute.

This change makes sure sc_prim will be set up properly even if errors
about the time a channel can be set up are ignored.

Also, if an exception is thrown while sc_port is being set up, the
corresponding Port object needs to be cleaned up. Rather than try to
intercept exceptions in the constructor and clean up properly, we'll
just make the allocation of the Port object be the last thing it does.
If the function exits early, then the Port pointer will still be
nullptr and nothing will need to be done.

Change-Id: If8f6f6b7e6830235fee3cd75625240b99e87dfbe
Reviewed-on: https://gem5-review.googlesource.com/c/13289
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13282:d0546737f962 03-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Add an sc_gem5::Port destructor.

This destructor just removes the port from the list of all ports.

Change-Id: I809b529540c2946d20aeb8d64467d77dc94a7a96
Reviewed-on: https://gem5-review.googlesource.com/c/13288
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13281:faae5b71f567 03-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Change the point where elaboration is considered over.

Make it the end of "before_end_of_elaboration" rather than the end
of "end_of_elaboration". This interpretation fits the behavior expected
by some of the tests.

Change-Id: I3f589147834ab5d5dc8c0e9b4849dd00491c5848
Reviewed-on: https://gem5-review.googlesource.com/c/13287
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13280:3a1147706ccf 02-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Implement sc_hierarchical_name_exists.

This function checks the top level collection of events and objects
to find if one with a particular name exists.

Change-Id: Icf539b502fa9c7401be907ee975eb24a47e79a87
Reviewed-on: https://gem5-review.googlesource.com/c/13206
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13279:de51c5711c1a 02-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Make sure otherwise unnamed events get autogenerated ones.

Change-Id: Iec4e0bd504e70d0096a4c90d5fbba9565dd0deed
Reviewed-on: https://gem5-review.googlesource.com/c/13205
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13275:67a279e54b7a 02-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Clear the current process when done with the eval phase.

The current process will still be set sometimes when exiting from the
yield loop in the top of runReady in the scheduler. Clear it to ensure
that we don't think a process is running when it isn't.

Change-Id: Idd44689e10fadf4a3e3ec07c60d107c80a44d39f
Reviewed-on: https://gem5-review.googlesource.com/c/13201
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13273:af60ddcf2a32 01-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Add missing sc_interface::register_port, and add calls to it.

This function is standard and supposed to be on sc_interface, but it
was somehow left out. This change adds it, and makes sure it's called
by the port binding code. The default implementation does nothing, as
it's supposed to according to the spec.

Also note that only the ports farthest from the interfaces are suppose
to call register_port. As the port bindings are completed, we keep
track of whether a port has been bound to another port. If it has, the
source port is farther from the interfaces than the target port (since
it has to go "through" the target port to get to them, and so the
target port should not call register_port.

Change-Id: Ia98f9ff364385fd1699d88a1d99787d205816a08
Reviewed-on: https://gem5-review.googlesource.com/c/13199
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13270:99e1cfb8c6e8 01-Oct-2018 Gabe Black <gabeblack@google.com>

systemc: Change how the timing of binding ports works.

In the Accellera implementation, interfaces are bound to ports
immediately if no ports have been bound, and otherwise saves them for
later along with the ports. The existing implementation would save
all interface and port bindings to finalize at the end of elaboration.

This seems like pointless complexity, but it's necessary to get the
output to match in the tests.

Change-Id: Ib82d324ee2be9e56e6a41561611c7fca4f4f4e72
Reviewed-on: https://gem5-review.googlesource.com/c/13196
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13268:9802f3e0a6ae 28-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Centralize how object parents are chosen.

There's a lot of repeated code for this. Also, the sc_vector type
needs to be able to artificially inject a parent for the objects it
creates.

Change-Id: I76f9b551632cd2cd70e26741b215290b35c382e9
Reviewed-on: https://gem5-review.googlesource.com/c/13194
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13267:7997f7b8bede 28-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Use c++11 partial functions instead of boosts.

This creates a depenendency on c++11 which the headers otherwise avoid,
but gem5 itself already has a c++11 dependency and not a boost
dependency, and outside of having a local copy of boost (which
Accellera does) there isn't a good way to put the placeholder values
_1, _2, etc., into the custom sc_unnammed namespace.

Change-Id: I52ca4c1bc52bef6ff2c62e9f3c32af46f95244dc
Reviewed-on: https://gem5-review.googlesource.com/c/13193
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13265:6cde60ee99fb 27-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Add a non-standard sc_time constructor and from_string.

The sc_time constructor was being called, but because of implicit type
conversions, a const char * was being treated as a bool and totally
unrelated constructor was being called.

This change adds and implements the missing but non-standard
constructor. It also implements the from_string function which uses
that constructor.

Change-Id: I21e7e40fd1a8d1c579b1abdc2036d016501f510c
Reviewed-on: https://gem5-review.googlesource.com/c/13191
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13264:cdb71995fe75 27-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Modify reportifyException to keep sc_reports in scope.

reportifyException was sometimes indirectly creating temporary
sc_report objects which would go out of scope when they were
returned. The later code which tried to print them would then read
garbage.

Change-Id: I0a744eb029c62bf2ffee83db0a0e6dcbe3e60f7d
Reviewed-on: https://gem5-review.googlesource.com/c/13190
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13263:bcd6d8140486 27-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement the sc_time_tuple class.

This class is non-standard and is an implementation detail in
Accellera's implementation, but is referred to directly by the tests.
It does the same thing as the time printing function, so rather than
having duplicate code the printing function now uses the sc_time_tuple
class even though it was doing fine on its own already.

Change-Id: I69594ed0651f212ded6d979d60523bb3b0a789b1
Reviewed-on: https://gem5-review.googlesource.com/c/13189
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13262:ef4b783f84f7 27-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Merge notify and notifyWork and ignore disabled for resets.

Always notify a process if a reset signal changed, even if it's
disabled. Also, because notify was what checked disabled and only
notifyWork was virtual, this change merges the two so both can be
overridden without any extra virtual functions.

Change-Id: I1e3563fa587aab65a5e95cd8a382ed48e093de3b
Reviewed-on: https://gem5-review.googlesource.com/c/13188
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13261:c8e97d29976d 26-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Ensure the reset event is notified before reseting the target.

The target may be the process which is currently running. In that case,
the reset method will end and never get to notifying the reset event.
To fix that, we need to notify the reset event first.

Change-Id: If3a9d87edc0999293a68d86d35989ae49eab3c07
Reviewed-on: https://gem5-review.googlesource.com/c/13187
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13260:4d18f1d20093 26-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement signal based resets.

The implementation is based on sc_event sensitivities.

Also of note is that the way reset works in the Accellera
implementation isn't consistent with the spec. That says that
wait(int n) is supposed to be equivalent to calling wait() n times,
assuming n is greater than 0.

Instead, Accellera stores that count and then doesn't wake up the
process until the count is 0, decrementing it otherwise.

That means that when the process is in reset, it won't actually reset
for those intermediate wait()s which it would if wait() was called
repeatedly. Also, oddly, when a reset becomes asserted, it will clear
the count to 0 explicitly. That may have been an attempt to make the
behavior of wait(int n) match the spec, but it doesn't handle cases
where the reset is already set when wait(int n) is called.

Change-Id: I92f8e9a128e6618af94dc048ce570a4436e17e4b
Reviewed-on: https://gem5-review.googlesource.com/c/13186
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13259:3730df183b84 26-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement the synchronous reset state.

Change-Id: Ie0c29bb6cf918aea1c0bc719b9d37628b5b19339
Reviewed-on: https://gem5-review.googlesource.com/c/13185
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13257:c59a22cb44d7 22-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Remove a hack which scaled sc_time into ps unnecessarily.

sc_time is now represented in whatever the underlying time resolution
is which isn't necessarily ps. Stop trying to scale it (incorrectly).

Change-Id: I18975e0ab01386b24196666e0ba02d1b36e11735
Reviewed-on: https://gem5-review.googlesource.com/c/12976
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13255:570e2d799f70 22-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Simplify sc_time_stamp().

sc_time is now inherently based on properly scaled Ticks, so there's no
reason to try to scale it to be in picoseconds, especially since the
scaling factor may be unreliable if the timescale hasn't been fixed
yet.

Change-Id: I28baeb9792e81e1d00f6f37672df435766311864
Reviewed-on: https://gem5-review.googlesource.com/c/12974
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13254:3133d9760716 22-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement sc_get_curr_process_handle().

The implementation is fairly trivial, but the pieces it relies on
weren't always available.

Change-Id: Ie77168ff336febd3ebe22c400f2b1f133e43aca7
Reviewed-on: https://gem5-review.googlesource.com/c/12973
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13252:8814e5d87a48 22-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Move some constants out of sc_time.cc for other files to use.

Change-Id: Ic88c6834dfe980022e58a3d859ea53193a55bbb1
Reviewed-on: https://gem5-review.googlesource.com/c/12971
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13251:5cb61fcb0ae2 22-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Add a warning to sc_interface::default_event.

The default implementation returns a dummy event, but in the Accellera
implementation it also prints a warning. Print a warning as well, so
that the output matches for the tests.

Change-Id: I1ae2755685515c3fe538f4075af396e963cf155d
Reviewed-on: https://gem5-review.googlesource.com/c/12970
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13249:5e60ab2199b9 22-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Check the process type when using sc_join.

Method processes aren't allowed in an sc_join.

Change-Id: I5c8421a396dbe261645a074df514f69fc652c9c8
Reviewed-on: https://gem5-review.googlesource.com/c/12968
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13248:a07071974510 22-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Make sure the right type process is running when calling wait.

That function is only allowed when running a thread or cthread.

Change-Id: Idf98b70018169d4f724aa8168f3c4e8161f0b83d
Reviewed-on: https://gem5-review.googlesource.com/c/12967
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13247:4aafce81e7dd 22-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Add an error check to sc_time.

Change-Id: Ie525a1624a6496a51277fb984cbfeec21eb79749
Reviewed-on: https://gem5-review.googlesource.com/c/12966
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13245:c666c5d4996b 20-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement general and VCD trace support.

This doesn't include WIF trace support, but does make allowances for
adding it in the future.

Change-Id: Ifb62f40a7d8a13e94463930a44ac4b1cf41e3009
Reviewed-on: https://gem5-review.googlesource.com/c/12826
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13244:deedec45898f 22-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Don't schedule the ready event unnecessarily.

If we're already going to process the thing we'd be scheduling it to
process, just let the existing invocation get to it.

Change-Id: Ifeebc80903065567fc0eed02beefec6156b22ff7
Reviewed-on: https://gem5-review.googlesource.com/c/12964
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13243:9bb0d62c8a74 20-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Fix the implementation of sc_event::triggered.

This function just returned false. The new implementation uses the
scheduler's changeStamp function to keep track of how recently the
event was triggered so it can return return the right value.

Change-Id: Idf61cd459e53e224a33d3e53c16210f5e0a99a3a
Reviewed-on: https://gem5-review.googlesource.com/c/12825
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13239:0fe49a9e1754 15-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Add an error check whether an interface is alread bound to a port.

Change-Id: I06e3484176c0c06daa28f7be0ed8437b3b15ddb2
Reviewed-on: https://gem5-review.googlesource.com/c/12816
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13238:3521d1f59c22 15-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Add some additional error checks.

Change-Id: I19c5e6f1795c2777dbe7d210cfa01f6ced2020f3
Reviewed-on: https://gem5-review.googlesource.com/c/12815
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13212:4729f211fbae 15-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Warn if sc_stop is called more than once.

Change-Id: Ief88b9af0119ba4b007f79905db2522b5f95b820
Reviewed-on: https://gem5-review.googlesource.com/c/12811
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13211:62e227fef520 15-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Check whether the simulation is running when creating sensitivities.

Change-Id: I499cde0d0eb45ba3287a8719174e1c794c1fb634
Reviewed-on: https://gem5-review.googlesource.com/c/12810
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13210:8f6d757c46dc 15-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Handle nonstandard cthread sensitivities.

Accellera allows some non-standard values in the second position of the
SC_CTHREAD macro. Do that as well, with the same special handling which
automatically selects the positive edge of boolean ports/interfaces.

Change-Id: I79594980898a17afc30fea6f77384589cbc3c250
Reviewed-on: https://gem5-review.googlesource.com/c/12809
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13209:aad30faa966b 14-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Change how the scheduler orders processes.

The Accellera implementation looks like it does all the methods, then
all the threads, and then loops back and tries again, and there are
even comments in the code that suggests that. What it actually does,
however, is runs all the methods, then runs a single thread if one is
waiting, and then starts over. The effect is that the scheduler will
run any methods first, then run threads until a method might have
become ready, and then repeat.

This will actually result in more mixing of threads and methods, more
context switches, and worse performance, but it makes the regressions
pass more.

Change-Id: I7cb0485e26eed79204ff2a3c3ded27b973e0b7b0
Reviewed-on: https://gem5-review.googlesource.com/c/12808
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13208:6703cb024823 14-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Differentiate between notifying methods and threads.

The Accellera implementation notifies all types of method
sensitivities first, and then notifies all the ones for threads.

Change-Id: I5eda75958675ba518f008852148030e032f70d83
Reviewed-on: https://gem5-review.googlesource.com/c/12807
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13207:034ca389a810 14-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Rework how delayed sensitivities are handled.

Make BindInfo into a more general purpose Port class which mirrors
sc_module and Module, sc_object and Object, etc. This tracks multiple
bindings internally, and also pending sensitivities. Keep a global
list of ports which are added in reverse order to match Accellera, and
which is iterated over to finalize binding and for phase callbacks.
This is as opposed to doing it one module at a time, and is to better
match Accellera's ordering for the regressions.

Also the sensitivity classes are now built with factory functions,
which gets around problems calling virtual functions from their
constructors or forgetting to having to have extra boilerplate each
place they're constructed.

The port class also now finalizes port or event finder sensitivities
when its binding is completed, unless it's already complete in which
case it does so immediately.

Change-Id: I1b01689715c425b94e0f68cf0271f5c1565d8c61
Reviewed-on: https://gem5-review.googlesource.com/c/12806
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13206:c944ef4abb48 14-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Refactor sensitivities.

Dynamic and Static sensitivities used to be represented by the same
classes, even though they're (almost) disjoint in how they worked. Also
timeouts, which can be used alongside dynamic sensitivities, were
handled by the sensitivities themselves. That meant that the
sensitivity mechanism had to mix in more types of behaviors,
increasing complexity. Also, the non-standard timed_out function
Accellera includes is harder to implement if the path for timeouts and
regular sensitivities are mixed together.

This change splits up dynamic and static sensitivities and splits out
timeouts. It also immitates the ordering Accellera uses when going
through sensitivities for an event. Static sensitivities are triggered
first in reverse order (why?), and then dynamic sensitivities are
triggered in what amounts to reverse order. To delete a sensitivity
which has been handled, it's swapped with the one in the last position,
and then the vector is truncated to drop it at the end. This has the
net effect of stirring the dynamic sensitivities, and isn't easily
immitated using a different approach, even if other approaches would
be more straightforward.

Double check addSensitivity for event.hh

Change-Id: I1e73dce386b95f68e9d6737deb8bed70ef717e0d
Reviewed-on: https://gem5-review.googlesource.com/c/12805
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13203:76ee4971fd9e 11-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Add some error checks to some classes.

These check whether those classes are being constructed in legal
circumstances, and avoids a null pointer dereference.

Change-Id: Ied36ee15c3d7bf6ee444351a841c38576780298e
Reviewed-on: https://gem5-review.googlesource.com/c/12622
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13196:4b5ab2c22743 11-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement SC_FORK, SC_JOIN, and SC_CJOIN.

SC_CJOIN is non-standard, but relied on by the Accellera tests.

Change-Id: Ia4ddcb1749a07891157a58398137e94fcaa8e815
Reviewed-on: https://gem5-review.googlesource.com/c/12615
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13195:de9e5572ac44 10-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Stop assuming picoseconds as the time resolution.

Also adjust some code to avoid floating point rounding problems and
integer overflow issues.

Change-Id: Ib4b9c4cf4af00333951db5ce07819556141aa5da
Reviewed-on: https://gem5-review.googlesource.com/c/12614
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13194:9c6b495e650c 10-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Keep all pre-init processes on a single list.

We were keeping track of processes which should be initialized and
those which shouldn't on two different lists, and then processing
each list one after the other. This could reorder processes from the
order they were created, and so cause spurious differences which cause
the Accellera tests to fail.

This does make the scheduler slightly simpler, so it's not all bad.

Change-Id: I63306a41ce7bea91fa9ff2f6774ce9150134ce48
Reviewed-on: https://gem5-review.googlesource.com/c/12613
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13193:37816241c855 10-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Track event sensitivities with a list instead of a set.

It's totally legal to signal that an event happened to waiting
processes in any order we choose, but to match the order of events
which appears in the Accellera test golden output, we need to do things
in the order they did. This is less efficient, but will reduce the
number of false positives.

Change-Id: Ie2882249ae846991d627f5f688a9e89e629bb300
Reviewed-on: https://gem5-review.googlesource.com/c/12612
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13192:28b6be4aeeb5 07-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Mostly implememt sc_simcontext.

Since we don't track the current process using the sc_curr_proc_handle
structure, we keep one around just to return from the appropriate
accessor, and set its values when it's requested. If the object is
kept around, those values won't change to track changing processes.

From what I see, none of the tests rely on the value tracking the
process beyond the callsight.

Change-Id: I1ad3b7a7b15aa0bc4d218f986ffbe7c51501b296
Reviewed-on: https://gem5-review.googlesource.com/c/12611
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13191:a2254693aa5b 07-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Centralize module callbacks and report new warnings.

By centralizing module callbacks, the gem5 module class knows when
different stages of the simulation are happening and can do it's own
extra checks. It also compartmentalizes modules more since the kernel
object doesn't have to reach into them to enumerate ports and exports.

Change-Id: I55887284af9c05150fe9d054f5b6147cad6092a1
Reviewed-on: https://gem5-review.googlesource.com/c/12610
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13189:057566bc8fd6 07-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement the deprecated "timed_out" function.

This function requires some slightly annoying bookkeeping since it
doesn't just report whether the current process is running as a result
of a timeout, it reports whether it's running as a result of a timeout
*and* it could have been running from some other sensitivity instead.
Pure timeouts don't count as timeouts which makes it harder to handle
in a general way.

Change-Id: I533d97fe66d20d7b83aba80f2ef45a8944668070
Reviewed-on: https://gem5-review.googlesource.com/c/12608
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13188:7af408b60cac 07-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Catch exceptions during updates, notifications, and callbacks.

Change-Id: I6005c12ce32d24413618e3955625432985f99f69
Reviewed-on: https://gem5-review.googlesource.com/c/12607
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13187:ee28771420a6 07-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Report an error if notifying during the update phase.

Change-Id: If261c7a981a247884f0a6466756966b454f197f4
Reviewed-on: https://gem5-review.googlesource.com/c/12606
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13186:1ebc6c729311 07-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Track the scheduler status using an enum instead of bools.

The scheduler tracked whether it was paused or stopped with two bools
which are mutually exclusive. It's useful to be able to also check for
some other mutually exclusive states like what phase the scheduler is
currently running.

Rather than adding a bunch of additional bools, this change switches
those mutually exclusive states over to an enum, and adds some methods
to access and maintain that enum.

Change-Id: Ia9696b2853d1b122c1100c9df0e12b018fe9b84b
Reviewed-on: https://gem5-review.googlesource.com/c/12605
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13185:286a48639227 07-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Remove a redundant call to update() from the kernel object.

The t0Handler runs the scheduler's initPhase function which has a call
to update built into it. There's no reason to call that within one of
the kernel's callbacks as well.

Change-Id: I02c755b7d53f93accdacf8149cc1988d7a6e214c
Reviewed-on: https://gem5-review.googlesource.com/c/12604
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13182:9e030f636a8c 07-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Fortify how exceptions are caught and passed around.

This change tightens up exception catching and makes gem5's systemc
code react to exceptions more in line with the Accellera
implementation. This prevents exceptions from being caught by the
pybind11 integration which makes it very difficult to see where an
exception came from, and makes the output differ by including a
(mostly useless) backtrace.

Change-Id: I7130d53a98fadd137073d1718f780f32f57c658c
Reviewed-on: https://gem5-review.googlesource.com/c/12601
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13180:79e680f62779 05-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Warn if a process is dont_initialize with no static sensitivieis.

Change-Id: I4db64f42872a6fb459faa401abdad3f168297347
Reviewed-on: https://gem5-review.googlesource.com/c/12599
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13179:7445c43d036b 05-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Report a warning if an event or object needs to be renamed.

Change-Id: I8085ba19fd7acd69d07a1e032f2fd18b6c5fed6f
Reviewed-on: https://gem5-review.googlesource.com/c/12598
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13177:7b750aeab360 05-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement sc_time::to_string.

This is just another way to call sc_time::print, but it returns a
string instead of printing to a stream.

Change-Id: Idc90c539127e6153af9511bfe5f258b870362330
Reviewed-on: https://gem5-review.googlesource.com/c/12596
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13176:76f52e8d8c6a 05-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Match how Accellera schedules processes even more closely.

The Accellera implementation runs processes in a cycle where it first
runs all the methods it has, then all the threads, and then starts
again in case any new methods have been scheduled. This keeps methods
and processes in the order they were marked ready (what a prior change
made this scheduler do), but also keeps the methods together and the
threads together (something it used to do, but that change made it
stop doing). This change should make the gem5 scheduler match in both
respects.

Note that its correct to run the processes in whatever order we want,
it's just that if we're going to compare against the "golden" output
from the Accellera tests, we need to match the order to get sensible
results.

Change-Id: I0b1e4ed24c56f97921148b74e90c2dca5fd3fbc4
Reviewed-on: https://gem5-review.googlesource.com/c/12595
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13175:b93fb6caf043 05-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement the nonstandard halt function.

Change-Id: Ie9bd9db92a63169980230bc9a15e153d5609dd0b
Reviewed-on: https://gem5-review.googlesource.com/c/12594
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13161:8bef8ce2784f 05-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Change the default naming scheme to use sc_gen_unique_name.

The spec says the default name should just be "object", but the
Accellera implementation calls sc_gen_unique_name, and the tests
expects that.

Change-Id: Ic6922a6d9fb53f3126a9d527868fc11da5320446
Reviewed-on: https://gem5-review.googlesource.com/c/12593
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13156:b3185074b0df 04-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Ensure sc_stop during callbacks actually stops.

Make sure calling sc_stop during the appropriate callbacks will
actually skip future action by skipping later callbacks, by flushing
the scheduler before running init (so it doesn't really do anything
but record that it's in running mode now), and schedule the stop event.

Change-Id: I5edfbceda457df88d15bfcac4d97e8578205ec5b
Reviewed-on: https://gem5-review.googlesource.com/c/12468
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13155:4e77f1d0cdc3 01-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement the nonstandard at_negedge and at_posedge.

Change-Id: I7ea5cfd309db4b9883df551fd7dcec186e4f38a3
Reviewed-on: https://gem5-review.googlesource.com/c/12467
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13154:f86c71dac456 01-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: When stopping immediately, block new processes/updates.

When stopping immediately, we're supposed to finish the current
process but not run any other processes or go to the update phase. The
rest of the process could introduce new processes or request new
updates, so we need to make sure we block those if we're in the process
of stopping.

Change-Id: I9cc867d294cf171dfedb4b9d43fbc167c2057de8
Reviewed-on: https://gem5-review.googlesource.com/c/12466
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13151:5ce517287782 01-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Add some error checks to sc_set_default_time_unit.

Change-Id: I1d21c56d3b39044d91c96c98d242a571c099707c
Reviewed-on: https://gem5-review.googlesource.com/c/12463
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13149:91e215a2da78 01-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Implement sc_(g|s)et_time_resolution.

Change-Id: If546bea633e777cdb2b14f47c0d9d50b044b99cf
Reviewed-on: https://gem5-review.googlesource.com/c/12461
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13146:3539fe351218 01-Sep-2018 Gabe Black <gabeblack@google.com>

systemc: Report an error if n <= 0 in wait(int n).

This is in the spec, and tested by one of the regression tests.

Change-Id: I035cfad279be3859242919a95598f191d5d06165
Reviewed-on: https://gem5-review.googlesource.com/c/12458
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13145:5291e0747c7c 31-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Toggle off clumping methods together in the ready list.

This is totally legal and good for performance, but because some of
Accellera's tests depend on processes which can run in any order
running in a particular order to reproduce the golden output, it needs
to be disabled to pass the tests.

This change leaves it as an option which could even be plumbed out in
the future to support some sort of "compatibility" mode with the tests.

An alternative would be to verify that the tests pass, change the
ordering to the alternative (but still correct) order, and then
update the reference output.

Change-Id: I113a40dec52f8b623253f8a27886b4a0abe89485
Reviewed-on: https://gem5-review.googlesource.com/c/12457
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13144:61e0f3230787 31-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Store timed notifications in a list instead of a set.

This has three advantages. First, the data structure doesn't have to
try to keep track of whether or not an event is already listed there.
Second, it's easier to delete an item by storing an iterator for it
when it gets inserted. Third, the ordering of events is not dependent
on the arbitrary ordering of the set, it's bsaed on the fixed order
the events get added to the list.

One part of this change makes ScEvent-s keep track of what list they're
on, and handle their own insertion and deletion when they're
scheduled or descheduled. A side effect of that is that it's no longer
safe to simply use a range based for loop to loop over all of an
ScEvent and deschedule all its events or to run then (which deschedules
them internally once they execute).

That can be avoided by looping until the list is empty, and operating
on the first element. As the first element is processed and removed
from the list, the next element will become first and will get picked
up in the next iteration.

Change-Id: Icad51a63f153297c88e65f85d22ac721e6c571d8
Reviewed-on: https://gem5-review.googlesource.com/c/12456
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13140:ecd8a58f3884 30-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Add a "changeStamp" value to the scheduler.

This value is incremented after each delta cycle's evaluate stage and
after timed notifications happen. Its value is used by some channels
to determine whether certain events happened within the previous update
phase to implement the "event()", "posedge()", and "negedge()"
functions.

Change-Id: I9a73f0b5007dcbb6a74da9d666f28da1930b9d3d
Reviewed-on: https://gem5-review.googlesource.com/c/12452
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13135:4bb2f323fb1a 30-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Raise an error when SC_METHOD, etc. is used after starting.

Those mechanisms for creating processes are only allowed before the
end of elaboration, or in other words before sc_start is called.
Technically the check in Accellera's implementation won't trigger if
the simulation is stopped, and we immitate that behavior.

Change-Id: I9b8b5bd32f876781b6e0d5c0ee0e09de19bdabc1
Reviewed-on: https://gem5-review.googlesource.com/c/12447
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13133:41d8cd260825 30-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Keep track of more cases when we should be ready after resume.

If a thread self suspends, it should be marked as ready after resuming.
If a process was already ready when suspended, it should also be
remarked as ready after resuming.

Special care has to be taken in pre-initialization situations so that
processes are put on the right lists, and whether a process is tracked
is already marked as ready.

Change-Id: I15da7d747db591785358d47781297468c5f9fd09
Reviewed-on: https://gem5-review.googlesource.com/c/12445
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13132:1fb4a87f550f 30-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: When sensitive to an event finder, find on all interfaces.

When a process is sensitive to an event finder and that finder is
attached to a port which is bound to multiple interfaces, the process
is supposed to be made sensitive to the event finder function's result
when called on each interface, not just the first one.

Change-Id: I92312e04e60fab7a7ea51c1ed687edabe9768205
Reviewed-on: https://gem5-review.googlesource.com/c/12444
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13131:bf07048d69e4 29-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Make Process track whether it's dynamic on its own.

Processes which are created in end_of_elaboration aren't created with
sc_spawn but still need to figure out if they're dynamic. Rather than
duplicate the check in sc_spawn, this change centralizes it in the
Process class itself.

Change-Id: I763d5a0fa89a72fbc82346b6ce2eed852ee72524
Reviewed-on: https://gem5-review.googlesource.com/c/12443
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13130:e67ad27f0858 29-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Track the module who's end_of_elaboration callback we're in.

Change-Id: Ib5fe3232cfea26df0c3396c583fd80da429cbdd5
Reviewed-on: https://gem5-review.googlesource.com/c/12442
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13129:7346c328de41 29-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: sc_spawn can create static or dynamic processes.

Their status depends on when sc_spawn is run.

Change-Id: I826adf9d5c905687e705642130ca5ad725ce92af
Reviewed-on: https://gem5-review.googlesource.com/c/12441
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13128:60311a75e876 29-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Improve handling of empty process handles.

Most had checks, but didn't print any message. throw_it needed a check
as well.

Change-Id: I916c837112f9b27852583f01b3e16a6f53d5e7ca
Reviewed-on: https://gem5-review.googlesource.com/c/12440
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13127:d3318222cf09 29-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Ensure all objects and events have unique names.

Change-Id: I59b78048849953773b80bb2dac9b834762625331
Reviewed-on: https://gem5-review.googlesource.com/c/12439
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13126:770f2c828e33 28-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Make sure children of processes are recorded as such.

The process was treated as the parent of the object, but the object
wasn't being installed as a child of the process.

Change-Id: I6710f34734835cbeceb3d33e5e37b6f5897c5e30
Reviewed-on: https://gem5-review.googlesource.com/c/12438
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13125:2488fd19b643 28-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Clamp the time of events to the present.

If systemc attempts to schedule an event in the past, schedule it for
right now instead. Still preserve the difference between delta and
timed events. This scheme doesn't really make a lot of sense (why not
just disallow scheduling events in the past?) but this will approximate
what I think the correct behavior is. What's probably supposed to
happen is that events in the past are executed from most past to most
present until they catch up with now, and then now advances as normal.
Our approach is simpler, but won't preserve ordering between multiple
events scheduled in the past.

Change-Id: I73c1e581c532530178458f044674613a4f4ea3be
Reviewed-on: https://gem5-review.googlesource.com/c/12277
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13124:538eff58fb30 28-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Implement support for the default time unit.

This is deprecated, but still used in the tests.

Change-Id: I454540e419c53624a37f3d1271cb240415b816b6
Reviewed-on: https://gem5-review.googlesource.com/c/12276
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13102:f9a4fa519bb3 28-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Report errors when proc ctrl funcs are called during elab.

Change-Id: I19475b86d04af5b3e4e907d9e24cb15666fb7bb1
Reviewed-on: https://gem5-review.googlesource.com/12274
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13097:6efbd43ab80e 26-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Handle sc_stop called from sc_main correctly.

When in sc_main, sc_is_running will return true but we're not going
to run any gem5 events since we're currently in the sc_main Fiber. In
that case, we need to do the sc_stop work inline.

If we're actually running and not just paused, then we do still want to
schedule the work of sc_stop to happen as its own event since that will
happen before returning to sc_main, and actually will likely be the
mechanism by which sc_main starts executing again.

Change-Id: If9ffafc4f240af0f3d9c726b36a0950b5219dc00
Reviewed-on: https://gem5-review.googlesource.com/12269
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13096:9295fa397b3f 26-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Fix some issues with starvation checks.

Make sure we check for starvation after timed notifications and at the
very end of delta cycles (after delta notifications, not before). Also
reverse the order of starvation checks (whether they apply at all, then
if they're satisfied) to make those checks faster. Checking a bool
is a lot easier than checking if a bunch of other structures are
empty.

Change-Id: I514ff219909823f1f424fde69856d6b510655188
Reviewed-on: https://gem5-review.googlesource.com/12268
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13095:836fd7929940 26-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: When sc_start-ing with zero time, ensure the ready event runs.

The ready event is what notices that we only wanted to run one delta
cycle, or no delta cycle if there was nothing to do, and return to
sc_main. If the ready event wasn't scheduled, we would advance time
before the ready event ran and returned to sc_main which is incorrect.

Change-Id: Ic3c10a2f1405f744e8c2bd37aa45846ee6e98e12
Reviewed-on: https://gem5-review.googlesource.com/12267
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13094:e74742df378b 26-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Fix where we checked if sc_stop was called durig elaboration.

If sc_stop is called during one of the various callbacks, that has
defined behavior and will cause the simulation to stop after the
current batch of callbacks. We were checking whether sc_stop had been
called during one of those batches and killing the system, erroneously
assuming that meant it had called during elaboration.

This change moves the check to before the callbacks which actually
does mean that sc_stop was called during elaboration.

Change-Id: I6876305450e52a407acffb9a2f45ee2ae24a9adf
Reviewed-on: https://gem5-review.googlesource.com/12266
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13093:bea17ab221ef 24-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Make sure methods aren't restarted by yield.

Methods may need to yield control to other Processes when throwing
them exceptions. In that case, we need to keep track of the fact that
the method doesn't need to be restarted when it resumes within yield.

Change-Id: I829c387d6ddb563b2957db47e55adadbbe6bc51a
Reviewed-on: https://gem5-review.googlesource.com/12265
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13092:a4995c783157 24-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: When a thread completes, yield to the scheduler.

Don't just fall off the end of the fiber and return to gem5. By
calling yield, we ensure that remaining Processes are run and that
bookkeeping is maintained correctly.

Change-Id: Ifbe104e155cad29e40a89767a7c1f986399f784d
Reviewed-on: https://gem5-review.googlesource.com/12264
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13091:81fceed26e1e 23-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Implement positional binding.

Change-Id: Ifbcd7e4148b82b9bf5241e040e812925daea3705
Reviewed-on: https://gem5-review.googlesource.com/12263
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13089:2cd69e58c0f8 23-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Get rid of the unused warning function in sc_event_finder_t.

Change-Id: Id615856af7ea366e499747e00f66924a25623663
Reviewed-on: https://gem5-review.googlesource.com/12261
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13088:05763ab10391 23-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Use the eq pointer directly less often in the scheduler.

This takes advantage of the utility functions that exist a little
better, and also avoids accidentally asymetrically using
eventsToSchedule and eq->(de)schedule.

Change-Id: I1eb1c228d47684cccb9deaf6f3409b77cfbad4cd
Reviewed-on: https://gem5-review.googlesource.com/12260
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13087:1df34ed84a4b 23-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Make sc_process_b less hokey, and make WAIT* work.

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>

13086:6a6fa249add7 23-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Handle null and omitted event names.

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>

13085:9a64693dabcc 23-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Handle null sc_object names.

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>

13084:383ac3b9b4ff 23-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Check for time overflow in sc_start.

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>

13083:dcd7f038f7ff 23-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Handle sc_time_stamp before any sc_time is constructed.

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>

13081:fd1b50840830 22-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Keep track of how sc_main completes and expose that to python.

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>

13079:e7e261dd975b 22-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: If no sc_module_name was used, throw an error.

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>

13078:f11496886d1a 22-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: If an event is a delta notification, checked if it's timed.

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>

13077:0037323cb4dd 22-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: If sc_main returns, don't do any more systemc stuff.

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>

13076:c9e2a8bfe907 22-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Clear out the scheduler more agressively and with common code.

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>

13075:d7b8d1d5fc66 22-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Override notifyWork for timeout/event_and_list sensitivities.

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>

13074:51b5e342f327 21-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Make sure no delta cycles are scheduled when stopping.

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>

13073:71fccb27bace 21-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Make sure an immediate notification overrides a delayed one.

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>

13072:f2b83208ab54 21-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Improve scheduler cleanup.

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>

13069:d894ba8f881c 17-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Generalize gem5 style event scheduling.

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>

13068:822c1be3550e 17-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Make sure sc_start waits for simulation even when starving.

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>

13067:3d6ef32002ef 16-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Rework the init phase for the new way delta notes are handled.

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>

13064:e06421881cec 16-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Don't run the ready event inline when unpausing.

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>

13063:c9905ead0041 16-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Rework how delta and timed notifications/timeouts are tracked.

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>

13061:9b868a2ab73c 16-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: When sc_start is told to run zero time, do one delta cycle.

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>

13060:a5465580f647 16-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Don't run clocked thread processes during the init phase.

Change-Id: I170d67fef61dd5536a842a1f64682d90ae7a1507
Reviewed-on: https://gem5-review.googlesource.com/12211
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13059:4be5f408e128 16-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Track exports and prim channels, and call their callbacks.

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>

13058:da3ffd935b29 15-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Fix the priority of the maximum time event.

Change-Id: I3e5e71165d06da77076f0e58012c575e24456182
Reviewed-on: https://gem5-review.googlesource.com/12209
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13057:b1cdffff3bed 15-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Implement a little more of sc_time.

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>

13053:a7a320144bc1 13-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12084
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13052:d1ac29fc3169 13-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Make BindInfo track ports or interfaces.

Change-Id: I0ca0d5de8de59d92cb65af56c25f418ff32696f4
Reviewed-on: https://gem5-review.googlesource.com/12083
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13049:181358d628b7 09-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12080
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13048:9ae0bf1b32e6 08-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12079
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13047:61a849083f15 08-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12078
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13046:3a5e942051db 08-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12077
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13045:ccedccd0d93d 08-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12076
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13043:3d8585dabc3e 08-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12074
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13042:8c1fb556547e 08-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12073
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13041:ffcb5efb97d7 07-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12072
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13040:877a6e22f8d4 07-Aug-2018 Gabe Black <gabeblack@google.com>

systemc: Implement a few more member functions for sc_time.

Change-Id: I40a7fb278f2a0ec4124589e02e4441c1866c86ea
Reviewed-on: https://gem5-review.googlesource.com/12071
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13039:0c8ecf92a420 07-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12070
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13038:7bf84150855b 07-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12069
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13035:bafbdba2352a 07-Aug-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12066
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

13006:f4e4f859d114 27-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12057
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12999:1325c18d9ffd 26-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12050
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12998:68d2c7538b82 26-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12049
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12997:cfc14d8f4725 25-Jul-2018 Gabe Black <gabeblack@google.com>

systemc: Implement most of the sc_report_handler mechanism.

This doesn't include support for the deprecated integer message ids.

Change-Id: I309d58df1cdc464428189eb0b7180edf41ca4f67
Reviewed-on: https://gem5-review.googlesource.com/12048
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12996:17ec70f9841e 23-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12047
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12995:3421144dd03e 21-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12046
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12994:afce27405f70 21-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12045
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12993:977fa1dfe9b3 20-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12044
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12991:9d018d22aefd 20-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12042
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12990:19d91b53e04e 20-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12041
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12989:f5e0cebe6999 20-Jul-2018 Gabe Black <gabeblack@google.com>

systemc: Implement + and - for sc_time, and sc_max_time.

Change-Id: I294b63840e42e2afdef198229adc60ddbb60b9a1
Reviewed-on: https://gem5-review.googlesource.com/12040
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12988:df70e73818e4 20-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12039
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12987:97fbdee919d8 20-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12038
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12986:761e57785c6a 20-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12037
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12985:ec84697e4e63 19-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12036
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12984:02f20eeeb8ce 19-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12035
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12983:fb1f462ae89e 19-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12034
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12982:c7966254372e 19-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12033
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12962:004cc9133bd6 18-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12032
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12961:9bd3a469fd11 17-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12031
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12960:ff77756883e0 16-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/12030
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12959:33d9a39e40a3 16-Jul-2018 Gabe Black <gabeblack@google.com>

systemc: Handle suspended processes and handle sensitivity overload.

This change keeps track of whether a process would have become ready
but was suspended so that it can become ready when the process is
resumed.

Also, this makes a process ignore its static sensitivity while a
dynamic sensitivity is in place.

Change-Id: If3f6c62f370051e574f81bf227746db8c43527e2
Reviewed-on: https://gem5-review.googlesource.com/11715
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12958:a8188f40f342 16-Jul-2018 Gabe Black <gabeblack@google.com>

systemc: Implement next_trigger and wait.

These set up dynamic sensitivity.

Change-Id: I6cf2c2e4f93fe001eb7df8377753d51846b57d32
Reviewed-on: https://gem5-review.googlesource.com/11714
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12957:e54f9890363d 16-Jul-2018 Gabe Black <gabeblack@google.com>

systemc: Implement the sensitivity mechanism.

This change lets processes be sensitive to events, timeouts, etc.

Change-Id: If30a256dfa8a2e92192c1f9c96b48e2aa28ec27e
Reviewed-on: https://gem5-review.googlesource.com/11713
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12956:264cdc9261e6 16-Jul-2018 Gabe Black <gabeblack@google.com>

systemc: Hook up sc_time_stamp sc_delta_count.

sc_time_stamp reports the current simulation time. sc_delta_count was
hooked up to a dummy value. This change hooks it up to the scheduler so
that it returns the real value.

Change-Id: I354c4be32161eabeea86af653f5cb0a5d384645b
Reviewed-on: https://gem5-review.googlesource.com/11712
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12955:9c8bf6a5f2e3 11-Jul-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/11711
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12954:8ea3a185354c 05-Jul-2018 Gabe Black <gabeblack@google.com>

systemc: Implement channel updates and rework the scheduler.

This change implements channel updates, and also reworks the scheduler
to delegate more to the gem5 event queue by taking advantage of
event priorities to ensure things happen in the right order. There's
a lengthy comment in scheduler.hh describes how that all works.

Change-Id: I5dee71b86b2e612bb720a4429f3a72e4b7c6d01f
Reviewed-on: https://gem5-review.googlesource.com/11710
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12953:ddfd5e4643a9 03-Jul-2018 Gabe Black <gabeblack@google.com>

systemc: Partially implement the scheduler.

This change implements the "evaluate" part of the delta cycles, and
sketches out a function to run delta cycles and the initialization
phase. The kernel object now schedules an event at time zero which
runs the initialization phase.

Also, some small places which were stubbed out pending a way to check
the currently running process have been filled in now that that's
being tracked.

Change-Id: I6899569eb0195ff1c059fa4e68e90ef162b2f2df
Reviewed-on: https://gem5-review.googlesource.com/11709
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12952:94fca7e8120b 29-Jun-2018 Gabe Black <gabeblack@google.com>

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
Reviewed-on: https://gem5-review.googlesource.com/11613
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12951:9db2476bea4e 25-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Implement some basic plumbing in sc_module.hh.

Take care of some low hanging fruit as far as wrapper methods and
the sc_bind_proxy class.

Change-Id: I7f55a37eeaa82338bd608218c0261fbc39e65fc2
Reviewed-on: https://gem5-review.googlesource.com/11612
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12950:af1f0b5e8dfb 22-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Implement most of sc_object.

To avoid making it hard to change sc_object's implementation in the
future, this change keeps most of the data members out of sc_object and
keeps them in a seperate Object which is managed independently but
still matches to the sc_objects one to one.

This change also moves away from the SystemC/sc_gem5 namespace pair in
favor of sc_gem5. Having two namespaces with classes, etc, living in
both was complicating things. Having to use a namespace that doesn't
fit in one scheme or the other isn't great, but it's the lesser of two
evils.

Change-Id: Ib59c3c515ca98c7fe519c59e9fe9270304b71cc0
Reviewed-on: https://gem5-review.googlesource.com/11611
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12949:7014101fea10 22-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Get sc_main to work even when dynamically linked.

Unfortunately multiply defined weak symbols don't work like they're
supposed to when the different versions are across dynamic linking
boundaries.

Fortunately, a weak symbol with no definition at all will still
consistently evaluate as 0, and a singularly defined weak symbol will
still resolve correctly.

Instead of relying on a weak version of sc_main being overridden by a
strong/non-default definition, this change leaves it as undefined and
detects at run time whether the symbol resolves to 0 or to an actual
code location.

Change-Id: I31c4ff769b0c52277c6cf4845ca3f85000009583
Reviewed-on: https://gem5-review.googlesource.com/11610
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12948:cd54609046c4 22-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Implement the sc_attr classes.

Change-Id: Ibbe6da957b1b36687178f226e80718adc0f4ab81
Reviewed-on: https://gem5-review.googlesource.com/11609
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12946:70c6625468c3 18-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Enable some more sc_simcontext related tests.

Now that we bit the bullet and stubbed out sc_simcontext and related
functions a little bit, we can enable a couple more tests. This change
also adds in some functions the new tests expect sc_simcontext to have.

Change-Id: I00b5cc0c6eb658eb689b9c85ed171f290009768d
Reviewed-on: https://gem5-review.googlesource.com/11356
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12943:12c1004709d4 18-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add the nonstandard sc_join class and sc_thread_handle type.

Change-Id: I09905bad4797d9c456229afe601006ce16977394
Reviewed-on: https://gem5-review.googlesource.com/11353
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12940:f191f383f3bf 18-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Minimally implemented the deprecated sc_simcontext.

This is supposed to be deprecated, but is still used in a small way
by the tests.

Change-Id: I94fc32f9e0f03d50c00ce5421926203859064020
Reviewed-on: https://gem5-review.googlesource.com/11352
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12939:5256de693153 18-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add a minimal version of the deprecated sc_process_b.

This type is deprecated, but some tests still rely on it. This change
adds just enough of it to satisfy the tests, and also the several
different mechanisms for retrieving the sc_process_b which refers to
the currently active process.

Change-Id: Id122ae5df23744b5de1e1c97573412f97a73b77a
Reviewed-on: https://gem5-review.googlesource.com/11351
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12938:003057e39b9f 18-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add bind() to sc_port_base.

sc_port_base is supposed to be implementation defined, but internal
details of it are relied on by the systemc tests.

Change-Id: I53d84e708a5543a2cf4bd0deffc2efea1c008d97
Reviewed-on: https://gem5-review.googlesource.com/11350
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12930:f0e472cf340c 16-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add the nonstandard sc_hierarchical_name_exists function.

Change-Id: I1340bb6cb0ae29d81b5d73b3dd39ebb11c14802c
Reviewed-on: https://gem5-review.googlesource.com/11280
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12929:6ed4226c66c7 16-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add the nonstandard timed_out function.

Change-Id: If14a5f98f03448c712827b7f92d2a36992541518
Reviewed-on: https://gem5-review.googlesource.com/11279
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12928:1746600c4672 16-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add some deprecated sc_module constructors.

Change-Id: Ibe2bfe63536af33fca6040f4aef999ee928d876b
Reviewed-on: https://gem5-review.googlesource.com/11278
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12927:6be191c20575 16-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add the non-standard sc_time_tuple class.

Change-Id: Ia3d6a6a4ea3383c82605653faac570ced7bebb70
Reviewed-on: https://gem5-review.googlesource.com/11277
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12925:a745745a930b 15-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add deprecated sc_time constructors.

Change-Id: Iffae751272302ff2996258a1ab31b086e12bbb8d
Reviewed-on: https://gem5-review.googlesource.com/11275
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12923:8a77b84341de 15-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add some deprecated sc_time factory methods.

Change-Id: I0d9a7040a48b9f0d0079e9daecaf44ea78c186de
Reviewed-on: https://gem5-review.googlesource.com/11273
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12916:8fa0c4e23f69 15-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add deprecated default time unit management functions.

Having default time units is deprecated, and so are the functions that
manage them.

Change-Id: Ie21f9a5fca9868dd4f0adcd9f32c568fbec1fa72
Reviewed-on: https://gem5-review.googlesource.com/11270
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12915:aff42de64e41 15-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add deprecated notify_delayed functions.

Change-Id: I8ec68920b35f9207b6856a0b1ddfdf7545b7148a
Reviewed-on: https://gem5-review.googlesource.com/11269
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12914:8fe7d8389c0f 15-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add some nonstandard cthread related sc_module functions.

Change-Id: I73f9868b80f9b75e7bd90df6e894daea60a203a1
Reviewed-on: https://gem5-review.googlesource.com/11268
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12909:88127fe770f5 15-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add the nonstandard, undocumented halt function.

Used in the tests.

Change-Id: I9b4f10600a50e0def1b5d55428cb4ad49e401295
Reviewed-on: https://gem5-review.googlesource.com/11263
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12901:72bc9ff65802 15-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add the nonstandard macro SC_NEW.

This is in the Accellera implementation and in the regression tests.
The implementation here is a bit different than theirs in that it uses
std::unique_ptrs.

Change-Id: Id3d1ad82482b94a5d99f27e02d1e447ca1944797
Reviewed-on: https://gem5-review.googlesource.com/11255
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12900:ae067a7dac04 14-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add the nonstandard triggered function sc_event.

The Accellera implementation of sc_event has a non-standard triggered
function which returns whether or not that particular event has been
triggered in the current delta cycle. The tests call it, so we probably
need to have it.

Change-Id: I675099b65d00e09536618d4d2d707bf3c25e3bde
Reviewed-on: https://gem5-review.googlesource.com/11187
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12899:9a512f5c4e91 14-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add the nonstandard variable sc_allow_process_control_corners.

This variable controls what happens in some situations which are left
as undefined in the spec. It's behavior is explained in a big comment
in the Accellera implementation. Since it's used in the regression
tests, we need to at least have that variable so they'll compile and
link properly.

Change-Id: I1ac4592641be3d9dd10e7bf6144704a6fac1b2d4
Reviewed-on: https://gem5-review.googlesource.com/11186
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12898:9c24286c7ddb 13-Jun-2018 Gabe Black <gabeblack@google.com>

systemc: Add some "implementation defined" stuff to sc_attr_cltn.

These "impelementation defined" methods are tested by the regression
tests, so we need to have them. We might as well have the same
general interface as the Accellera implementation since nothing there
seems overly specialized for that environment.

Change-Id: Ief6567fcd9d99d3a0f526cfa3b65043b2c828efa
Reviewed-on: https://gem5-review.googlesource.com/11185
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12863:ed8c2541cb30 31-May-2018 Gabe Black <gabeblack@google.com>

systemc: Construct and manage a module name stack.

Change-Id: I5f7f64d6c3d7e08ec6d2529f3c5d84fbfc2c421b
Reviewed-on: https://gem5-review.googlesource.com/10850
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12862:df3aaa5bda42 31-May-2018 Gabe Black <gabeblack@google.com>

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 <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

12861:6cd674bd189a 30-May-2018 Gabe Black <gabeblack@google.com>

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 <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>

12860:6051cef4adec 30-May-2018 Gabe Black <gabeblack@google.com>

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 <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>

12842:79e4e6e731fe 15-May-2018 Gabe Black <gabeblack@google.com>

systemc: Flesh out the sc_port implementation slightly.

This makes other files compile because it changes the relationship
between constructors,etc., slightly.

Change-Id: I8d9a6e12ec640a82da166fe05c4f5e91f3f608de
Reviewed-on: https://gem5-review.googlesource.com/10840
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>

12839:45ad57043567 09-May-2018 Gabe Black <gabeblack@google.com>

systemc: Stub out the sc_spawn related classes and functions.

Change-Id: I79f695cca97aaae9af324eb18cab073f42f0a193
Reviewed-on: https://gem5-review.googlesource.com/10837
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>

12838:f03602fb0c75 09-May-2018 Gabe Black <gabeblack@google.com>

systemc: Stub out the sc_process_handle class.

Change-Id: I2250ccb369e0a5f2b9172d35662a9ce5e41ab1c1
Reviewed-on: https://gem5-review.googlesource.com/10836
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>

12837:413a7b490b1b 08-May-2018 Gabe Black <gabeblack@google.com>

systemc: Seperate the "external" header interface.

Most (but not all) of the SystemC headers are part of the "external"
interface that an existing, standard compliant module would include
through <systemc.h> or <systemc>. Since those follow slightly different
rules (relative includes, no gem5 includes), this change separates them
out so that they're easier to identify.

Also, this change moves the other files into a "core" subdirectory,
with the intention to add a "dt", aka data type, directory some time in
the future when those standard defined types are implemented.

Change-Id: Ida63f9cc0bc0431024d4dd691cc5b22b944a99a8
Reviewed-on: https://gem5-review.googlesource.com/10835
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>


/gem5/src/systemc/SConscript
/gem5/src/systemc/SystemC.py
SConscript
SystemC.py
kernel.cc
kernel.hh
sc_attr.cc
sc_event.cc
sc_export.cc
sc_interface.cc
sc_main.cc
sc_module.cc
sc_module_name.cc
sc_object.cc
sc_port.cc
sc_prim.cc
sc_sensitive.cc
sc_time.cc
/gem5/src/systemc/dt/int/sc_nbdefs.hh
/gem5/src/systemc/ext/core/sc_attr.hh
/gem5/src/systemc/ext/core/sc_event.hh
/gem5/src/systemc/ext/core/sc_export.hh
/gem5/src/systemc/ext/core/sc_interface.hh
/gem5/src/systemc/ext/core/sc_main.hh
/gem5/src/systemc/ext/core/sc_module.hh
/gem5/src/systemc/ext/core/sc_module_name.hh
/gem5/src/systemc/ext/core/sc_object.hh
/gem5/src/systemc/ext/core/sc_port.hh
/gem5/src/systemc/ext/core/sc_prim.hh
/gem5/src/systemc/ext/core/sc_sensitive.hh
/gem5/src/systemc/ext/core/sc_time.hh
/gem5/src/systemc/ext/dt/int/sc_nbdefs.hh
/gem5/src/systemc/kernel.cc
/gem5/src/systemc/kernel.hh
/gem5/src/systemc/sc_attr.cc
/gem5/src/systemc/sc_attr.hh
/gem5/src/systemc/sc_event.cc
/gem5/src/systemc/sc_event.hh
/gem5/src/systemc/sc_export.cc
/gem5/src/systemc/sc_export.hh
/gem5/src/systemc/sc_interface.cc
/gem5/src/systemc/sc_interface.hh
/gem5/src/systemc/sc_main.cc
/gem5/src/systemc/sc_main.hh
/gem5/src/systemc/sc_module.cc
/gem5/src/systemc/sc_module.hh
/gem5/src/systemc/sc_module_name.cc
/gem5/src/systemc/sc_module_name.hh
/gem5/src/systemc/sc_object.cc
/gem5/src/systemc/sc_object.hh
/gem5/src/systemc/sc_port.cc
/gem5/src/systemc/sc_port.hh
/gem5/src/systemc/sc_prim.cc
/gem5/src/systemc/sc_prim.hh
/gem5/src/systemc/sc_sensitive.cc
/gem5/src/systemc/sc_sensitive.hh
/gem5/src/systemc/sc_time.cc
/gem5/src/systemc/sc_time.hh