summaryrefslogtreecommitdiff
path: root/src/cpu/minor/lsq.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2015-02-11 10:48:50 -0800
committerSteve Reinhardt <steve.reinhardt@amd.com>2015-02-11 10:48:50 -0800
commitee0b52404c99cfed91a8d3fbebe3f42b0ac133df (patch)
tree5c26f8de53e57903f80ed45e643b4abd3020040a /src/cpu/minor/lsq.cc
parentccef61d1ccaea43cf44aa45bee272475f0b10405 (diff)
downloadgem5-ee0b52404c99cfed91a8d3fbebe3f42b0ac133df.tar.xz
mem: restructure Packet cmd initialization a bit more
Refactor the way that specific MemCmd values are generated for packets. The new approach is a little more elegant in that we assign the right value up front, and it's also more amenable to non-heap-allocated Packet objects. Also replaced the code in the Minor model that was still doing it the ad-hoc way. This is basically a refinement of http://repo.gem5.org/gem5/rev/711eb0e64249.
Diffstat (limited to 'src/cpu/minor/lsq.cc')
-rw-r--r--src/cpu/minor/lsq.cc14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/cpu/minor/lsq.cc b/src/cpu/minor/lsq.cc
index 06b6c5165..ff609deac 100644
--- a/src/cpu/minor/lsq.cc
+++ b/src/cpu/minor/lsq.cc
@@ -1545,18 +1545,8 @@ PacketPtr
makePacketForRequest(Request &request, bool isLoad,
Packet::SenderState *sender_state, PacketDataPtr data)
{
- MemCmd command;
-
- /* Make a ret with the right command type to match the request */
- if (request.isLLSC()) {
- command = (isLoad ? MemCmd::LoadLockedReq : MemCmd::StoreCondReq);
- } else if (request.isSwap()) {
- command = MemCmd::SwapReq;
- } else {
- command = (isLoad ? MemCmd::ReadReq : MemCmd::WriteReq);
- }
-
- PacketPtr ret = new Packet(&request, command);
+ PacketPtr ret = isLoad ? Packet::createRead(&request)
+ : Packet::createWrite(&request);
if (sender_state)
ret->pushSenderState(sender_state);