AddrMapper.py revision 13665:9c7fe3811b88
110234Syasuko.eckert@amd.com# Copyright (c) 2012 ARM Limited
210234Syasuko.eckert@amd.com# All rights reserved.
310234Syasuko.eckert@amd.com#
410234Syasuko.eckert@amd.com# The license below extends only to copyright in the software and shall
510234Syasuko.eckert@amd.com# not be construed as granting a license to any other intellectual
610234Syasuko.eckert@amd.com# property including but not limited to intellectual property relating
710234Syasuko.eckert@amd.com# to a hardware implementation of the functionality of the software
810234Syasuko.eckert@amd.com# licensed hereunder.  You may use the software subject to the license
910234Syasuko.eckert@amd.com# terms below provided that you ensure that this notice is replicated
1010234Syasuko.eckert@amd.com# unmodified and in its entirety in all distributions of the software,
1110234Syasuko.eckert@amd.com# modified or unmodified, in source code or in binary form.
1210234Syasuko.eckert@amd.com#
1310234Syasuko.eckert@amd.com# Redistribution and use in source and binary forms, with or without
1410234Syasuko.eckert@amd.com# modification, are permitted provided that the following conditions are
1510234Syasuko.eckert@amd.com# met: redistributions of source code must retain the above copyright
1610234Syasuko.eckert@amd.com# notice, this list of conditions and the following disclaimer;
1710234Syasuko.eckert@amd.com# redistributions in binary form must reproduce the above copyright
1810234Syasuko.eckert@amd.com# notice, this list of conditions and the following disclaimer in the
1910234Syasuko.eckert@amd.com# documentation and/or other materials provided with the distribution;
2010234Syasuko.eckert@amd.com# neither the name of the copyright holders nor the names of its
2110234Syasuko.eckert@amd.com# contributors may be used to endorse or promote products derived from
2210234Syasuko.eckert@amd.com# this software without specific prior written permission.
2310234Syasuko.eckert@amd.com#
2410234Syasuko.eckert@amd.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2510234Syasuko.eckert@amd.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2610234Syasuko.eckert@amd.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2710234Syasuko.eckert@amd.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2810234Syasuko.eckert@amd.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2910234Syasuko.eckert@amd.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3010234Syasuko.eckert@amd.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3110234Syasuko.eckert@amd.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3210234Syasuko.eckert@amd.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3310234Syasuko.eckert@amd.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3410234Syasuko.eckert@amd.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3510234Syasuko.eckert@amd.com#
3610234Syasuko.eckert@amd.com# Authors: Andreas Hansson
3710234Syasuko.eckert@amd.com
3810234Syasuko.eckert@amd.comfrom m5.params import *
3910234Syasuko.eckert@amd.comfrom m5.objects.MemObject import MemObject
4010234Syasuko.eckert@amd.com
4110234Syasuko.eckert@amd.com# An address mapper changes the packet addresses in going from the
4210234Syasuko.eckert@amd.com# slave port side of the mapper to the master port side. When the
4310234Syasuko.eckert@amd.com# slave port is queried for the address ranges, it also performs the
4410234Syasuko.eckert@amd.com# necessary range updates. Note that snoop requests that travel from
4510234Syasuko.eckert@amd.com# the master port (i.e. the memory side) to the slave port are
46# currently not modified.
47class AddrMapper(MemObject):
48    type = 'AddrMapper'
49    cxx_header = 'mem/addr_mapper.hh'
50    abstract = True
51
52    # one port in each direction
53    master = MasterPort("Master port")
54    slave = SlavePort("Slave port")
55
56
57# Range address mapper that maps a set of original ranges to a set of
58# remapped ranges, where a specific range is of the same size
59# (original and remapped), only with an offset.
60class RangeAddrMapper(AddrMapper):
61    type = 'RangeAddrMapper'
62    cxx_header = 'mem/addr_mapper.hh'
63
64    # These two vectors should be the exact same length and each range
65    # should be the exact same size. Each range in original_ranges is
66    # mapped to the corresponding element in the remapped_ranges. Note
67    # that the same range can occur multiple times in the remapped
68    # ranges for address aliasing.
69    original_ranges = VectorParam.AddrRange(
70        "Ranges of memory that should me remapped")
71    remapped_ranges = VectorParam.AddrRange(
72        "Ranges of memory that are being mapped to")
73