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

6 years agosystemc: Teach verify.py to filter messages which start within a line.
Gabe Black [Thu, 6 Sep 2018 00:35:15 +0000 (17:35 -0700)]
systemc: Teach verify.py to filter messages which start within a line.

It's possible for a test to generate a warning or error in the middle
of a line of output. The previous filter generator function would
create a filter which would only detect those messages which started
at the beginning of a new line.

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

6 years agosystemc: Implement sc_time::to_string.
Gabe Black [Thu, 6 Sep 2018 00:34:43 +0000 (17:34 -0700)]
systemc: Implement sc_time::to_string.

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

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

6 years agosystemc: Match how Accellera schedules processes even more closely.
Gabe Black [Thu, 6 Sep 2018 00:21:11 +0000 (17:21 -0700)]
systemc: Match how Accellera schedules processes even more closely.

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

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

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

6 years agosystemc: Implement the nonstandard halt function.
Gabe Black [Wed, 5 Sep 2018 23:08:24 +0000 (16:08 -0700)]
systemc: Implement the nonstandard halt function.

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

6 years agoconfigs: Fix CPUClass typo in se.py
Daniel R. Carvalho [Tue, 9 Oct 2018 09:27:08 +0000 (11:27 +0200)]
configs: Fix CPUClass typo in se.py

Change 719eb033fe435133abf15501c249eec10d1c861f added a typo
to se.py that breaks simpoint simulation, which generates the
following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/daniel/gem5/src/python/m5/main.py", line 435, in main
    exec filecode in scope
  File "./configs/example/se.py", line 217, in <module>
    if not CpuConfig.is_atomic_cpu(TestCPUClass):
NameError: name 'TestCPUClass' is not defined

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

6 years agoarch-arm: Add have_crypto System parameter
Giacomo Travaglini [Thu, 17 May 2018 16:07:16 +0000 (17:07 +0100)]
arch-arm: Add have_crypto System parameter

This patch adds the have_crypto ArmSystem parameter for enabling crypto
extension. This is done by modifying the AArch32/AArch64 ID registers
at startup time.

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

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

Crypto instruction classes added to the MinorDefaultFloatSimdFU.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Furthermore, trying to use it fails with:

object 'RealViewEB' has no attribute 'pci_host'

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

6 years agosystemc: Ensure sc_stop during callbacks actually stops.
Gabe Black [Tue, 4 Sep 2018 22:09:48 +0000 (15:09 -0700)]
systemc: Ensure sc_stop during callbacks actually stops.

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

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

6 years agosystemc: Implement the nonstandard at_negedge and at_posedge.
Gabe Black [Sun, 2 Sep 2018 01:53:23 +0000 (18:53 -0700)]
systemc: Implement the nonstandard at_negedge and at_posedge.

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

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

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

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

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

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

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

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

6 years agosystemc: Add some error checks to sc_set_default_time_unit.
Gabe Black [Sun, 2 Sep 2018 00:49:20 +0000 (17:49 -0700)]
systemc: Add some error checks to sc_set_default_time_unit.

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

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

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

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

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

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

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

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

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

This test purposefully fails with an error.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

6 years agosystemc: sc_spawn can create static or dynamic processes.
Gabe Black [Wed, 29 Aug 2018 06:32:50 +0000 (23:32 -0700)]
systemc: sc_spawn can create static or dynamic processes.

Their status depends on when sc_spawn is run.

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