1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 44 unchanged lines hidden (view full) --- 53 * outside the Port object since it's also used by some mem objects. 54 * Eventually we should move this typedef to wherever Addr is 55 * defined. 56 */ 57 58typedef std::list<Range<Addr> > AddrRangeList; 59typedef std::list<Range<Addr> >::iterator AddrRangeIter; 60 |
61class MemObject; 62 |
63/** 64 * Ports are used to interface memory objects to 65 * each other. They will always come in pairs, and we refer to the other 66 * port object as the peer. These are used to make the design more 67 * modular so that a specific interface between every type of objcet doesn't 68 * have to be created. 69 * 70 * Recv accesor functions are being called from the peer interface. --- 7 unchanged lines hidden (view full) --- 78 /** Descriptive name (for DPRINTF output) */ 79 mutable std::string portName; 80 81 /** A pointer to the peer port. Ports always come in pairs, that way they 82 can use a standardized interface to communicate between different 83 memory objects. */ 84 Port *peer; 85 |
86 /** A pointer to the MemObject that owns this port. This may not be set. */ 87 MemObject *owner; 88 |
89 public: 90 91 Port() |
92 : peer(NULL), owner(NULL) |
93 { } 94 95 /** 96 * Constructor. 97 * 98 * @param _name Port name for DPRINTF output. Should include name 99 * of memory system object to which the port belongs. |
100 * @param _owner Pointer to the MemObject that owns this port. 101 * Will not necessarily be set. |
102 */ |
103 Port(const std::string &_name, MemObject *_owner = NULL) 104 : portName(_name), peer(NULL), owner(_owner) |
105 { } 106 107 /** Return port name (for DPRINTF). */ 108 const std::string &name() const { return portName; } 109 110 virtual ~Port() {}; 111 112 // mey be better to use subclasses & RTTI? 113 /** Holds the ports status. Currently just that a range recomputation needs 114 * to be done. */ 115 enum Status { 116 RangeChange 117 }; 118 119 void setName(const std::string &name) 120 { portName = name; } 121 |
122 /** Function to set the pointer for the peer port. */ |
123 void setPeer(Port *port); 124 |
125 /** Function to get the pointer to the peer port. */ |
126 Port *getPeer() { return peer; } 127 |
128 /** Function to set the owner of this port. */ 129 void setOwner(MemObject *_owner) { owner = _owner; } 130 131 /** Function to return the owner of this port. */ 132 MemObject *getOwner() { return owner; } 133 |
134 protected: 135 136 /** These functions are protected because they should only be 137 * called by a peer port, never directly by any outside object. */ 138 139 /** Called to recive a timing call from the peer port. */ 140 virtual bool recvTiming(PacketPtr pkt) = 0; 141 --- 109 unchanged lines hidden (view full) --- 251/** A simple functional port that is only meant for one way communication to 252 * physical memory. It is only meant to be used to load data into memory before 253 * the simulation begins. 254 */ 255 256class FunctionalPort : public Port 257{ 258 public: |
259 FunctionalPort(const std::string &_name, MemObject *_owner = NULL) 260 : Port(_name, _owner) |
261 {} 262 263 protected: 264 virtual bool recvTiming(PacketPtr pkt) { panic("FuncPort is UniDir"); } 265 virtual Tick recvAtomic(PacketPtr pkt) { panic("FuncPort is UniDir"); } 266 virtual void recvFunctional(PacketPtr pkt) { panic("FuncPort is UniDir"); } 267 virtual void recvStatusChange(Status status) {} 268 --- 25 unchanged lines hidden --- |