112339Sjason@lowepower.com# -*- coding: utf-8 -*- 212339Sjason@lowepower.com# Copyright (c) 2017 Jason Lowe-Power 312339Sjason@lowepower.com# All rights reserved. 412339Sjason@lowepower.com# 512339Sjason@lowepower.com# Redistribution and use in source and binary forms, with or without 612339Sjason@lowepower.com# modification, are permitted provided that the following conditions are 712339Sjason@lowepower.com# met: redistributions of source code must retain the above copyright 812339Sjason@lowepower.com# notice, this list of conditions and the following disclaimer; 912339Sjason@lowepower.com# redistributions in binary form must reproduce the above copyright 1012339Sjason@lowepower.com# notice, this list of conditions and the following disclaimer in the 1112339Sjason@lowepower.com# documentation and/or other materials provided with the distribution; 1212339Sjason@lowepower.com# neither the name of the copyright holders nor the names of its 1312339Sjason@lowepower.com# contributors may be used to endorse or promote products derived from 1412339Sjason@lowepower.com# this software without specific prior written permission. 1512339Sjason@lowepower.com# 1612339Sjason@lowepower.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712339Sjason@lowepower.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812339Sjason@lowepower.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912339Sjason@lowepower.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012339Sjason@lowepower.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112339Sjason@lowepower.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212339Sjason@lowepower.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312339Sjason@lowepower.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412339Sjason@lowepower.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512339Sjason@lowepower.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612339Sjason@lowepower.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712339Sjason@lowepower.com# 2812339Sjason@lowepower.com# Authors: Jason Lowe-Power 2912339Sjason@lowepower.com 3012339Sjason@lowepower.comfrom m5.params import * 3112339Sjason@lowepower.comfrom m5.proxy import * 3214252Sgabeblack@google.comfrom m5.objects.ClockedObject import ClockedObject 3312339Sjason@lowepower.com 3414252Sgabeblack@google.comclass SimpleCache(ClockedObject): 3512339Sjason@lowepower.com type = 'SimpleCache' 3612339Sjason@lowepower.com cxx_header = "learning_gem5/part2/simple_cache.hh" 3712339Sjason@lowepower.com 3812339Sjason@lowepower.com # Vector port example. Both the instruction and data ports connect to this 3912339Sjason@lowepower.com # port which is automatically split out into two ports. 4012339Sjason@lowepower.com cpu_side = VectorSlavePort("CPU side port, receives requests") 4112339Sjason@lowepower.com mem_side = MasterPort("Memory side port, sends requests") 4212339Sjason@lowepower.com 4312339Sjason@lowepower.com latency = Param.Cycles(1, "Cycles taken on a hit or to resolve a miss") 4412339Sjason@lowepower.com 4512339Sjason@lowepower.com size = Param.MemorySize('16kB', "The size of the cache") 4612339Sjason@lowepower.com 4712339Sjason@lowepower.com system = Param.System(Parent.any, "The system this cache is part of") 48