gem5.git
6 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>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

6 years agosystemc: Teach verify.py how to verify vcd files.
Gabe Black [Thu, 20 Sep 2018 09:50:48 +0000 (02:50 -0700)]
systemc: Teach verify.py how to verify vcd files.

The reference output skips the first 7 lines which have volatile info
like the current time.

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

6 years agosystemc: Fix the default width values for the various sc_trace-s.
Gabe Black [Wed, 19 Sep 2018 23:18:16 +0000 (16:18 -0700)]
systemc: Fix the default width values for the various sc_trace-s.

These were all set to 8 * sizeof(char) instead of using the size of the
actual data type being traced.

Also add a very simple implementation to the generic sc_signal_in_if<T>
sc_trace which just delegates to the sc_trace of the underlying type T.

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

6 years agosystemc: Fix a typo in verify.py.
Gabe Black [Mon, 17 Sep 2018 10:08:24 +0000 (03:08 -0700)]
systemc: Fix a typo in verify.py.

In the generic (non-console output) output checker, a variable should
have been called self.test, but was called self.text.

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

6 years agosystemc: Add an error check whether an interface is alread bound to a port.
Gabe Black [Sat, 15 Sep 2018 23:20:27 +0000 (16:20 -0700)]
systemc: Add an error check whether an interface is alread bound to a port.

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

6 years agosystemc: Add some additional error checks.
Gabe Black [Sat, 15 Sep 2018 23:04:34 +0000 (16:04 -0700)]
systemc: Add some additional error checks.

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

6 years agosystemc: Change an error message to match the reference outputs.
Gabe Black [Sat, 15 Sep 2018 22:33:58 +0000 (15:33 -0700)]
systemc: Change an error message to match the reference outputs.

This is different from the message the Accellera implementation would
print, so it looks like it wouldn't pass this test as is.

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

6 years agomem-cache: Add missing includes in TreePLRU
Daniel [Fri, 12 Oct 2018 20:36:13 +0000 (22:36 +0200)]
mem-cache: Add missing includes in TreePLRU

Add missing includes to TreePLRU files.

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

6 years agomem: Get rid of some stray lines which ended up in packet.hh.
Gabe Black [Sat, 13 Oct 2018 00:32:54 +0000 (17:32 -0700)]
mem: Get rid of some stray lines which ended up in packet.hh.

These were left in by mistake when refactoring patches for review.

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

6 years agoarch: Explicitly specify the endianness in the generic mem helpers.
Gabe Black [Fri, 12 Oct 2018 12:03:38 +0000 (05:03 -0700)]
arch: Explicitly specify the endianness in the generic mem helpers.

This avoids using the accessors which automatically assume an
endianness, requiring the memory system to know what the guest ISA is.

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

6 years agomips: Use little endian packet accessors.
Gabe Black [Fri, 12 Oct 2018 12:02:45 +0000 (05:02 -0700)]
mips: Use little endian packet accessors.

We know data is little endian, so we can use those accessors
explicitly.

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

6 years agoalpha: Use little endian packet accessors.
Gabe Black [Fri, 12 Oct 2018 12:02:01 +0000 (05:02 -0700)]
alpha: Use little endian packet accessors.

We know data is little endian, so we can use those accessors
explicitly.

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

6 years agosparc: Use big endian packet accessors.
Gabe Black [Fri, 12 Oct 2018 12:01:06 +0000 (05:01 -0700)]
sparc: Use big endian packet accessors.

We know data is big endian, so we can use those accessors
explicitly.

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

6 years agoarm: Use little endian packet accessors.
Gabe Black [Fri, 12 Oct 2018 11:58:50 +0000 (04:58 -0700)]
arm: Use little endian packet accessors.

We know data is little endian, so we can use those accessors
explicitly.

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

6 years agox86: Use little endian packet accessors.
Gabe Black [Fri, 12 Oct 2018 11:57:29 +0000 (04:57 -0700)]
x86: Use little endian packet accessors.

We know data is little endian, so we can use those accessors
explicitly.

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

6 years agomem: Expose the raw packet accessor functions.
Gabe Black [Fri, 12 Oct 2018 11:53:00 +0000 (04:53 -0700)]
mem: Expose the raw packet accessor functions.

