Difference between revisions of "Source Code"

From gem5
Jump to: navigation, search
m
m
Line 46: Line 46:
 
===Initialization Function Call Sequence===
 
===Initialization Function Call Sequence===
  
The following figure shows the function call sequence for the initialization of gem5 when running the "Hello, World" example given in the "Introduction" section (http://gem5.org/Introduction#Running).
+
The figure to the left shows the function call sequence for the initialization of gem5 when running the "Hello, World" example given in the [[Introduction#Running]] section.
  
[[File:gem5_initialization_call_sequence.png|200px|thumb|left|gem5 Initialization Function Call Sequence]] ]]
+
[[File:gem5_initialization_call_sequence.png|400px|thumb|left|gem5 Initialization Function Call Sequence]]
  
 
===Style rules===
 
===Style rules===

Revision as of 16:58, 14 February 2012

Source Code

Tour of the tree

  • AUTHORS - A list of people who have historically contributed to gem5.
  • LICENSE - The license terms that apply to gem5 as a whole, unless overridden by a more specific license.
  • README - Some very basic information introducing gem5 and explaining how to get started.
  • SConstruct - A 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.
  • configs - Simulation configuration scripts which are written in python, 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.
  • ext - Things gem5 depends on but which aren’t actually part of gem5. Specifically, dependencies that are harder to find, not likely to be available, or where a particular version is needed.
  • src - gem5 source code.
    • arch - ISA implementations.
      • generic - Common files for use in other ISAs.
      • isa_parser.py - Parser that interprets ISA descriptions.
      • ISA directories - The files associated with the given ISA.
        • OS directories - Code for supporting an ISA/OS combination, generally in SE mode.
        • isa - ISA description files.
    • base - General data structures and facilities that could be useful for another project.
      • loader - Code for loading binaries and reading symbol tables.
      • stats - Code for keeping statistics and writing the data to a file or a database.
      • vnc - VNC support.
    • cpu - CPU models.
    • dev - Device models.
      • ISA directories - Device models specific to the given ISA
    • doxygen - Doxygen templates & output
    • kern - Operating system specific but architecture independent code (e.g. types of data structures).
      • OS directories - Code specific to the given simulated operating system.
    • mem - Memory system models and infrastructure.
      • cache - Code that implements a cache model in the classic memory system.
      • ruby - Code that implements the ruby memory model.
      • protocol - Ruby protocol definitions.
      • slicc - The slicc compiler.
    • python - Python code for configuration and higher level functions.
    • sim - Code that implements basic, fundamental simulator functionality.
  • system - Low level software like firmware or bootloaders for use in simulated systems.
    • alpha - Alpha console and palcode.
    • arm - A simple ARM bootloader.
  • tests - Files related to gem5’s regression tests.
    • configs - General configurations used for the tests.
    • test-progs - "Hello world" binaries for each ISA, other binaries are downloaded separately.
    • quick, long - Quick and long regression inputs, reference outputs, and test specific configuration files, arranged per test.
  • util - Utility scripts, programs and useful files which are not part of the gem5 binary but are generally useful when working on gem5.

Initialization Function Call Sequence

The figure to the left shows the function call sequence for the initialization of gem5 when running the "Hello, World" example given in the Introduction#Running section.

gem5 Initialization Function Call Sequence

Style rules

All of the code in gem5 is expected to follow a set rules described in our style guide. These rules make the code more consistent which make it easier to read, maintain, and extend 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. There are also Documentation Guidelines which you should follow which allow documentation to be generated automatically using the Doxygen system.

Generated files - where do they end up

.m5 config files

If you would like to set some gem5 parameters to a value by default you can create a .m5 directory within your home directory and inside place a file called options.py. Within this file you may set any gem5 command line option to a new default. For example placing options.stdout_file=simout</ccode> in <code>options.py will result in the simulators stdout always being re-directed to a file named simout.

jobfile to run multiple jobs