gem5.git
5 years agodev: Explicitly specify the endianness for packet accessors.
Gabe Black [Fri, 12 Oct 2018 12:06:26 +0000 (05:06 -0700)]
dev: Explicitly specify the endianness for packet accessors.

Generally speaking, the endianness of the data devices provide or
accept is dependent on the device and not the ISA the system
executes. This change makes the devices in dev pick an endianness
rather than using the guest's.

For the ISA bus and the UART, accesses are byte sized and so endianness
doesn't matter. The ISA and PCI busses and the devices which use them
are defined to be little endian.

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

5 years agopython: Stop conditionally excluding code from pyobject.cc
Gabe Black [Fri, 12 Oct 2018 01:02:14 +0000 (18:02 -0700)]
python: Stop conditionally excluding code from pyobject.cc

Now that the Ether* classes are included in all builds, there's no
reason to conditionally compile code in pyobject.cc.

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

5 years agodev: Build most of the networking devices in the NULL_ISA build.
Gabe Black [Fri, 12 Oct 2018 01:00:03 +0000 (18:00 -0700)]
dev: Build most of the networking devices in the NULL_ISA build.

The only part of these devices which are incompatible with other ISAs,
with the possible exception of endianness transformation, is that
the dist_iface implementation refers to ThreadContext methods and
that class is heavily tied to the guest ISA. Only those few lines are
excluded in a NULL_ISA build.

Change-Id: Ic6d643fdbb792d0a996a37d75e027c5ce0ecd460
Reviewed-on: https://gem5-review.googlesource.com/c/13469
Reviewed-by: Gabor Dozsa <gabor.dozsa@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

5 years agodev: Build the PCI device models even in NULL_ISA builds.
Gabe Black [Fri, 12 Oct 2018 00:57:20 +0000 (17:57 -0700)]
dev: Build the PCI device models even in NULL_ISA builds.

There are some minor ISA dependencies in the PCI device models,
specifically that they use the set<> accessors on the packet objects.
This actually compiles fine because the NULL ISA claims to be little
endian, but really these accessors should be changed to use little
endian all the time since that's what PCI is defined to use, not
the guest endianness.

The other types of accessors, specifically the ones that default to
what the guest wants, should be excluded when building NULL_ISA, and,
pending other dependencies, the NULL_ISA should no longer have an
endianness associated with it.

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

5 years agoarch: Get rid of the unused type AnyReg.
Gabe Black [Tue, 16 Oct 2018 03:45:45 +0000 (20:45 -0700)]
arch: Get rid of the unused type AnyReg.

This type is defined for all the ISAs but isn't used by anything.

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

5 years agodev-arm: Don't panic when EOIR a non active PPI
Adrien Pesle [Fri, 12 Oct 2018 10:42:33 +0000 (12:42 +0200)]
dev-arm: Don't panic when EOIR a non active PPI

GIC architecture specification says that writing EOIR with
a not active irq it is an unpredictable behavior.
So, just warn when it happens for a PPI case, like it is
already done in SPI case.

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

5 years agodev-arm: Fix Gicv2 distributor group register
Adrien Pesle [Thu, 11 Oct 2018 14:09:07 +0000 (16:09 +0200)]
dev-arm: Fix Gicv2 distributor group register

For each bit in GICD_IGROUPR:
value 0 means corresponding irq is group0
value 1 means corresponding irq is group 1.

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

5 years agosystemc: Get rid of leftovers from unimplemented warnings past.
Gabe Black [Thu, 11 Oct 2018 02:19:36 +0000 (19:19 -0700)]
systemc: Get rid of leftovers from unimplemented warnings past.

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

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

5 years agosystemc: Implement Object::simcontext().
Gabe Black [Thu, 11 Oct 2018 02:20:49 +0000 (19:20 -0700)]
systemc: Implement Object::simcontext().

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

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

5 years agosystemc: Stop filtering out warnings about unimplemented features.
Gabe Black [Thu, 11 Oct 2018 02:03:58 +0000 (19:03 -0700)]
systemc: Stop filtering out warnings about unimplemented features.

