summaryrefslogtreecommitdiff
path: root/src/python/m5
AgeCommit message (Collapse)Author
2017-11-13config: Add an Energy param type.Gabe Black
This type expects values in joules (J). Change-Id: I77a3a4f1c19443f573d5fe7a84d5abd954ce1603 Reviewed-on: https://gem5-review.googlesource.com/5625 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-13config: Export the "Current" param type from m5.params.Gabe Black
This type was defined, but it was never added to __all__. Change-Id: I5414829a9562790416f5ceab71af01503d142903 Reviewed-on: https://gem5-review.googlesource.com/5624 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-13util: Add a "toEnergy" function to the convert module.Gabe Black
Change-Id: I7299af0e2a6ce9bd2272d6ccb898997336e95e51 Reviewed-on: https://gem5-review.googlesource.com/5623 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-13config: Simplify the definitions of the Voltage and Current params.Gabe Black
These had a lot of code which duplicated what was already in the Float param value class. Also, printing into the ini file with "%f" forces python to truncate values which require more precision than the fixed float format supports. Change-Id: Iad9623b71a31d17b69c184082585dcbb881eaa20 Reviewed-on: https://gem5-review.googlesource.com/5622 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-13util: Simplify/consolidate the python conversion module.Gabe Black
The python conversion module was really repetitive and fragmented, where some types of conversions use common code, and some use hand written case statements which did something very similar. Also, some types like Voltage could only handle V and mV but no other scaling prefix. This change restructures the module to centralize a lot of the unit handling code into toFloat, and makes the various other functions use it. Change-Id: Ic8529203cc226c9b551b8535a444e3f2f25ad1eb Reviewed-on: https://gem5-review.googlesource.com/5621 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-09-26util: Make dot_writer ignore NULL simobjects.Gabe Black
Also centralize the code which iterates over the parameters of a simnode's children, and remove a copy/paste block of code in the DVFS block of code. Change-Id: I01305fbff59346010780ee386ba97ad9106b1f5d Reviewed-on: https://gem5-review.googlesource.com/4849 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-09-26sim: Add a get_config_as_dict to the NullSimObject class.Gabe Black
Change-Id: I1ba6f6b196b7dfa790d1baaa23640bb3ed73f450 Reviewed-on: https://gem5-review.googlesource.com/4847 Maintainer: Gabe Black <gabeblack@google.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-09-26sim: Don't add the NULL SimObject as a child of other SimObjects.Gabe Black
Change-Id: Ibdc48af8e5a461077f75d781cfd8191586c54115 Reviewed-on: https://gem5-review.googlesource.com/4846 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-09-26sim: Give the NullSimObject singleton a _name.Gabe Black
The name is 'Null', and is what __str__ returns. Change-Id: I113f52496f5e9133b8d03206289b719fda003582 Reviewed-on: https://gem5-review.googlesource.com/4845 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-09-26sim: Add a NullSimObject.descendants function.Gabe Black
Null simobjects don't have any descendants. Change-Id: Ia43a99056709f422c9c817c017912d23d689fb1e Reviewed-on: https://gem5-review.googlesource.com/4844 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-09-26sim: Add a clear_parent function to NullSimObject.Gabe Black
Change-Id: I3842176f147997105fcc62aaf9cb93b9896708be Reviewed-on: https://gem5-review.googlesource.com/4843 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-09-26sim: Check the SimObjectVector.has_parent function to use the "any" function.Gabe Black
The existing code was essentially doing the same thing, but in a more roundabout and obscure way. One difference between the two versions is that I believe this will stop as soon as it encounters an element without a parent, where the original version would call has_parent() on all the elements regardless. Change-Id: Ia1fef3083fc88fca11f8ecfca453476e33194695 Reviewed-on: https://gem5-review.googlesource.com/4842 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-09-26sim: Only consider non-NULL elements in SimObjectVector.has_parent.Gabe Black
NullSimObject doesn't have a has_parent function, and it's not clear what its return value should be if one were added. The appropriate value seems to depend on why some other bit of code is checking if there's a parent in the first place. In SimObjectVector, the has_parent function is checking whether all of its elements have a parent. In this particular case, the most reasonable thing to do seems to be to just skip those elements. Change-Id: I5f8cad66d1b22c5e37962492fd77cff9371e5af8 Reviewed-on: https://gem5-review.googlesource.com/4841 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-09-26sim: Add a set_parent to NullSimObject which does nothing.Gabe Black
This lets attempts to set_parent on NullSimObject fall away harmlessly without having to add a bunch of checks whenever set_parent is called. Change-Id: I6d3510772ba71e765c4739e486e9f3d2460c4e11 Reviewed-on: https://gem5-review.googlesource.com/4840 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-05-31python: Fix unproxing of VectorParamsNikos Nikoleris
Previously proxy vector parameters would resolve correctly only for Parent.all. Any other proxy such as Parent.any, or exact ones such as Parent.addr_range would resolve to a *vector* of the right value resulting into a vector of a vector. For example if we set: DirectoryController0.addr_range = [0x100000-0x1fffff, 0x200000-0x2fffff] DirectoryMemory0.addr_range = Parent.addr_range where DirectoryController0 is the parent SimObject of DirectoryMemory0 after unproxying the Parent.addr_range VectorParam we would get DirectoryMemory0.addr_range = [[0x100000-0x1fffff, 0x200000-0x2fffff]] This change unifies handling of all three proxies to the same correct unproxy mechanism. Change-Id: Ie5107f69f58eb700b3e1b92c55210e0d53e6788d Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2901 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-05-24python: Fix PyEvent reference counting bugAndreas Sandberg
The current implementation of reference counting for PyEvents only partially works. The native object is currently kept alive while it is in the event queue. However, if the Python object goes out of scope, the Python side of this object is garbage collected which leaves a "dangling" native object. This results in confusing error messages where PyBind is unable to find the Python implementation of an event when it is triggered. Implement reference counting using the generalized reference counting API instead. Change-Id: I4e8e04abc4f61dff238d718065f5371e73b38ab3 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-on: https://gem5-review.googlesource.com/3222 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-05-22python: Prevent Python wrappers from deleting SimObjectsAndreas Sandberg
The PyBind wrappers could potentially delete SimObjects if they don't have any references. This is not desirable since there could be pointers to such objects within the C++ world. This problem doesn't normally occur since Python typically holds a pointer to the root node as long as the simulator is running. Prevent SimObject and Param deletion by using a PyBind-prescribed unique_ptr with a dummy deleter as the pointer wrapper for the Python world. Change-Id: Ied14602c9ee69a083a69c5dae1b5fcf8efb4548a Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-on: https://gem5-review.googlesource.com/3224 Reviewed-by: Gabe Black <gabeblack@google.com>
2017-05-22python: Fix weird memory issue in wrapped AddrRange vectorsAndreas Sandberg
There is a weird issue with the PyBind wrapper of vector<AddrRange>. Assigning new values to a param that is a vector of AddrRange sometimes results in an out-of-bounds memory access. We work around this issue by treating AddrRange vectors as opaque types. This slightly changes the semantics of the wrapper since Python now manipulates the real object rather than a copy that has been converted to a list. Change-Id: Ie027c06e7a7262214b43b19a76b24fe4b20426c5 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Timothy Hayes <timothy.hayes@arm.com> Reviewed-on: https://gem5-review.googlesource.com/3223 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-05-19python: Remove unused readline importAndreas Sandberg
The readline module is imported by main.py but doesn't seem to be used. Change-Id: I7888e3b6ad0a0fedc14b0feec2adf0a39883bbf8 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/3421 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-05-16python: Add a helper function to create Python eventsAndreas Sandberg
Add a helper function, m5.event.create(), to create events from Python. This function takes a callable Python object (e.g., a function) as an argument and optionally a priority as a keyword argument. This function was accidentally dropped from the public API when switching to PyBind. Change-Id: Icbd0e392d9506934ec2c9f541199aa35c1c2df8c Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-on: https://gem5-review.googlesource.com/3220 Reviewed-by: Gabe Black <gabeblack@google.com>
2017-05-15style: fix line lengths and include orderingBrandon Potter
The style checker complains about line length and ordering for these files. This fix should make these two files kosher. Change-Id: I822a0518a98d9e379a543d2017e90c4e9666a58d Reviewed-on: https://gem5-review.googlesource.com/3380 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Brandon Potter <Brandon.Potter@amd.com>
2017-05-09misc: Add the --listener-loopback-only command line option.Gabe Black
This option invokes the Listener::loopbackOnly() static function which will make the port listeners bind to the loopback device exclusively and ignore connections on other devices. That prevents external agents like port scanners from disrupting simulations with spurious connections. Change-Id: I46b22165046792a6f970826c109bdbce7db25c84 Reviewed-on: https://gem5-review.googlesource.com/3082 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-09misc: Expose the listener loopbackOnly function to python.Gabe Black
Change-Id: Ibb405af54a46a93706a6f476b5314491e84be0c8 Reviewed-on: https://gem5-review.googlesource.com/3081 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-09python: Fix debug flag listing regressionAndreas Sandberg
The PyBind11 changes slightly modified gem5's internal debug interfaces. The corresponding change to the public API went missing before the new bindings were merged. This change updates the Python glue to use the new interface. Change-Id: I3ecca5a3f6c35b99d55126d697371124f81a12dd Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Matteo Andreozzi <matteo.andreozzi@arm.com> Reviewed-on: https://gem5-review.googlesource.com/3140 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-05-02python: Remove SWIGAndreas Sandberg
Remove SWIG-specific Python code. Change-Id: If1d1b253d84021c9a8f9a64027ea7a94f2336dff Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Andreas Hansson <andreas.hansson@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2922 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Tony Gutierrez <anthony.gutierrez@amd.com>
2017-05-02python: Use PyBind11 instead of SWIG for Python wrappersAndreas Sandberg
Use the PyBind11 wrapping infrastructure instead of SWIG to generate wrappers for functionality that needs to be exported to Python. This has several benefits: * PyBind11 can be redistributed with gem5, which means that we have full control of the version used. This avoid a large number of hard-to-debug SWIG issues we have seen in the past. * PyBind11 doesn't rely on a custom C++ parser, instead it relies on wrappers being explicitly declared in C++. The leads to slightly more boiler-plate code in manually created wrappers, but doesn't doesn't increase the overall code size. A big benefit is that this avoids strange compilation errors when SWIG doesn't understand modern language features. * Unlike SWIG, there is no risk that the wrapper code incorporates incorrect type casts (this has happened on numerous occasions in the past) since these will result in compile-time errors. As a part of this change, the mechanism to define exported methods has been redesigned slightly. New methods can be exported either by declaring them in the SimObject declaration and decorating them with the cxxMethod decorator or by adding an instance of PyBindMethod/PyBindProperty to the cxx_exports class variable. The decorator has the added benefit of making it possible to add a docstring and naming the method's parameters. The new wrappers have the following known issues: * Global events can't be memory managed correctly. This was the case in SWIG as well. Change-Id: I88c5a95b6cf6c32fa9e1ad31dfc08b2e8199a763 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Andreas Hansson <andreas.hansson@arm.com> Reviewed-by: Andrew Bardsley <andrew.bardsley@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2231 Reviewed-by: Tony Gutierrez <anthony.gutierrez@amd.com> Reviewed-by: Pierre-Yves PĂ©neau <pierre-yves.peneau@lirmm.fr> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-03-21python: Automatically disable listeners in batch setupsAndreas Sandberg
Determine if gem5 is running in a batch environment by checking if STDIN is wired to a TTY or not. If the simulator is running in a batch environment, disable all listeners by default. This behavior can be overridden using the --enable-listeners option. Change-Id: I404c709135339144216bf08a2769c016c543333c Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Sean McGoogan <sean.mcgoogan@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2322 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-02-27python: Add a generalized mechanism to configure statsAndreas Sandberg
Add a mechanism to configure the stat output format using a URL-like syntax. This makes it possible to specify both an output format (currently, only text is supported) and override default parameters. On the Python-side, this is implemented using a helper function (m5.stats.addStatVisitor) that adds a visitor to the list of active stat visitors. The helper function parses a URL-like stat specification to determine the stat output type. Optional parameters can be specified to change how stat visitors behave. For example, to output stats in text format without stat descriptions: m5.stats.addStatVisitor("text://stats.txt?desc=False") From the command line: gem5.opt --stats-file="text://stats.txt?desc=False" Internally, the stat framework uses the _url_factory decorator to wrap a Python function with the fn(path, **kwargs) signature in a function that takes a parsed URL as its only argument. The path and keyword arguments are automatically derived from the URL in the wrapper function. New output formats can be registered in the m5.stats.factories dictionary. This dictionary contains a mapping between format names (URL schemes) and factory methods. To retain backwards compatibility, the code automatically assumes that the user wants text output if no format has been specified (i.e., when specifying a plain path). Change-Id: Ic4dce93ab4ead07ffdf71e55a22ba0ae5a143061 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com> Reviewed-by: Ilias Vougioukas <ilias.vougioukas@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Tony Gutierrez <anthony.gutierrez@amd.com>
2017-01-27python: Move native wrappers to the _m5 namespaceAndreas Sandberg
Swig wrappers for native objects currently share the _m5.internal name space with Python code. This is undesirable if we ever want to switch from Swig to some other framework for native binding (e.g., PyBind11 or Boost::Python). This changeset moves all of such wrappers to the _m5 namespace, which is now reserved for native code. Change-Id: I2d2bc12dbc05b57b7c5a75f072e08124413d77f3 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-01-03python: Don't use Swig to cast statsAndreas Sandberg
Call the stat visitor from the stat itself rather than casting stats in Python. This reduces the number of ways visitors are called. Change-Id: Ic4d0b7b32e3ab9897b9a34cd22d353f4da62d738 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Joe Gross <joseph.gross@amd.com>
2017-01-03sim: Remove redundant export_method_cxx_predeclsAndreas Sandberg
The headers declared in export_method_cxx_predecls are redundant since a SimObject's main header is automatically included. Change-Id: Ied9e84630b36960e54efe91d16f8c66fba7e0da0 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Joe Gross <joseph.gross@amd.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2016-12-19python: Export periodicStatDumpAndreas Sandberg
Some configuration scripts need periodic stat dumps. One of the ways this can be achieved is by using the pariodicStatDump helper function. This function was previously only exported in the internal name space. Export it as a normal function in m5.stat instead. Change-Id: Ic88bf1fd33042a62ab436d5944d8ed778264ac98 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com>
2016-09-15base: eliminate ipython warningCurtis Dunham
Change-Id: I3e282baeb969b6bb9534813a2f433d68246c0669 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2016-09-13base: Output all AddrRange parameters to config.iniMatt Poremba
Currently only 'start' and 'end' of AddrRange are printed in config.ini. This causes address ranges to be overlapping when loading a c++-only config with interleaved addresses using CxxConfigManger. This patch adds prints for the interleave and XOR bits to config.ini such that address ranges are properly setup with cxx config.
2016-05-27power: Allow voltage to be configured via cmd lineAkash Bagdia
--- src/python/m5/params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
2016-04-06misc: Bail out of DVFS dot if we cannot resolve the domainsSascha Bischoff
This changeset updates the dot output to bail out if it is unable to resolve the voltage or clock domains (which will cause it to raise an AttributeError). Additionally, the DVFS dot output is disabled by default for speed purposes. Minor fixup for 0aeca8f.
2015-12-15misc: Add secondary dot output for DVFS domainsSascha Bischoff
This patch adds a secondary dot output file which shows the DVFS domains. This has been done separately for now to avoid cluttering the already existing diagram. Due to the way that the clock domains are assigned to components in gem5, this output must be generated after the C++ objects have been instantiated. This further motivates the need to generate this file separately to the current dot output, and not to replace it entirely.
2016-03-30style: Refactor the style checker as a Python packageAndreas Sandberg
Refactor the style checker into a Python module that can be reused by command line tools that integrate with git. In particular: * Create a style package in util * Move style validators from style.py to the style/validators.py. * Move style verifiers from style.py to the style/verifiers.py. * Move utility functions (sort_includes, region handling, file_types) into the style package * Move generic code from style.py to style/style.py. Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Steve Reinhardt <steve.reinhardt@amd.com> --HG-- rename : util/style.py => util/hgstyle.py rename : util/sort_includes.py => util/style/sort_includes.py extra : rebase_source : ad6cf9b9a18c48350dfc7b7c77bea6c5344fb53c
2015-11-26sim: Add support for forkingAndreas Sandberg
This changeset adds forking capabilities to the gem5 python scripts. A fork method is added to simulate.py. This method is responsible for forking the simulator itself, and will direct all output files to a new output directory based on the fork sequence number. The default name of the output directory is the same as the parent with the suffix ".fN" added where N is the fork sequence number. The fork method provides the option to specify if the system should be drained prior to forking, or not. By default the system is drained to ensure that there are no in-flight transactions. When forking the simulator, the fork method returns the PID of the child process, or returns 0 if running in the child. This is in line with the standard Python forking interface. Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se> [sascha.bischoff@arm.com: Rebased patches onto a newer gem5 version] Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com> [andreas.sandberg@arm.com: Updated to comply with modern draining semantics ] Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
2015-11-26sim: Add support for notifying Drainable objects of a forkAndreas Sandberg
When forking a gem5 process, some objects need to clean up resources (mainly file descriptions) shared between the child and the parent of the fork. This changeset adds the notifyFork() method to Drainable, which is called in the child process. Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se> [sascha.bischoff@arm.com: Rebased patches onto a newer gem5 version] Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com> Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
2016-02-13configs: add command-line option to stop debug outputMichael LeBeane
This patch adds a --debug-end flag to main.py so that debug output can be stoped at a specified tick, while allowing the simulation to continue. It is useful in situations where you would like to produce a trace for a region of interest while still collecting stats for the entire run. This is in contrast to the currently existing --debug-break flag, which terminates the simulation at the tick.
2016-02-06style: remove trailing whitespaceSteve Reinhardt
Result of running 'hg m5style --skip-all --fix-white -a'.
2016-01-17sim: fix redundant --debug-start help stringSteve Reinhardt
Just changes the metavar for --debug-start from TIME to TICK in cset 72046b9b3323 and didn't notice that the comment "must be in ticks" is now redundant.
2016-01-17sim: don't ignore SIG_TRAPSteve Reinhardt
By ignoring SIG_TRAP, using --debug-break <N> when not connected to a debugger becomes a no-op. Apparently this was intended to be a feature, though the rationale is not clear. If we don't ignore SIG_TRAP, then using --debug-break <N> when not connected to a debugger causes the simulation process to terminate at tick N. This is occasionally useful, e.g., if you just want to collect a trace for a specific window of execution then you can combine this with --debug-start to do exactly that. In addition to not ignoring the signal, this patch also updates the --debug-break help message and deletes a handful of unprotected calls to Debug::breakpoint() that relied on the prior behavior.
2015-12-01config: Fix broken SimObject listingAndreas Sandberg
The gem5 option '--list-sim-objects' is supposed to list all available SimObjects and their parameters. It currently chokes on SimObjects with parameters that have an object instance as their default value. This is caused by __str__ in SimObject trying to resolve its complete path. When the path resolution method reaches the parent object (a MetaSimObject since it hasn't been instantiated), it dies with a Python exception. This changeset adds a guard to stop path resolution if the parent object is a MetaSimObject.
2015-11-22config: Added missing types to JSON/INI Python readerAndrew Bardsley
Added the missing types EthernetAddr and Current to the JSON/INI file reader example configs/example/read_config.py. Also added __str__ to EthernetAddr to make values appear in the same form in JSON an INI files.
2015-10-06sim: print pid in output headerSteve Reinhardt
This information is useful if you have a bunch of simulations running and want to know which one to kill, but you've neglected to take advantage of the previous patch and embed the pid in your output path.
2015-09-30base: remove Trace::enabled flagCurtis Dunham
The DTRACE() macro tests both Trace::enabled and the specific flag. This change uses the same administrative interface for enabling/disabling tracing, but masks the SimpleFlags settings directly. This eliminates a load for every DTRACE() test, e.g. DPRINTF.
2015-07-07sim: Decouple draining from the SimObject hierarchyAndreas Sandberg
Draining is currently done by traversing the SimObject graph and calling drain()/drainResume() on the SimObjects. This is not ideal when non-SimObjects (e.g., ports) need draining since this means that SimObjects owning those objects need to be aware of this. This changeset moves the responsibility for finding objects that need draining from SimObjects and the Python-side of the simulator to the DrainManager. The DrainManager now maintains a set of all objects that need draining. To reduce the overhead in classes owning non-SimObjects that need draining, objects inheriting from Drainable now automatically register with the DrainManager. If such an object is destroyed, it is automatically unregistered. This means that drain() and drainResume() should never be called directly on a Drainable object. While implementing the new functionality, the DrainManager has now been made thread safe. In practice, this means that it takes a lock whenever it manipulates the set of Drainable objects since SimObjects in different threads may create Drainable objects dynamically. Similarly, the drain counter is now an atomic_uint, which ensures that it is manipulated correctly when objects signal that they are done draining. A nice side effect of these changes is that it makes the drain state changes stricter, which the simulation scripts can exploit to avoid redundant drains.
2015-07-07sim: Move mem(Writeback|Invalidate) to SimObjectAndreas Sandberg
The memWriteback() and memInvalidate() calls used to live in the Serializable interface. In this series of patches, the Serializable interface will be redesigned to make serialization independent of the object graph and always work on the entire simulator. This means that the Serialization interface won't be useful to perform maintenance of the caches in a sub-graph of the entire SimObject graph. This changeset moves these memory maintenance methods to the SimObject interface instead.