This avoids a place where data has its endianness switched so that when
the endianness based accessors switch it back it returns to normal. It
also makes it easier to show intent when accessing single bytes where
endianness doesn't matter, and there's no contextual endianness.

Change-Id: I1b97396c1b9bb39727d35112d90e3969e5fe0aab
Reviewed-on: https://gem5-review.googlesource.com/c/13455
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

6 years agodev: Include the platform base class even in NULL_ISA builds.
Gabe Black [Fri, 12 Oct 2018 00:56:16 +0000 (17:56 -0700)]
dev: Include the platform base class even in NULL_ISA builds.

These classes don't have any ISA specific aspects.

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

6 years agosyscall_emul: update arm uname release to 3.7.0+
Ciro Santilli [Tue, 25 Sep 2018 15:21:30 +0000 (16:21 +0100)]
syscall_emul: update arm uname release to 3.7.0+

Trying to compile an ARM C hello world with arm-linux-gnueabihf-gcc from
Ubuntu 16.04 leads to a runtime failure with se.py:

FATAL: kernel too old

because the glibc tests if the kernel is at least 3.2.0, and gem5 was
reporting 3.0.0.

Furthermore, it is hard to obtain such toolchain at all: for example
crosstool-NG currently only allows for minimum kernels above 3.2.0.

3.7.0+ was chosen to match the aarch64 value, as it is likely that the
level of support will be very similar.

This commit does not guarantee that full 3.7.0 is supported, but it is
not likely that we had full 3.0.0 support previously either.

However, it is more likely that such support will be eventually achieved
if users can at least try out their programs and implement the missing
system calls as they are found.

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

6 years agomem-cache: Factor ReplaceableEntry out
Daniel R. Carvalho [Thu, 11 Oct 2018 13:02:54 +0000 (15:02 +0200)]
mem-cache: Factor ReplaceableEntry out

ReplaceableEntry is referenced by many classes that do
not necessarily need access to the replacement policies.
Therefore, in order to allow better compilation units,
we factor it out to a new file.

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

6 years agomem-cache: Move sector_blks to tags folder
Daniel R. Carvalho [Thu, 11 Oct 2018 12:31:56 +0000 (14:31 +0200)]
mem-cache: Move sector_blks to tags folder

Move sector_blks.hh and sector_blks.cc to the tags folder,
as its usage scope is restricted to the tags, and caches
should not be aware of them.

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

6 years agomem-cache: Rename blk.cc/hh to cache_blk.cc/hh
Daniel R. Carvalho [Thu, 11 Oct 2018 12:27:35 +0000 (14:27 +0200)]
mem-cache: Rename blk.cc/hh to cache_blk.cc/hh

Rename the files blk.cc and blk.hh to cache_blk.cc and cache_blk.hh
to comply with the usual file-class naming rules.

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

6 years agomem-cache: Virtualize block print
Daniel R. Carvalho [Wed, 10 Oct 2018 12:44:05 +0000 (14:44 +0200)]
mem-cache: Virtualize block print

Encapsulate and virtualize block print, so that relevant
information can be easily printed anywhere.

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

6 years agomem-cache: Create Tree-PLRU replacement policy
Daniel R. Carvalho [Tue, 5 Jun 2018 11:59:42 +0000 (13:59 +0200)]
mem-cache: Create Tree-PLRU replacement policy

Implementation of a Tree-PLRU replacement policy. It is based on
the assumption that a set associative cache is used.

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

6 years agomem-cache: Remove CacheSet.hh
Daniel R. Carvalho [Thu, 12 Apr 2018 11:03:55 +0000 (13:03 +0200)]
mem-cache: Remove CacheSet.hh

Replacement policies aren't aware of cache sets and do not
organize blocks based on replacement data. Block search is
independent of block placement.

Besides, indexing policies have their own way of addressing
the sets, therefore there is no need to use this class anymore.

BlkType has been removed, as it wasn't being used.

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

6 years agomem-cache: Split Tags for indexing policies
Daniel R. Carvalho [Fri, 9 Mar 2018 14:16:41 +0000 (15:16 +0100)]
mem-cache: Split Tags for indexing policies