These no longer cause any of the tests to break, so there's no reason
to filter them out.

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

5 years agosystemc: Warn about using deprecated sc_port constructors.
Gabe Black [Thu, 11 Oct 2018 02:03:12 +0000 (19:03 -0700)]
systemc: Warn about using deprecated sc_port constructors.

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

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

5 years agosystemc: Add a python config class for sc_modules.
Gabe Black [Wed, 10 Oct 2018 04:07:57 +0000 (21:07 -0700)]
systemc: Add a python config class for sc_modules.

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

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

5 years agosystemc: Don't include the scheduler in an external header file.
Gabe Black [Tue, 9 Oct 2018 23:22:47 +0000 (16:22 -0700)]
systemc: Don't include the scheduler in an external header file.

The scheduler is an internal detail and shouldn't be exposed to the
headers in ext. It would transitively include more headers which are
not in ext, making it not self contained.

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

5 years agosystemc: Add an accessor for getting the current process.
Gabe Black [Tue, 9 Oct 2018 23:21:34 +0000 (16:21 -0700)]
systemc: Add an accessor for getting the current process.

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

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

5 years agosystemc: Don't re-schedule a process which is already scheduled.
Gabe Black [Tue, 9 Oct 2018 06:08:27 +0000 (23:08 -0700)]
systemc: Don't re-schedule a process which is already scheduled.

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

5 years agosystemc: Fix accounting in the sc_fifo class.
Gabe Black [Tue, 9 Oct 2018 05:39:36 +0000 (22:39 -0700)]
systemc: Fix accounting in the sc_fifo class.

Reads shouldn't free up space until an update happens.

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

5 years agosystemc: Exclude a test which tests a feature we're not implementing.
Gabe Black [Tue, 9 Oct 2018 05:21:23 +0000 (22:21 -0700)]
systemc: Exclude a test which tests a feature we're not implementing.

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

5 years agosystemc: Switch to using predefined messages for datatypes.
Gabe Black [Tue, 9 Oct 2018 02:01:38 +0000 (19:01 -0700)]
systemc: Switch to using predefined messages for datatypes.

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

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

5 years agosystemc: Switch to using predefined messages for channels.
Gabe Black [Sun, 7 Oct 2018 12:23:49 +0000 (05:23 -0700)]
systemc: Switch to using predefined messages for channels.

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

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

5 years agosystemc: Don't depend on the order of static initializers.
Gabe Black [Sun, 7 Oct 2018 10:59:56 +0000 (03:59 -0700)]
systemc: Don't depend on the order of static initializers.

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

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

5 years agosystemc: Switch to using predefined messages for utils.
Gabe Black [Sun, 7 Oct 2018 10:02:56 +0000 (03:02 -0700)]
systemc: Switch to using predefined messages for utils.

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

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

5 years agosystemc: Remove a redundant error check.
Gabe Black [Sun, 7 Oct 2018 08:51:25 +0000 (01:51 -0700)]
systemc: Remove a redundant error check.

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

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

5 years agosystemc: Check the maximum port size when finializing bindings.
Gabe Black [Sun, 7 Oct 2018 08:38:41 +0000 (01:38 -0700)]
systemc: Check the maximum port size when finializing bindings.

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

5 years agosystemc: Fix how the maximum size is computed for sc_ports.
Gabe Black [Sun, 7 Oct 2018 08:37:52 +0000 (01:37 -0700)]
systemc: Fix how the maximum size is computed for sc_ports.

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

5 years agosystemc: Mark a test as expected to fail.
Gabe Black [Sun, 7 Oct 2018 08:01:30 +0000 (01:01 -0700)]
systemc: Mark a test as expected to fail.

This test expects to exit with an error.

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

5 years agosystemc: Switch to using predefined messages for core.
Gabe Black [Sun, 7 Oct 2018 07:42:04 +0000 (00:42 -0700)]
systemc: Switch to using predefined messages for core.

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

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

5 years agosystemc: Add a mechanism for pre-registering message type ids.
Gabe Black [Sun, 7 Oct 2018 07:34:35 +0000 (00:34 -0700)]
systemc: Add a mechanism for pre-registering message type ids.

