gem5.git
5 years agodev-arm: Implement GICv2 GICD_IGROUPR register
Giacomo Travaglini [Tue, 11 Sep 2018 12:15:18 +0000 (13:15 +0100)]
dev-arm: Implement GICv2 GICD_IGROUPR register

This patch is implementing GICD_IGROUPR register.

Change-Id: I1626f61fbf7deec9c81d8d2c135f1d6c0c4eb891
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12946
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agodev-arm: Fix GICv2 cpu interrupt enable flag
Giacomo Travaglini [Tue, 11 Sep 2018 11:57:36 +0000 (12:57 +0100)]
dev-arm: Fix GICv2 cpu interrupt enable flag

Read/WriteCpu methods in the GICv2 are accessing the GICC_CTRL register
as if writing any non-zero value to the register will enable IRQ
signaling to the CPU.  Instead, only the 2 least significant bits
control group0/group1 enablement.  This patch is renaming GICC_CTRL
underlying data buffer from cpuEnabled to cpuControl and it is making it
an array of uint32_t instead of bool.  cpuEnabled now becomes a method
and checks if GICC_CTRL.EnableGrp0 or GICC_CTRL.EnableGrp0 are set.

Change-Id: I40f0b3c52c40abd482a856f032bf3686f96ef641
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12945
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agodev-arm: Add basic support for level sensitive SPIs in GICv2
Adrien Pesle [Mon, 3 Sep 2018 14:43:24 +0000 (16:43 +0200)]
dev-arm: Add basic support for level sensitive SPIs in GICv2

For level sensitive interrupt IRQ line must be cleared when interrupt is
deasserted. This is not the case for edge-trigerred interrupt.

Change-Id: Ib1660da74a296750c0eb9e20878d4ee64bd23130
Reviewed-on: https://gem5-review.googlesource.com/12944
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agosim: Extend (UN)SERIALIZE_ARRAY to BitUnions
Giacomo Travaglini [Mon, 24 Sep 2018 15:45:30 +0000 (16:45 +0100)]
sim: Extend (UN)SERIALIZE_ARRAY to BitUnions

This patch is making it possible to use SERIALIZE_ARRAY and UNSERIALIZE
array for serializing arrays of BitUnions.

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

5 years agodev-arm: Make CpuLocalTimer use standard ArmInterruptPin
Giacomo Travaglini [Tue, 11 Sep 2018 14:18:02 +0000 (15:18 +0100)]
dev-arm: Make CpuLocalTimer use standard ArmInterruptPin

Change-Id: I8c4eb9389b47df8cdf1eec966bb2c9da85a7a7c8
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12744
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agodev-arm: Take into account PPI enable bit
Giacomo Travaglini [Wed, 5 Sep 2018 13:43:09 +0000 (14:43 +0100)]
dev-arm: Take into account PPI enable bit

When checking for PPIs to send to the cpu in the PL390 GIC we
were forwarding any pending PPI regardless of their masking
in the distributor.

Change-Id: I2e294abeca733cca95cd0deeb9659c7d3d9d8734
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12624
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agoarch-arm: raise/clear IRQ when writing to PMOVSCLR/SET
Giacomo Travaglini [Tue, 4 Sep 2018 11:17:15 +0000 (13:17 +0200)]
arch-arm: raise/clear IRQ when writing to PMOVSCLR/SET

Writing a 1 to the Overflow Flag Status register should trigger an
interrupt raise/clear depending on the register we are currently using
(PMOVSCLR for clearing and PMOVSSET for raising).

Change-Id: I2091456685a245712045cf7a4932ac36b7dded1d
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12531
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agoutil: Do not use $(PWD) in Makefiles
Kevin Brodsky [Tue, 18 Sep 2018 14:20:04 +0000 (15:20 +0100)]
util: Do not use $(PWD) in Makefiles

644e8cdf5ee7 ("util: Move the m5ops.h file to a shared directory")
added include/ to the include path for m5 Makefiles, based on
$(PWD): $(PWD)/../../include.

Unfortunately, this breaks when using `make -C <path>`, as -C does
not move PWD accordingly. The fix is simply to remove $(PWD), as a
relative path is just fine here.

Change-Id: Ia046c29761363b6670e52c52a604c7e70a6a305a
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12844
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

