port.hh (3349:fec4a86fa212) port.hh (3401:1df0cb879413)
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
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
61/**
62 * Ports are used to interface memory objects to
63 * each other. They will always come in pairs, and we refer to the other
64 * port object as the peer. These are used to make the design more
65 * modular so that a specific interface between every type of objcet doesn't
66 * have to be created.
67 *
68 * Recv accesor functions are being called from the peer interface.

--- 7 unchanged lines hidden (view full) ---

76 /** Descriptive name (for DPRINTF output) */
77 mutable std::string portName;
78
79 /** A pointer to the peer port. Ports always come in pairs, that way they
80 can use a standardized interface to communicate between different
81 memory objects. */
82 Port *peer;
83
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
84 public:
85
86 Port()
89 public:
90
91 Port()
87 : peer(NULL)
92 : peer(NULL), owner(NULL)
88 { }
89
90 /**
91 * Constructor.
92 *
93 * @param _name Port name for DPRINTF output. Should include name
94 * of memory system object to which the port belongs.
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.
95 */
102 */
96 Port(const std::string &_name)
97 : portName(_name), peer(NULL)
103 Port(const std::string &_name, MemObject *_owner = NULL)
104 : portName(_name), peer(NULL), owner(_owner)
98 { }
99
100 /** Return port name (for DPRINTF). */
101 const std::string &name() const { return portName; }
102
103 virtual ~Port() {};
104
105 // mey be better to use subclasses & RTTI?
106 /** Holds the ports status. Currently just that a range recomputation needs
107 * to be done. */
108 enum Status {
109 RangeChange
110 };
111
112 void setName(const std::string &name)
113 { portName = name; }
114
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
115 /** Function to set the pointer for the peer port.
116 @todo should be called by the configuration stuff (python).
117 */
122 /** Function to set the pointer for the peer port. */
118 void setPeer(Port *port);
119
123 void setPeer(Port *port);
124
120 /** Function to set the pointer for the peer port.
121 @todo should be called by the configuration stuff (python).
122 */
125 /** Function to get the pointer to the peer port. */
123 Port *getPeer() { return peer; }
124
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
125 protected:
126
127 /** These functions are protected because they should only be
128 * called by a peer port, never directly by any outside object. */
129
130 /** Called to recive a timing call from the peer port. */
131 virtual bool recvTiming(PacketPtr pkt) = 0;
132

--- 109 unchanged lines hidden (view full) ---

242/** A simple functional port that is only meant for one way communication to
243 * physical memory. It is only meant to be used to load data into memory before
244 * the simulation begins.
245 */
246
247class FunctionalPort : public Port
248{
249 public:
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:
250 FunctionalPort(const std::string &_name)
251 : Port(_name)
259 FunctionalPort(const std::string &_name, MemObject *_owner = NULL)
260 : Port(_name, _owner)
252 {}
253
254 protected:
255 virtual bool recvTiming(PacketPtr pkt) { panic("FuncPort is UniDir"); }
256 virtual Tick recvAtomic(PacketPtr pkt) { panic("FuncPort is UniDir"); }
257 virtual void recvFunctional(PacketPtr pkt) { panic("FuncPort is UniDir"); }
258 virtual void recvStatusChange(Status status) {}
259

--- 25 unchanged lines hidden ---
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 ---