From ee0b52404c99cfed91a8d3fbebe3f42b0ac133df Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Wed, 11 Feb 2015 10:48:50 -0800 Subject: 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. --- src/cpu/minor/lsq.cc | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/cpu/minor') 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); -- cgit v1.2.3