blob: 7f7435b02ea66862e65e6c40736c2e8391d070e0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>gem5</title>
<!-- SITE FAVICON -->
<link rel="shortcut icon" type="image/gif" href="/assets/img/gem5ColorVert.gif"/>
<link rel="canonical" href="http://localhost:4000/example_configs/">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700,800,600' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Muli:400,300' rel='stylesheet' type='text/css'>
<!-- FAVICON -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<!-- BOOTSTRAP -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- CUSTOM CSS -->
<link rel="stylesheet" href="/css/main.css">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-light bg-light">
<a class="navbar-brand" href="/">
<img src="/assets/img/gem5ColorLong.gif" alt="gem5" height=45px>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav ml-auto">
<li class="nav-item ">
<a class="nav-link" href="/">Home</a>
</li>
<li class="nav-item dropdown ">
<a class="nav-link dropdown-toggle" href="/about" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
About
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="/about">About</a>
<a class="dropdown-item" href="/publications">Publications</a>
<a class="dropdown-item" href="/governance">Governance</a>
</div>
</li>
<li class="nav-item dropdown active">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Documentation
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<!-- Pull navigation from _data/documentation.yml -->
<a class="dropdown-item" href="/introduction">Introduction</a>
<a class="dropdown-item" href="/building">Getting Started</a>
<a class="dropdown-item" href="/environment">Modifying/Extending</a>
<a class="dropdown-item" href="/MSIintro">Modeling Cache Coherence with Ruby</a>
</div>
</li>
<li class="nav-item ">
<a class="nav-link" href="/contributing">Contributing</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="/search">Search</a>
</li>
</ul>
</div>
</nav>
<main>
<div class="sidenav-top">
<img src="/assets/img/gem5ColorLong.gif" height="80">
<div class="search">
<form action="/search" method="get">
<!-- <label for="search-box"><i class="fa fa-search"></i></label> -->
<input type="text" name="query">
<button type="submit" name="submit"><i class="fa fa-search"></i></button>
</form>
</div>
</div>
<div class="sidenav">
<!-- Pull navigation from _data/documentation.yml -->
<a class="item" href="/introduction" role="button" aria-expanded="false" aria-controls="collapseExample">
Introduction
</a>
<div class="collapse " id="introdution">
</div>
<a class="item" data-toggle="collapse" href="#pt1" role="button" aria-expanded="false" aria-controls="collapseExample">
Getting Started
</a>
<div class="collapse show" id="pt1">
<a class="subitem " href="/building">Building gem5</a>
<a class="subitem " href="/simple_config">Creating a simple configuration script</a>
<a class="subitem " href="/cache_config">Adding cache to configuration script</a>
<a class="subitem " href="/gem5_stats">Understanding gem5 statistics and output</a>
<a class="subitem active" href="/example_configs">Using the default configuration scripts</a>
</div>
<a class="item" data-toggle="collapse" href="#pt2" role="button" aria-expanded="false" aria-controls="collapseExample">
Modifying/Extending
</a>
<div class="collapse " id="pt2">
<a class="subitem " href="/environment">Setting up your development environment</a>
<a class="subitem " href="/helloobject">Creating a very simple SimObject</a>
<a class="subitem " href="/debugging">Debugging gem5</a>
<a class="subitem " href="/events">Event-driven programming</a>
<a class="subitem " href="/parameters">Adding parameters to SimObjects and more events</a>
<a class="subitem " href="/memoryobject">Creating SimObjects in the memory system</a>
<a class="subitem " href="/simplecache">Creating a simple cache object</a>
</div>
<a class="item" data-toggle="collapse" href="#pt3" role="button" aria-expanded="false" aria-controls="collapseExample">
Modeling Cache Coherence with Ruby
</a>
<div class="collapse " id="pt3">
<a class="subitem " href="/MSIintro">Introduction to Ruby</a>
<a class="subitem " href="/cache-intro">MSI example cache protocol</a>
<a class="subitem " href="/cache-declarations">Declaring a state machine</a>
<a class="subitem " href="/cache-in-ports">In port code blocks</a>
<a class="subitem " href="/cache-actions">Action code blocks</a>
<a class="subitem " href="/cache-transitions">Transition code blocks</a>
<a class="subitem " href="/directory">MSI Directory implementation</a>
<a class="subitem " href="/MSIbuilding">Compiling a SLICC protocol</a>
<a class="subitem " href="/configuration">Configuring a simple Ruby system</a>
<a class="subitem " href="/running">Running the simple Ruby system</a>
<a class="subitem " href="/MSIdebugging">Debugging SLICC Protocols</a>
<a class="subitem " href="/simple-MI_example">Configuring for a standard protocol</a>
</div>
</div>
<div class="container" id="doc-container">
<!-- <h1>Using the default configuration scripts</h1> -->
<dl>
<dt>authors</dt>
<dd>Jason Lowe-Power</dd>
</dl>
<h1 id="using-the-default-configuration-scripts">Using the default configuration scripts</h1>
<p>In this chapter, we’ll explore using the default configuration scripts
that come with gem5. gem5 ships with many configuration scripts that
allow you to use gem5 very quickly. However, a common pitfall is to use
these scripts without fully understanding what is being simulated. It is
important when doing computer architecture research with gem5 to fully
understand the system you are simulating. This chapter will walk you
through some important options and parts of the default configuration
scripts.</p>
<p>In the last few chapters you have created your own configuration scripts
from scratch. This is very powerful, as it allows you to specify every
single system parameter. However, some systems are very complex to set
up (e.g., a full-system ARM or x86 machine). Luckily, the gem5
developers have provided many scripts to bootstrap the process of
building systems.</p>
<h2 id="a-tour-of-the-directory-structure">A tour of the directory structure</h2>
<p>All of gem5’s configuration files can be found in <code class="highlighter-rouge">configs/</code>. The
directory structure is shown below:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>configs/boot:
ammp.rcS halt.sh micro_tlblat2.rcS netperf-stream-udp-local.rcS
...
configs/common:
Benchmarks.py cpu2000.py Options.py
Caches.py FSConfig.py O3_ARM_v7a.py SysPaths.py
CacheConfig.py CpuConfig.py MemConfig.py Simulation.py
configs/dram:
sweep.py
configs/example:
fs.py read_config.py ruby_mem_test.py ruby_random_test.py
memtest.py ruby_direct_test.py ruby_network_test.py se.py
configs/ruby:
MESI_Three_Level.py MI_example.py MOESI_CMP_token.py Network_test.py
MESI_Two_Level.py MOESI_CMP_directory.py MOESI_hammer.py Ruby.py
configs/splash2:
cluster.py run.py
configs/topologies:
BaseTopology.py Cluster.py Crossbar.py MeshDirCorners.py Mesh.py Pt2Pt.py Torus.py
</code></pre></div></div>
<p>Each directory is briefly described below:</p>
<dl>
<dt><strong>boot/</strong></dt>
<dd>These are rcS files which are used in full-system mode. These files
are loaded by the simulator after Linux boots and are executed by
the shell. Most of these are used to control benchmarks when running
in full-system mode. Some are utility functions, like
<code class="highlighter-rouge">hack_back_ckpt.rcS</code>. These files are covered in more depth in the
chapter on full-system simulation.</dd>
<dt><strong>common/</strong></dt>
<dd>This directory contains a number of helper scripts and functions to
create simulated systems. For instance, <code class="highlighter-rouge">Caches.py</code> is similar to
the <code class="highlighter-rouge">caches.py</code> and <code class="highlighter-rouge">caches_opts.py</code> files created in previous
chapters.
<p><code class="highlighter-rouge">Options.py</code> contains a variety of options that can be set on the
command line. Like the number of CPUs, system clock, and many, many
more. This is a good place to look to see if the option you want to
change already has a command line parameter.</p>
<p><code class="highlighter-rouge">CacheConfig.py</code> contains the options and functions for setting
cache parameters for the classic memory system.</p>
<p><code class="highlighter-rouge">MemConfig.py</code> provides some helper functions for setting the memory
system.</p>
<p><code class="highlighter-rouge">FSConfig.py</code> contains the necessary functions to set up full-system
simulation for many different kinds of systems. Full-system
simulation is discussed further in it’s own chapter.</p>
<p><code class="highlighter-rouge">Simulation.py</code> contains many helper functions to set up and run
gem5. A lot of the code contained in this file manages saving and
restoring checkpoints. The example configuration files below in
<code class="highlighter-rouge">examples/</code> use the functions in this file to execute the gem5
simulation. This file is quite complicated, but it also allows a lot
of flexibility in how the simulation is run.</p>
</dd>
<dt><strong>dram/</strong></dt>
<dd>Contains scripts to test DRAM.</dd>
<dt><strong>example/</strong></dt>
<dd>This directory contains some example gem5 configuration scripts that
can be used out-of-the-box to run gem5. Specifically, <code class="highlighter-rouge">se.py</code> and
<code class="highlighter-rouge">fs.py</code> are quite useful. More on these files can be found in the
next section. There are also some other utility configuration
scripts in this directory.</dd>
<dt><strong>ruby/</strong></dt>
<dd>This directory contains the configurations scripts for Ruby and its
included cache coherence protocols. More details can be found in the
chapter on Ruby.</dd>
<dt><strong>splash2/</strong></dt>
<dd>This directory contains scripts to run the splash2 benchmark suite
with a few options to configure the simulated system.</dd>
<dt><strong>topologies/</strong></dt>
<dd>This directory contains the implementation of the topologies that
can be used when creating the Ruby cache hierarchy. More details can
be found in the chapter on Ruby.</dd>
</dl>
<h2 id="using-sepy-and-fspy">Using <code class="highlighter-rouge">se.py</code> and <code class="highlighter-rouge">fs.py</code></h2>
<p>In this section, I’ll discuss some of the common options that can be
passed on the command line to <code class="highlighter-rouge">se.py</code> and <code class="highlighter-rouge">fs.py</code>. More details on how
to run full-system simulation can be found in the full-system simulation
chapter. Here I’ll discuss the options that are common to the two files.</p>
<p>Most of the options discussed in this section are found in Options.py
and are registered in the function <code class="highlighter-rouge">addCommonOptions</code>. This section does
not detail all of the options. To see all of the options, run the
configuration script with <code class="highlighter-rouge">--help</code>, or read the script’s source code.</p>
<p>First, let’s simply run the hello world program without any parameters:</p>
<p>``` {.sourceCode .sh}
build/X86/gem5.opt configs/example/se.py –cmd=tests/test-progs/hello/bin/x86/linux/hello</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
And we get the following as output:
gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled Jan 14 2015 16:11:34
gem5 started Feb 2 2015 15:22:24
gem5 executing on mustardseed.cs.wisc.edu
command line: build/X86/gem5.opt configs/example/se.py --cmd=tests/test-progs/hello/bin/x86/linux/hello
Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
**** REAL SIMULATION ****
info: Entering event queue @ 0. Starting simulation...
Hello world!
Exiting @ tick 5942000 because target called exit()
However, this isn't a very interesting simulation at all! By default,
gem5 uses the atomic CPU and uses atomic memory accesses, so there's no
real timing data reported! To confirm this, you can look at
m5out/config.ini. The CPU is shown on line 46:
[system.cpu]
type=AtomicSimpleCPU
children=apic_clk_domain dtb interrupts isa itb tracer workload
branchPred=Null
checker=Null
clk_domain=system.cpu_clk_domain
cpu_id=0
do_checkpoint_insts=true
do_quiesce=true
do_statistics_insts=true
To actually run gem5 in timing mode, let's specify a CPU type. While
we're at it, we can also specify sizes for the L1 caches.
``` {.sourceCode .sh}
build/X86/gem5.opt configs/example/se.py --cmd=tests/test-progs/hello/bin/x86/linux/hello --cpu-type=TimingSimpleCPU --l1d_size=64kB --l1i_size=16kB
</code></pre></div></div>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled Jan 14 2015 16:11:34
gem5 started Feb 2 2015 15:26:57
gem5 executing on mustardseed.cs.wisc.edu
command line: build/X86/gem5.opt configs/example/se.py --cmd=tests/test-progs/hello/bin/x86/linux/hello --cpu-type=TimingSimpleCPU --l1d_size=64kB --l1i_size=16kB
Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
**** REAL SIMULATION ****
info: Entering event queue @ 0. Starting simulation...
Hello world!
Exiting @ tick 344986500 because target called exit()
</code></pre></div></div>
<p>Now, let’s check the config.ini file and make sure that these options
propagated correctly to the final system. If you search
<code class="highlighter-rouge">m5out/config.ini</code> for “cache”, you’ll find that no caches were created!
Even though we specified the size of the caches, we didn’t specify that
the system should use caches, so they weren’t created. The correct
command line should be:</p>
<p>``` {.sourceCode .sh}
build/X86/gem5.opt configs/example/se.py –cmd=tests/test-progs/hello/bin/x86/linux/hello –cpu-type=TimingSimpleCPU –l1d_size=64kB –l1i_size=16kB –caches</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled Jan 14 2015 16:11:34
gem5 started Feb 2 2015 15:29:20
gem5 executing on mustardseed.cs.wisc.edu
command line: build/X86/gem5.opt configs/example/se.py --cmd=tests/test-progs/hello/bin/x86/linux/hello --cpu-type=TimingSimpleCPU --l1d_size=64kB --l1i_size=16kB --caches
Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
**** REAL SIMULATION ****
info: Entering event queue @ 0. Starting simulation...
Hello world!
Exiting @ tick 29480500 because target called exit()
On the last line, we see that the total time went from 344986500 ticks
to 29480500, much faster! Looks like caches are probably enabled now.
But, it's always a good idea to double check the `config.ini` file.
[system.cpu.dcache]
type=BaseCache
children=tags
addr_ranges=0:18446744073709551615
assoc=2
clk_domain=system.cpu_clk_domain
demand_mshr_reserve=1
eventq_index=0
forward_snoops=true
hit_latency=2
is_top_level=true
max_miss_count=0
mshrs=4
prefetch_on_access=false
prefetcher=Null
response_latency=2
sequential_access=false
size=65536
system=system
tags=system.cpu.dcache.tags
tgts_per_mshr=20
two_queue=false
write_buffers=8
cpu_side=system.cpu.dcache_port
mem_side=system.membus.slave[2]
Some common options `se.py` and `fs.py`
---------------------------------------
All of the possible options are printed when you run:
``` {.sourceCode .sh}
build/X86/gem5.opt configs/example/se.py --help
</code></pre></div></div>
<p>Below is a few important options from that list.</p>
</div>
</main>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script>
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 20) {
document.getElementById("myBtn").style.display = "block";
} else {
document.getElementById("myBtn").style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
</script>
</body>
<footer class="page-footer">
<div class="container">
<div class="row">
<div class="col-12 col-sm-4">
<p><a href="/about">About</a></p>
<p><a href="/publications">Publications</a></p>
<p><a href="/contributing">Contributing</a></p>
</div><br>
<div class="col-12 col-sm-4">
<p><a href="/gettingstarted">Documentation</a></p>
<p><a href="#">Source</a></p>
</div><br>
<div class="col-12 col-sm-4">
<p><a href="/help">Help</a></p>
<p><a href="/search">Search</a></p>
<p><a href="#">Mailing Lists</a></p>
</div>
</div>
</div>
</footer>
</html>