Ruby.py revision 6892
12686Sksewell@umich.edu# Copyright (c) 2006-2007 The Regents of The University of Michigan
22686Sksewell@umich.edu# Copyright (c) 2009 Advanced Micro Devices, Inc.
32754Sksewell@umich.edu# All rights reserved.
42706Sksewell@umich.edu#
52706Sksewell@umich.edu# Redistribution and use in source and binary forms, with or without
62706Sksewell@umich.edu# modification, are permitted provided that the following conditions are
72706Sksewell@umich.edu# met: redistributions of source code must retain the above copyright
82706Sksewell@umich.edu# notice, this list of conditions and the following disclaimer;
92706Sksewell@umich.edu# redistributions in binary form must reproduce the above copyright
102706Sksewell@umich.edu# notice, this list of conditions and the following disclaimer in the
112706Sksewell@umich.edu# documentation and/or other materials provided with the distribution;
122706Sksewell@umich.edu# neither the name of the copyright holders nor the names of its
132706Sksewell@umich.edu# contributors may be used to endorse or promote products derived from
142706Sksewell@umich.edu# this software without specific prior written permission.
152706Sksewell@umich.edu#
162706Sksewell@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172706Sksewell@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182706Sksewell@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192706Sksewell@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202706Sksewell@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212706Sksewell@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222706Sksewell@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232706Sksewell@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242706Sksewell@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252706Sksewell@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262706Sksewell@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272706Sksewell@umich.edu#
282706Sksewell@umich.edu# Authors: Brad Beckmann
292706Sksewell@umich.edu
302706Sksewell@umich.eduimport m5
312022SN/Afrom m5.objects import *
322022SN/Afrom m5.defines import buildEnv
332022SN/Afrom m5.util import addToPath
342022SN/A
352022SN/Aimport MOESI_hammer
362022SN/A
372022SN/Adef create_system(options, physmem):
382022SN/A
392022SN/A    protocol = buildEnv['PROTOCOL']
402022SN/A
413349Sbinkertn@umich.edu    if protocol == "MOESI_hammer":
422022SN/A        (sequencers, dir_cntrls, all_cntrls) = MOESI_hammer.create_system( \
433349Sbinkertn@umich.edu                                                options, physmem)
442022SN/A    else:
452022SN/A         print "Error: unsupported ruby protocol"
462022SN/A         sys.exit(1)
473349Sbinkertn@umich.edu
483349Sbinkertn@umich.edu    #
493349Sbinkertn@umich.edu    # Important: the topology constructor must be called before the network
503349Sbinkertn@umich.edu    # constructor.
513349Sbinkertn@umich.edu    #
523349Sbinkertn@umich.edu    network = SimpleNetwork(topology = makeCrossbar(all_cntrls))
532447SN/A
543349Sbinkertn@umich.edu    mem_size_mb = sum([int(dir_cntrl.directory.size_mb) \
553349Sbinkertn@umich.edu                       for dir_cntrl in dir_cntrls])
563349Sbinkertn@umich.edu
572022SN/A    #
582022SN/A    # determine the number of memory controllers and other memory controller
592687Sksewell@umich.edu    # parameters for the profiler
602447SN/A    #
612447SN/A    mcCount = len(dir_cntrls)
622022SN/A    banksPerRank = dir_cntrls[0].memBuffer.banks_per_rank
632022SN/A    ranksPerDimm = dir_cntrls[0].memBuffer.ranks_per_dimm
642022SN/A    dimmsPerChannel = dir_cntrls[0].memBuffer.dimms_per_channel
652523SN/A
662447SN/A    ruby_profiler = RubyProfiler(mem_cntrl_count = mcCount,
672686Sksewell@umich.edu                                 banks_per_rank = banksPerRank,
682686Sksewell@umich.edu                                 ranks_per_dimm = ranksPerDimm,
692022SN/A                                 dimms_per_channel = dimmsPerChannel)
702022SN/A
712022SN/A    ruby = RubySystem(clock = '1GHz',
722022SN/A                      network = network,
732022SN/A                      profiler = ruby_profiler,
742022SN/A                      tracer = RubyTracer(),
752022SN/A                      debug = RubyDebug(filter_string = 'none',
762022SN/A                                        verbosity_string = 'none',
772022SN/A                                        protocol_trace = False),
782022SN/A                      mem_size_mb = mem_size_mb)
793348Sbinkertn@umich.edu
803348Sbinkertn@umich.edu    ruby.cpu_ruby_ports = sequencers
812022SN/A
822447SN/A    return ruby
832447SN/A