gem5.git
6 years agocpu: Fix MinorCPU executing Crypto Instructions
Giacomo Travaglini [Mon, 14 May 2018 10:46:10 +0000 (11:46 +0100)]
cpu: Fix MinorCPU executing Crypto Instructions

Crypto instruction classes added to the MinorDefaultFloatSimdFU.

Change-Id: I0cd4aa422bec74285595312a8cf01f5f425a82cd
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/13251
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

6 years agoarch-arm: AArch64 Crypto AES
Giacomo Travaglini [Wed, 9 May 2018 10:52:05 +0000 (11:52 +0100)]
arch-arm: AArch64 Crypto AES

This patch implements the AArch64 AES instructions
from the Crypto extension.

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

6 years agoarch-arm: AArch64 Crypto SHA
Giacomo Travaglini [Tue, 1 May 2018 09:14:35 +0000 (10:14 +0100)]
arch-arm: AArch64 Crypto SHA

This patch implements the AArch64 secure hashing instructions
from the Crypto extension.

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

6 years agoarch-arm: AArch32 Crypto AES
Matt Horsnell [Wed, 9 May 2018 11:40:24 +0000 (12:40 +0100)]
arch-arm: AArch32 Crypto AES

This patch implements the AArch32 AES instructions
from the Crypto extension.

Change-Id: I51e6deda748b0c26135bcfe9d0c7128f3af91f3d
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Matt Horsnell <matt.horsnell@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/13248
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

6 years agoarch-arm: AArch32 Crypto SHA
Matt Horsnell [Wed, 11 Apr 2018 13:08:45 +0000 (14:08 +0100)]
arch-arm: AArch32 Crypto SHA

This patch implements the AArch32 secure hashing instructions
from the Crypto extension.

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

6 years agodev, arm: remove the RealViewEB platform
Ciro Santilli [Tue, 4 Sep 2018 13:11:10 +0000 (14:11 +0100)]
dev, arm: remove the RealViewEB platform

This is an old platform, and we haven't had official Linux kernel configs
for it in a while, so we've decided to deprecate it.

Furthermore, trying to use it fails with:

object 'RealViewEB' has no attribute 'pci_host'

and the last commit in the class happened two years ago, which indicates
that no one has been using it.

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

6 years agoarch-arm: Mark ArmProcess method as override
Matteo Andreozzi [Tue, 2 Oct 2018 14:32:41 +0000 (15:32 +0100)]
arch-arm: Mark ArmProcess method as override

Allows compilation on clang3.5+ by fixing Winconsistent-missing-override

Change-Id: Ic0ebf3869fc2d9a29fcf7cf5a6535952f41714d0
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/13227
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

6 years agomem-cache: Fix FALRU hash invalidation
Daniel R. Carvalho [Thu, 4 Oct 2018 08:53:12 +0000 (10:53 +0200)]
mem-cache: Fix FALRU hash invalidation

The block was being invalidated before the hash could erase
its entry, therefore it was using invalid values (tag was
being assigned MaxAddr and the secure bit was reset).

This change reorders the calls, so that the appropriate hash
entry is erased.

Change-Id: I161463df0f8f5220179bc68d7be12051e5390d01
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/13210
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

6 years agomem-cache: Make checking function const in FALRU
Daniel R. Carvalho [Wed, 3 Oct 2018 12:55:31 +0000 (14:55 +0200)]
mem-cache: Make checking function const in FALRU

The checking function should not be able to modify either
the head and tail pointers nor should it modify its class.

Change-Id: I2ad495f0c8c6b778d48512143e94b4c9a353f22e
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/13209
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

6 years agomem-cache: Make boundaries in FALRU an STL container
Daniel R. Carvalho [Wed, 3 Oct 2018 12:49:57 +0000 (14:49 +0200)]
mem-cache: Make boundaries in FALRU an STL container

Turn the dynamically allocated array of pointers "boundaries"
into a STL vector.

Change-Id: I3409898473b155f69b4c6e038eba2dffb5b09380
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/13208
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

6 years agomem-cache: Fix FALRU inCachesMask initialization
Daniel R. Carvalho [Wed, 3 Oct 2018 12:37:15 +0000 (14:37 +0200)]
mem-cache: Fix FALRU inCachesMask initialization

