ruby_test.py revision 12610
16019Shines@cs.fsu.edu# -*- coding: utf-8 -*-
26019Shines@cs.fsu.edu# Copyright (c) 2015 Jason Power
37100Sgblack@eecs.umich.edu# All rights reserved.
47100Sgblack@eecs.umich.edu#
57100Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
67100Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are
77100Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright
87100Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
97100Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
107100Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
117100Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution;
127100Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its
137100Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
147100Sgblack@eecs.umich.edu# this software without specific prior written permission.
156019Shines@cs.fsu.edu#
166019Shines@cs.fsu.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176019Shines@cs.fsu.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186019Shines@cs.fsu.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196019Shines@cs.fsu.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206019Shines@cs.fsu.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216019Shines@cs.fsu.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226019Shines@cs.fsu.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236019Shines@cs.fsu.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246019Shines@cs.fsu.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256019Shines@cs.fsu.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266019Shines@cs.fsu.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276019Shines@cs.fsu.edu#
286019Shines@cs.fsu.edu# Authors: Jason Lowe-Power
296019Shines@cs.fsu.edu
306019Shines@cs.fsu.edu""" This file creates a system with Ruby caches and runs the ruby random tester
316019Shines@cs.fsu.eduSee Part 3 in the Learning gem5 book: learning.gem5.org/book/part3
326019Shines@cs.fsu.edu
336019Shines@cs.fsu.eduIMPORTANT: If you modify this file, it's likely that the Learning gem5 book
346019Shines@cs.fsu.edu           also needs to be updated. For now, email Jason <jason@lowepower.com>
356019Shines@cs.fsu.edu
366019Shines@cs.fsu.edu"""
376019Shines@cs.fsu.edufrom __future__ import print_function
386019Shines@cs.fsu.edu
396019Shines@cs.fsu.edu# import the m5 (gem5) library created when gem5 is built
406019Shines@cs.fsu.eduimport m5
416019Shines@cs.fsu.edu# import all of the SimObjects
426757SAli.Saidi@ARM.comfrom m5.objects import *
436019Shines@cs.fsu.edu
446019Shines@cs.fsu.edufrom test_caches import TestCacheSystem
456019Shines@cs.fsu.edu
466019Shines@cs.fsu.edu# create the system we are going to simulate
476019Shines@cs.fsu.edusystem = System()
486019Shines@cs.fsu.edu
496019Shines@cs.fsu.edu# Set the clock fequency of the system (and all of its children)
506019Shines@cs.fsu.edusystem.clk_domain = SrcClockDomain()
517170Sgblack@eecs.umich.edusystem.clk_domain.clock = '1GHz'
526253Sgblack@eecs.umich.edusystem.clk_domain.voltage_domain = VoltageDomain()
537202Sgblack@eecs.umich.edu
546253Sgblack@eecs.umich.edu# Set up the system
556253Sgblack@eecs.umich.edusystem.mem_mode = 'timing'               # Use timing accesses
567396Sgblack@eecs.umich.edusystem.mem_ranges = [AddrRange('512MB')] # Create an address range
577405SAli.Saidi@ARM.com
587259Sgblack@eecs.umich.edu# Create the tester
597423Sgblack@eecs.umich.edusystem.tester = RubyTester(checks_to_complete = 100,
606397Sgblack@eecs.umich.edu                           wakeup_frequency = 10,
616019Shines@cs.fsu.edu                           num_cpus = 2)
626757SAli.Saidi@ARM.com
636019Shines@cs.fsu.edu# Create a DDR3 memory controller and connect it to the membus
646397Sgblack@eecs.umich.edusystem.mem_ctrl = DDR3_1600_8x8()
656019Shines@cs.fsu.edusystem.mem_ctrl.range = system.mem_ranges[0]
666397Sgblack@eecs.umich.edu
676019Shines@cs.fsu.edu# Create the Ruby System
687404SAli.Saidi@ARM.comsystem.caches = TestCacheSystem()
696735Sgblack@eecs.umich.edusystem.caches.setup(system, system.tester, [system.mem_ctrl])
707100Sgblack@eecs.umich.edu
716019Shines@cs.fsu.edu# set up the root SimObject and start the simulation
726757SAli.Saidi@ARM.comroot = Root(full_system = False, system = system)
736757SAli.Saidi@ARM.com
746757SAli.Saidi@ARM.com# Not much point in this being higher than the L1 latency
757694SAli.Saidi@ARM.comm5.ticks.setGlobalFrequency('1ns')
767585SAli.Saidi@arm.com
777404SAli.Saidi@ARM.com# instantiate all of the objects we've created above
786757SAli.Saidi@ARM.comm5.instantiate()
796757SAli.Saidi@ARM.com
806757SAli.Saidi@ARM.comprint("Beginning simulation!")
816019Shines@cs.fsu.eduexit_event = m5.simulate()
826019Shines@cs.fsu.eduprint('Exiting @ tick {} because {}'.format(
836019Shines@cs.fsu.edu         m5.curTick(), exit_event.getCause())
846019Shines@cs.fsu.edu     )
856019Shines@cs.fsu.edu