devices.py revision 11569
111569Sgabor.dozsa@arm.com# Copyright (c) 2016 ARM Limited
211569Sgabor.dozsa@arm.com# All rights reserved.
311569Sgabor.dozsa@arm.com#
411569Sgabor.dozsa@arm.com# The license below extends only to copyright in the software and shall
511569Sgabor.dozsa@arm.com# not be construed as granting a license to any other intellectual
611569Sgabor.dozsa@arm.com# property including but not limited to intellectual property relating
711569Sgabor.dozsa@arm.com# to a hardware implementation of the functionality of the software
811569Sgabor.dozsa@arm.com# licensed hereunder.  You may use the software subject to the license
911569Sgabor.dozsa@arm.com# terms below provided that you ensure that this notice is replicated
1011569Sgabor.dozsa@arm.com# unmodified and in its entirety in all distributions of the software,
1111569Sgabor.dozsa@arm.com# modified or unmodified, in source code or in binary form.
1211569Sgabor.dozsa@arm.com#
1311569Sgabor.dozsa@arm.com# Redistribution and use in source and binary forms, with or without
1411569Sgabor.dozsa@arm.com# modification, are permitted provided that the following conditions are
1511569Sgabor.dozsa@arm.com# met: redistributions of source code must retain the above copyright
1611569Sgabor.dozsa@arm.com# notice, this list of conditions and the following disclaimer;
1711569Sgabor.dozsa@arm.com# redistributions in binary form must reproduce the above copyright
1811569Sgabor.dozsa@arm.com# notice, this list of conditions and the following disclaimer in the
1911569Sgabor.dozsa@arm.com# documentation and/or other materials provided with the distribution;
2011569Sgabor.dozsa@arm.com# neither the name of the copyright holders nor the names of its
2111569Sgabor.dozsa@arm.com# contributors may be used to endorse or promote products derived from
2211569Sgabor.dozsa@arm.com# this software without specific prior written permission.
2311569Sgabor.dozsa@arm.com#
2411569Sgabor.dozsa@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2511569Sgabor.dozsa@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2611569Sgabor.dozsa@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2711569Sgabor.dozsa@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2811569Sgabor.dozsa@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2911569Sgabor.dozsa@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3011569Sgabor.dozsa@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3111569Sgabor.dozsa@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3211569Sgabor.dozsa@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3311569Sgabor.dozsa@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3411569Sgabor.dozsa@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3511569Sgabor.dozsa@arm.com#
3611569Sgabor.dozsa@arm.com# Authors: Andreas Sandberg
3711569Sgabor.dozsa@arm.com#          Gabor Dozsa
3811569Sgabor.dozsa@arm.com
3911569Sgabor.dozsa@arm.com# System components used by the bigLITTLE.py configuration script
4011569Sgabor.dozsa@arm.com
4111569Sgabor.dozsa@arm.comimport m5
4211569Sgabor.dozsa@arm.comfrom m5.objects import *
4311569Sgabor.dozsa@arm.comm5.util.addToPath('../../common')
4411569Sgabor.dozsa@arm.comfrom Caches import *
4511569Sgabor.dozsa@arm.com
4611569Sgabor.dozsa@arm.comclass L1I(L1_ICache):
4711569Sgabor.dozsa@arm.com    hit_latency = 1
4811569Sgabor.dozsa@arm.com    response_latency = 1
4911569Sgabor.dozsa@arm.com    mshrs = 4
5011569Sgabor.dozsa@arm.com    tgts_per_mshr = 8
5111569Sgabor.dozsa@arm.com    size = '48kB'
5211569Sgabor.dozsa@arm.com    assoc = 3
5311569Sgabor.dozsa@arm.com
5411569Sgabor.dozsa@arm.com
5511569Sgabor.dozsa@arm.comclass L1D(L1_DCache):
5611569Sgabor.dozsa@arm.com    hit_latency = 2
5711569Sgabor.dozsa@arm.com    response_latency = 1
5811569Sgabor.dozsa@arm.com    mshrs = 16
5911569Sgabor.dozsa@arm.com    tgts_per_mshr = 16
6011569Sgabor.dozsa@arm.com    size = '32kB'
6111569Sgabor.dozsa@arm.com    assoc = 2
6211569Sgabor.dozsa@arm.com    write_buffers = 16
6311569Sgabor.dozsa@arm.com
6411569Sgabor.dozsa@arm.com
6511569Sgabor.dozsa@arm.comclass WalkCache(PageTableWalkerCache):
6611569Sgabor.dozsa@arm.com    hit_latency = 4
6711569Sgabor.dozsa@arm.com    response_latency = 4
6811569Sgabor.dozsa@arm.com    mshrs = 6
6911569Sgabor.dozsa@arm.com    tgts_per_mshr = 8
7011569Sgabor.dozsa@arm.com    size = '1kB'
7111569Sgabor.dozsa@arm.com    assoc = 8
7211569Sgabor.dozsa@arm.com    write_buffers = 16
7311569Sgabor.dozsa@arm.com
7411569Sgabor.dozsa@arm.com
7511569Sgabor.dozsa@arm.comclass L2(L2Cache):
7611569Sgabor.dozsa@arm.com    hit_latency = 12
7711569Sgabor.dozsa@arm.com    response_latency = 5
7811569Sgabor.dozsa@arm.com    mshrs = 32
7911569Sgabor.dozsa@arm.com    tgts_per_mshr = 8
8011569Sgabor.dozsa@arm.com    size = '1MB'
8111569Sgabor.dozsa@arm.com    assoc = 16
8211569Sgabor.dozsa@arm.com    write_buffers = 8
8311569Sgabor.dozsa@arm.com    clusivity='mostly_excl'
8411569Sgabor.dozsa@arm.com
8511569Sgabor.dozsa@arm.com
8611569Sgabor.dozsa@arm.comclass L3(Cache):
8711569Sgabor.dozsa@arm.com    size = '16MB'
8811569Sgabor.dozsa@arm.com    assoc = 16
8911569Sgabor.dozsa@arm.com    hit_latency = 20
9011569Sgabor.dozsa@arm.com    response_latency = 20
9111569Sgabor.dozsa@arm.com    mshrs = 20
9211569Sgabor.dozsa@arm.com    tgts_per_mshr = 12
9311569Sgabor.dozsa@arm.com    clusivity='mostly_excl'
9411569Sgabor.dozsa@arm.com
9511569Sgabor.dozsa@arm.com
9611569Sgabor.dozsa@arm.comclass MemBus(SystemXBar):
9711569Sgabor.dozsa@arm.com    badaddr_responder = BadAddr(warn_access="warn")
9811569Sgabor.dozsa@arm.com    default = Self.badaddr_responder.pio
9911569Sgabor.dozsa@arm.com
10011569Sgabor.dozsa@arm.com
10111569Sgabor.dozsa@arm.comclass SimpleSystem(LinuxArmSystem):
10211569Sgabor.dozsa@arm.com    cache_line_size = 64
10311569Sgabor.dozsa@arm.com
10411569Sgabor.dozsa@arm.com    voltage_domain = VoltageDomain(voltage="1.0V")
10511569Sgabor.dozsa@arm.com    clk_domain = SrcClockDomain(clock="1GHz",
10611569Sgabor.dozsa@arm.com                                voltage_domain=Parent.voltage_domain)
10711569Sgabor.dozsa@arm.com
10811569Sgabor.dozsa@arm.com    realview = VExpress_GEM5_V1()
10911569Sgabor.dozsa@arm.com
11011569Sgabor.dozsa@arm.com    gic_cpu_addr = realview.gic.cpu_addr
11111569Sgabor.dozsa@arm.com    flags_addr = realview.realview_io.pio_addr + 0x30
11211569Sgabor.dozsa@arm.com
11311569Sgabor.dozsa@arm.com    membus = MemBus()
11411569Sgabor.dozsa@arm.com
11511569Sgabor.dozsa@arm.com    intrctrl = IntrControl()
11611569Sgabor.dozsa@arm.com    terminal = Terminal()
11711569Sgabor.dozsa@arm.com    vncserver = VncServer()
11811569Sgabor.dozsa@arm.com
11911569Sgabor.dozsa@arm.com    iobus = IOXBar()
12011569Sgabor.dozsa@arm.com    # CPUs->PIO
12111569Sgabor.dozsa@arm.com    iobridge = Bridge(delay='50ns')
12211569Sgabor.dozsa@arm.com    # Device DMA -> MEM
12311569Sgabor.dozsa@arm.com    dmabridge = Bridge(delay='50ns', ranges=realview._mem_regions)
12411569Sgabor.dozsa@arm.com
12511569Sgabor.dozsa@arm.com    _pci_devices = 0
12611569Sgabor.dozsa@arm.com    _clusters = []
12711569Sgabor.dozsa@arm.com    _cpus = []
12811569Sgabor.dozsa@arm.com
12911569Sgabor.dozsa@arm.com    def attach_pci(self, dev):
13011569Sgabor.dozsa@arm.com        dev.pci_bus, dev.pci_dev, dev.pci_func = (0, self._pci_devices + 1, 0)
13111569Sgabor.dozsa@arm.com        self._pci_devices += 1
13211569Sgabor.dozsa@arm.com        self.realview.attachPciDevice(dev, self.iobus)
13311569Sgabor.dozsa@arm.com
13411569Sgabor.dozsa@arm.com    def connect(self):
13511569Sgabor.dozsa@arm.com        self.iobridge.master = self.iobus.slave
13611569Sgabor.dozsa@arm.com        self.iobridge.slave = self.membus.master
13711569Sgabor.dozsa@arm.com
13811569Sgabor.dozsa@arm.com        self.dmabridge.master = self.membus.slave
13911569Sgabor.dozsa@arm.com        self.dmabridge.slave = self.iobus.master
14011569Sgabor.dozsa@arm.com
14111569Sgabor.dozsa@arm.com        self.gic_cpu_addr = self.realview.gic.cpu_addr
14211569Sgabor.dozsa@arm.com        self.realview.attachOnChipIO(self.membus, self.iobridge)
14311569Sgabor.dozsa@arm.com        self.realview.attachIO(self.iobus)
14411569Sgabor.dozsa@arm.com        self.system_port = self.membus.slave
145