5 years agosystemc: Report errors when proc ctrl funcs are called during elab.
Gabe Black [Tue, 28 Aug 2018 04:20:18 +0000 (21:20 -0700)]
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>

5 years agosystemc: Abort verify.py if no tests were selected.
Gabe Black [Tue, 28 Aug 2018 03:39:01 +0000 (20:39 -0700)]
systemc: Abort verify.py if no tests were selected.

The various phases assume there are at least some tests, and if there
are none they may try to run malformed commands.

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

5 years agosystemc: Make verify.py run the tests from the directory they expect.
Gabe Black [Tue, 28 Aug 2018 03:34:07 +0000 (20:34 -0700)]
systemc: Make verify.py run the tests from the directory they expect.

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

5 years agosystemc: Add a --working-dir option to the test config.py.
Gabe Black [Tue, 28 Aug 2018 03:20:40 +0000 (20:20 -0700)]
systemc: Add a --working-dir option to the test config.py.

The tests expect to be run from a certain directory. Generally that
doesn't matter, but in at least one case the test opens a file with a
relative path, and that doesn't work unless CWD is what it expects.

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

5 years agosystemc: Change the test binaries to use rpath.
Gabe Black [Tue, 28 Aug 2018 03:08:05 +0000 (20:08 -0700)]
systemc: Change the test binaries to use rpath.

Use rpath to link the gem5 dynamic library into the systemc test
binaries so that they don't have to be run from a particular directory
to resolve all their linking dependencies.

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

5 years agosystemc: Handle sc_stop called from sc_main correctly.
Gabe Black [Sun, 26 Aug 2018 22:53:31 +0000 (15:53 -0700)]
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>

5 years agosystemc: Fix some issues with starvation checks.
Gabe Black [Sun, 26 Aug 2018 22:34:31 +0000 (15:34 -0700)]
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>

5 years agosystemc: When sc_start-ing with zero time, ensure the ready event runs.
Gabe Black [Sun, 26 Aug 2018 21:56:30 +0000 (14:56 -0700)]
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>

5 years agosystemc: Fix where we checked if sc_stop was called durig elaboration.
Gabe Black [Sun, 26 Aug 2018 21:54:20 +0000 (14:54 -0700)]
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>

5 years agosystemc: Make sure methods aren't restarted by yield.
Gabe Black [Sat, 25 Aug 2018 00:58:10 +0000 (17:58 -0700)]
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>

5 years agosystemc: When a thread completes, yield to the scheduler.
Gabe Black [Sat, 25 Aug 2018 00:19:39 +0000 (17:19 -0700)]
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>

5 years agosystemc: Implement positional binding.
Gabe Black [Fri, 24 Aug 2018 00:55:18 +0000 (17:55 -0700)]
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>

5 years agosystemc: Use sc_assert to check the number of interfaces.
Gabe Black [Thu, 23 Aug 2018 07:41:22 +0000 (00:41 -0700)]
systemc: Use sc_assert to check the number of interfaces.

The sc_port code had been using the .at() function of the vector class,
but when that failed it threw an exception, and it was very difficult
to tell where the exception came from from how gem5 crashed. This
change switches to sc_assert (the systemc version of assert) which
makes the cause/location of failures much more obvious.

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

5 years agosystemc: Get rid of the unused warning function in sc_event_finder_t.
Gabe Black [Thu, 23 Aug 2018 07:40:11 +0000 (00:40 -0700)]
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>

5 years agosystemc: Use the eq pointer directly less often in the scheduler.
Gabe Black [Thu, 23 Aug 2018 06:51:16 +0000 (23:51 -0700)]
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>

5 years agosystemc: Make sc_process_b less hokey, and make WAIT* work.
Gabe Black [Thu, 23 Aug 2018 05:45:29 +0000 (22:45 -0700)]
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>

5 years agosystemc: Handle null and omitted event names.
Gabe Black [Thu, 23 Aug 2018 04:59:47 +0000 (21:59 -0700)]
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>

5 years agosystemc: Handle null sc_object names.
Gabe Black [Thu, 23 Aug 2018 04:54:19 +0000 (21:54 -0700)]
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>

5 years agosystemc: Check for time overflow in sc_start.
Gabe Black [Thu, 23 Aug 2018 04:37:11 +0000 (21:37 -0700)]
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>