These ids are the ones the Accellera implementation/tests use. Some of
the tests expect them to be available and usable.

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

5 years agosystemc: Add a warning about dont_initialize and cthreads.
Gabe Black [Sun, 7 Oct 2018 03:34:27 +0000 (20:34 -0700)]
systemc: Add a warning about dont_initialize and cthreads.

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

5 years agosystemc: Make suppress_id work like the test expects.
Gabe Black [Sun, 7 Oct 2018 03:21:31 +0000 (20:21 -0700)]
systemc: Make suppress_id work like the test expects.

This is in contrast to how Accellera actually implements it, implying
they would fail their own test.

The specific difference is that suppress_id should only suppress
SC_INFO and SC_WARNING, not all severity levels like the Accellera
implementation will do.

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

5 years agosystemc: Handle integer based IDs like Accellera does.
Gabe Black [Sun, 7 Oct 2018 03:09:42 +0000 (20:09 -0700)]
systemc: Handle integer based IDs like Accellera does.

This is actually not consistent with how it was handled in 2.0.1 which
is supposedly what this is supposed to be backwards compatible with,
in that in the earlier version on info and warning messages were
suppressed. This is exposed by one of the tests,
utils/sc_report/test01, which suppresses an integer ID and then reports
an error with it. The "golden" output shows the message supressed, but
the actual implementation makes no such distinction.

This implementation duplicates Accelleras for now, but a future change
will make it consistent with the old implementation so the test will
pass.

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

5 years agosystemc: Refactor reporting to prep for int based messages.
Gabe Black [Sun, 7 Oct 2018 02:00:56 +0000 (19:00 -0700)]
systemc: Refactor reporting to prep for int based messages.

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

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

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

5 years agosystemc: Stop passing arguments to sc_main.
Gabe Black [Sat, 6 Oct 2018 23:44:32 +0000 (16:44 -0700)]
systemc: Stop passing arguments to sc_main.

These arguments were originally just to make sure arguments could be
successfully passed to sc_main, but serve no intrinsic purpose. There
are some tests which can accept command line arguments to customize
how they run, and having nonsense arguments confuses them and makes
them behave incorrectly.

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

5 years agosystemc: When resetting a process, clear suspended ready.
Gabe Black [Sat, 6 Oct 2018 11:31:04 +0000 (04:31 -0700)]
systemc: When resetting a process, clear suspended ready.

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

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

5 years agosystemc: Manually correct the golden output for a test.
Gabe Black [Sat, 6 Oct 2018 11:11:50 +0000 (04:11 -0700)]
systemc: Manually correct the golden output for a test.

The golden reference output for the test was to throw an error which
is clearly not at all related to the test (it was about immediate
self notifications while the test never calls any form of notify())
and which would happen significantly before the end of the test,
negating all the other behaviors and checks which would happen after
that point.

Since it strongly looks like the reference output was updated in error,
and because other very similarly structured tests are expected to run
silently except for printing "Success" at the end (which it does when
run under gem5), this change manually updates the golden reference
output to reflect what appears to be correct.

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

5 years agosystemc: If a process hasn't started, still signal its reset event.
Gabe Black [Sat, 6 Oct 2018 11:11:00 +0000 (04:11 -0700)]
systemc: If a process hasn't started, still signal its reset event.

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

5 years agosystemc: Ignore attempts to throw a signal to a method.
Gabe Black [Sat, 6 Oct 2018 11:10:39 +0000 (04:10 -0700)]
systemc: Ignore attempts to throw a signal to a method.

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

5 years agosystemc: Remove a redundant injectException for Thread's throw_it.
Gabe Black [Sat, 6 Oct 2018 09:58:02 +0000 (02:58 -0700)]
systemc: Remove a redundant injectException for Thread's throw_it.

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

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

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

5 years agosystemc: Get rid of the unused Process::_procKind.
Gabe Black [Sat, 6 Oct 2018 10:14:48 +0000 (03:14 -0700)]
systemc: Get rid of the unused Process::_procKind.

This seems to be a leftover from an earlier implementation.

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

