112336Sjason@lowepower.com# -*- coding: utf-8 -*- 212336Sjason@lowepower.com# Copyright (c) 2017 Jason Lowe-Power 312336Sjason@lowepower.com# All rights reserved. 412336Sjason@lowepower.com# 512336Sjason@lowepower.com# Redistribution and use in source and binary forms, with or without 612336Sjason@lowepower.com# modification, are permitted provided that the following conditions are 712336Sjason@lowepower.com# met: redistributions of source code must retain the above copyright 812336Sjason@lowepower.com# notice, this list of conditions and the following disclaimer; 912336Sjason@lowepower.com# redistributions in binary form must reproduce the above copyright 1012336Sjason@lowepower.com# notice, this list of conditions and the following disclaimer in the 1112336Sjason@lowepower.com# documentation and/or other materials provided with the distribution; 1212336Sjason@lowepower.com# neither the name of the copyright holders nor the names of its 1312336Sjason@lowepower.com# contributors may be used to endorse or promote products derived from 1412336Sjason@lowepower.com# this software without specific prior written permission. 1512336Sjason@lowepower.com# 1612336Sjason@lowepower.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712336Sjason@lowepower.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812336Sjason@lowepower.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912336Sjason@lowepower.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012336Sjason@lowepower.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112336Sjason@lowepower.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212336Sjason@lowepower.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312336Sjason@lowepower.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412336Sjason@lowepower.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512336Sjason@lowepower.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612336Sjason@lowepower.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712336Sjason@lowepower.com# 2812336Sjason@lowepower.com# Authors: Jason Lowe-Power 2912336Sjason@lowepower.com 3012336Sjason@lowepower.com""" Simple config/run script for the HelloObject 3112336Sjason@lowepower.com 3212336Sjason@lowepower.comThis is probably the simplest gem5 config file you can possibly create. 3312336Sjason@lowepower.comIt creates a Root object and one *very* simple SimObject and simulates the 3412336Sjason@lowepower.comsystem. Since there are no events, this "simulation" should finish immediately 3512336Sjason@lowepower.com 3612336Sjason@lowepower.com""" 3712336Sjason@lowepower.com 3812564Sgabeblack@google.comfrom __future__ import print_function 3913774Sandreas.sandberg@arm.comfrom __future__ import absolute_import 4012564Sgabeblack@google.com 4112336Sjason@lowepower.com# import the m5 (gem5) library created when gem5 is built 4212336Sjason@lowepower.comimport m5 4312336Sjason@lowepower.com# import all of the SimObjects 4412336Sjason@lowepower.comfrom m5.objects import * 4512336Sjason@lowepower.com 4612336Sjason@lowepower.com# set up the root SimObject and start the simulation 4712336Sjason@lowepower.comroot = Root(full_system = False) 4812336Sjason@lowepower.com 4912336Sjason@lowepower.com# Create an instantiation of the simobject you created 5012336Sjason@lowepower.comroot.hello = SimpleObject() 5112336Sjason@lowepower.com 5212336Sjason@lowepower.com# instantiate all of the objects we've created above 5312336Sjason@lowepower.comm5.instantiate() 5412336Sjason@lowepower.com 5512564Sgabeblack@google.comprint("Beginning simulation!") 5612336Sjason@lowepower.comexit_event = m5.simulate() 5712564Sgabeblack@google.comprint('Exiting @ tick %i because %s' % (m5.curTick(), exit_event.getCause())) 58