5 years agosystemc: Handle sc_time_stamp before any sc_time is constructed.
Gabe Black [Thu, 23 Aug 2018 04:35:44 +0000 (21:35 -0700)]
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>

5 years agosystemc: Make the test config retrieve sc_main results.
Gabe Black [Thu, 23 Aug 2018 03:33:26 +0000 (20:33 -0700)]
systemc: Make the test config retrieve sc_main results.

Accellera's implementation prints any sc_report which is thrown and
escapes sc_main, so we need to do the same to make some tests pass.
Arguably gem5 should fail if sc_main reports an error, but verify.py
would interpret that as the test failing too, and some tests
purposefully generate errors.

This change also stops using the logging module. It wasn't really
providing any benefit, and added extra decoration to log messages
which confused verify.py.

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

5 years agosystemc: Keep track of how sc_main completes and expose that to python.
Gabe Black [Thu, 23 Aug 2018 03:31:27 +0000 (20:31 -0700)]
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>

5 years agosystemc: Make the report handler handle null messages.
Gabe Black [Thu, 23 Aug 2018 02:26:38 +0000 (19:26 -0700)]
systemc: Make the report handler handle null messages.

It was checking the first character of the message for a null byte, but
not whether the message string pointer itself was null.

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

5 years agosystemc: If no sc_module_name was used, throw an error.
Gabe Black [Thu, 23 Aug 2018 02:24:18 +0000 (19:24 -0700)]
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>

5 years agosystemc: If an event is a delta notification, checked if it's timed.
Gabe Black [Thu, 23 Aug 2018 01:40:32 +0000 (18:40 -0700)]
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>

5 years agosystemc: If sc_main returns, don't do any more systemc stuff.
Gabe Black [Thu, 23 Aug 2018 00:52:19 +0000 (17:52 -0700)]
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>

5 years agosystemc: Clear out the scheduler more agressively and with common code.
Gabe Black [Wed, 22 Aug 2018 21:54:08 +0000 (14:54 -0700)]
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>

5 years agosystemc: Override notifyWork for timeout/event_and_list sensitivities.
Gabe Black [Wed, 22 Aug 2018 21:28:37 +0000 (14:28 -0700)]
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>

5 years agosystemc: Make sure no delta cycles are scheduled when stopping.
Gabe Black [Wed, 22 Aug 2018 02:10:47 +0000 (19:10 -0700)]
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>

5 years agosystemc: Make sure an immediate notification overrides a delayed one.
Gabe Black [Wed, 22 Aug 2018 01:59:13 +0000 (18:59 -0700)]
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>

5 years agosystemc: Improve scheduler cleanup.
Gabe Black [Tue, 21 Aug 2018 22:29:15 +0000 (15:29 -0700)]
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>

5 years agosystemc: Implement most of sc_inout.
Gabe Black [Tue, 21 Aug 2018 22:11:59 +0000 (15:11 -0700)]
systemc: Implement most of sc_inout.

Because sc_inout needs sc_dt::sc_logic and that probably calls
functions from dt_sc_mempool.cc and because those hadn't yet been
stubbed out. This change adds stubs for those as well.

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

5 years agosystemc: Make sc_out delegate to its base class sc_inout.
Gabe Black [Tue, 21 Aug 2018 00:45:42 +0000 (17:45 -0700)]
systemc: Make sc_out delegate to its base class sc_inout.

The spec says these are essentially identical classes, they just have
both so that users can show their intent.

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

5 years agosystemc: Generalize gem5 style event scheduling.
Gabe Black [Sat, 18 Aug 2018 00:48:56 +0000 (17:48 -0700)]
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>

5 years agosystemc: Make sure sc_start waits for simulation even when starving.
Gabe Black [Sat, 18 Aug 2018 00:30:31 +0000 (17:30 -0700)]
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>

5 years agosystemc: Rework the init phase for the new way delta notes are handled.
Gabe Black [Fri, 17 Aug 2018 03:59:29 +0000 (20:59 -0700)]
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>

5 years agosystemc: Make a test use cout for all its messages.
Gabe Black [Fri, 17 Aug 2018 02:10:27 +0000 (19:10 -0700)]
systemc: Make a test use cout for all its messages.

This makes them end up in simout so verify.py can find them when it's
checking output.

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

