14486Sbinkertn@umich.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan 29983Sstever@gmail.com# Copyright (c) 2010-2013 Advanced Micro Devices, Inc. 39983Sstever@gmail.com# Copyright (c) 2013 Mark D. Hill and David A. Wood 44486Sbinkertn@umich.edu# All rights reserved. 54486Sbinkertn@umich.edu# 64486Sbinkertn@umich.edu# Redistribution and use in source and binary forms, with or without 74486Sbinkertn@umich.edu# modification, are permitted provided that the following conditions are 84486Sbinkertn@umich.edu# met: redistributions of source code must retain the above copyright 94486Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer; 104486Sbinkertn@umich.edu# redistributions in binary form must reproduce the above copyright 114486Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer in the 124486Sbinkertn@umich.edu# documentation and/or other materials provided with the distribution; 134486Sbinkertn@umich.edu# neither the name of the copyright holders nor the names of its 144486Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from 154486Sbinkertn@umich.edu# this software without specific prior written permission. 164486Sbinkertn@umich.edu# 174486Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 184486Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 194486Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 204486Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 214486Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 224486Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 234486Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 244486Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 254486Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 264486Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 274486Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 284486Sbinkertn@umich.edu# 294486Sbinkertn@umich.edu# Authors: Nathan Binkert 304486Sbinkertn@umich.edu 313102SN/Afrom m5.SimObject import SimObject 323102SN/Afrom m5.params import * 337525Ssteve.reinhardt@amd.comfrom m5.util import fatal 341382SN/A 351692SN/Aclass Root(SimObject): 367525Ssteve.reinhardt@amd.com 377525Ssteve.reinhardt@amd.com _the_instance = None 387525Ssteve.reinhardt@amd.com 397525Ssteve.reinhardt@amd.com def __new__(cls, **kwargs): 407525Ssteve.reinhardt@amd.com if Root._the_instance: 417525Ssteve.reinhardt@amd.com fatal("Attempt to allocate multiple instances of Root.") 427525Ssteve.reinhardt@amd.com return None 437525Ssteve.reinhardt@amd.com 447525Ssteve.reinhardt@amd.com # first call: allocate the unique instance 457525Ssteve.reinhardt@amd.com # 467525Ssteve.reinhardt@amd.com # If SimObject ever implements __new__, we may want to pass 477525Ssteve.reinhardt@amd.com # kwargs here, but for now this goes straight to 487525Ssteve.reinhardt@amd.com # object.__new__ which prints an ugly warning if you pass it 497525Ssteve.reinhardt@amd.com # args. Seems like a bad design but that's the way it is. 507525Ssteve.reinhardt@amd.com Root._the_instance = SimObject.__new__(cls) 517525Ssteve.reinhardt@amd.com return Root._the_instance 5211320Ssteve.reinhardt@amd.com 537525Ssteve.reinhardt@amd.com @classmethod 547525Ssteve.reinhardt@amd.com def getInstance(cls): 557525Ssteve.reinhardt@amd.com return Root._the_instance 567525Ssteve.reinhardt@amd.com 577525Ssteve.reinhardt@amd.com def path(self): 587525Ssteve.reinhardt@amd.com return 'root' 597525Ssteve.reinhardt@amd.com 601366SN/A type = 'Root' 619338SAndreas.Sandberg@arm.com cxx_header = "sim/root.hh" 627861Sgblack@eecs.umich.edu 639983Sstever@gmail.com # By default, root sim object and hence all other sim objects schedule 649983Sstever@gmail.com # event on the eventq with index 0. 659983Sstever@gmail.com eventq_index = 0 669983Sstever@gmail.com 679983Sstever@gmail.com # Simulation Quantum for multiple main event queue simulation. 689983Sstever@gmail.com # Needs to be set explicitly for a multi-eventq simulation. 699983Sstever@gmail.com sim_quantum = Param.Tick(0, "simulation quantum") 709983Sstever@gmail.com 718801Sgblack@eecs.umich.edu full_system = Param.Bool("if this is a full system simulation") 728801Sgblack@eecs.umich.edu 737861Sgblack@eecs.umich.edu # Time syncing prevents the simulation from running faster than real time. 747861Sgblack@eecs.umich.edu time_sync_enable = Param.Bool(False, "whether time syncing is enabled") 757861Sgblack@eecs.umich.edu time_sync_period = Param.Clock("100ms", "how often to sync with real time") 767861Sgblack@eecs.umich.edu time_sync_spin_threshold = \ 777861Sgblack@eecs.umich.edu Param.Clock("100us", "when less than this much time is left, spin") 78