mem: introduce bad command error to packet commands
The bad command is used to model a request is sent to target but the
target cannot make it. The bad command error is designed to model AXI
SLVERR.
Change-Id: I8142df36a5ed3e461493796266821a2b30a3415e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64872
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Earl Ou <shunhsingou@google.com>
diff --git a/src/mem/packet.cc b/src/mem/packet.cc
index 3cd1bb9..31dc330 100644
--- a/src/mem/packet.cc
+++ b/src/mem/packet.cc
@@ -214,6 +214,10 @@
{ {IsResponse, IsError}, InvalidCmd, "InvalidDestError" },
/* BadAddressError -- memory address invalid */
{ {IsResponse, IsError}, InvalidCmd, "BadAddressError" },
+ /* ReadError -- packet dest unable to fulfill read command */
+ { {IsRead, IsResponse, IsError}, InvalidCmd, "ReadError" },
+ /* WriteError -- packet dest unable to fulfill write command */
+ { {IsWrite, IsResponse, IsError}, InvalidCmd, "WriteError" },
/* FunctionalReadError */
{ {IsRead, IsResponse, IsError}, InvalidCmd, "FunctionalReadError" },
/* FunctionalWriteError */
diff --git a/src/mem/packet.hh b/src/mem/packet.hh
index 7d32634..9238dbe 100644
--- a/src/mem/packet.hh
+++ b/src/mem/packet.hh
@@ -133,6 +133,8 @@
// compatibility
InvalidDestError, // packet dest field invalid
BadAddressError, // memory address invalid
+ ReadError, // packet dest unable to fulfill read command
+ WriteError, // packet dest unable to fulfill write command
FunctionalReadError, // unable to fulfill functional read
FunctionalWriteError, // unable to fulfill functional write
// Fake simulator-only commands
@@ -785,6 +787,19 @@
cmd = MemCmd::BadAddressError;
}
+ // Command error conditions. The request is sent to target but the target
+ // cannot make it.
+ void
+ setBadCommand()
+ {
+ assert(isResponse());
+ if (isWrite()) {
+ cmd = MemCmd::WriteError;
+ } else {
+ cmd = MemCmd::ReadError;
+ }
+ }
+
void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; }
Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; }