5 years agosystemc: Implement a significant portion of sc_clock.
Gabe Black [Fri, 17 Aug 2018 02:10:09 +0000 (19:10 -0700)]
systemc: Implement a significant portion of sc_clock.

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

5 years agosystemc: Don't run the ready event inline when unpausing.
Gabe Black [Fri, 17 Aug 2018 02:01:28 +0000 (19:01 -0700)]
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>

5 years agosystemc: Rework how delta and timed notifications/timeouts are tracked.
Gabe Black [Fri, 17 Aug 2018 01:59:06 +0000 (18:59 -0700)]
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>

5 years agomem-ruby: Fix a bug in MessageBuffer randomization
Xianwei Zhang [Wed, 19 Sep 2018 23:14:40 +0000 (19:14 -0400)]
mem-ruby: Fix a bug in MessageBuffer randomization

In the previous implementation, messages are randomly inserted with
delays only if both RubySystem and MessageBuffer randomization flags
are set true.  However, to find race conditions and cover more slicc
transitions, ruby random testers rely on setting RubySystem flag to
turn on randomization on all message buffers.
As a fix, this patch enables a message buffer to have randomization
when either RubySystem or its own flag is set.

Change-Id: I1e076908ff07e5846ebad4f4fc1c8f28d40bbfd4
Reviewed-on: https://gem5-review.googlesource.com/12784
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

5 years agosystemc: When sc_start is told to run zero time, do one delta cycle.
Gabe Black [Thu, 16 Aug 2018 21:42:24 +0000 (14:42 -0700)]
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>

5 years agosystemc: Don't run clocked thread processes during the init phase.
Gabe Black [Thu, 16 Aug 2018 07:49:25 +0000 (00:49 -0700)]
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>

5 years agosystemc: Track exports and prim channels, and call their callbacks.
Gabe Black [Thu, 16 Aug 2018 06:35:38 +0000 (23:35 -0700)]
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>

5 years agosystemc: Fix the priority of the maximum time event.
Gabe Black [Thu, 16 Aug 2018 02:16:41 +0000 (19:16 -0700)]
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>

5 years agosystemc: Implement a little more of sc_time.
Gabe Black [Thu, 16 Aug 2018 00:42:52 +0000 (17:42 -0700)]
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>

5 years agosystemc: Teach verify.py to ignore another deprecation warning.
Gabe Black [Thu, 16 Aug 2018 00:42:30 +0000 (17:42 -0700)]
systemc: Teach verify.py to ignore another deprecation warning.

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

5 years agosystemc: Generalize ignoring info messages in the reference output.
Gabe Black [Tue, 14 Aug 2018 01:50:28 +0000 (18:50 -0700)]
systemc: Generalize ignoring info messages in the reference output.

Those messages are very implementation specific and don't (generally)
affect correctness. This makes it easier to ignore info messages based
on their number.

This change also makes the output checker ignore a similarly styled
message gem5 generates. We should consider making gem5 not generate
that message and have it generate another message instead which is
specific to gem5. We would need to filter that out too when comparing
results.

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

5 years agosystemc: Implement the sc_in class.
Gabe Black [Tue, 14 Aug 2018 01:20:52 +0000 (18:20 -0700)]
systemc: Implement the sc_in class.

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

5 years agosystemc: Implement port binding except positional binding.
Gabe Black [Tue, 14 Aug 2018 01:19:15 +0000 (18:19 -0700)]
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>

5 years agosystemc: Make BindInfo track ports or interfaces.
Gabe Black [Tue, 14 Aug 2018 01:16:14 +0000 (18:16 -0700)]
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>

5 years agosystemc: Implement sc_event_finder.
Gabe Black [Tue, 14 Aug 2018 01:14:35 +0000 (18:14 -0700)]
systemc: Implement sc_event_finder.

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

5 years agosystemc: Exclude two more tests which have undefined functions.
Gabe Black [Tue, 14 Aug 2018 01:10:05 +0000 (18:10 -0700)]
systemc: Exclude two more tests which have undefined functions.

It seems that implementing more of systemc makes the compiler think it
wants an implementation, and so the build fails with linker errors.

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

5 years agosystemc: Ensure delta notifications happen at the right time after sc_pause.
Gabe Black [Fri, 10 Aug 2018 03:31:35 +0000 (20:31 -0700)]
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>

