diff options
Diffstat (limited to 'mem/bus.hh')
-rw-r--r-- | mem/bus.hh | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/mem/bus.hh b/mem/bus.hh index e26065295..fad44aba5 100644 --- a/mem/bus.hh +++ b/mem/bus.hh @@ -45,6 +45,13 @@ class Bus : public MemObject { + struct DevMap { + int portId; + Range<Addr> range; + }; + std::vector<DevMap> portList; + + /** Function called by the port when the bus is recieving a Timing transaction.*/ bool recvTiming(Packet &pkt, int id); @@ -60,6 +67,16 @@ class Bus : public MemObject /** Function called by the port when the bus is recieving a status change.*/ void recvStatusChange(Port::Status status, int id); + /** Find which port connected to this bus (if any) should be given a packet + * with this address. + * @param addr Address to find port for. + * @param id Id of the port this packet was received from (to prevent + * loops) + * @return pointer to port that the packet should be sent out of. + */ + Port * + Bus::findPort(Addr addr, int id); + /** Decleration of the buses port type, one will be instantiated for each of the interfaces connecting to the bus. */ class BusPort : public Port @@ -103,26 +120,30 @@ class Bus : public MemObject // downstream from this bus, yes? That is, the union of all // the 'owned' address ranges of all the other interfaces on // this bus... - virtual void addressRanges(AddrRangeList &range_list, bool &owner); - }; + virtual void addressRanges(AddrRangeList &resp, AddrRangeList &snoop); + + // Hack to make translating port work without changes + virtual int deviceBlockSize() { return 32; } - /** A count of the number of interfaces connected to this bus. */ - int num_interfaces; + }; /** An array of pointers to the peer port interfaces connected to this bus.*/ - Port *interfaces[]; + std::vector<Port*> interfaces; public: /** A function used to return the port associated with this bus object. */ - virtual Port *getPort(const char *if_name) + virtual Port *getPort(const std::string &if_name) { // if_name ignored? forced to be empty? - int id = num_interfaces++; - interfaces[id] = new BusPort(this, id); - return interfaces[id]; + int id = interfaces.size(); + interfaces.push_back(new BusPort(this, id)); + return interfaces.back(); } + Bus(const std::string &n) + : MemObject(n) {} + }; #endif //__MEM_BUS_HH__ |