From 5c84157c291dceb8040ab4dd29142a4d141fd2ed Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Tue, 2 Dec 2014 06:07:56 -0500 Subject: mem: Relax packet src/dest check and shift onus to crossbar This patch allows objects to get the src/dest of a packet even if it is not set to a valid port id. This simplifies (ab)using the bridge as a buffer and latency adapter in situations where the neighbouring MemObjects are not crossbars. The checks that were done in the packet are now shifted to the crossbar where the fields are used to index into the port arrays. Thus, the carrier of the information is not burdened with checking, and the crossbar can check not only that the destination is set, but also that the port index is within limits. --- src/mem/packet.hh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/mem/packet.hh') diff --git a/src/mem/packet.hh b/src/mem/packet.hh index dab1b1b95..9320d7886 100644 --- a/src/mem/packet.hh +++ b/src/mem/packet.hh @@ -544,15 +544,13 @@ class Packet : public Printable bool hadBadAddress() const { return cmd == MemCmd::BadAddressError; } void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; } - bool isSrcValid() const { return src != InvalidPortID; } /// Accessor function to get the source index of the packet. - PortID getSrc() const { assert(isSrcValid()); return src; } + PortID getSrc() const { return src; } /// Accessor function to set the source index of the packet. void setSrc(PortID _src) { src = _src; } - bool isDestValid() const { return dest != InvalidPortID; } /// Accessor function for the destination index of the packet. - PortID getDest() const { assert(isDestValid()); return dest; } + PortID getDest() const { return dest; } /// Accessor function to set the destination index of the packet. void setDest(PortID _dest) { dest = _dest; } /// Reset destination field, e.g. to turn a response into a request again. -- cgit v1.2.3