summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-10-16systemc: Add some error checks to sc_clock.Gabe Black
The Accellera version reports an error if the period, high or low portions of the clock are zero. Change-Id: I2cbb7c3a1b6abe4d969ef875ebf8754d2d1c489a Reviewed-on: https://gem5-review.googlesource.com/c/13303 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Add an error check to sc_gen_unique_name.Gabe Black
Accellera checks for a null pointer, and a test tries using that input. Change-Id: I0f098f53de37ebbe481ea46e61fc0a9a404c29db Reviewed-on: https://gem5-review.googlesource.com/c/13302 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Detach child events in the Object destructor.Gabe Black
This way they don't try to detach themselves from a parent object which no longer exists. Change-Id: Id4a3f3b2241cf8c67cae9b983bd4c1acbef083e3 Reviewed-on: https://gem5-review.googlesource.com/c/13301 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Report an error if an sc_event_finder is used on an unbound port.Gabe Black
Rather than assuming the port is bound, check and report an error. Change-Id: I4af89d104bc6de9932ff044740446833732d01d9 Reviewed-on: https://gem5-review.googlesource.com/c/13300 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Implement port binding policies.Gabe Black
Change-Id: I585e34c4a666103af16ff1675701b61122822b55 Reviewed-on: https://gem5-review.googlesource.com/c/13299 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Add some deprecated positional binding operators.Gabe Black
These are used in one of the tests, specifically the comma operator. It didn't cause compilation to fail because of the default meaning of the comma. Change-Id: I7ce7fe74f02d4ad6a4ab896a2f0d6bd1ce635c2f Reviewed-on: https://gem5-review.googlesource.com/c/13298 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Keep track of progress when positionally binding.Gabe Black
Positionally binding more than once (like with the deprecated comma or << operators) should pick up where it left off the last time instead of starting again from the beginning. Change-Id: Ifc33520d6ce40544bd0ad80a5657b1a38a7914e4 Reviewed-on: https://gem5-review.googlesource.com/c/13297 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Fill out some error reporting in sc_port.Gabe Black
Rather than just asserting some invariants are true, report errors if they aren't. Change-Id: Id361b8a13011e1a75289ddddb6b41c1d09dbf794 Reviewed-on: https://gem5-review.googlesource.com/c/13296 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Run delta notifications in reverse insertion order.Gabe Black
This is sort of pointless, except that it matches Accellera's behavior. Change-Id: Ia63f2de998157aa68ce36fdc2ba39ca7a80fecbe Reviewed-on: https://gem5-review.googlesource.com/c/13295 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Change how signal based resets work.Gabe Black
The previous implementation used the value changed event to track when signals changed value, but there were a couple problems with this approach. First, this piggybacked on the sensitivity mechanism in some ways, but diverged in others. The sensitivity didn't notify a process when it was satisfied like other sensitivity types would, and it also ignored whether the process was disabled. Second, the value_changed_event is notified by a signal instance as a delta notification, but reset signals are supposed to act immediately. That means they should happen before all delta notifications, or in other words all delta notifications should see the reset status of a given process. That's particularly important in the case of wait(int n) where setting the reset clears the reset count, and the count is checked when determining whether or not to wake up a process when its sensitivity is satisfied, potentially by a delta notification. Third, by removing the middle man and not trying to repurpose the sensitivity mechanism, the code gets simpler and easier to understand. Change-Id: I0d05d11437291d368b060f6a45a207813615f113 Reviewed-on: https://gem5-review.googlesource.com/c/13294 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Increment the change stamp value before the timing phase.Gabe Black
It appears that events which are triggered during the timing phase are considered triggered in the following evaluation phase. The "triggered()" function on events is non-standard and not really explained anywhere, but this appears to work in practice. Change-Id: I2574dc4569bf148c55fbe2a4873d458fc507f2a5 Reviewed-on: https://gem5-review.googlesource.com/c/13293 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Add a simple implementation for sc_mempool.Gabe Black
This class is supposed to be a more efficient way to manage small bits of memory. At least for now, new and delete will do the same job functionally. Also, the heap manager may be just as efficient as whatever custom mechanism sc_mempool would use. Change-Id: I6fdc01a69ca017d94b14a15a196ad29b66ef9858 Reviewed-on: https://gem5-review.googlesource.com/c/13292 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Add an sc_gen_unique_name namespace to processes as well.Gabe Black
The standard says that there are namespaces for each module, and one global namespace. Accellera also has namespaces for each process, which shows up in the test output. Change-Id: I4c8c5cecd5fb685d7bab521d9ae131aef23a6ab4 Reviewed-on: https://gem5-review.googlesource.com/c/13291 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Add some error checks to the sc_module constructor.Gabe Black
These match error checks which are already in, for instance, the sc_port constructor. Change-Id: I8dfb4ce37bf0e59c6fa879f0afda5112af78b40b Reviewed-on: https://gem5-review.googlesource.com/c/13290 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Change how errors are handled in some constructors slightly.Gabe Black
Because SC_REPORT_ERROR usually causes an exception to be thrown, it's easy to assume it will be the last thing executed in a function. It might, however, be set up to do nothing, in which case the function will continue to execute. This change makes sure sc_prim will be set up properly even if errors about the time a channel can be set up are ignored. Also, if an exception is thrown while sc_port is being set up, the corresponding Port object needs to be cleaned up. Rather than try to intercept exceptions in the constructor and clean up properly, we'll just make the allocation of the Port object be the last thing it does. If the function exits early, then the Port pointer will still be nullptr and nothing will need to be done. Change-Id: If8f6f6b7e6830235fee3cd75625240b99e87dfbe Reviewed-on: https://gem5-review.googlesource.com/c/13289 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Add an sc_gem5::Port destructor.Gabe Black
This destructor just removes the port from the list of all ports. Change-Id: I809b529540c2946d20aeb8d64467d77dc94a7a96 Reviewed-on: https://gem5-review.googlesource.com/c/13288 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Change the point where elaboration is considered over.Gabe Black
Make it the end of "before_end_of_elaboration" rather than the end of "end_of_elaboration". This interpretation fits the behavior expected by some of the tests. Change-Id: I3f589147834ab5d5dc8c0e9b4849dd00491c5848 Reviewed-on: https://gem5-review.googlesource.com/c/13287 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Implement sc_hierarchical_name_exists.Gabe Black
This function checks the top level collection of events and objects to find if one with a particular name exists. Change-Id: Icf539b502fa9c7401be907ee975eb24a47e79a87 Reviewed-on: https://gem5-review.googlesource.com/c/13206 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Make sure otherwise unnamed events get autogenerated ones.Gabe Black
Change-Id: Iec4e0bd504e70d0096a4c90d5fbba9565dd0deed Reviewed-on: https://gem5-review.googlesource.com/c/13205 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-10-16systemc: Fix a typo in one of the error messages.Gabe Black
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>
2018-10-16systemc: Implement writer policies.Gabe Black
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>
2018-10-16systemc: Don't use write() in sc_clock to set the clock value.Gabe Black
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>
2018-10-16systemc: Clear the current process when done with the eval phase.Gabe Black
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>
2018-10-16systemc: Implement register_port in all the predefined channels.Gabe Black
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>
2018-10-16systemc: Add missing sc_interface::register_port, and add calls to it.Gabe Black
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>
2018-10-16systemc: Remove some old warn includes from ext/channel.Gabe Black
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>
2018-10-16systemc: Implement sc_vector.Gabe Black
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>
2018-10-16systemc: Change how the timing of binding ports works.Gabe Black
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>
2018-10-16systemc: Use the stage of simulation and not port size in add_trace.Gabe Black
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>
2018-10-16systemc: Centralize how object parents are chosen.Gabe Black
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>
2018-10-16systemc: Use c++11 partial functions instead of boosts.Gabe Black
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>
2018-10-16systemc: Filter out a test which breaks rules gem5 won't let it break.Gabe Black
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>
2018-10-16systemc: Add a non-standard sc_time constructor and from_string.Gabe Black
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>
2018-10-16systemc: Modify reportifyException to keep sc_reports in scope.Gabe Black
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>
2018-10-16systemc: Implement the sc_time_tuple class.Gabe Black
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>
2018-10-16systemc: Merge notify and notifyWork and ignore disabled for resets.Gabe Black
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>
2018-10-16systemc: Ensure the reset event is notified before reseting the target.Gabe Black
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>
2018-10-16systemc: Implement signal based resets.Gabe Black
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>
2018-10-16systemc: Implement the synchronous reset state.Gabe Black
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>
2018-10-16systemc: Implement sc_event_queue.Gabe Black
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>
2018-10-16systemc: Remove a hack which scaled sc_time into ps unnecessarily.Gabe Black
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>
2018-10-16systemc: Change how the default timescale is set.Gabe Black
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>
2018-10-16systemc: Simplify sc_time_stamp().Gabe Black
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>
2018-10-16systemc: Implement sc_get_curr_process_handle().Gabe Black
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>
2018-10-16systemc: Print an Info when setting a tracefile's time unit.Gabe Black
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>
2018-10-16systemc: Move some constants out of sc_time.cc for other files to use.Gabe Black
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>
2018-10-16systemc: Add a warning to sc_interface::default_event.Gabe Black
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>
2018-10-16systemc: Filter out an Info about delta cycles and pseudo timesteps.Gabe Black
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>
2018-10-16systemc: Check the process type when using sc_join.Gabe Black
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>
2018-10-16systemc: Make sure the right type process is running when calling wait.Gabe Black
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>