Split indexing functionality from tags, so that code duplication
is reduced when adding new classes that use different indexing
policies, such as set associative, skewed associative or other
hash-based policies.

An indexing policy defines the mapping between an address' set
and its physical location. For example, a conventional set assoc
cache maps an address to all ways in a set using an immutable
function, that is, a set x is always mapped to set x. However,
skewed assoc caches map an address to a different set for each way,
using a skewing function.

FALRU has been left unmodified as it is a specialization with its
own complexity.

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

6 years agomem-cache: Use set and way for ReplaceableEntry
Daniel R. Carvalho [Fri, 7 Sep 2018 12:33:00 +0000 (14:33 +0200)]
mem-cache: Use set and way for ReplaceableEntry

Replaceable entries belong to table-like structures, and therefore
they should be indexable by combining a row and a column. These,
using conventional cache nomenclature translate to sets and ways.

Make these entries aware of their sets and ways. The idea is to
make indexing policies usable by other table-like structures. In
order to do so we move sets and ways to ReplaceableEntry, which
will be the common base among table entries.

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

6 years agomem-cache: Use possible locations to find block
Daniel R. Carvalho [Fri, 9 Mar 2018 14:04:20 +0000 (15:04 +0100)]
mem-cache: Use possible locations to find block

Use possible locations to find block to make it placement policy
independent.

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

6 years agomem-cache: Create tags initialization function
Daniel R. Carvalho [Thu, 21 Jun 2018 14:57:37 +0000 (16:57 +0200)]
mem-cache: Create tags initialization function

Having the blocks initialized in the constructor makes it harder
to apply inheritance in the tags classes. This patch decouples
the block initialization functionality from the constructor by
using an init() function. It also sets the parent cache.

Change-Id: I0da7fdaae492b1177c7cc3bda8639f79921fbbeb
Reviewed-on: https://gem5-review.googlesource.com/c/11509
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

6 years agomem-cache: Remove Packet dependency in Tags
Daniel R. Carvalho [Thu, 7 Jun 2018 10:19:27 +0000 (12:19 +0200)]
mem-cache: Remove Packet dependency in Tags

Decouple Tags from Packets, only extracting the necessary
functionality for block insertion. As a side effect, create
a new function to update common insertion statistics.

Change-Id: I5c58f7c17de3255beee531f72a3fd25a30d74c90
Reviewed-on: https://gem5-review.googlesource.com/c/11098
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

6 years agosystemc: Implement the sc_signal_rv channel and ports.
Gabe Black [Sat, 15 Sep 2018 22:24:28 +0000 (15:24 -0700)]
systemc: Implement the sc_signal_rv channel and ports.

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

6 years agosystemc: Ignore a gem5 warning about setting the stack size in verify.py.
Gabe Black [Sat, 15 Sep 2018 05:03:29 +0000 (22:03 -0700)]
systemc: Ignore a gem5 warning about setting the stack size in verify.py.

This warning shouldn't make a test fail, but it's still useful to keep
around.

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

6 years agosystemc: Warn if sc_stop is called more than once.
Gabe Black [Sat, 15 Sep 2018 04:56:14 +0000 (21:56 -0700)]
systemc: Warn if sc_stop is called more than once.

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

6 years agosystemc: Check whether the simulation is running when creating sensitivities.
Gabe Black [Sat, 15 Sep 2018 04:38:45 +0000 (21:38 -0700)]
systemc: Check whether the simulation is running when creating sensitivities.

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

6 years agosystemc: Handle nonstandard cthread sensitivities.
Gabe Black [Sat, 15 Sep 2018 04:28:16 +0000 (21:28 -0700)]
systemc: Handle nonstandard cthread sensitivities.

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

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

6 years agosystemc: Change how the scheduler orders processes.
Gabe Black [Sat, 15 Sep 2018 03:20:54 +0000 (20:20 -0700)]
systemc: Change how the scheduler orders processes.

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

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

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

6 years agosystemc: Differentiate between notifying methods and threads.
Gabe Black [Sat, 15 Sep 2018 03:19:53 +0000 (20:19 -0700)]
systemc: Differentiate between notifying methods and threads.

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

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