inCachesMask is not being initialized, which triggers an assertion
on insertion. Fix this by implementing a default constructor for
the FALRUBlk.

Change-Id: I587cf5e0191c4587d938e6ab6036ec1b32f37793
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/13207
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

6 years agosystemc: Change the default naming scheme to use sc_gen_unique_name.
Gabe Black [Wed, 5 Sep 2018 07:40:04 +0000 (00:40 -0700)]
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>

6 years agosystemc: "Fix" some error message formatting.
Gabe Black [Wed, 5 Sep 2018 07:06:26 +0000 (00:06 -0700)]
systemc: "Fix" some error message formatting.

These changes make the output match what Accellera outputs so that the
tests will pass.

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

6 years agosystemc: Fix a typo/bug in sc_int_base.hh.
Gabe Black [Wed, 5 Sep 2018 06:49:59 +0000 (23:49 -0700)]
systemc: Fix a typo/bug in sc_int_base.hh.

When being turned into gem5 coding style, a pair of "!" operators were
dropped, reversing the behavior of the functions involved.

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

6 years agosystemc: Make some tests use cout instead of cerr to report completion.
Gabe Black [Wed, 5 Sep 2018 01:13:23 +0000 (18:13 -0700)]
systemc: Make some tests use cout instead of cerr to report completion.

cerr goes to simerr, but we compare simout against the golden output.

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

6 years agosystemc: Copy the msgType and msg parameters of sc_report.
Gabe Black [Wed, 5 Sep 2018 01:05:13 +0000 (18:05 -0700)]
systemc: Copy the msgType and msg parameters of sc_report.

The original strings pointed to by those parameters may go away before
the sc_report has been completely consumed. By copying them, we make
sure other consumers downstream can still access them.

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

6 years agosystemc: Ensure sc_stop during callbacks actually stops.
Gabe Black [Tue, 4 Sep 2018 22:09:48 +0000 (15:09 -0700)]
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>

6 years agosystemc: Implement the nonstandard at_negedge and at_posedge.
Gabe Black [Sun, 2 Sep 2018 01:53:23 +0000 (18:53 -0700)]
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>

6 years agosystemc: When stopping immediately, block new processes/updates.
Gabe Black [Sun, 2 Sep 2018 01:27:02 +0000 (18:27 -0700)]
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>

6 years agosystemc: Teach verify.py to ignore two types of errors.
Gabe Black [Sun, 2 Sep 2018 00:51:09 +0000 (17:51 -0700)]
systemc: Teach verify.py to ignore two types of errors.

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

6 years agosystemc: Mark a test as expected to fail/report an error.
Gabe Black [Sun, 2 Sep 2018 00:50:13 +0000 (17:50 -0700)]
systemc: Mark a test as expected to fail/report an error.

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

6 years agosystemc: Add some error checks to sc_set_default_time_unit.
Gabe Black [Sun, 2 Sep 2018 00:49:20 +0000 (17:49 -0700)]
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>

6 years agosystemc: Mark some tests as expected to fail.
Gabe Black [Sun, 2 Sep 2018 00:30:58 +0000 (17:30 -0700)]
systemc: Mark some tests as expected to fail.

One of them, systemc/kernel/sc_time/test07, should fail, but it should
fail from an error check and not a floating point exception like it
currently does.

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

6 years agosystemc: Implement sc_(g|s)et_time_resolution.
Gabe Black [Sun, 2 Sep 2018 00:15:24 +0000 (17:15 -0700)]
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>

6 years agosystemc: Teach verify.py to ignore a new error.
Gabe Black [Sat, 1 Sep 2018 23:40:55 +0000 (16:40 -0700)]
systemc: Teach verify.py to ignore a new error.

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

6 years agosystemc: Record that one of the tests will report an error.
Gabe Black [Sat, 1 Sep 2018 23:40:07 +0000 (16:40 -0700)]
systemc: Record that one of the tests will report an error.

This test purposefully fails with an error.

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