5 years agosystemc: Ignore immediate self notifications.
Gabe Black [Sat, 6 Oct 2018 07:57:48 +0000 (00:57 -0700)]
systemc: Ignore immediate self notifications.

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

5 years agosystemc: Distinguish internal events from normal sc_events.
Gabe Black [Sat, 6 Oct 2018 07:10:20 +0000 (00:10 -0700)]
systemc: Distinguish internal events from normal sc_events.

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

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

5 years agosystemc: Mark a test as expected to fail.
Gabe Black [Fri, 5 Oct 2018 23:55:20 +0000 (16:55 -0700)]
systemc: Mark a test as expected to fail.

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

5 years agosystemc: Use the "catch action" and the handler func outside sc_main.
Gabe Black [Fri, 5 Oct 2018 23:45:55 +0000 (16:45 -0700)]
systemc: Use the "catch action" and the handler func outside sc_main.

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

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

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

5 years agosystemc: Change the default "catch action" to SC_DISPLAY.
Gabe Black [Fri, 5 Oct 2018 23:45:29 +0000 (16:45 -0700)]
systemc: Change the default "catch action" to SC_DISPLAY.

There is a test which checks what it was and asserts if it's something
else.

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

5 years agosystemc: Add an error check to the deprecated notify_delayed.
Gabe Black [Fri, 5 Oct 2018 23:24:18 +0000 (16:24 -0700)]
systemc: Add an error check to the deprecated notify_delayed.

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

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

5 years agosystemc: Add a range check to the intial value of sc_semaphore.
Gabe Black [Fri, 5 Oct 2018 23:12:11 +0000 (16:12 -0700)]
systemc: Add a range check to the intial value of sc_semaphore.

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

5 years agosystemc: Add some error checks to sc_clock.
Gabe Black [Fri, 5 Oct 2018 22:55:50 +0000 (15:55 -0700)]
systemc: Add some error checks to sc_clock.

The Accellera version reports an error if the period, high or low
portions of the clock are zero.

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

5 years agosystemc: Add an error check to sc_gen_unique_name.
Gabe Black [Fri, 5 Oct 2018 22:38:23 +0000 (15:38 -0700)]
systemc: Add an error check to sc_gen_unique_name.

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

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

5 years agosystemc: Detach child events in the Object destructor.
Gabe Black [Fri, 5 Oct 2018 22:31:50 +0000 (15:31 -0700)]
systemc: Detach child events in the Object destructor.

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

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

5 years agosystemc: Report an error if an sc_event_finder is used on an unbound port.
Gabe Black [Fri, 5 Oct 2018 22:09:31 +0000 (15:09 -0700)]
systemc: Report an error if an sc_event_finder is used on an unbound port.

Rather than assuming the port is bound, check and report an error.

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

5 years agosystemc: Implement port binding policies.
Gabe Black [Fri, 5 Oct 2018 00:46:55 +0000 (17:46 -0700)]
systemc: Implement port binding policies.

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

5 years agosystemc: Add some deprecated positional binding operators.
Gabe Black [Fri, 5 Oct 2018 00:40:36 +0000 (17:40 -0700)]
systemc: Add some deprecated positional binding operators.

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

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

5 years agosystemc: Keep track of progress when positionally binding.
Gabe Black [Fri, 5 Oct 2018 00:45:34 +0000 (17:45 -0700)]
systemc: Keep track of progress when positionally binding.

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

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

5 years agosystemc: Fill out some error reporting in sc_port.
Gabe Black [Thu, 4 Oct 2018 23:41:32 +0000 (16:41 -0700)]
systemc: Fill out some error reporting in sc_port.

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

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

5 years agosystemc: Run delta notifications in reverse insertion order.
Gabe Black [Thu, 4 Oct 2018 22:58:55 +0000 (15:58 -0700)]
systemc: Run delta notifications in reverse insertion order.

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

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

5 years agosystemc: Change how signal based resets work.
Gabe Black [Thu, 4 Oct 2018 21:59:28 +0000 (14:59 -0700)]
systemc: Change how signal based resets work.

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

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

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

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

