hg clone http://repo.gem5.org/gem5
git clone https://gem5.googlesource.com/public/gem5
git checkout -b asplos
scons -j5 build/X86/gem5.opt
Slide on gem5 interface
Make new folder: configs/tutorial
Create new file: configs/tutorial/simple.py
Import all compiled objects
import m5
from m5.objects import *
system = System()
system.clk_domain = SrcClockDomain()
system.clk_domain.clock = '1GHz'
system.clk_domain.voltage_domain = VoltageDomain()
system.mem_mode = 'timing'
system.mem_ranges = [AddrRange('512MB')]
system.cpu = TimingSimpleCPU()
system.membus = SystemXBar()
system.cpu.icache_port = system.membus.slave
system.cpu.dcache_port = system.membus.slave
system.cpu.createInterruptController()
system.cpu.interrupts[0].pio = system.membus.master
system.cpu.interrupts[0].int_master = system.membus.slave
system.cpu.interrupts[0].int_slave = system.membus.master
system.system_port = system.membus.slave
system.mem_ctrl = DDR3_1600_8x8()
system.mem_ctrl.range = system.mem_ranges[0]
system.mem_ctrl.port = system.membus.master
process = Process()
process.cmd = ['tests/test-progs/hello/bin/x86/linux/hello']
system.cpu.workload = process
system.cpu.createThreads()
Create the “root”.
All scripts must have a root
root = Root(full_system = False, system = system)
m5.instantiate()
print("Beginning simulation!")
exit_event = m5.simulate()
print('Exiting @ tick {} because {}'
.format(m5.curTick(), exit_event.getCause()))
build/X86/gem5.opt configs/tutorial/simple.py
Slide on running
slide on SE vs FS mode
build/X86/gem5.opt configs/learning_gem5/part1/two_level.py
build/X86/gem5.opt configs/learning_gem5/part1/two_level.py -h
build/X86/gem5.opt configs/learning_gem5/part1/two_level.py --l1d_size=2kB
If extra time...
Talk about using se.py.
Talk about common options: cpu-type, sys-clock, cpu-clock, mem-type, caches, l2cache, ruby, -m, -I, -c, -o, –output, etc.