5 years agosystemc: Implement sc_export.
Gabe Black [Thu, 9 Aug 2018 02:31:56 +0000 (19:31 -0700)]
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>

5 years agosystemc: Don't schedule the update phase if the event queue is null.
Gabe Black [Wed, 8 Aug 2018 09:56:00 +0000 (02:56 -0700)]
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>

5 years agosystemc: Use an std::list to track all modules.
Gabe Black [Wed, 8 Aug 2018 09:03:30 +0000 (02:03 -0700)]
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>

5 years agosystemc: Track the module in the end_of_elaboration callback.
Gabe Black [Wed, 8 Aug 2018 09:02:25 +0000 (02:02 -0700)]
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>

5 years agosystemc: Partially implement the sc_signal class template.
Gabe Black [Wed, 8 Aug 2018 08:32:00 +0000 (01:32 -0700)]
systemc: Partially implement the sc_signal class template.

There are a few details of this class that still need to be fleshed
out, but this implements most of it.

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

5 years agosystemc: Add a nonstandard sc_status pretty printer operator.
Gabe Black [Wed, 8 Aug 2018 08:30:47 +0000 (01:30 -0700)]
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>

5 years agosystemc: Set the scheduler's event queue earlier.
Gabe Black [Wed, 8 Aug 2018 08:29:27 +0000 (01:29 -0700)]
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>

5 years agosystemc: "Implement" sc_interface's methods.
Gabe Black [Tue, 7 Aug 2018 11:53:01 +0000 (04:53 -0700)]
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>

5 years agosystemc: Implement a few more member functions for sc_time.
Gabe Black [Tue, 7 Aug 2018 11:49:04 +0000 (04:49 -0700)]
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>

5 years agosystemc: Use the new python interface to delay fixing the timescale.
Gabe Black [Tue, 7 Aug 2018 10:54:08 +0000 (03:54 -0700)]
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>

5 years agosystemc: Generalize working with the systemc python module from C++.
Gabe Black [Tue, 7 Aug 2018 10:51:18 +0000 (03:51 -0700)]
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>

5 years agosystemc: Ignore a warning in the reference test outputs.
Gabe Black [Tue, 7 Aug 2018 08:29:29 +0000 (01:29 -0700)]
systemc: Ignore a warning in the reference test outputs.

The warning is about deprecated sc_module constructors which don't take
an sc_module_name.

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

5 years agosystemc: Fix the seed used with sc_gen_unique_name for sc_port.
Gabe Black [Tue, 7 Aug 2018 08:26:14 +0000 (01:26 -0700)]
systemc: Fix the seed used with sc_gen_unique_name for sc_port.

The seed should only be "port" not "sc_port".

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

5 years agosystemc: Implement sc_gen_unique_name.
Gabe Black [Tue, 7 Aug 2018 08:23:01 +0000 (01:23 -0700)]
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>

5 years agosystemc: Always set USE_SYSTEMC=1 when compiling with verify.py.
Gabe Black [Sat, 28 Jul 2018 08:49:52 +0000 (01:49 -0700)]
systemc: Always set USE_SYSTEMC=1 when compiling with verify.py.

It doesn't make sense not to have systemc enabled when building the
systemc regression tests.

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

5 years agosystemc: Make verify.py ignore an Info: message.
Gabe Black [Sat, 28 Jul 2018 08:13:23 +0000 (01:13 -0700)]
systemc: Make verify.py ignore an Info: message.

This message is about how to disable a warning about sc_bit being
deprecated.

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

5 years agosystemc: Adjust a warning to match Accellera.
Gabe Black [Sat, 28 Jul 2018 08:07:15 +0000 (01:07 -0700)]
systemc: Adjust a warning to match Accellera.

This is to pass fix a diff in the regression tests.

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

5 years agosyscall_emul: implement dir-related syscalls
Brandon Potter [Wed, 18 Apr 2018 18:45:37 +0000 (14:45 -0400)]
syscall_emul: implement dir-related syscalls

Add getdents, rmdir, chdir, and mknod to SE mode for x86.

Change-Id: I387ea3066869e8999bc0064f74070f4e47c1e9a1
Reviewed-on: https://gem5-review.googlesource.com/12112
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>