5 years agosystemc: Increment the change stamp value before the timing phase.
Gabe Black [Thu, 4 Oct 2018 02:02:53 +0000 (19:02 -0700)]
systemc: Increment the change stamp value before the timing phase.

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

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

5 years agosystemc: Add a simple implementation for sc_mempool.
Gabe Black [Thu, 4 Oct 2018 00:37:53 +0000 (17:37 -0700)]
systemc: Add a simple implementation for sc_mempool.

This class is supposed to be a more efficient way to manage small bits
of memory. At least for now, new and delete will do the same job
functionally. Also, the heap manager may be just as efficient as
whatever custom mechanism sc_mempool would use.

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

5 years agosystemc: Add an sc_gen_unique_name namespace to processes as well.
Gabe Black [Thu, 4 Oct 2018 00:08:15 +0000 (17:08 -0700)]
systemc: Add an sc_gen_unique_name namespace to processes as well.

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

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

5 years agosystemc: Add some error checks to the sc_module constructor.
Gabe Black [Wed, 3 Oct 2018 23:24:10 +0000 (16:24 -0700)]
systemc: Add some error checks to the sc_module constructor.

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

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

5 years agosystemc: Change how errors are handled in some constructors slightly.
Gabe Black [Wed, 3 Oct 2018 23:17:50 +0000 (16:17 -0700)]
systemc: Change how errors are handled in some constructors slightly.

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

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

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

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

5 years agosystemc: Add an sc_gem5::Port destructor.
Gabe Black [Wed, 3 Oct 2018 23:16:08 +0000 (16:16 -0700)]
systemc: Add an sc_gem5::Port destructor.

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

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

5 years agosystemc: Change the point where elaboration is considered over.
Gabe Black [Wed, 3 Oct 2018 23:14:41 +0000 (16:14 -0700)]
systemc: Change the point where elaboration is considered over.

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

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

5 years agosystemc: Implement sc_hierarchical_name_exists.
Gabe Black [Tue, 2 Oct 2018 23:59:46 +0000 (16:59 -0700)]
systemc: Implement sc_hierarchical_name_exists.

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

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

5 years agosystemc: Make sure otherwise unnamed events get autogenerated ones.
Gabe Black [Tue, 2 Oct 2018 23:59:16 +0000 (16:59 -0700)]
systemc: Make sure otherwise unnamed events get autogenerated ones.

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

5 years agosystemc: Fix a typo in one of the error messages.
Gabe Black [Tue, 2 Oct 2018 06:00:09 +0000 (23:00 -0700)]
systemc: Fix a typo in one of the error messages.

This typo was added purposefully to match Accellera's output, but then
it was discovered that some test's golden output had the typo, and some
didn't. That must mean that not all tests have up to date output, and
that Accellera couldn't possibly pass all of their own tests.

To resolve this conflict, this change fixes the typo and manually
updates all the golden output.

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

5 years agosystemc: Implement writer policies.
Gabe Black [Tue, 2 Oct 2018 05:02:21 +0000 (22:02 -0700)]
systemc: Implement writer policies.

This includes the nonstandard SC_NO_WRITE_CHECK #define which the
Accellera tests use and depend on.

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

5 years agosystemc: Don't use write() in sc_clock to set the clock value.
Gabe Black [Tue, 2 Oct 2018 05:47:27 +0000 (22:47 -0700)]
systemc: Don't use write() in sc_clock to set the clock value.

The two different processes we have to use to match Accellera behavior
would trip the checks in write.

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

5 years agosystemc: Clear the current process when done with the eval phase.
Gabe Black [Tue, 2 Oct 2018 04:58:50 +0000 (21:58 -0700)]
systemc: Clear the current process when done with the eval phase.

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

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

5 years agosystemc: Implement register_port in all the predefined channels.
Gabe Black [Mon, 1 Oct 2018 10:59:05 +0000 (03:59 -0700)]
systemc: Implement register_port in all the predefined channels.

Something the Accellera implementation does which would be good to do
in the gem5 implementation is to create a base class for sc_signal
which isn't templated, and which holds the common/non-type specific
versions of the various sc_signal methods. This will reduce code
redundancy and binary size, and also let us hide more code in .cc
files so that it's less likely we'd need to recompile model code to
fix a bug.

