19259SAli.Saidi@ARM.com# Copyright (c) 2012 ARM Limited 29259SAli.Saidi@ARM.com# All rights reserved. 39259SAli.Saidi@ARM.com# 49259SAli.Saidi@ARM.com# The license below extends only to copyright in the software and shall 59259SAli.Saidi@ARM.com# not be construed as granting a license to any other intellectual 69259SAli.Saidi@ARM.com# property including but not limited to intellectual property relating 79259SAli.Saidi@ARM.com# to a hardware implementation of the functionality of the software 89259SAli.Saidi@ARM.com# licensed hereunder. You may use the software subject to the license 99259SAli.Saidi@ARM.com# terms below provided that you ensure that this notice is replicated 109259SAli.Saidi@ARM.com# unmodified and in its entirety in all distributions of the software, 119259SAli.Saidi@ARM.com# modified or unmodified, in source code or in binary form. 129259SAli.Saidi@ARM.com# 139259SAli.Saidi@ARM.com# Redistribution and use in source and binary forms, with or without 149259SAli.Saidi@ARM.com# modification, are permitted provided that the following conditions are 159259SAli.Saidi@ARM.com# met: redistributions of source code must retain the above copyright 169259SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer; 179259SAli.Saidi@ARM.com# redistributions in binary form must reproduce the above copyright 189259SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer in the 199259SAli.Saidi@ARM.com# documentation and/or other materials provided with the distribution; 209259SAli.Saidi@ARM.com# neither the name of the copyright holders nor the names of its 219259SAli.Saidi@ARM.com# contributors may be used to endorse or promote products derived from 229259SAli.Saidi@ARM.com# this software without specific prior written permission. 239259SAli.Saidi@ARM.com# 249259SAli.Saidi@ARM.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 259259SAli.Saidi@ARM.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 269259SAli.Saidi@ARM.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 279259SAli.Saidi@ARM.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 289259SAli.Saidi@ARM.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 299259SAli.Saidi@ARM.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 309259SAli.Saidi@ARM.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 319259SAli.Saidi@ARM.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 329259SAli.Saidi@ARM.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 339259SAli.Saidi@ARM.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 349259SAli.Saidi@ARM.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 359259SAli.Saidi@ARM.com# 369259SAli.Saidi@ARM.com# Authors: Andreas Hansson 379259SAli.Saidi@ARM.com 389259SAli.Saidi@ARM.comfrom m5.params import * 3913892Sgabeblack@google.comfrom m5.SimObject import SimObject 409259SAli.Saidi@ARM.com 419259SAli.Saidi@ARM.com# An address mapper changes the packet addresses in going from the 429259SAli.Saidi@ARM.com# slave port side of the mapper to the master port side. When the 439259SAli.Saidi@ARM.com# slave port is queried for the address ranges, it also performs the 449259SAli.Saidi@ARM.com# necessary range updates. Note that snoop requests that travel from 459259SAli.Saidi@ARM.com# the master port (i.e. the memory side) to the slave port are 469259SAli.Saidi@ARM.com# currently not modified. 4713892Sgabeblack@google.comclass AddrMapper(SimObject): 489259SAli.Saidi@ARM.com type = 'AddrMapper' 499338SAndreas.Sandberg@arm.com cxx_header = 'mem/addr_mapper.hh' 509259SAli.Saidi@ARM.com abstract = True 519259SAli.Saidi@ARM.com 529259SAli.Saidi@ARM.com # one port in each direction 539259SAli.Saidi@ARM.com master = MasterPort("Master port") 549259SAli.Saidi@ARM.com slave = SlavePort("Slave port") 559259SAli.Saidi@ARM.com 569259SAli.Saidi@ARM.com 579259SAli.Saidi@ARM.com# Range address mapper that maps a set of original ranges to a set of 589259SAli.Saidi@ARM.com# remapped ranges, where a specific range is of the same size 599259SAli.Saidi@ARM.com# (original and remapped), only with an offset. 609259SAli.Saidi@ARM.comclass RangeAddrMapper(AddrMapper): 619259SAli.Saidi@ARM.com type = 'RangeAddrMapper' 629338SAndreas.Sandberg@arm.com cxx_header = 'mem/addr_mapper.hh' 639259SAli.Saidi@ARM.com 649259SAli.Saidi@ARM.com # These two vectors should be the exact same length and each range 659259SAli.Saidi@ARM.com # should be the exact same size. Each range in original_ranges is 669259SAli.Saidi@ARM.com # mapped to the corresponding element in the remapped_ranges. Note 679259SAli.Saidi@ARM.com # that the same range can occur multiple times in the remapped 689259SAli.Saidi@ARM.com # ranges for address aliasing. 699259SAli.Saidi@ARM.com original_ranges = VectorParam.AddrRange( 709259SAli.Saidi@ARM.com "Ranges of memory that should me remapped") 719259SAli.Saidi@ARM.com remapped_ranges = VectorParam.AddrRange( 729259SAli.Saidi@ARM.com "Ranges of memory that are being mapped to") 73