00001
00002 #ifndef __INTERCONNECT_SLAVE_HH__
00003 #define __INTERCONNECT_SLAVE_HH__
00004
00005 #include <iostream>
00006
00007 #include "base/range.hh"
00008 #include "targetarch/isa_traits.hh"
00009 #include "mem/bus/base_interface.hh"
00010
00011 #include "interconnect_interface.hh"
00012 #include "interconnect.hh"
00013
00014 class Interconnect;
00015
00026 template <class MemType>
00027 class InterconnectSlave : public InterconnectInterface
00028 {
00029 private:
00030
00037 class InterconnectResponse{
00038
00039 public:
00040 MemReqPtr req;
00041 Tick time;
00042
00053 InterconnectResponse(MemReqPtr &_req, Tick _time)
00054 {
00055 req = _req;
00056 time = _time;
00057 }
00058 };
00059
00060 MemType* thisCache;
00061
00062 std::vector<InterconnectResponse* > responseQueue;
00063
00064 public:
00074 InterconnectSlave(const std::string &name,
00075 Interconnect* interconnect,
00076 MemType* cache,
00077 HierParams *hier);
00078
00086 MemAccessResult access(MemReqPtr &req);
00087
00094 void request(Tick time){
00095 fatal("InterconnectSlave request(Tick time) not implemented");
00096 }
00097
00098
00109 void respond(MemReqPtr &req, Tick time);
00110
00116 bool grantData();
00117
00124 void deliver(MemReqPtr &req){
00125 fatal("InterconnectSlave deliver() not implemented");
00126 }
00127
00133 bool isMaster(){
00134 return false;
00135 }
00136
00143 std::pair<Addr, int> getTargetAddr(){
00144 fatal("getTargetAddr() not valid for slave interfaces");
00145 return std::pair<Addr, int>(-42,-42);
00146 }
00147
00155 int getTargetId(){
00156 assert(!responseQueue.empty());
00157 return responseQueue.front()->req->fromInterfaceID;
00158 }
00159
00165 std::string getCacheName(){
00166 return thisCache->name();
00167 }
00168
00184 virtual bool inRange(Addr addr);
00185
00186
00187
00188
00189
00190
00191
00192
00193 };
00194
00195 #endif // __INTERCONNECT_SLAVE_HH__