summaryrefslogtreecommitdiff
path: root/src/python/m5
AgeCommit message (Collapse)Author
2019-06-10python: Add binding for the new AddrRange c++ constructorNikos Nikoleris
Change-Id: I5b3fb59a11d8587a753759310dd3b2748ac13a0b Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19132 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Jason Lowe-Power <jason@lowepower.com> Tested-by: kokoro <noreply+kokoro@google.com>
2019-05-20misc: Added dot_writer for Ruby's network topologyTiago Muck
Change-Id: Ic71ca7bc2eb4174d70afa368bc9cc987f3df89e9 Signed-off-by: Tiago Muck <tiago.muck@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17548 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com> Tested-by: kokoro <noreply+kokoro@google.com>
2019-04-28mem: Minimize the use of MemObject.Gabe Black
MemObject doesn't provide anything beyond its base ClockedObject any more, so this change removes it from most inheritance hierarchies. Occasionally MemObject is replaced with SimObject when I was fairly confident that the extra functionality of ClockedObject wasn't needed. Change-Id: Ic014ab61e56402e62548e8c831eb16e26523fdce Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18289 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
2019-04-27python: Get rid of the VectorPort constructor.Gabe Black
The only thing it was doing beyond calling the parent Port __init__ was to set isVec, and nobody actually looks at that value later. Change-Id: I567cb583e6f02a6c18504b9bb20dd13b3c934822 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18175 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2019-04-27python: Replace the Master/Slave Ports with Request/Response ports.Gabe Black
These are a little more descriptive and a little less potentially offensive. Change-Id: I84c30f783f0a4c242cb4f54ab272b6fdf1e9eec7 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18174 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2019-04-24python: Generalize the Port.splice function.Gabe Black
Now that the MASTER and SLAVE roles aren't special, the splice function needs to be able to handle arbitrarily role-d peers. Change-Id: I22a28b7cdcb93f7f370730b7e38b0e6d3500a6a0 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18170 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2019-04-24python: Generalize the dot_writer to handle non Master/Slave roles.Gabe Black
Change-Id: I6d93c28e754c0cacacdd5e8885c45bc861135e94 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18169 Maintainer: Gabe Black <gabeblack@google.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
2019-04-24python: Make Port roles a more generic concept.Gabe Black
A recent change got rid of the strict Master => Slave port relationship which used to be checked in python and instead left the checking up to C++. One major downside to this approach is that it was no longer obvious in the configuration what was supposed to be connected to what, and it still left the arbitrary and misleading MasterPort and SlavePort types in the Ethernet devices which could now connect with each other symmetrically but couldn't actually connect to an arbitrary MasterPort/SlavePort. This change exposes the base Port and VectorPort types, and makes them accept a "role" parameter in __init__ which used to be set directly by their subclasses. This role can be any string, and will be used later to check for compatiblity and to give a hint as to what can be connected to what in the SimObject definitions. To make the checks work with arbitrary compatible pairs, the base Port type now has a class method called compat() which accepts a pair of roles which will become mutually compatible, ie any port with the first role will be allowed to connect to any port with the second role, and vice versa. To be self compatible, the same role should be passed in for both parameters. To maintain compatibility, the MasterPort and SlavePort types are retained, but now they're nothing special and could have been set up in any arbitrary SimObject .py file. The same is true for MasterVectorPort and SlaveVectorPort. Also, since we can no longer assume that all edges in the dot graph of the config should start with a port with the MASTER role and end with a port with the SLAVE role, Ports now track an is_source property which says whether the arrow head should be surpressed at that end of the edge representing the connection. Change-Id: Ifcc6faab05e437ad87cd21f0ba613b09cf21c321 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18168 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
2019-04-23python: fix tracing after Python 3 refactorCiro Santilli
gem5.opt --debug-flags ExecAll was failing with: ImportError: No module named defines on Python 2. Change-Id: I06959d6e0ccb7c661c7c749af3392632dac779f3 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18108 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
2019-03-19python: Switch to the new getPort mechanism to connect ports.Gabe Black
This retrieves ports using the getPort method, and connects them using the bind method on the ports themselves. Any smarts as far as what type of peers are allowed to connect or how they connect is left up to the individual bind methods. Change-Id: Ic640d1fce8af1bed411116e5830edc4a8a0f9d66 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17039 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2019-03-19sim: Add a getPort function to SimObject.Gabe Black
This will retrieve a Port object from a given SimObject (which might not be a MemObject) no matter what flavor of Port it is. Change-Id: I636b85e9d4929a05a769e165849106bcb5f3e9c1 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17037 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2019-03-18python: Improve how templated SimObject classes are handled.Gabe Black
When setting up a SimObject's Param structure, gem5 will autogenerate a header file which attempts to declare the SimObject's C++ type. It has had at least some level of sophistication there where it would pull off the namespaces ahead of the class name and handle them properly, but it didn't know how to handle templates. This change improves that handling in two ways. First, it adds a new magical SimObject attribute called 'cxx_template_params' which is used to specify what the template parameters are as a list. For instance, if your SimObject was a template which took an integer constant as its first parameter and a type as its second, this attribute could look like the following: cxx_template_params = [ 'int FOO', 'class Bar' ] Importantly, if there are any default values for these template parameters, they should *not* be included here, they should be specified where the class is later defined. The second new mechanism is to add an internal CxxClass in the SimObject.cxx_param_decl method. This class accepts the class signature in the cxx_class attribute and the cxx_template_params and does two things. First, it strips off namespaces like in the old implementation. Second, it extracts and processes any template arguments attached to the class. If these are constants (as determined by the contents of cxx_template_params), then they are stored verbatim. If they're types, then they're recursively expanded into a CxxClass and stored that way. Note that these are the *values* of the template arguments, where as cxx_template_params lists the *types* and *names* of those arguments. In our earlier example, if cxx_class was: cxx_class = 'CoolClasses::ClassName<12, Fruit::Apple>' Then CxxClass would extract the namespace 'CoolClasses', the class name 'ClassName', the argument '12', and the argument 'Fruit::Apple'. That second argument would be expanded into a CxxClass with the namespace 'Fruit' and the class name 'Apple'. Importantly here, because there were no default arguments given in cxx_template_params, all "hidden" arguments which would fall through to their defaults need to be fully specified in cxx_class. The CxxClass has a method called declare() which uses the information extracted earlier to output all of the "stuff" necessary for declaring the given class, including opening any containing namespaces and putting template<...> ahead of the actual class declaration with the template parameters specified. If any of the template arguments are themselves CxxClass instances, then they'll be recursively declared immediately before the current class is. An alternative solution to this problem might be to include the header file which actually defines the cxx_class type to avoid having to come up with a declaration. Unfortunately this doesn't work since it can set up include loops where the SimObject C++ header file includes the param header to get access to the Param type, but that includes the C++ header to get access to the SimObject type. This also makes it harder for SimObjects to refer to each other, since they rely on the declaration in the params header files when declaring a member pointer to that type in their own Param structures. Change-Id: I68cfc36ddff6d789eb4cdef5178c4619ac2cc8b1 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17228 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2019-03-14python: Teach cxxMethod how to set return_value_policy.Gabe Black
This is passed through to the underlying call to PyBindMethod. Change-Id: Ib46c55664ba0707464bb84e137a0fad817aea1bb Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17034 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2019-03-14python: Teach PyBindMethod how to set return_value_policy.Gabe Black
Change-Id: Ia208e43672672556b36f905e8f71dce44b978d22 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17033 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2019-03-14python: Fix unknown params and proxy multiplicationDaniel R. Carvalho
One of the recent changes made params not visible anymore: NameError: global name 'params' is not defined This is fixed by adding the proper import statement. However, the second error makes the multiplication values be assigned to other proxies (that are not even used on the multiplication). A workaround is added to prevent this from happening by extending "*=". Change-Id: I3ad276a456efff62058672d16caac2b3ad1b326b Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17048 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2019-03-01python: Fix issue when Self proxy resolves to a another proxyAndreas Sandberg
The problem occurs when a proxy is being resolved to another proxy that hasn't been resolved yet. The problematic case that was triggering this issues in the VGIC. It was caused by parameters looking a bit like this: gic = Param.GicV2(Parent.any) some_param = Param.Int(Self.gic.some_param) When 'some_param' was resolved, it found the 'gic' parameter in Self. However, that parameter hadn't been resolved yet, so the existing code was setting the proxy evaluation context to the unresolved Parent.any proxy without first unproxying it. It seems like this bug depends on the graph traversal order and I have so far only seen it when compiling gem5 with Python 3. Change-Id: Iea12cc138765e70bfd6bb776b1efa012364db066 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/16004 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2019-02-25systemc: Add m5.systemc and m5.tlm python modules.Gabe Black
These will be how systemc and tlm APIs which are not attached to SimObjects will be exposed. This avoids having to artificially attach them to wrapping SimObjects for instance, which is a bit awkward and non-obvious. The python code which attaches the systemc and tlm modules to the m5 modules lives in src/python/m5/__init__.py, but the modules themselves live in src/systemc/python to keep all the systemc code grouped together. It might be a little confusing to have a small part of the glue that adds those modules in a separate place (__init__.py), but that is, as far as I can tell, unavoidable, and it's better in my opinion to keep the systemc code grouped together than to put it alongside the other python code and __init__.py. Change-Id: Iecb218daec5e15772152b5ad22b51f43b86c3d4b Reviewed-on: https://gem5-review.googlesource.com/c/16563 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
2019-02-25python: Stop using basestring to test for stringsAndreas Sandberg
The base class basestring doesn't exist in Python 3. Use string_types from six instead. Change-Id: I7e84903fb7dd4a0af7ae4e9f4ec2e54338f212bb Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15998 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Juha Jäykkä <juha.jaykka@arm.com>
2019-02-25python: Add Python 3 workarounds for longAndreas Sandberg
Python 3 doesn't have a separate long type. Make long an alias for int where needed to maintain compatibility. Change-Id: I4c0861302bc3a2fa5226b3041803ef975d29b2fd Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15988 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
2019-02-25python: Fix params/proxy import loopAndreas Sandberg
There is a circular dependency between params and proxy at import time. This causes issues for Python 3. Add the imports to the specific methods with the dependencies to make the import happen when the method is executed instead. Change-Id: I770112fd3c07c395459e204976942bda3dc7236f Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15993 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Juha Jäykkä <juha.jaykka@arm.com>
2019-02-23python: Enforce absolute imports for Python 3 compatibilityAndreas Sandberg
Change-Id: Ia88d7fd472f7aed9b97df81468211384981bf6c6 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15983 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2019-02-22python: Add fallbacks for packages that have been renamedAndreas Sandberg
Python 3 has restructured some packages. Specifically, __builtin__ has been renamed to builtins and urlparse has been included in urllib. Change-Id: I81f8f3942471db1043006a36abbad6e5a49e0a43 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15994 Reviewed-by: Juha Jäykkä <juha.jaykka@arm.com>
2019-02-22python: Fix param -> int conversion issuesAndreas Sandberg
Python 3 doesn't convert params to integers automatically in range(). Add __index__ to CheckedInt to enable implicit conversions again. Add explicit conversions where necessary. Change-Id: I2de6c9906d3bb7616f12ada6728b9e4b1928511c Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/16000 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2019-02-22python: Make iterator handling Python 3 compatibleAndreas Sandberg
Many functions that used to return lists (e.g., dict.items()) now return iterators and their iterator counterparts (e.g., dict.iteritems()) have been removed. Switch calls to the Python 2.7 iterator methods to use the Python 3 equivalent and add explicit list conversions where necessary. Change-Id: I0c18114955af8f4932d81fb689a0adb939dafaba Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15992 Reviewed-by: Juha Jäykkä <juha.jaykka@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2019-02-22python: Add missing operators to NumericParamValueAndreas Sandberg
Add missing operators to NumericParamValue and ensure that they are able to work on the underlying value if the right hand side is a param. Change-Id: I2bd86662aee9891bbd89aed7ebe20b827b5528bd Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/16001 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
2019-02-20python: Fix Param initialization issue in Python 3Andreas Sandberg
When initializing a param with a SimObject NULL pointer, convert() checks if the 'ptype' attribute has been created and whether the value is NULL. In that case, it assumes that the object is being initizalized as a part of SimObject initialization and defers the conversion. This check is implemented using hasattr() which in turn is implemented using the __getattr__ implementation that asserts because all SimObjects haven't been initialized yet. Implement the check using a lookup in the object's dictionary instead to prevent the SimObject lookup. Change-Id: I7367563c4fb71f6d2be541ebdc0be418e9f73d48 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15990 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
2019-02-20python: Use __name__ instead of func_name for Py3 compatAndreas Sandberg
Change-Id: I62a9685b4bce7e9012bc65309fcafe26135fde6d Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15997 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
2019-02-20python: Add __bool__ helpers in addition to __nonzero__Andreas Sandberg
Python 3 uses __bool__ instead of __nonzero__ when performing a Boolean comparison. Change-Id: I85185bbe136ecae67346fa23569e24edd7329222 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15996 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
2019-02-20config: Make parameter conversion handle integers in other bases.Gabe Black
Python's float() function/type can't handle hexadecimal notation, but int() can. Since there are also cases where converting to a float and then back to an int (or long) can cause rounding error, this change splits toFloat and toInteger apart and makes them call a worker function which accepts a conversion function which does the work of converting a numeric string into an actual number. in the case of toFloat, it still uses the standard float(), and in the case of toInteger it uses a lambda which wraps int(x, 0). Change-Id: Ic46cf4ae86b7eba6f55d731d1b25e3f84b8bb64c Reviewed-on: https://gem5-review.googlesource.com/c/16504 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2019-02-13python: Remove uses of tuple unpacking in function paramsAndreas Sandberg
Python 3 doesn't support tuple unpacking in function parameters and lambdas. Change-Id: I36c72962e33a9ad37145089687834becccc76adb Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15991 Reviewed-by: Gabe Black <gabeblack@google.com>
2019-02-13python: Replace deprecated repr syntaxAndreas Sandberg
Change-Id: I5f9538cf2ca5ee17c51e7c5388d3aef363fcfa54 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15989 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2019-02-13python: Switch from using compare to key in list sortAndreas Sandberg
Python 3 has deprecated the use of a comparison function in favour of a key extraction function. Change-Id: I4b7eab791ecbdfbf7147f57fdbc7cbe8f1de20dd Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15995 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2019-02-12python: Replace dict.has_key with 'key in dict'Andreas Sandberg
Python 3 has removed dict.has_key in favour of 'key in dict'. Change-Id: I9852a5f57d672bea815308eb647a0ce45624fad5 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15987 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2019-02-12python: Add missing defines importAndreas Sandberg
The _check_tracing helper function in main.py depends on defines to check if tracing has been enabled at compile time. This module is imported in main() but not at the module level, which breaks this function. Change-Id: I26d65a4320da8618e0e552553695884fd2c880e0 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/16402 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2019-02-12python: Replace DictMixin with Mapping / MutableMappingAndreas Sandberg
Python 3 has removed support for DictMixin, so switch to Mapping / MutableMapping in collections which provides the same functionality. Change-Id: I61fbe366d2c9fc6e01b470f82f49cc02b99dec32 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15984 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2019-02-12python: Replace orderdict with collections.OrderedDictAndreas Sandberg
Python 2.7 and newer has support for ordered dictionaries in the standard library. Remove this custom class. Change-Id: I4b720405aa3c4ce8d5c0b401eefe744a85ac3a3e Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/16362 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2019-02-12python: Update use of exec to work with Python 3Andreas Sandberg
Python 3 uses 'exec(code, globals)' instead of 'exec code in globals'. Switch to the newer syntax since it is supported by Python 2.7. Also, move check_tracing out of main to work around a bug in Python 2.7. Change-Id: I6d390160f58783e1b038a572b64cdf3ff09535fa Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15986 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2019-02-12python: Switch to using open instead of fileAndreas Sandberg
Python 3 doesn't support the file(name, mode) syntax which has been deprecated in favour of open. Change-Id: I35ef8690d97a5243860a64ff985fd22fa86253f1 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15985 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2019-02-12python: Make exception handling Python 3 safeAndreas Sandberg
Change-Id: I9c2cdfad20deb1ddfa224320cf93f2105d126652 Reviewed-on: https://gem5-review.googlesource.com/c/15980 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2019-01-25python: Always throw TypeError on slave-slave connectionsNicholas Lindsay
params.py checks the validity of memory port-port connections before they are instantiated in C++. This commit ensures that attempting to connect two slave ports together will cause a TypeError. Change-Id: Ia7d0a15df28b96c7bf5e568c4f4917d21a19b824 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15896 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2019-01-17python: Add support for scoped enumsNikos Nikoleris
At the moment gem5 has support for enum params that either generate a unscoped within the Enums namespace or a struct encapsulated enum. The Enums namespace is getting quite big and some params have the same names which results in collisions. This change adds support for the scoped enums. Change-Id: I930e1cc3b814081627b653939e75d6c43956a334 Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15395 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2019-01-14config: De-nest the code in Port.splice().Gabe Black
The error checking in that function used an if/else structure where one of the two branches would be the error condition which would cause the function to exit. Because the function would exit if an error was detected, there's no reason to have the non-error condition guarded in the other half of the if. This change de-nests the non-error cases to make the function simpler and easier to read. Change-Id: Idedf54e84a178fa5a2a47f96373374152e420cf3 Reviewed-on: https://gem5-review.googlesource.com/c/15516 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2019-01-14config: Fix an error message in Port.splice().Gabe Black
That error message referenced non-existent variables which were likely renamed without updating the error message. Change-Id: I6878802ef4b83e3fdf75a860d848b8c5e2e8d6c0 Reviewed-on: https://gem5-review.googlesource.com/c/15515 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2018-11-16sim: Fix data type of ticks per second before passing it to C++Srikant Bharadwaj
Casts ticks per second value to int before passing it to C++. Python throws an error because of incompatible type because of the recent change. Change-Id: Ibcaf8c327f1be0dba38763975d389584addd8373 Reviewed-on: https://gem5-review.googlesource.com/c/14375 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-11-12sim: Push the global frequency management code into C++.Gabe Black
That makes it available when python is left out, and makes it available to c++ code without having to call back into python. Change-Id: If82e7e8eff526f2b957f84afe046e1d56fed4aa2 Reviewed-on: https://gem5-review.googlesource.com/c/14055 Reviewed-by: Srikant Bharadwaj <srikant.bharadwaj@amd.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2018-10-19python: Add utility function to override config parametersCiro Santilli
Add a utility method, SimObject.apply_config that can be used to implement SimObject param overrides from the command line. This function provides safe and convenient semantics for CLI assignment: * The override expression is evaluated in a restricted environment. The only global variables are the child objects and params from the root object. * Only params can be overridden. For example, calling methods or setting attributes on SimObjects isn't possible. * Vectors use non-standard list semantics which enable something similar to glob expansion on the shell. For example, setting: root.system.cpu[0:2].numThreads = 2 will override numThreads for cpu 0 and 1 and: root.system.cpus[0,2].numThreads = 2 sets it for cpus 0 and 2. The intention is that the helper method is called to override default values before calling m5.instantiate. Change-Id: I73f99da21d6d8ce1ff2ec8db2bb34338456f6799 Reviewed-on: https://gem5-review.googlesource.com/c/12984 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2018-06-28python: Fix call bug in @cxxMethod when override is TrueAndreas Sandberg
Change-Id: Ifa9efbd329fd01eb13100bc6690e651df2c12294 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Javier Setoain <javier.setoain@arm.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/11514 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2018-06-28python: Fixup incorrect syntax in PyBind argument handlerAndreas Sandberg
Change-Id: Ie81104d89b554795ec1020d5ce4edcf28795eda8 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-on: https://gem5-review.googlesource.com/11511 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2018-06-26python: Add support for multiplying proxies to compatible ParamNikos Nikoleris
Previously we allowed multiplications between proxy Param and compatible constants (int, long, float). This change extends this functionality and adds support for multiplying with between proxy Param and compatible proxy Param. Change-Id: I23a083881ae4d770e818895b893534767cd2472d Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/11510 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2018-06-21sim: Use the canonical way of iterating over a dictionaryAndreas Sandberg
Instead of using a convoluted getattr call, use the conventional iteritems() interface. Change-Id: I6d6bbccf865f8a0e8ff0767914157a7460099b09 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/10782 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>