Deleted Added
sdiff udiff text old ( 5494:85c8d296c1cb ) new ( 5605:b194a80157e2 )
full compact
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
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
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 */
74class Port
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:
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 */
100 Port(const std::string &_name, MemObject *_owner = NULL);
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. */
124 void setOwner(MemObject *_owner) { owner = _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 ---