Source Code
Contents
Source Code
Tour of the tree
These are the files and directories at the top of the tree:
AUTHORS LICENSE README RELEASE_NOTES SConstruct build_opts configs ext src system tests util
AUTHORS, LICENSE, README
are files with general information about the simulator. AUTHORS is a list of people who have historically contributed to M5. LICENSE has the license terms that applies to M5 as a whole, unless overridden by a more specific license. README has some very basic information introducing M5 and explaining how to get started.
The SConstruct
file is part of the build system, as is the build_opts directory. build_opts holds files that define default settings for build different build configurations. These include X86_FS and MIPS_SE, for instance.
The configs
directory is for simulation configuration scripts which are written in python. These are described in more detail later. The files in this directory help make writing configurations easier by providing some basic prepackaged functionality, and include a few examples which can be used directly or as a starting point for your own scripts.
The ext
directory is for things M5 depends on but which aren’t actually part of M5. Specifically these are for dependencies that are harder to find, not likely to be available, or where a particular version is needed.
The src
directory is where most of M5 is located. This is where all of the C++ and python source that contributes to the M5 binary is kept, excluding components in the ext directory.
The system
directory is for the source for low level software like firmware or bootloaders for use in simulated systems. Currently this includes Alpha’s PAL and console code, and a simple bootloader for ARM.
The tests
directory stores files related to M5’s regression tests. These include the scripts that build up the configurations used in the tests and reference outputs. Simple hello world binaries are also stored here, but other binaries need to be downloaded separately.
Finally, in the util
directory are utility scripts, programs and useful files which are not part of the M5 binary but are generally useful when working on M5.
Style rules
As you go through the M5 source code, you'll notice that there are a number of coding conventions that M5 developers use throughout out. Consistent Coding Style makes it easier for M5 users to read, maintain, and eventually update the code. Specific coding style has been defined for things such as Indentation and Line Breaks , Spacing, Naming of Variables & Classes, and M5 Status Messages. Finally, Following the Documentation Guidelines provides an easy way for M5 to automatically generate Doxygen, gem5 documentation.
Please see the Coding Style page for details and examples of the gem5 style rules.