5 years agosyscall_emul: refactor FDEntry and children classes
Brandon Potter [Wed, 18 Apr 2018 18:44:10 +0000 (14:44 -0400)]
syscall_emul: refactor FDEntry and children classes

Strips off superfluous inline specifiers in header file.

Changes return types and parameters that deal with strings
to include the const& specifiers.

Change-Id: I570b1801abb059b91216f0223458d00963b9ca1c
Reviewed-on: https://gem5-review.googlesource.com/12111
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

5 years agosyscall_emul: style changes and FDArray refactor
Brandon Potter [Wed, 18 Apr 2018 18:42:31 +0000 (14:42 -0400)]
syscall_emul: style changes and FDArray refactor

Some members were defined as public when they should have been
privately declared so these were moved to the appropriate spot.

The operator[] had inline specified for for an in-class
definition which is redundant since inline definitions are
always implicitly inline.

Private members had the leading underscore applied to them to
denote that they're private (consistent with style guide).

Changed static const defined class variable into a constexpr
with brace-list initialization.

Change-Id: If3054416b57827d1542e9ebab428d67d0e767723
Reviewed-on: https://gem5-review.googlesource.com/12110
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

5 years agosyscall_emul: expand AuxVector class
Brandon Potter [Fri, 4 May 2018 21:55:24 +0000 (17:55 -0400)]
syscall_emul: expand AuxVector class

The AuxVector class is responsible for holding Process data.
The data that it holds is normally setup by an OS kernel in
the process address space. The purpose behind doing this is
to pass in information that the process will need for various
reasons. (Check out the enum in the header file for an idea of
what the AuxVector holds.)

The AuxVector struct was changed into a class and encapsulation
methods were added to protect access to the member variables.

The host ISA may have a different endianness than the simulated
ISA. Since data is passed between the process address space and
the simulator for auxiliary vectors, we need to worry about
maintaining endianness for the right context.

Change-Id: I32c5ac4b679559886e1efeb4b5483b92dfc94af9
Reviewed-on: https://gem5-review.googlesource.com/12109
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>

5 years agoscons: remove as version check
Ciro Santilli [Fri, 31 Aug 2018 10:39:19 +0000 (11:39 +0100)]
scons: remove as version check

GNU as 2.31.1 checks if the input and output files are the same:

Assembler messages:
Fatal error: The input and output files must be distinct

The check already does not work for llvm-as which has a different
output format.

Since it is too hard to maintain the check correctly for all possible
assemblers, it is better to just remove it completely.

Change-Id: I38a993ab83ca83d4a2f5e77820d2ca903f70c6ac
Reviewed-on: https://gem5-review.googlesource.com/12403
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agomem-cache: Fix non-bijective function in Skewed caches
Daniel R. Carvalho [Wed, 19 Sep 2018 08:19:06 +0000 (10:19 +0200)]
mem-cache: Fix non-bijective function in Skewed caches

The hash() function must be bijective for the skewed caches to work,
however when the hashing is done on top of a one-bit address, the
MSB and LSB refer to the same bit, and therefore their xor will
always be zero.

This patch adds a fatal error to not allow the user to set an invalid
value for the number of sets that would generate that bug.

As a side note, the missing header for the bitfields functions has
been added.

Change-Id: I35a03ac5fdc4debb091f7f2db5db33568d0b0021
Reviewed-on: https://gem5-review.googlesource.com/12724
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

5 years agodev, arm: fix error class-memaccess with GCC >= 8.1
Maurice Becker [Tue, 18 Sep 2018 08:14:24 +0000 (10:14 +0200)]
dev, arm: fix error class-memaccess with GCC >= 8.1

From GCC 8.1 on GCC issues a warning when using memset et al on structs and
classes. With the way gem5 builds, this actually prevents successful
builds.

Instead of using a pointer with SCSIReply as type, we cast to a void
pointer to avoid the message. On the way we wrap the memset call into a
method of SCSIReply called reset for better code readability.

Signed-off-by: Maurice Becker <madnaurice@googlemail.com>
Change-Id: I3ed3fd9714be5d253aba01ca00b1863e1ae5cb68
Reviewed-on: https://gem5-review.googlesource.com/12685
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

5 years agoPl011: Added registers UART_RSR/UART_ECR
Maurice Becker [Tue, 18 Sep 2018 08:27:40 +0000 (10:27 +0200)]
Pl011: Added registers UART_RSR/UART_ECR

