Commit Graph

35 Commits

Author SHA1 Message Date
wmin0
00ed1d30cf python,util: Fix SimObjectParams default constructor and destructor (#880)
The empty constructor prevent zero-initialization working correctly. In
this change we fix the issue by removing the unwanted empty constructor.
We also change the default destructor specification with c++11 style.

Change-Id: I869a93ca5283f811c2aa58406f1478459e0d7022
2024-02-26 06:42:27 -08:00
Bobby R. Bruce
d11c40dcac misc: Run pre-commit run --all-files
This ensures `isort` is applied to all files in the repo.

Change-Id: Ib7ced1c924ef1639542bf0d1a01c5737f6ba43e9
2023-11-29 22:06:41 -08:00
Gabe Black
1cdccd7ac0 scons: Add a build script for generating a root Kconfig file.
This root Kconfig file "source"s (includes) the base gem5 src/Kconfig
file, and also any optional Kconfig files found in the base of EXTRAS
directories. These will be called out in the menuconfig interface and
config files with the name of the EXTRAS directory they came from, and a
blank section will be present either if the Kconfig didn't exist, or it
did exist but had no options in it.

Change-Id: I54060d613f0e0ab9372bed37a2fe5849bf5bbcdb
2023-11-23 08:26:10 +08:00
Bobby R. Bruce
298119e402 misc,python: Run pre-commit run --all-files
Applies the `pyupgrade` hook to all files in the repo.

Change-Id: I9879c634a65c5fcaa9567c63bc5977ff97d5d3bf
2023-10-10 21:47:07 -07:00
Bobby R. Bruce
ddf6cb88e4 misc: Run pre-commit run --all-files
This is reflect the updates made to black when running `pre-commit
autoupdate`.

Change-Id: Ifb7fea117f354c7f02f26926a5afdf7d67bc5919
2023-10-10 14:01:58 -07:00
Thilo Vörtler
73b6e98f51 arch-riscv,systemc: Fix cxx_config_cc.py to use is is_source
Update the cxx_config_cc.oy port description generation to use the
port.is_source attribute.

Github Issue: https://github.com/gem5/gem5/issues/181

Change-Id: I3fa12c2fbb06083379118e57aedb8be414c0d929
2023-08-20 14:06:37 +00:00
Bobby R. Bruce
f80015ea18 misc: Update README/README.md (#71)
* misc: Update README to README.md

This change converts the text-based README to markdown. This works
better with modern source-control systems, most notably, GitHub.

The README.md has been broken down into sections to better organize the
document.
This section now included expanded information on Reporting bugs and
Requesting Features.

Due to renaming 'README' to 'README.md', this code was generating the
following for "info.py":

```
README.md = "<FILE CONTENTS HERE>"
```

As '.' is used to access member variables/methods in python. To fix this
"infopy.oy" now replaces "." with "_". As such the generated in in
"info.py" is now:

```
README_MD = "<FILE CONTENTS HERE>"

This puts GitHub Discussions and GitHub Issues towards the top of the
list. This is to incentivize their usage.

Change-Id: I18018ba23493f43861544497f23ec59f1e8debe1

---------

Co-authored-by: Jason Lowe-Power <jason@lowepower.com>
2023-07-17 15:30:35 -07:00
Gabriel Busnot
91b4540477 python: Fix namespaced enums params code generation
The wrapper_name parameter was not properly handled. Enums were always
generated in the enums namespace even if required differently by
wrapper_name.

Change-Id: I366846ce39dfe10effc2cc145e7772a3fd171b92
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67662
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2023-07-07 10:17:54 +00:00
Jason Lowe-Power
1a2904e021 scons: Add os import to marshall
This file was missing the `import os` after
I3ad28b6ee52fd347d2fe71f279baab629e88d12c

Change-Id: I7fde59e92f03fd240f48a304488d77628bfdb852
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70918
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2023-05-23 20:54:41 +00:00
Luming Wang
332ef131dc scons: fix build failed caused by Non-ASCII directory path
This patch addresses the issue of gem5 failing to build when
the build directory path contains non-ASCII characters.
The previous patches[1] that attempted to fix this issue
became ineffective after the upgrade of Python and pybind11
to new versions. This new patch manually sets the locale in
marshal.py based on the `LC_CTYPE` environment variable,
providing a comprehensive solution that works with Non-ASCII
build directory paths.

[1] https://gem5-review.googlesource.com/c/public/gem5/+/58369

Change-Id: I3ad28b6ee52fd347d2fe71f279baab629e88d12c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70818
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2023-05-23 07:24:59 +00:00
Daniel R. Carvalho
c8e3708d89 sim: Remove the Enums namespace
This namespace has gone through the deprecation period
and can now be removed.

Change-Id: If4daad57a421b076ae6661812c2255c7f06f30b9
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67372
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2023-01-17 09:16:20 +00:00
Daniel R. Carvalho
d2bfb4aeef base: Remove the Debug namespace
This namespace has gone through the deprecation period
and can now be removed.

Change-Id: I4241501f3683c1daa8554693cba7aa2c022db130
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67360
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
2023-01-17 09:16:20 +00:00
Hoa Nguyen
eac06ad681 python: Fix multiline quotes in a single line
An example case,
```python
mem_side_port = RequestPort(
    "This port sends requests and " "receives responses"
)
```

This is the residue of running the python formatter.
This is done by finding all tokens matching the regex `"\s"(?![.;"])`
and manually replacing them by empty strings.

Change-Id: Icf223bbe889e5fa5749a81ef77aa6e721f38b549
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/66111
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-29 23:44:38 +00:00
Bobby R. Bruce
2bc5a8b71a misc: Run pre-commit run on all files in repo
The following command was run:

```
pre-commit run --all-files
```

This ensures all the files in the repository are formatted to pass our
checks.

Change-Id: Ia2fe3529a50ad925d1076a612d60a4280adc40de
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62572
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
2022-08-24 21:47:07 +00:00
Richard Cooper
24daaf7828 mem-ruby: Fix file extension detection in code_formatter.py.
Insufficiently specific regular expressions were causing the C/C++
pattern to match the `.html` extension. This resulted in C-style
comments being inserted into generated HTML files.

This was causing the SLICC HTML documentation to be unreadable in a
web browser.

Change-Id: Iebad9896db393bba7ec9b0836693012959222455
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/60871
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-07-06 17:09:46 +00:00
Jason Lowe-Power
8e8c1ded15 scons: Update enum output when not using python
This changeset brings the enum_cc.py file in line with how the
sim_object_param_struct_cc.py file works and updates the SConscript to
correctly tag the created source files.

Change-Id: I4635a4f46de7d62a6c38e71ace121c06e139d486
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/59609
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-05-19 14:32:11 +00:00
Jason Lowe-Power
4978bf8d5a scons: Fix bug in error message
The variable p doesn't exist in the context. Just remove the extra
print. Even without the specific variable printed the error message is
pretty helpful.

Change-Id: If681d686c228c1362b8cc46cb14a94d7302f3793
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58429
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-12 20:30:54 +00:00
Gabe Black
93bebf86cc scons,sim: Eliminate the generated cxx_config/init.cc file.
This file populated the "cxx_config_directory" map from type names to
directory entry generating types. It used a comprehensive list of
includes of all SimObject headers, and a comprehensive list of the
generating types to fill everything in.

Instead, this change creates a new singleton helper class which, when
instantiated as a static member of a CxxConfigParams subclass, will
install a pointer to a CxxConfigDirectoryEntry to that map during global
object construction time.

Also, this change renames the map to cxxConfigDirectory which is in
compliance with the style guide, and puts it behind an accessor which
returns a static variable which is the actual map. This avoids any
problems that might come from global object construction order.

Change-Id: Iaa913fbe5af1b11d90ca618e29420eeb7cb0faed
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49455
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-13 05:21:41 +00:00
Gabe Black
b0f9375377 python,util: Pull enum hh|cc generation out of the MetaEnum class.
Change-Id: Ibfcc2d6916318ffef806f74e57e3f8360489efb6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49452
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-13 05:21:41 +00:00
Gabe Black
4003ad7510 python,util: Pull CXX config generation code out of SimObject.
Change-Id: I94d6f5b172ab71ee8bedea854e1db9711748f313
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49451
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-13 05:21:41 +00:00
Gabe Black
df540f0dbf python,util: Pull param struct generation code out of SimObject.
Change-Id: I9f9c3b858a214650f6f07e6127bb316a227982a0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49450
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-11 22:46:43 +00:00
Gabe Black
19c7fe03ac scons: Generate cxx_config/init.cc using a helper script.
Change-Id: Ib0129fc5c2de3977f2dedc1bfec532bbedb2d20e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49428
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-11 22:46:43 +00:00
Gabe Black
ee8ad3f8eb scons: Generate cxx config wrappers using a helper script.
Change-Id: I003426881dc0fd8a338048abbdfa05a606221c39
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49427
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-11 22:46:43 +00:00
Gabe Black
a8d7a41f9f scons,util: Use external helper scripts to build enum hhs and ccs.
Change-Id: Id5cfca9ca7848394baff39c76a4ed0edbec61573
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49426
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-11 22:46:43 +00:00
Gabe Black
4c1422e3ba scons: Also build param struct .cc files using a helper script.
There was a comment in the SConscript talking about building a single
.cc file for all the param structs, but that's not what the code was
actually doing. This change drops that misleading comment.

Change-Id: I3a5e4424e1021d6dfbdeafcef7709dae988747a4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49425
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-08 08:01:23 +00:00
Gabe Black
61b7268b2e scons: Use an external script to generate param struct headers.
Change-Id: I633537f2b7542350895e50fe79dd80c88a811a41
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49424
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-08 08:01:23 +00:00
Gabe Black
1799526954 python,sim,util: Move EmbeddedPython into it's own file.
By separating out this utility class, we make it possible to build
embedded python modules into other binarys without dragging along lots
of other, unrelated gem5 dependencies.

Also, move the class from sim/init.hh (which is a largely unrelated
name) to python/embedded.hh which much more directly describes what that
file contains.

Change-Id: Ia83439144893ad8401a5d51003e2686d9c9b2d7b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49418
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-08 08:01:23 +00:00
Gabe Black
c594bf8e24 scons: Pull info.py generation out of SConscript and into build_tools.
Change-Id: I36e21901741a61673198011ce3889982e19f37f4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49404
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
2021-10-23 08:28:32 +00:00
Gabe Black
038bf7075a scons: Use unions to prevent debug flag destruction.
When an object is a field in a union, it's the programmer's
resposibility to destroy it from the union's destructor. We can simply
neglect to do that and avoid having to use new to create the flags.

Also, we can define the flags as inline variables (a c++17 feature), and
then create a constexpr references to them. This lets us refer to debug
flags in constexpr objects, although we can't interact with them at, for
instance, construciton time or we'd lose our own constexpr-ness since
the actual object is not constexpr.

In c++20 we would hypothetically be able to use constexpr with new and
delete, but there may be additional restrictions that would make this
particular use impossible. Also this avoids leaking memory, which, even
though it's intentional, may confuse tools like valgrind.

Also, we need to ensure that all headers are included in some source
file so that they exist in the final executable, so that they show up in
the help, can be enabled/disabled, etc.

Change-Id: Ia43111d938e7af7140b1c17dd68135f426d0a1e9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49783
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Jui-min Lee <fcrh@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-10-19 10:53:44 +00:00
Gabe Black
3f9b493982 scons: Pull the code which generates debug/flags.cc into a helper script.
Change-Id: Ib4ce51ae0311428e3bcd2dae431cfb0abe185c5d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49401
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-10-12 22:18:17 +00:00
Gabe Black
74c6297453 scons: Pull makeDebugFlagHH into build_tools.
Change-Id: I5c6f38a859b3d61aa47fc84e4e17d9ba8624389a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49400
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-10-05 00:29:25 +00:00
Gabe Black
84abf07777 scons: Pull the rest of the embedPyFile function into marshal.py.
This further unburdens src/SConscript, and makes marshal.py a mostly
self contained implementation of that build step.

Change-Id: I4eb9da40de56feec9ab32c384aa5730be70ae498
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49399
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-09-24 21:24:06 +00:00
Gabe Black
64c9e07498 scons: Pull bytesToCppArray into build_tools.
This mechanism will be used by various small scripts which perform steps
of the build.

Change-Id: I91d842c022d6f568715e8a10310894cb8afbab20
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49398
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-09-24 21:23:52 +00:00
Gabe Black
cc75a47b84 python,scons: Move grammar.py and code_formatter.py into build_tools.
These are only used in a build, and so don't need to be built into gem5.
grammar.py is used by slicc and the fast model project file parser, and
code_formatter.py is only used by SConscripts.

Change-Id: Id43e62459d69f07fdb2ed125548a83e38bbb7590
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49396
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-09-24 21:23:27 +00:00
Gabe Black
6cc3b4f6c1 scons,python: Move the marshal.py script into build_tools.
It's really a part of the build system and not part of gem5, and so it
should probably live outside of the main tree. It would be confusing to
have a bunch of python scripts which don't end up inside gem5 alongside
a bunch of ones that do in src/python.

The directory is called build_tools instead of build so it doesn't get
confused with an actual build output directory.

Change-Id: Ie12475a15517508dc2044f0ca4db71a601b7ab6d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49393
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-09-24 21:23:11 +00:00