From: Giacomo Travaglini Date: Wed, 27 Nov 2019 19:16:26 +0000 (+0000) Subject: mem: Add Request::isMasked to check for byte strobing X-Git-Tag: v19.0.0.0~218 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc26c0dd355f2bbaf2274dd4f549f11efcf84bba;p=gem5.git mem: Add Request::isMasked to check for byte strobing This is trying to overcome the following problem: At the moment a memory request with a non empty byteEnable mask will be considered masking even if all elements in the vector are true. Change-Id: I16ae2c0ea8c3f3370e397bab9d79d6d60c3784bd Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23284 Reviewed-by: Nikos Nikoleris Reviewed-by: Bobby R. Bruce Reviewed-by: Daniel Carvalho Maintainer: Nikos Nikoleris Tested-by: kokoro --- diff --git a/src/mem/packet.hh b/src/mem/packet.hh index 4aee81f9b..cf31fa53d 100644 --- a/src/mem/packet.hh +++ b/src/mem/packet.hh @@ -1305,7 +1305,7 @@ class Packet : public Printable bool isMaskedWrite() const { - return (cmd == MemCmd::WriteReq && !req->getByteEnable().empty()); + return (cmd == MemCmd::WriteReq && req->isMasked()); } /** diff --git a/src/mem/request.hh b/src/mem/request.hh index 90d1ee3dd..b3268e02e 100644 --- a/src/mem/request.hh +++ b/src/mem/request.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013,2017-2018 ARM Limited + * Copyright (c) 2012-2013,2017-2019 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -650,6 +650,20 @@ class Request _byteEnable = be; } + /** + * Returns true if the memory request is masked, which means + * there is at least one byteEnable element which is false + * (byte is masked) + */ + bool + isMasked() const + { + return std::find( + _byteEnable.begin(), + _byteEnable.end(), + false) != _byteEnable.end(); + } + /** Accessor for time. */ Tick time() const