UART_RSR shows errors with the transmission and UART_ECR can clear
those (according to PL011 Technical Reference Manual Revision r1p4).  As
these transmission errors never occur, they are implemented as RAZ/WI.

Both registers exist at the same offset 0x004. RSR is read-only, ECR is
write-only.

Signed-off-by: Maurice Becker <madnaurice@googlemail.com>
Change-Id: Ia9d13c90c65feccf3ecec36a782170755b1e1c02
Reviewed-on: https://gem5-review.googlesource.com/12686
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agomem: Implement QoS Proportional Fair policy
Giacomo Travaglini [Fri, 17 Aug 2018 09:17:59 +0000 (10:17 +0100)]
mem: Implement QoS Proportional Fair policy

Providing a configurable fair scheduling policy based on utilization;
utilization is directly proportional to a score which is inversely
proportional to the QoS priority. It is meant to avoid starvation of low
priority packets.

Users can tune the policy by adjusting the weight parameter (weight of
the following formula)

new_score = ((1.0 - weight) * old_score) + (weight * served_bytes)

Change-Id: I7679e234b916c57ebed06cec0ff3cff3cf2aef22
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12359
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>

5 years agoconfig, arm, power: Example to report the power for the L2 Cache
Sherif Elhabbal [Fri, 14 Sep 2018 15:10:24 +0000 (17:10 +0200)]
config, arm, power: Example to report the power for the L2 Cache

This patch add an example to demonstrate how to report the power for the L2
Cache of the big cluster separately ,it decouples the L2 contributions from
the CPU power equation

Signed-off-by: Sherif Elhabbal <elhabbalsherif@gmail.com>
Change-Id: Idde43c8bcb10df9d44d20282eaf21ce87a9d3f58
Reviewed-on: https://gem5-review.googlesource.com/12684
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Anouk Van Laer <anouk.vanlaer@arm.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

5 years agopower: Add a clock_period variable to power expressions
Sherif Elhabbal [Thu, 13 Sep 2018 14:01:55 +0000 (16:01 +0200)]
power: Add a clock_period variable to power expressions

Currently 'Clock period in ticks' stat is not accessible in power equations .
This patch adds a variable 'clock_period' to be referenced to get the Clock period in
ticks

Signed-off-by: Sherif Elhabbal <elhabbalsherif@gmail.com>
Change-Id: Icac6a2e2003ed75d1680180e53343b0203139d72
Reviewed-on: https://gem5-review.googlesource.com/12664
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agoFix SConstruct for asan build
Earl Ou [Fri, 7 Sep 2018 07:16:53 +0000 (15:16 +0800)]
Fix SConstruct for asan build

Sometimes it's easier to debug gem5 built with ASan enabled. This CL fixes
some build error when using --with-asan.

Bug: None
Test: ./scripts/build_gem5 --with-asan --with-ubsan build/ARM/gem5.debug

Change-Id: Iaaaaebc3f25749e11f97bf454ddd0153b3de56e7
Reviewed-on: https://gem5-review.googlesource.com/12511
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>

5 years agoarch-arm: Correction for address size in EL1&0 translation
Anouk Van Laer [Tue, 4 Sep 2018 10:44:42 +0000 (11:44 +0100)]
arch-arm: Correction for address size in EL1&0 translation

When doing EL0/1 translation in stage2, the
physical address size will be defined by the
hypervisor (via VTCR_EL2.ps, not TCR.ips).

See D10.2.121 of the ARM ARM.

Change-Id: Ic7df97c0f5950a648f7408cde3955a640b562c1d
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12552
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>

5 years agoarch-arm: Correction to address size in EL2/EL3
Anouk Van Laer [Mon, 3 Sep 2018 10:18:31 +0000 (11:18 +0100)]
arch-arm: Correction to address size in EL2/EL3

This commit corrects how the address size is
determined in EL2/EL3.  Previously, TCR_ELx.ips
was used but this should be TCR_ELx.ps.

Change-Id: I7e5a2f376335532a1d1c8c74d12a416617474ae2
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12551
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>

5 years agomem-cache: Fix bug in handleAtomicReqMiss
Nikos Nikoleris [Sat, 1 Sep 2018 14:38:13 +0000 (15:38 +0100)]
mem-cache: Fix bug in handleAtomicReqMiss

