113676Sjason@lowepower.com# Copyright (c) 2018 The Regents of the University of California.
213676Sjason@lowepower.com# All rights reserved.
313676Sjason@lowepower.com#
413676Sjason@lowepower.com# Redistribution and use in source and binary forms, with or without
513676Sjason@lowepower.com# modification, are permitted provided that the following conditions are
613676Sjason@lowepower.com# met: redistributions of source code must retain the above copyright
713676Sjason@lowepower.com# notice, this list of conditions and the following disclaimer;
813676Sjason@lowepower.com# redistributions in binary form must reproduce the above copyright
913676Sjason@lowepower.com# notice, this list of conditions and the following disclaimer in the
1013676Sjason@lowepower.com# documentation and/or other materials provided with the distribution;
1113676Sjason@lowepower.com# neither the name of the copyright holders nor the names of its
1213676Sjason@lowepower.com# contributors may be used to endorse or promote products derived from
1313676Sjason@lowepower.com# this software without specific prior written permission.
1413676Sjason@lowepower.com#
1513676Sjason@lowepower.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1613676Sjason@lowepower.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1713676Sjason@lowepower.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1813676Sjason@lowepower.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1913676Sjason@lowepower.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2013676Sjason@lowepower.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2113676Sjason@lowepower.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2213676Sjason@lowepower.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2313676Sjason@lowepower.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2413676Sjason@lowepower.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2513676Sjason@lowepower.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2613676Sjason@lowepower.com#
2713676Sjason@lowepower.com# Authors: Jason Lowe-Power
2813676Sjason@lowepower.com
2913676Sjason@lowepower.com'''
3013676Sjason@lowepower.comTest file for simple memory test
3113676Sjason@lowepower.comTODO: Add stats checking
3213676Sjason@lowepower.com'''
3313676Sjason@lowepower.comfrom testlib import *
3413676Sjason@lowepower.com
3513676Sjason@lowepower.comgem5_verify_config(
3613676Sjason@lowepower.com    name='simple_mem_default',
3713676Sjason@lowepower.com    verifiers=(), # No need for verfiers this will return non-zero on fail
3813676Sjason@lowepower.com    config=joinpath(getcwd(), 'simple-run.py'),
3913676Sjason@lowepower.com    config_args = [],
4013676Sjason@lowepower.com    valid_isas=(constants.null_tag,),
4113676Sjason@lowepower.com)
4213676Sjason@lowepower.com
4313676Sjason@lowepower.comsimple_mem_params = [
4413676Sjason@lowepower.com        ('inf-bandwidth', {'bandwidth': '0GB/s'}),
4513676Sjason@lowepower.com        ('low-latency', {'latency': '1ns'}),
4613676Sjason@lowepower.com        ('high-latency', {'latency': '1us'}),
4713676Sjason@lowepower.com        ('low-bandwidth', {'bandwidth': '1MB/s'}),
4813676Sjason@lowepower.com        ('high-var', {'latency_var': '100ns'})
4913676Sjason@lowepower.com        ]
5013676Sjason@lowepower.com
5113676Sjason@lowepower.com
5213676Sjason@lowepower.comfor name, params in simple_mem_params:
5313676Sjason@lowepower.com    args = ['--' + key + '=' + val for key,val in params.iteritems()]
5413676Sjason@lowepower.com
5513676Sjason@lowepower.com    gem5_verify_config(
5613676Sjason@lowepower.com        name='simple_mem_' + name,
5713676Sjason@lowepower.com        verifiers=(), # No need for verfiers this will return non-zero on fail
5813676Sjason@lowepower.com        config=joinpath(getcwd(), 'simple-run.py'),
5913676Sjason@lowepower.com        config_args = args,
6013676Sjason@lowepower.com        valid_isas=(constants.null_tag,),
6113677Sjason@lowepower.com        ) # This tests for validity as well as performance
6213676Sjason@lowepower.com
6313677Sjason@lowepower.comgem5_verify_config(
6413677Sjason@lowepower.com    name='memtest',
6513677Sjason@lowepower.com    verifiers=(), # No need for verfiers this will return non-zero on fail
6613677Sjason@lowepower.com    config=joinpath(getcwd(), 'memtest-run.py'),
6713677Sjason@lowepower.com    config_args = [],
6813677Sjason@lowepower.com    valid_isas=(constants.null_tag,),
6913677Sjason@lowepower.com)
70