6 years agosystemc: Rework how delayed sensitivities are handled.
Gabe Black [Sat, 15 Sep 2018 01:33:16 +0000 (18:33 -0700)]
systemc: Rework how delayed sensitivities are handled.

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

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

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

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

6 years agosystemc: Refactor sensitivities.
Gabe Black [Fri, 14 Sep 2018 07:04:22 +0000 (00:04 -0700)]
systemc: Refactor sensitivities.

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

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

Double check addSensitivity for event.hh

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

6 years agosystemc: Implement sc_buffer.
Gabe Black [Wed, 12 Sep 2018 04:46:12 +0000 (21:46 -0700)]
systemc: Implement sc_buffer.

This required a small change to sc_signal so that the value change
event and the change stamp for it were accessible.

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

6 years agosystemc: Mark a few more tests as expected to return non-zero.
Gabe Black [Wed, 12 Sep 2018 03:34:11 +0000 (20:34 -0700)]
systemc: Mark a few more tests as expected to return non-zero.

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

6 years agosystemc: Add some error checks to some classes.
Gabe Black [Tue, 11 Sep 2018 23:16:49 +0000 (16:16 -0700)]
systemc: Add some error checks to some classes.

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

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

6 years agosystemc: Add a "kind()" overload to sc_port_base.
Gabe Black [Wed, 12 Sep 2018 03:15:05 +0000 (20:15 -0700)]
systemc: Add a "kind()" overload to sc_port_base.

This is "implementation defined" but needs to exist to match the
golden reference output from Accellera.

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

6 years agosystemc: Implement the sc_*_resolved classes.
Gabe Black [Wed, 12 Sep 2018 03:14:22 +0000 (20:14 -0700)]
systemc: Implement the sc_*_resolved classes.

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

6 years agosystemc: Implement the sc_clock::time_stamp function.
Gabe Black [Wed, 12 Sep 2018 00:43:50 +0000 (17:43 -0700)]
systemc: Implement the sc_clock::time_stamp function.

This is just a non-standard static alias for the sc_time_stamp
function.

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

6 years agosystemc: Implement sc_mutex.
Gabe Black [Tue, 11 Sep 2018 08:51:27 +0000 (01:51 -0700)]
systemc: Implement sc_mutex.

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

6 years agosystemc: Implement sc_semaphore.
Gabe Black [Tue, 11 Sep 2018 08:51:00 +0000 (01:51 -0700)]
systemc: Implement sc_semaphore.

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

6 years agosystemc: Ensure SC_LONG_64 is defined and available.
Gabe Black [Tue, 11 Sep 2018 06:34:49 +0000 (23:34 -0700)]
systemc: Ensure SC_LONG_64 is defined and available.

The datatype code was checking if SC_LONG_64 was defined to determine
if a long was 64 bits. The code that would define that value was
dropped when porting over from the Accellera implementation, and so
the wrong code was being included. This change both makes those checks
look at the *value* of SC_LONG_64 to ensure that it's not missing by
accident, and assigns it a value in sc_fxdefs.hh.

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

6 years agosystemc: Implement SC_FORK, SC_JOIN, and SC_CJOIN.
Gabe Black [Tue, 11 Sep 2018 05:01:47 +0000 (22:01 -0700)]
systemc: Implement SC_FORK, SC_JOIN, and SC_CJOIN.

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

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

6 years agosystemc: Stop assuming picoseconds as the time resolution.
Gabe Black [Tue, 11 Sep 2018 03:37:19 +0000 (20:37 -0700)]
systemc: Stop assuming picoseconds as the time resolution.

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

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

6 years agosystemc: Keep all pre-init processes on a single list.
Gabe Black [Tue, 11 Sep 2018 00:25:00 +0000 (17:25 -0700)]
systemc: Keep all pre-init processes on a single list.

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

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

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

6 years agosystemc: Track event sensitivities with a list instead of a set.
Gabe Black [Tue, 11 Sep 2018 00:23:22 +0000 (17:23 -0700)]
systemc: Track event sensitivities with a list instead of a set.

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

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

