110688Sandreas.hansson@arm.com# Copyright (c) 2015 ARM Limited
210688Sandreas.hansson@arm.com# All rights reserved.
310688Sandreas.hansson@arm.com#
410688Sandreas.hansson@arm.com# The license below extends only to copyright in the software and shall
510688Sandreas.hansson@arm.com# not be construed as granting a license to any other intellectual
610688Sandreas.hansson@arm.com# property including but not limited to intellectual property relating
710688Sandreas.hansson@arm.com# to a hardware implementation of the functionality of the software
810688Sandreas.hansson@arm.com# licensed hereunder.  You may use the software subject to the license
910688Sandreas.hansson@arm.com# terms below provided that you ensure that this notice is replicated
1010688Sandreas.hansson@arm.com# unmodified and in its entirety in all distributions of the software,
1110688Sandreas.hansson@arm.com# modified or unmodified, in source code or in binary form.
1210688Sandreas.hansson@arm.com#
134486SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan
144486SN/A# All rights reserved.
154486SN/A#
164486SN/A# Redistribution and use in source and binary forms, with or without
174486SN/A# modification, are permitted provided that the following conditions are
184486SN/A# met: redistributions of source code must retain the above copyright
194486SN/A# notice, this list of conditions and the following disclaimer;
204486SN/A# redistributions in binary form must reproduce the above copyright
214486SN/A# notice, this list of conditions and the following disclaimer in the
224486SN/A# documentation and/or other materials provided with the distribution;
234486SN/A# neither the name of the copyright holders nor the names of its
244486SN/A# contributors may be used to endorse or promote products derived from
254486SN/A# this software without specific prior written permission.
264486SN/A#
274486SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
284486SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
294486SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
304486SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
314486SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
324486SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
334486SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
344486SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
354486SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
364486SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
374486SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
384486SN/A#
394486SN/A# Authors: Nathan Binkert
4010688Sandreas.hansson@arm.com#          Andreas Hansson
413102SN/Afrom m5.params import *
423187SN/Afrom m5.proxy import *
433187SN/A
4413892Sgabeblack@google.comfrom m5.objects.ClockedObject import ClockedObject
4513665Sandreas.sandberg@arm.com
4613892Sgabeblack@google.comclass MemTest(ClockedObject):
471366SN/A    type = 'MemTest'
489338SAndreas.Sandberg@arm.com    cxx_header = "cpu/testers/memtest/memtest.hh"
4910688Sandreas.hansson@arm.com
5010688Sandreas.hansson@arm.com    # Interval of packet injection, the size of the memory range
5110688Sandreas.hansson@arm.com    # touched, and an optional stop condition
5210688Sandreas.hansson@arm.com    interval = Param.Cycles(1, "Interval between request packets")
5310688Sandreas.hansson@arm.com    size = Param.Unsigned(65536, "Size of memory region to use (bytes)")
5410688Sandreas.hansson@arm.com    max_loads = Param.Counter(0, "Number of loads to execute before exiting")
5510688Sandreas.hansson@arm.com
5610688Sandreas.hansson@arm.com    # Control the mix of packets and if functional accesses are part of
5710688Sandreas.hansson@arm.com    # the mix or not
5810688Sandreas.hansson@arm.com    percent_reads = Param.Percent(65, "Percentage reads")
5910688Sandreas.hansson@arm.com    percent_functional = Param.Percent(50, "Percentage functional accesses")
6010688Sandreas.hansson@arm.com    percent_uncacheable = Param.Percent(10, "Percentage uncacheable")
6110688Sandreas.hansson@arm.com
6210688Sandreas.hansson@arm.com    # Determine how often to print progress messages and what timeout
6310688Sandreas.hansson@arm.com    # to use for checking progress of both requests and responses
641310SN/A    progress_interval = Param.Counter(1000000,
6510688Sandreas.hansson@arm.com        "Progress report interval (in accesses)")
6610688Sandreas.hansson@arm.com    progress_check = Param.Cycles(5000000, "Cycles before exiting " \
6710688Sandreas.hansson@arm.com                                      "due to lack of progress")
683187SN/A
6910688Sandreas.hansson@arm.com    port = MasterPort("Port to the memory system")
7010688Sandreas.hansson@arm.com    system = Param.System(Parent.any, "System this tester is part of")
718832SAli.Saidi@ARM.com
7210688Sandreas.hansson@arm.com    # Add the ability to supress error responses on functional
7310688Sandreas.hansson@arm.com    # accesses as Ruby needs this
7410688Sandreas.hansson@arm.com    suppress_func_warnings = Param.Bool(False, "Suppress warnings when "\
7510688Sandreas.hansson@arm.com                                            "functional accesses fail.")
76