6 years agosystemc: Report an error if n <= 0 in wait(int n).
Gabe Black [Sat, 1 Sep 2018 23:37:55 +0000 (16:37 -0700)]
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>

6 years agosystemc: Toggle off clumping methods together in the ready list.
Gabe Black [Sat, 1 Sep 2018 00:34:38 +0000 (17:34 -0700)]
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>

6 years agosystemc: Store timed notifications in a list instead of a set.
Gabe Black [Fri, 31 Aug 2018 23:18:10 +0000 (16:18 -0700)]
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>

6 years agosystemc: Implement sc_fifo::dump and improve sc_fifo::print.
Gabe Black [Fri, 31 Aug 2018 00:41:05 +0000 (17:41 -0700)]
systemc: Implement sc_fifo::dump and improve sc_fifo::print.

The print function is supposed to print both pending and committed
writes, apparently.

Accellera's implementation of sc_fifo uses a ring buffer to store the
entries and manages a head and tail pointer to keep track of what's
full, etc. Their dump function prints that whole buffer using the
indexes. When not using a ring buffer, there's no easy way to determine
what those indexes should be.

Fortunately the test that uses dump never moves away from the base of
the ring buffer, so I can get the same effect (which also makes sense
on its own) by printing the index into the fifo instead.

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

6 years agosystemc: Implement the << operator for sc_signal.
Gabe Black [Thu, 30 Aug 2018 23:01:47 +0000 (16:01 -0700)]
systemc: Implement the << operator for sc_signal.

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

6 years agosystemc: Implement the "event()" style sc_signal methods.
Gabe Black [Thu, 30 Aug 2018 22:51:51 +0000 (15:51 -0700)]
systemc: Implement the "event()" style sc_signal methods.

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

6 years agosystemc: Add a "changeStamp" value to the scheduler.
Gabe Black [Thu, 30 Aug 2018 22:49:56 +0000 (15:49 -0700)]
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>

6 years agosystemc: Teach verify.py to ignore "In file: *" in test output.
Gabe Black [Thu, 30 Aug 2018 21:55:55 +0000 (14:55 -0700)]
systemc: Teach verify.py to ignore "In file: *" in test output.

Those lines are sensitive to the paths to the test files and are even
redacted in the golden reference output, presumably for that reason.

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

6 years agosystemc: Adjust some error messages to match Accellera.
Gabe Black [Thu, 30 Aug 2018 21:51:25 +0000 (14:51 -0700)]
systemc: Adjust some error messages to match Accellera.

Those messages include an error number in the Accellera implementation.
Add those numbers to gem5 so it's easier to check against golden
reference output for the regression tests.

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

6 years agosystemc: Make verify.py filter out some error messages.
Gabe Black [Thu, 30 Aug 2018 08:44:26 +0000 (01:44 -0700)]
systemc: Make verify.py filter out some error messages.

Some of the details of these messages would be annoying to match
exactly, and the error messages in gem5 go to simerr which isn't
being checked.

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

6 years agosystemc: Tell verify.py to expect two tests to fail.
Gabe Black [Thu, 30 Aug 2018 08:43:20 +0000 (01:43 -0700)]
systemc: Tell verify.py to expect two tests to fail.

These tests purposefully fail when they run, so a return code of 1
should be considered successful.

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

6 years agosystemc: Raise an error when SC_METHOD, etc. is used after starting.
Gabe Black [Thu, 30 Aug 2018 08:39:21 +0000 (01:39 -0700)]
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>

6 years agosystemc: Teach verify.py how to expect failing error codes.
Gabe Black [Thu, 30 Aug 2018 08:37:00 +0000 (01:37 -0700)]
systemc: Teach verify.py how to expect failing error codes.

Some tests expect to fail. For those tests (and only those tests) we
need to tell verify.py that it's ok if their exit status isn't 0. Also
if those tests *don't* fail, then that will also be flagged as an
error.

This is done by adding an expected_returncode file into the test's
source directory which holds what the expected return code should be.

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

6 years agosystemc: Keep track of more cases when we should be ready after resume.
Gabe Black [Thu, 30 Aug 2018 07:39:49 +0000 (00:39 -0700)]
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>