6 years agosystemc: Mostly implememt sc_simcontext.
Gabe Black [Sat, 8 Sep 2018 01:54:49 +0000 (18:54 -0700)]
systemc: Mostly implememt sc_simcontext.

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

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

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

6 years agosystemc: Centralize module callbacks and report new warnings.
Gabe Black [Sat, 8 Sep 2018 01:25:10 +0000 (18:25 -0700)]
systemc: Centralize module callbacks and report new warnings.

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

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

6 years agosystemc: Change how sc_clock creates processes to match the tests.
Gabe Black [Sat, 8 Sep 2018 01:22:18 +0000 (18:22 -0700)]
systemc: Change how sc_clock creates processes to match the tests.

Accellera sets up the mechanism which toggles sc_clock differently
than it's set up in gem5. This change moves things around a little to
more closely match the order things are done by Accellera so that the
test output matches.

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

6 years agosystemc: Implement the deprecated "timed_out" function.
Gabe Black [Fri, 7 Sep 2018 23:53:12 +0000 (16:53 -0700)]
systemc: Implement the deprecated "timed_out" function.

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

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

6 years agosystemc: Catch exceptions during updates, notifications, and callbacks.
Gabe Black [Fri, 7 Sep 2018 22:42:51 +0000 (15:42 -0700)]
systemc: Catch exceptions during updates, notifications, and callbacks.

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

6 years agosystemc: Report an error if notifying during the update phase.
Gabe Black [Fri, 7 Sep 2018 22:24:17 +0000 (15:24 -0700)]
systemc: Report an error if notifying during the update phase.

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

6 years agosystemc: Track the scheduler status using an enum instead of bools.
Gabe Black [Fri, 7 Sep 2018 22:19:44 +0000 (15:19 -0700)]
systemc: Track the scheduler status using an enum instead of bools.

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

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

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

6 years agosystemc: Remove a redundant call to update() from the kernel object.
Gabe Black [Fri, 7 Sep 2018 22:22:18 +0000 (15:22 -0700)]
systemc: Remove a redundant call to update() from the kernel object.

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

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

6 years agosystemc: Mark a few tests as expected to raise an error.
Gabe Black [Fri, 7 Sep 2018 09:21:15 +0000 (02:21 -0700)]
systemc: Mark a few tests as expected to raise an error.

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

6 years agosystemc: Update some defaults in verify.py.
Gabe Black [Fri, 7 Sep 2018 09:14:27 +0000 (02:14 -0700)]
systemc: Update some defaults in verify.py.

Change the defaults in verify.py to be more like how I've been running
it. This is as close of an approximation as I have to how someone else
would want to run it manually. When run as part of a script, it's less
cumbersome to have to add extra arguments.

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

6 years agosystemc: Fortify how exceptions are caught and passed around.
Gabe Black [Fri, 7 Sep 2018 08:37:57 +0000 (01:37 -0700)]
systemc: Fortify how exceptions are caught and passed around.

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

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

6 years agosystemc: Merge stderr and stdout when running tests.
Gabe Black [Thu, 6 Sep 2018 23:49:24 +0000 (16:49 -0700)]
systemc: Merge stderr and stdout when running tests.

The golden output for tests doesn't distinguish between stderr and
stdout, and by only comparing against stdout we have to throw away
errors which would be good to verify we get right. Also the tests
sometimes send output to stderr for no apparent reason, requiring
manually patching the tests.

This change adds filters for two messages which used to go to stderr
in gem5 but now show up in the diffs, one that just says the simulation
is starting, and the other for warns of unimplemented functionality.
The second warning should be turned on at some point so we make sure
everything the tests touch works and they don't just work by
coincidence, but for now it introduces a lot of noise among otherwise
passing tests.

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

6 years agosystemc: Warn if a process is dont_initialize with no static sensitivieis.
Gabe Black [Thu, 6 Sep 2018 02:28:44 +0000 (19:28 -0700)]
systemc: Warn if a process is dont_initialize with no static sensitivieis.

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

6 years agosystemc: Report a warning if an event or object needs to be renamed.
Gabe Black [Thu, 6 Sep 2018 01:46:05 +0000 (18:46 -0700)]
systemc: Report a warning if an event or object needs to be renamed.

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