port.hh (5494:85c8d296c1cb) port.hh (5605:b194a80157e2)
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;

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

42
43#include <list>
44#include <inttypes.h>
45
46#include "base/misc.hh"
47#include "base/range.hh"
48#include "mem/packet.hh"
49#include "mem/request.hh"
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;

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

42
43#include <list>
44#include <inttypes.h>
45
46#include "base/misc.hh"
47#include "base/range.hh"
48#include "mem/packet.hh"
49#include "mem/request.hh"
50#include "sim/eventq.hh"
50
51/** This typedef is used to clean up the parameter list of
52 * getDeviceAddressRanges() and getPeerAddressRanges(). It's declared
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
51
52/** This typedef is used to clean up the parameter list of
53 * getDeviceAddressRanges() and getPeerAddressRanges(). It's declared
54 * outside the Port object since it's also used by some mem objects.
55 * Eventually we should move this typedef to wherever Addr is
56 * defined.
57 */
58
59typedef std::list<Range<Addr> > AddrRangeList;
60typedef std::list<Range<Addr> >::iterator AddrRangeIter;
61
62class EventQueue;
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.
71 * Send accessor functions are being called from the device the port is
72 * associated with, and it will call the peer recv. accessor function.
73 */
63class MemObject;
64
65/**
66 * Ports are used to interface memory objects to
67 * each other. They will always come in pairs, and we refer to the other
68 * port object as the peer. These are used to make the design more
69 * modular so that a specific interface between every type of objcet doesn't
70 * have to be created.
71 *
72 * Recv accesor functions are being called from the peer interface.
73 * Send accessor functions are being called from the device the port is
74 * associated with, and it will call the peer recv. accessor function.
75 */
74class Port
76class Port : public EventManager
75{
76 protected:
77 /** Descriptive name (for DPRINTF output) */
78 mutable std::string portName;
79
80 /** A pointer to the peer port. Ports always come in pairs, that way they
81 can use a standardized interface to communicate between different
82 memory objects. */
83 Port *peer;
84
85 /** A pointer to the MemObject that owns this port. This may not be set. */
86 MemObject *owner;
87
88 public:
77{
78 protected:
79 /** Descriptive name (for DPRINTF output) */
80 mutable std::string portName;
81
82 /** A pointer to the peer port. Ports always come in pairs, that way they
83 can use a standardized interface to communicate between different
84 memory objects. */
85 Port *peer;
86
87 /** A pointer to the MemObject that owns this port. This may not be set. */
88 MemObject *owner;
89
90 public:
89
90 Port();
91
92 /**
93 * Constructor.
94 *
95 * @param _name Port name for DPRINTF output. Should include name
96 * of memory system object to which the port belongs.
97 * @param _owner Pointer to the MemObject that owns this port.
98 * Will not necessarily be set.
99 */
91 /**
92 * Constructor.
93 *
94 * @param _name Port name for DPRINTF output. Should include name
95 * of memory system object to which the port belongs.
96 * @param _owner Pointer to the MemObject that owns this port.
97 * Will not necessarily be set.
98 */
100 Port(const std::string &_name, MemObject *_owner = NULL);
99 Port(const std::string &_name, MemObject *_owner);
101
102 /** Return port name (for DPRINTF). */
103 const std::string &name() const { return portName; }
104
105 virtual ~Port();
106
107 // mey be better to use subclasses & RTTI?
108 /** Holds the ports status. Currently just that a range recomputation needs

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

116
117 /** Function to set the pointer for the peer port. */
118 virtual void setPeer(Port *port);
119
120 /** Function to get the pointer to the peer port. */
121 Port *getPeer() { return peer; }
122
123 /** Function to set the owner of this port. */
100
101 /** Return port name (for DPRINTF). */
102 const std::string &name() const { return portName; }
103
104 virtual ~Port();
105
106 // mey be better to use subclasses & RTTI?
107 /** Holds the ports status. Currently just that a range recomputation needs

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

115
116 /** Function to set the pointer for the peer port. */
117 virtual void setPeer(Port *port);
118
119 /** Function to get the pointer to the peer port. */
120 Port *getPeer() { return peer; }
121
122 /** Function to set the owner of this port. */
124 void setOwner(MemObject *_owner) { owner = _owner; }
123 void setOwner(MemObject *_owner);
125
126 /** Function to return the owner of this port. */
127 MemObject *getOwner() { return owner; }
128
129 /** Inform the peer port to delete itself and notify it's owner about it's
130 * demise. */
131 void removeConn();
132

--- 171 unchanged lines hidden ---
124
125 /** Function to return the owner of this port. */
126 MemObject *getOwner() { return owner; }
127
128 /** Inform the peer port to delete itself and notify it's owner about it's
129 * demise. */
130 void removeConn();
131

--- 171 unchanged lines hidden ---