X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmem%2Fbus.hh;h=705a3a999cd2a9d6df943b49cd8abd717a4db14d;hb=8573a69d8f7bf7b3f074e3e0ac64994801c551be;hp=849bef639cbe9e4d8476b4ce0b5f73b924e712cd;hpb=36d199b9a96838359230f1ae8a40446e05296145;p=gem5.git diff --git a/src/mem/bus.hh b/src/mem/bus.hh index 849bef639..705a3a999 100644 --- a/src/mem/bus.hh +++ b/src/mem/bus.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2012 ARM Limited + * Copyright (c) 2011-2013 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -51,7 +51,7 @@ #ifndef __MEM_BUS_HH__ #define __MEM_BUS_HH__ -#include +#include #include #include "base/addr_range_map.hh" @@ -94,7 +94,7 @@ class BaseBus : public MemObject * whereas a response layer holds master ports. */ template - class Layer + class Layer : public Drainable { public: @@ -105,9 +105,8 @@ class BaseBus : public MemObject * * @param _bus the bus this layer belongs to * @param _name the layer's name - * @param _clock clock period in ticks */ - Layer(BaseBus& _bus, const std::string& _name, Tick _clock); + Layer(BaseBus& _bus, const std::string& _name); /** * Drain according to the normal semantics, so that the bus @@ -118,7 +117,7 @@ class BaseBus : public MemObject * * @return 1 if busy or waiting to retry, or 0 if idle */ - unsigned int drain(Event *de); + unsigned int drain(DrainManager *dm); /** * Get the bus layer's name @@ -203,17 +202,14 @@ class BaseBus : public MemObject /** track the state of the bus layer */ State state; - /** the clock speed for the bus layer */ - Tick clock; - - /** event for signalling when drained */ - Event * drainEvent; + /** manager to signal when drained */ + DrainManager *drainManager; /** * An array of ports that retry should be called * on because the original send failed for whatever reason. */ - std::list retryList; + std::deque retryList; /** * Release the bus layer after being occupied and return to an @@ -236,6 +232,9 @@ class BaseBus : public MemObject typedef AddrRangeMap::const_iterator PortMapConstIter; AddrRangeMap portMap; + /** all contigous ranges seen by this bus */ + AddrRangeList busRanges; + AddrRange defaultRange; /** @@ -264,13 +263,13 @@ class BaseBus : public MemObject // Checks the cache and returns the id of the port that has the requested // address within its range inline PortID checkPortCache(Addr addr) const { - if (portCache[0].valid && portCache[0].range == addr) { + if (portCache[0].valid && portCache[0].range.contains(addr)) { return portCache[0].id; } - if (portCache[1].valid && portCache[1].range == addr) { + if (portCache[1].valid && portCache[1].range.contains(addr)) { return portCache[1].id; } - if (portCache[2].valid && portCache[2].range == addr) { + if (portCache[2].valid && portCache[2].range.contains(addr)) { return portCache[2].id; } @@ -306,12 +305,13 @@ class BaseBus : public MemObject */ AddrRangeList getAddrRanges() const; - /** Calculate the timing parameters for the packet. Updates the - * firstWordTime and finishTime fields of the packet object. - * Returns the tick at which the packet header is completed (which - * will be all that is sent if the target rejects the packet). + /** + * Calculate the timing parameters for the packet. Updates the + * busFirstWordDelay and busLastWordDelay fields of the packet + * object with the relative number of ticks required to transmit + * the header and the first word, and the last word, respectively. */ - Tick calcPacketTiming(PacketPtr pkt); + void calcPacketTiming(PacketPtr pkt); /** * Ask everyone on the bus what their size is and determine the @@ -361,10 +361,12 @@ class BaseBus : public MemObject virtual void init(); /** A function used to return the port associated with this bus object. */ - virtual MasterPort& getMasterPort(const std::string& if_name, int idx = -1); - virtual SlavePort& getSlavePort(const std::string& if_name, int idx = -1); + BaseMasterPort& getMasterPort(const std::string& if_name, + PortID idx = InvalidPortID); + BaseSlavePort& getSlavePort(const std::string& if_name, + PortID idx = InvalidPortID); - virtual unsigned int drain(Event *de) = 0; + virtual unsigned int drain(DrainManager *dm) = 0; };