"4976ff5 mem-cache: Refactor the recvAtomic function" introduced a bug
where if an atomic request that fills in using the tempBlock it will
not evict it when it finishes handling the request as it should. This
triggers an assertion. This change fixes this bug.

Change-Id: I73c808a7e15237eddb36b5448ef6728f7bcf7fd9
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12644
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

5 years agodev-arm: fix build to missing Pl390 to Gicv2 rename
Ciro Santilli [Wed, 12 Sep 2018 14:33:01 +0000 (15:33 +0100)]
dev-arm: fix build to missing Pl390 to Gicv2 rename

Change-Id: I6756f2c789aaca410d201aa64147443b66afee39
Reviewed-on: https://gem5-review.googlesource.com/12645
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agoconfig, dev-arm: Fix UART handling baremetal mode
Ciro Santilli [Thu, 30 Aug 2018 09:58:10 +0000 (10:58 +0100)]
config, dev-arm: Fix UART handling baremetal mode

fs.py in baremetal mode currently fails for the VExpress_GEM5_V1 platform
due to inconsistent UART naming with error message:

AttributeError: object 'VExpress_GEM5_V1' has no attribute 'uart'

Consistently name keep all UARTs in the Arm platforms in a vector named
'uart' or as a single device named 'uart'. Update the configuration
scripts to reflect the fact that 'uart' can be a vector.

Change-Id: I20b8dbac794d6a9be19b6ce8c335a097872132fb
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12473
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agodev-arm: rename Pl390 to GicV2
Ciro Santilli [Thu, 30 Aug 2018 13:50:31 +0000 (14:50 +0100)]
dev-arm: rename Pl390 to GicV2

The Pl390 model has evolved and acquired a lot of the features from GICv2,
which means that the name is no longer appropriate. Rename it to GICv2
since this is more representative of the supported features.

GICv2 is backwards compatible with the older Pl390, so we decided to
simply rename the class to represent both GICv2 and older interfaces such
as the instead of creating a new separate one.

Change-Id: I1c05fba8b3cb5841c66480e9f05b8c873eba3229
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12492
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agodev-arm: improve Pl390 parameters
Ciro Santilli [Thu, 30 Aug 2018 13:50:31 +0000 (14:50 +0100)]
dev-arm: improve Pl390 parameters

Remove default dist_addr and cpu_addr register addresses since those are
purely platform specific.

Parametrize the cpu_size parameter. RealViewPBX has the Gic CPU and
distributor base too close for the newer CPU size of 0x2000, leading to
overlap.

This was introduced in I90a9f669a46a37d79c6cc542087cf91f2044f104 and makes
using RealViewPBX fail with:

fatal: system.membus has two ports responding within range
[0x1f000100 : 0x1f0020ff]:
        system.realview.gic.pio
        system.realview.gic.pio

Change-Id: Ic6c0e6b3d4705ff369eb739d54a1173a47819b7d
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12491
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agocpu: Replace the fastmem with a new CPU model
Andreas Sandberg [Tue, 15 Mar 2016 15:45:12 +0000 (15:45 +0000)]
cpu: Replace the fastmem with a new CPU model

The AtomicSimpleCPU used to be able to access memory directly to speed
up simulation if no caches are used. This is fine as long as no
switching between CPU models is required. In order to switch to a new
CPU model that requires caches, we currently need to checkpoint the
system and restore it into a new configuration. The new
'atomic_noncaching' memory mode provides a solution that avoids this
issue since caches are bypassed in this mode. This changeset removes
the old fastmem option from the AtomicSimpleCPU and introduces a new
CPU, NonCachingSimpleCPU, which derives from the AtomicSimpleCPU.

The NonCachingSimpleCPU uses the same mechanism as the AtomicSimpleCPU
used to use when accessing memory in when fastmem was enabled.

This changeset also introduces a new switcheroo test that tests
switching between a NonCachingSimpleCPU and a TimingSimpleCPU with
caches.

Change-Id: If01893f9b37528b14f530c11ce6f53c097582c21
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12419
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

5 years agosystemc: Adjust some whitespace in a print out.
Gabe Black [Sat, 28 Jul 2018 07:57:55 +0000 (00:57 -0700)]
systemc: Adjust some whitespace in a print out.

This makes a test output file diff successfully.

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