114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 1999-2005 Mark D. Hill and David A. Wood
314184Sgabeblack@google.com * Copyright (c) 2013 Advanced Micro Devices, Inc.
414184Sgabeblack@google.com * All rights reserved.
514184Sgabeblack@google.com *
614184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
714184Sgabeblack@google.com * modification, are permitted provided that the following conditions are
814184Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
914184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
1014184Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1114184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1214184Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1314184Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1414184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1514184Sgabeblack@google.com * this software without specific prior written permission.
1614184Sgabeblack@google.com *
1714184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1814184Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1914184Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2014184Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2114184Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2214184Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2314184Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2414184Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2514184Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2614184Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2714184Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2814184Sgabeblack@google.com */
2914184Sgabeblack@google.com
3014184Sgabeblack@google.com// External Types
3114184Sgabeblack@google.com
3214184Sgabeblack@google.com//
3314184Sgabeblack@google.com// **PLEASE NOTE!**  When adding objects to this file you must also add a line
3414184Sgabeblack@google.com// in the src/mem/ruby/SConscript file.  Otherwise the external object's .hh
3514184Sgabeblack@google.com// file will not be copied to the protocol directory and you will encounter a
3614184Sgabeblack@google.com// undefined declaration error.
3714184Sgabeblack@google.com//
3814184Sgabeblack@google.com
3914184Sgabeblack@google.comexternal_type(MessageBuffer, buffer="yes", inport="yes", outport="yes");
4014184Sgabeblack@google.comexternal_type(OutPort, primitive="yes");
4114184Sgabeblack@google.comexternal_type(Scalar, primitive="yes");
4214184Sgabeblack@google.com
4314184Sgabeblack@google.comstructure(InPort, external = "yes", primitive="yes") {
4414184Sgabeblack@google.com  bool isReady(Tick current_time);
4514184Sgabeblack@google.com  Tick dequeue(Tick current_time);
4614184Sgabeblack@google.com  void recycle(Tick current_time, Tick recycle_latency);
4714184Sgabeblack@google.com  bool isEmpty();
4814184Sgabeblack@google.com  bool isStallMapEmpty();
4914184Sgabeblack@google.com  int getStallMapSize();
5014184Sgabeblack@google.com}
5114184Sgabeblack@google.com
5214184Sgabeblack@google.comexternal_type(NodeID, default="0", primitive="yes");
5314184Sgabeblack@google.comexternal_type(MachineID);
5414184Sgabeblack@google.com
5514184Sgabeblack@google.comstructure (Set, external = "yes", non_obj="yes") {
5614184Sgabeblack@google.com  void setSize(int);
5714184Sgabeblack@google.com  void add(NodeID);
5814184Sgabeblack@google.com  void addSet(Set);
5914184Sgabeblack@google.com  void remove(NodeID);
6014184Sgabeblack@google.com  void removeSet(Set);
6114184Sgabeblack@google.com  void broadcast();
6214184Sgabeblack@google.com  void addRandom();
6314184Sgabeblack@google.com  void clear();
6414184Sgabeblack@google.com  int count();
6514184Sgabeblack@google.com  bool isElement(NodeID);
6614184Sgabeblack@google.com  bool isEqual(Set);
6714184Sgabeblack@google.com  bool isSuperset(Set);
6814184Sgabeblack@google.com  bool intersectionIsEmpty(Set);
6914184Sgabeblack@google.com  NodeID smallestElement();
7014184Sgabeblack@google.com}
7114184Sgabeblack@google.com
7214184Sgabeblack@google.comstructure (NetDest, external = "yes", non_obj="yes") {
7314184Sgabeblack@google.com  void setSize(int);
7414184Sgabeblack@google.com  void setSize(int, int);
7514184Sgabeblack@google.com  void add(NodeID);
7614184Sgabeblack@google.com  void add(MachineID);
7714184Sgabeblack@google.com  void addSet(Set);
7814184Sgabeblack@google.com  void addNetDest(NetDest);
7914184Sgabeblack@google.com  void setNetDest(MachineType, Set);
8014184Sgabeblack@google.com  void remove(NodeID);
8114184Sgabeblack@google.com  void remove(MachineID);
8214184Sgabeblack@google.com  void removeSet(Set);
8314184Sgabeblack@google.com  void removeNetDest(NetDest);
8414184Sgabeblack@google.com  void broadcast();
8514184Sgabeblack@google.com  void broadcast(MachineType);
8614184Sgabeblack@google.com  void addRandom();
8714184Sgabeblack@google.com  void clear();
8814184Sgabeblack@google.com  Set toSet();
8914184Sgabeblack@google.com  int count();
9014184Sgabeblack@google.com  bool isElement(NodeID);
9114184Sgabeblack@google.com  bool isElement(MachineID);
9214184Sgabeblack@google.com  bool isSuperset(Set);
9314184Sgabeblack@google.com  bool isSuperset(NetDest);
9414184Sgabeblack@google.com  bool isEmpty();
9514184Sgabeblack@google.com  bool intersectionIsEmpty(Set);
9614184Sgabeblack@google.com  bool intersectionIsEmpty(NetDest);
9714184Sgabeblack@google.com  MachineID smallestElement(MachineType);
9814184Sgabeblack@google.com  NetDest OR(NetDest);
9914184Sgabeblack@google.com  NetDest AND(NetDest);
10014184Sgabeblack@google.com}
10114184Sgabeblack@google.com
10214184Sgabeblack@google.comstructure (Sequencer, external = "yes") {
10314184Sgabeblack@google.com  void readCallback(Addr, DataBlock);
10414184Sgabeblack@google.com  void readCallback(Addr, DataBlock, bool);
10514184Sgabeblack@google.com  void readCallback(Addr, DataBlock, bool, MachineType);
10614184Sgabeblack@google.com  void readCallback(Addr, DataBlock, bool, MachineType,
10714184Sgabeblack@google.com                    Cycles, Cycles, Cycles);
10814184Sgabeblack@google.com
10914184Sgabeblack@google.com  void writeCallback(Addr, DataBlock);
11014184Sgabeblack@google.com  void writeCallback(Addr, DataBlock, bool);
11114184Sgabeblack@google.com  void writeCallback(Addr, DataBlock, bool, MachineType);
11214184Sgabeblack@google.com  void writeCallback(Addr, DataBlock, bool, MachineType,
11314184Sgabeblack@google.com                     Cycles, Cycles, Cycles);
11414184Sgabeblack@google.com
11514184Sgabeblack@google.com  void checkCoherence(Addr);
11614184Sgabeblack@google.com  void evictionCallback(Addr);
11714184Sgabeblack@google.com  void recordRequestType(SequencerRequestType);
11814184Sgabeblack@google.com  bool checkResourceAvailable(CacheResourceType, Addr);
11914184Sgabeblack@google.com  void invalidateSC(Addr);
12014184Sgabeblack@google.com}
12114184Sgabeblack@google.com
12214184Sgabeblack@google.comstructure (GPUCoalescer, external = "yes") {
12314184Sgabeblack@google.com  void readCallback(Addr, DataBlock);
12414184Sgabeblack@google.com  void readCallback(Addr, MachineType, DataBlock);
12514184Sgabeblack@google.com  void readCallback(Addr, MachineType, DataBlock,
12614184Sgabeblack@google.com                    Cycles, Cycles, Cycles);
12714184Sgabeblack@google.com  void readCallback(Addr, MachineType, DataBlock,
12814184Sgabeblack@google.com                    Cycles, Cycles, Cycles, bool);
12914184Sgabeblack@google.com  void writeCallback(Addr, DataBlock);
13014184Sgabeblack@google.com  void writeCallback(Addr, MachineType, DataBlock);
13114184Sgabeblack@google.com  void writeCallback(Addr, MachineType, DataBlock,
13214184Sgabeblack@google.com                     Cycles, Cycles, Cycles);
13314184Sgabeblack@google.com  void writeCallback(Addr, MachineType, DataBlock,
13414184Sgabeblack@google.com                     Cycles, Cycles, Cycles, bool);
13514184Sgabeblack@google.com  void checkCoherence(Addr);
13614184Sgabeblack@google.com  void evictionCallback(Addr);
13714184Sgabeblack@google.com  void recordCPReadCallBack(MachineID, MachineID);
13814184Sgabeblack@google.com  void recordCPWriteCallBack(MachineID, MachineID);
13914184Sgabeblack@google.com}
14014184Sgabeblack@google.com
14114184Sgabeblack@google.comstructure (VIPERCoalescer, external = "yes") {
14214184Sgabeblack@google.com  void readCallback(Addr, DataBlock);
14314184Sgabeblack@google.com  void readCallback(Addr, MachineType, DataBlock);
14414184Sgabeblack@google.com  void readCallback(Addr, MachineType, DataBlock,
14514184Sgabeblack@google.com                    Cycles, Cycles, Cycles);
14614184Sgabeblack@google.com  void readCallback(Addr, MachineType, DataBlock,
14714184Sgabeblack@google.com                    Cycles, Cycles, Cycles, bool);
14814184Sgabeblack@google.com  void writeCallback(Addr, DataBlock);
14914184Sgabeblack@google.com  void writeCallback(Addr, MachineType, DataBlock);
15014184Sgabeblack@google.com  void writeCallback(Addr, MachineType, DataBlock,
15114184Sgabeblack@google.com                     Cycles, Cycles, Cycles);
15214184Sgabeblack@google.com  void writeCallback(Addr, MachineType, DataBlock,
15314184Sgabeblack@google.com                     Cycles, Cycles, Cycles, bool);
15414184Sgabeblack@google.com  void invCallback(Addr);
15514184Sgabeblack@google.com  void wbCallback(Addr);
15614184Sgabeblack@google.com  void checkCoherence(Addr);
15714184Sgabeblack@google.com  void evictionCallback(Addr);
15814184Sgabeblack@google.com}
15914184Sgabeblack@google.com
16014184Sgabeblack@google.comstructure(RubyRequest, desc="...", interface="Message", external="yes") {
16114184Sgabeblack@google.com  Addr LineAddress,       desc="Line address for this request";
16214184Sgabeblack@google.com  Addr PhysicalAddress,   desc="Physical address for this request";
16314184Sgabeblack@google.com  RubyRequestType Type,      desc="Type of request (LD, ST, etc)";
16414184Sgabeblack@google.com  Addr ProgramCounter,    desc="Program counter of the instruction that caused the miss";
16514184Sgabeblack@google.com  RubyAccessMode AccessMode, desc="user/supervisor access type";
16614184Sgabeblack@google.com  int Size,                  desc="size in bytes of access";
16714184Sgabeblack@google.com  PrefetchBit Prefetch,      desc="Is this a prefetch request";
16814184Sgabeblack@google.com  int contextId,             desc="this goes away but must be replace with Nilay";
16914184Sgabeblack@google.com  WriteMask writeMask,       desc="Writethrough mask";
17014184Sgabeblack@google.com  DataBlock WTData,          desc="Writethrough data block";
17114184Sgabeblack@google.com  int wfid,                  desc="Writethrough wavefront";
17214184Sgabeblack@google.com  HSAScope scope,            desc="HSA scope";
17314184Sgabeblack@google.com  HSASegment segment,        desc="HSA segment";
17414184Sgabeblack@google.com  PacketPtr pkt,             desc="Packet associated with this request";
17514184Sgabeblack@google.com}
17614184Sgabeblack@google.com
17714184Sgabeblack@google.comstructure(AbstractEntry, primitive="yes", external = "yes") {
17814184Sgabeblack@google.com  void changePermission(AccessPermission);
17914184Sgabeblack@google.com}
18014184Sgabeblack@google.com
18114184Sgabeblack@google.comstructure (DirectoryMemory, external = "yes") {
18214184Sgabeblack@google.com  AbstractEntry allocate(Addr, AbstractEntry);
18314184Sgabeblack@google.com  AbstractEntry lookup(Addr);
18414184Sgabeblack@google.com  bool isPresent(Addr);
18514184Sgabeblack@google.com  void invalidateBlock(Addr);
18614184Sgabeblack@google.com  void recordRequestType(DirectoryRequestType);
18714184Sgabeblack@google.com}
18814184Sgabeblack@google.com
18914184Sgabeblack@google.comstructure(AbstractCacheEntry, primitive="yes", external = "yes") {
19014184Sgabeblack@google.com  void changePermission(AccessPermission);
19114184Sgabeblack@google.com}
19214184Sgabeblack@google.com
19314184Sgabeblack@google.comstructure (CacheMemory, external = "yes") {
19414184Sgabeblack@google.com  bool cacheAvail(Addr);
19514184Sgabeblack@google.com  Addr cacheProbe(Addr);
19614184Sgabeblack@google.com  AbstractCacheEntry allocate(Addr, AbstractCacheEntry);
19714184Sgabeblack@google.com  AbstractCacheEntry allocate(Addr, AbstractCacheEntry, bool);
19814184Sgabeblack@google.com  void allocateVoid(Addr, AbstractCacheEntry);
19914184Sgabeblack@google.com  void deallocate(Addr);
20014184Sgabeblack@google.com  AbstractCacheEntry lookup(Addr);
20114184Sgabeblack@google.com  bool isTagPresent(Addr);
20214184Sgabeblack@google.com  Cycles getTagLatency();
20314184Sgabeblack@google.com  Cycles getDataLatency();
20414184Sgabeblack@google.com  void setMRU(Addr);
20514184Sgabeblack@google.com  void setMRU(Addr, int);
20614184Sgabeblack@google.com  void setMRU(AbstractCacheEntry);
20714184Sgabeblack@google.com  void recordRequestType(CacheRequestType, Addr);
20814184Sgabeblack@google.com  bool checkResourceAvailable(CacheResourceType, Addr);
20914184Sgabeblack@google.com
21014184Sgabeblack@google.com  int getCacheSize();
21114184Sgabeblack@google.com  int getNumBlocks();
21214184Sgabeblack@google.com  Addr getAddressAtIdx(int);
21314184Sgabeblack@google.com
21414184Sgabeblack@google.com  Scalar demand_misses;
21514184Sgabeblack@google.com  Scalar demand_hits;
21614184Sgabeblack@google.com}
21714184Sgabeblack@google.com
21814184Sgabeblack@google.comstructure (WireBuffer, inport="yes", outport="yes", external = "yes") {
21914184Sgabeblack@google.com
22014184Sgabeblack@google.com}
22114184Sgabeblack@google.com
22214184Sgabeblack@google.comstructure (DMASequencer, external = "yes") {
22314184Sgabeblack@google.com  void ackCallback(Addr);
22414184Sgabeblack@google.com  void dataCallback(DataBlock,Addr);
22514184Sgabeblack@google.com  void recordRequestType(CacheRequestType);
22614184Sgabeblack@google.com}
22714184Sgabeblack@google.com
22814184Sgabeblack@google.comstructure (TimerTable, inport="yes", external = "yes") {
22914184Sgabeblack@google.com  bool isReady(Tick);
23014184Sgabeblack@google.com  Addr nextAddress();
23114184Sgabeblack@google.com  void set(Addr, Tick);
23214184Sgabeblack@google.com  void unset(Addr);
23314184Sgabeblack@google.com  bool isSet(Addr);
23414184Sgabeblack@google.com}
23514184Sgabeblack@google.com
23614184Sgabeblack@google.comstructure (Prefetcher, external = "yes") {
23714184Sgabeblack@google.com    void observeMiss(Addr, RubyRequestType);
23814184Sgabeblack@google.com    void observePfHit(Addr);
23914184Sgabeblack@google.com    void observePfMiss(Addr);
24014184Sgabeblack@google.com}
241