Also, since this all uses of sc_channel_warn_unimple have now been
eliminated, remove that function.

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

5 years agosystemc: Add missing sc_interface::register_port, and add calls to it.
Gabe Black [Mon, 1 Oct 2018 09:33:55 +0000 (02:33 -0700)]
systemc: Add missing sc_interface::register_port, and add calls to it.

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

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

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

5 years agosystemc: Remove some old warn includes from ext/channel.
Gabe Black [Mon, 1 Oct 2018 08:32:50 +0000 (01:32 -0700)]
systemc: Remove some old warn includes from ext/channel.

The calls to sc_channel_warn_unimpl have been removed, so the includes
aren't needed.

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

5 years agosystemc: Implement sc_vector.
Gabe Black [Mon, 1 Oct 2018 08:22:39 +0000 (01:22 -0700)]
systemc: Implement sc_vector.

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

5 years agosystemc: Change how the timing of binding ports works.
Gabe Black [Mon, 1 Oct 2018 05:44:56 +0000 (22:44 -0700)]
systemc: Change how the timing of binding ports works.

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

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

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

5 years agosystemc: Use the stage of simulation and not port size in add_trace.
Gabe Black [Mon, 1 Oct 2018 05:40:28 +0000 (22:40 -0700)]
systemc: Use the stage of simulation and not port size in add_trace.

The assumption was that a port wouldn't have any interfaces until
after elaboration, and that if it would be traced, it would have
interfaces. Checking if the simulation has started (and hence
elaboration has finished) is a more accurate and direct way to check
the same thing.

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

5 years agosystemc: Centralize how object parents are chosen.
Gabe Black [Sat, 29 Sep 2018 00:12:46 +0000 (17:12 -0700)]
systemc: Centralize how object parents are chosen.

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

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

5 years agosystemc: Use c++11 partial functions instead of boosts.
Gabe Black [Fri, 28 Sep 2018 20:02:05 +0000 (13:02 -0700)]
systemc: Use c++11 partial functions instead of boosts.

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

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

5 years agosystemc: Filter out a test which breaks rules gem5 won't let it break.
Gabe Black [Thu, 27 Sep 2018 08:27:31 +0000 (01:27 -0700)]
systemc: Filter out a test which breaks rules gem5 won't let it break.

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

5 years agosystemc: Add a non-standard sc_time constructor and from_string.
Gabe Black [Thu, 27 Sep 2018 08:20:28 +0000 (01:20 -0700)]
systemc: Add a non-standard sc_time constructor and from_string.

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

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

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

5 years agosystemc: Modify reportifyException to keep sc_reports in scope.
Gabe Black [Thu, 27 Sep 2018 08:16:42 +0000 (01:16 -0700)]
systemc: Modify reportifyException to keep sc_reports in scope.

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

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

5 years agosystemc: Implement the sc_time_tuple class.
Gabe Black [Thu, 27 Sep 2018 05:53:01 +0000 (22:53 -0700)]
systemc: Implement the sc_time_tuple class.

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

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

5 years agosystemc: Merge notify and notifyWork and ignore disabled for resets.
Gabe Black [Thu, 27 Sep 2018 05:09:12 +0000 (22:09 -0700)]
systemc: Merge notify and notifyWork and ignore disabled for resets.

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

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

5 years agosystemc: Ensure the reset event is notified before reseting the target.
Gabe Black [Thu, 27 Sep 2018 03:32:41 +0000 (20:32 -0700)]
systemc: Ensure the reset event is notified before reseting the target.

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

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

5 years agosystemc: Implement signal based resets.
Gabe Black [Wed, 26 Sep 2018 10:20:09 +0000 (03:20 -0700)]
systemc: Implement signal based resets.

The implementation is based on sc_event sensitivities.

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

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

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

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

5 years agosystemc: Implement the synchronous reset state.
Gabe Black [Wed, 26 Sep 2018 07:24:01 +0000 (00:24 -0700)]
systemc: Implement the synchronous reset state.

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