6 years agosystemc: When sensitive to an event finder, find on all interfaces.
Gabe Black [Thu, 30 Aug 2018 06:02:21 +0000 (23:02 -0700)]
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>

6 years agosystemc: Make Process track whether it's dynamic on its own.
Gabe Black [Wed, 29 Aug 2018 07:18:23 +0000 (00:18 -0700)]
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>

6 years agosystemc: Track the module who's end_of_elaboration callback we're in.
Gabe Black [Wed, 29 Aug 2018 07:05:23 +0000 (00:05 -0700)]
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>

6 years agosystemc: sc_spawn can create static or dynamic processes.
Gabe Black [Wed, 29 Aug 2018 06:32:50 +0000 (23:32 -0700)]
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>

6 years agosystemc: Improve handling of empty process handles.
Gabe Black [Wed, 29 Aug 2018 06:14:40 +0000 (23:14 -0700)]
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>

6 years agosystemc: Ensure all objects and events have unique names.
Gabe Black [Wed, 29 Aug 2018 04:23:29 +0000 (21:23 -0700)]
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>

6 years agosystemc: Make sure children of processes are recorded as such.
Gabe Black [Wed, 29 Aug 2018 03:58:37 +0000 (20:58 -0700)]
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>

6 years agosystemc: Clamp the time of events to the present.
Gabe Black [Tue, 28 Aug 2018 06:18:18 +0000 (23:18 -0700)]
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>

6 years agosystemc: Implement support for the default time unit.
Gabe Black [Tue, 28 Aug 2018 05:55:54 +0000 (22:55 -0700)]
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>

6 years agosystemc: Implement most of sc_fifo and its interfaces.
Gabe Black [Tue, 28 Aug 2018 05:37:27 +0000 (22:37 -0700)]
systemc: Implement most of sc_fifo and its interfaces.

There are still some bugs since the output of the tests don't all
match, but more tests pass and fewer abort.

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

6 years agosim-se: Set ArmProcess64 hwcaps depending on ID regs
Giacomo Travaglini [Tue, 25 Sep 2018 16:35:35 +0000 (17:35 +0100)]
sim-se: Set ArmProcess64 hwcaps depending on ID regs

ArmProcess64 needs to query AArch64 ID registers to check which hw
capability is going to report in the appropriate aux vector's entry.

Change-Id: I1e1294b831e902226f9b162f25e841e53b940454
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/13164
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Maintainer: Brandon Potter <Brandon.Potter@amd.com>

6 years agosim-se: Different HWCAP for ArmProcess32/64
Giacomo Travaglini [Thu, 20 Sep 2018 11:39:36 +0000 (12:39 +0100)]
sim-se: Different HWCAP for ArmProcess32/64

AArch32 and AArch64 have different HWCAP flags in Linux, but we are
currently using AArch32 HWCAP flags to initialize the aux vector of both
AArch32 and AArch64 binaries.

This patch also fixes a bug that was introduced by running in SE mode a
target binary compiled with glibc > 2.18. Using AArch32 flags
resulted on CPUID flag being set for AArch64. This incorrectly tells
libc that emulation of the midr_el1 is supported.
In FullSystem this might work, but since we are in Syscall Emulation
there is no OS behind emulating the mrs midr_el1 instruction.

By separating AArch32 flags from AArch64 flags we are turning off the
CPUID hwcap flag in SE mode.

Change-Id: I9f651957ba9d19dc2bc06606de070c6586f0f9fa
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/12884
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Maintainer: Brandon Potter <Brandon.Potter@amd.com>

6 years agoarch-arm: Add FP16 support introduced by Armv8.2-A
Edmund Grimley Evans [Thu, 28 Jun 2018 13:32:01 +0000 (14:32 +0100)]
arch-arm: Add FP16 support introduced by Armv8.2-A

This changeset adds support for FP/SIMD instructions with
half-precision floating-point operands.

Change-Id: I4957f111c9c5e5d6a3747fe9d169d394d642fee8
Signed-off-by: Giacomo Gabrielli <giacomo.gabrielli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/13084
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

6 years agoarch: Fix unserialization of VectorReg value
Gabor Dozsa [Tue, 7 Nov 2017 14:05:00 +0000 (14:05 +0000)]
arch: Fix unserialization of VectorReg value

