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>
This commit is contained in:
Yu-hsin Wang
2022-10-21 11:53:12 +08:00
parent 144ce7f12c
commit 80c3bd3bdf
2 changed files with 19 additions and 0 deletions

View File

@@ -214,6 +214,10 @@ MemCmd::commandInfo[] =
{ {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 */

View File

@@ -133,6 +133,8 @@ class MemCmd
// 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 @@ class Packet : public Printable
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; }