5 years agosystemc: Implement sc_event_queue.
Gabe Black [Wed, 26 Sep 2018 06:59:32 +0000 (23:59 -0700)]
systemc: Implement sc_event_queue.

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

5 years agosystemc: Remove a hack which scaled sc_time into ps unnecessarily.
Gabe Black [Sat, 22 Sep 2018 15:32:55 +0000 (08:32 -0700)]
systemc: Remove a hack which scaled sc_time into ps unnecessarily.

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

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

5 years agosystemc: Change how the default timescale is set.
Gabe Black [Sat, 22 Sep 2018 15:09:31 +0000 (08:09 -0700)]
systemc: Change how the default timescale is set.

The spec says that the default timescale should be 1 PS, but the
Accellera implementation uses the time resolution.

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

5 years agosystemc: Simplify sc_time_stamp().
Gabe Black [Sat, 22 Sep 2018 15:05:16 +0000 (08:05 -0700)]
systemc: Simplify sc_time_stamp().

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

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

5 years agosystemc: Implement sc_get_curr_process_handle().
Gabe Black [Sat, 22 Sep 2018 14:36:36 +0000 (07:36 -0700)]
systemc: Implement sc_get_curr_process_handle().

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

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

5 years agosystemc: Print an Info when setting a tracefile's time unit.
Gabe Black [Sat, 22 Sep 2018 14:30:28 +0000 (07:30 -0700)]
systemc: Print an Info when setting a tracefile's time unit.

This matches Accellera's output for the tests.

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

5 years agosystemc: Move some constants out of sc_time.cc for other files to use.
Gabe Black [Sat, 22 Sep 2018 14:28:13 +0000 (07:28 -0700)]
systemc: Move some constants out of sc_time.cc for other files to use.

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

5 years agosystemc: Add a warning to sc_interface::default_event.
Gabe Black [Sat, 22 Sep 2018 13:50:27 +0000 (06:50 -0700)]
systemc: Add a warning to sc_interface::default_event.

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

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

5 years agosystemc: Filter out an Info about delta cycles and pseudo timesteps.
Gabe Black [Sat, 22 Sep 2018 13:42:41 +0000 (06:42 -0700)]
systemc: Filter out an Info about delta cycles and pseudo timesteps.

In the Accellera implementation, every time a delta cycle is traced a
check is done to see if the user has been told what the pseudo timestep
is. To avoid doing that check over and over, we'll leave that out and
tell the verify.py to ignore that message in the reference output.

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

5 years agosystemc: Check the process type when using sc_join.
Gabe Black [Sat, 22 Sep 2018 13:35:06 +0000 (06:35 -0700)]
systemc: Check the process type when using sc_join.

Method processes aren't allowed in an sc_join.

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

5 years agosystemc: Make sure the right type process is running when calling wait.
Gabe Black [Sat, 22 Sep 2018 13:28:32 +0000 (06:28 -0700)]
systemc: Make sure the right type process is running when calling wait.

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

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

5 years agosystemc: Add an error check to sc_time.
Gabe Black [Sat, 22 Sep 2018 13:12:16 +0000 (06:12 -0700)]
systemc: Add an error check to sc_time.

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

5 years agosystemc: Add some error checks to sc_export.
Gabe Black [Sat, 22 Sep 2018 12:34:37 +0000 (05:34 -0700)]
systemc: Add some error checks to sc_export.

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

5 years agosystemc: Implement general and VCD trace support.
Gabe Black [Thu, 20 Sep 2018 09:57:54 +0000 (02:57 -0700)]
systemc: Implement general and VCD trace support.

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

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

5 years agosystemc: Don't schedule the ready event unnecessarily.
Gabe Black [Sat, 22 Sep 2018 11:51:29 +0000 (04:51 -0700)]
systemc: Don't schedule the ready event unnecessarily.

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

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

5 years agosystemc: Fix the implementation of sc_event::triggered.
Gabe Black [Thu, 20 Sep 2018 09:51:54 +0000 (02:51 -0700)]
systemc: Fix the implementation of sc_event::triggered.

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

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