Change-Id: Iba01ae60e10703877eae299ba924fa1f04a4a387
Signed-off-by: Giacomo Gabrielli <giacomo.gabrielli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/13104
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

6 years agoarch-arm: Add FP16 support and other primitives to fplib
Edmund Grimley Evans [Fri, 10 Nov 2017 10:07:30 +0000 (10:07 +0000)]
arch-arm: Add FP16 support and other primitives to fplib

This changeset:
- extends fplib to support emulation of half-precision floating-point
  (FP16) operations;
- extends fplib to support additional primitives introduced by the Arm
  Scalable Vector Extension (SVE) (fplibExpa, fplibScale,
  fplibTrigMAdd, fplibTrigSMul, fplibTrigSSel);
- adds the FZ16 bit to FPSCR;
- cleans up fplib code by replacing constants with preprocessor macros
  and by adding inline functions to recognise NaNs and infinities.

Change-Id: If8fdb2a5824b478c8310bbc126ec60cc1105f135
Signed-off-by: Giacomo Gabrielli <giacomo.gabrielli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/13044
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

6 years agoarch-arm: Implement AArch64 ID regs as bitunions
Giacomo Travaglini [Tue, 25 Sep 2018 16:37:48 +0000 (17:37 +0100)]
arch-arm: Implement AArch64 ID regs as bitunions

This patch is implementing the following AArch64 ID registers as
bitunions, so that it is easier to query for feature availability:

- ID_AA64DFR0_EL1
- ID_AA64ISAR0_EL1
- ID_AA64ISAR1_EL1
- ID_AA64MMFR1_EL1
- ID_AA64MMFR2_EL1
- ID_AA64PFR0_EL1

They are updated to the latest Armv8.5 arch release version.
RES0 only ID registers like ID_AA64AFR1_EL1 haven't been added.

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

6 years agoarch-arm: Implement AArch64 ID_AA64MMFR2_EL1 register
Giacomo Travaglini [Tue, 25 Sep 2018 16:37:06 +0000 (17:37 +0100)]
arch-arm: Implement AArch64 ID_AA64MMFR2_EL1 register

This patch implements AArch64 Memory Model Feature Register 2
(from ARMv8.2)

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

6 years agoarch-arm: Move MiscReg BitUnions into a separate header file
Giacomo Travaglini [Tue, 25 Sep 2018 15:11:37 +0000 (16:11 +0100)]
arch-arm: Move MiscReg BitUnions into a separate header file

As the number of MiscRegs increases there is the need of a cleaner
header file; this patch is separating miscreg.[cc,hh] where the miscreg
decoding/utility functions are defined/declared from the MiscReg
register types (BitUnion).

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

6 years agoarch-arm: Init AArch64 ID registers in SE mode
Giacomo Travaglini [Mon, 24 Sep 2018 08:55:19 +0000 (09:55 +0100)]
arch-arm: Init AArch64 ID registers in SE mode

One of the auxv vector's flag is the HWCAP, whose bits match the content
of several arm ID registers.  This patch factors out AArch64 ID
registers init into a separate method and creates the symmetric AArch32
ID register init as well, so that we get a meaningful auxiliary vector
in SE mode.

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

6 years agocpu: Fix typo in header guard for Noncaching cpu
Giacomo Travaglini [Mon, 1 Oct 2018 13:07:35 +0000 (14:07 +0100)]
cpu: Fix typo in header guard for Noncaching cpu

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

6 years agodev-arm: Enable FIQ signaling for Group0 interrupts in GICv2
Giacomo Travaglini [Tue, 11 Sep 2018 12:39:00 +0000 (13:39 +0100)]
dev-arm: Enable FIQ signaling for Group0 interrupts in GICv2

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

6 years agodev-arm: Create postFiq events for GICv2
Giacomo Travaglini [Tue, 11 Sep 2018 12:21:03 +0000 (13:21 +0100)]
dev-arm: Create postFiq events for GICv2

GICv2 is signaling IRQs only to the CPU. This patch is adding the
capability of scheduling FIQs.

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

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>

6 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>