diff options
Diffstat (limited to 'src/mem/bus.hh')
-rw-r--r-- | src/mem/bus.hh | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/mem/bus.hh b/src/mem/bus.hh index 079d6a08d..fc240a22b 100644 --- a/src/mem/bus.hh +++ b/src/mem/bus.hh @@ -93,7 +93,7 @@ class BaseBus : public MemObject * a request layer has a retry list containing slave ports, * whereas a response layer holds master ports. */ - template <typename PortClass> + template <typename SrcType, typename DstType> class Layer : public Drainable { @@ -103,11 +103,11 @@ class BaseBus : public MemObject * Create a bus layer and give it a name. The bus layer uses * the bus an event manager. * + * @param _port destination port the layer converges at * @param _bus the bus this layer belongs to * @param _name the layer's name - * @param num_dest_ports number of destination ports */ - Layer(BaseBus& _bus, const std::string& _name, uint16_t num_dest_ports); + Layer(DstType& _port, BaseBus& _bus, const std::string& _name); /** * Drain according to the normal semantics, so that the bus @@ -133,11 +133,10 @@ class BaseBus : public MemObject * updated accordingly. * * @param port Source port presenting the packet - * @param dest_port_id Destination port id * * @return True if the bus layer accepts the packet */ - bool tryTiming(PortClass* port, PortID dest_port_id); + bool tryTiming(SrcType* src_port); /** * Deal with a destination port accepting a packet by potentially @@ -155,11 +154,9 @@ class BaseBus : public MemObject * accordingly. * * @param src_port Source port - * @param dest_port_id Destination port id * @param busy_time Time to spend as a result of a failed send */ - void failedTiming(PortClass* src_port, PortID dest_port_id, - Tick busy_time); + void failedTiming(SrcType* src_port, Tick busy_time); /** Occupy the bus layer until until */ void occupyLayer(Tick until); @@ -174,10 +171,8 @@ class BaseBus : public MemObject * Handle a retry from a neighbouring module. This wraps * retryWaiting by verifying that there are ports waiting * before calling retryWaiting. - * - * @param port_id Id of the port that received the retry */ - void recvRetry(PortID port_id); + void recvRetry(); /** * Register stats for the layer @@ -186,6 +181,9 @@ class BaseBus : public MemObject private: + /** The destination port this layer converges at. */ + DstType& port; + /** The bus this layer is a part of. */ BaseBus& bus; @@ -220,7 +218,7 @@ class BaseBus : public MemObject * A deque of ports that retry should be called on because * the original send was delayed due to a busy layer. */ - std::deque<PortClass*> waitingForLayer; + std::deque<SrcType*> waitingForLayer; /** * Port that we are currently in the process of telling to @@ -228,18 +226,13 @@ class BaseBus : public MemObject * transaction. This is a valid port when in the retry state, * and NULL when in busy or idle. */ - PortClass* retryingPort; + SrcType* retryingPort; /** - * A vector that tracks who is waiting for the retry when - * receiving it from a peer. The vector indices are port ids - * of the outgoing ports for the specific layer. The values - * are the incoming ports that tried to forward something to - * the outgoing port, but was told to wait and is now waiting - * for a retry. If no port is waiting NULL is stored on the - * location in question. + * Track who is waiting for the retry when receiving it from a + * peer. If no port is waiting NULL is stored. */ - std::vector<PortClass*> waitingForPeer; + SrcType* waitingForPeer; /** * Release the bus layer after being occupied and return to an |