diff options
author | Curtis Dunham <Curtis.Dunham@arm.com> | 2014-05-13 12:20:48 -0500 |
---|---|---|
committer | Curtis Dunham <Curtis.Dunham@arm.com> | 2014-05-13 12:20:48 -0500 |
commit | e3b19cb294c98466a431950888045c6b5d24b675 (patch) | |
tree | 781bcf5ea9fdce45a5747a4d5ef74485ee5e0727 /src/cpu/simple | |
parent | afbae1ec95e94b6da441a0269dbd9359a7069e3d (diff) | |
download | gem5-e3b19cb294c98466a431950888045c6b5d24b675.tar.xz |
mem: Refactor assignment of Packet types
Put the packet type swizzling (that is currently done in a lot of places)
into a refineCommand() member function.
Diffstat (limited to 'src/cpu/simple')
-rw-r--r-- | src/cpu/simple/atomic.cc | 5 | ||||
-rw-r--r-- | src/cpu/simple/timing.cc | 15 |
2 files changed, 3 insertions, 17 deletions
diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc index f62f891f7..219e94043 100644 --- a/src/cpu/simple/atomic.cc +++ b/src/cpu/simple/atomic.cc @@ -340,9 +340,8 @@ AtomicSimpleCPU::readMem(Addr addr, uint8_t * data, // Now do the access. if (fault == NoFault && !req->getFlags().isSet(Request::NO_ACCESS)) { - Packet pkt = Packet(req, - req->isLLSC() ? MemCmd::LoadLockedReq : - MemCmd::ReadReq); + Packet pkt(req, MemCmd::ReadReq); + pkt.refineCommand(); pkt.dataStatic(data); if (req->isMmappedIpr()) diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc index 3b4f0e7d8..f572fc268 100644 --- a/src/cpu/simple/timing.cc +++ b/src/cpu/simple/timing.cc @@ -349,20 +349,7 @@ TimingSimpleCPU::translationFault(Fault fault) void TimingSimpleCPU::buildPacket(PacketPtr &pkt, RequestPtr req, bool read) { - MemCmd cmd; - if (read) { - cmd = MemCmd::ReadReq; - if (req->isLLSC()) - cmd = MemCmd::LoadLockedReq; - } else { - cmd = MemCmd::WriteReq; - if (req->isLLSC()) { - cmd = MemCmd::StoreCondReq; - } else if (req->isSwap()) { - cmd = MemCmd::SwapReq; - } - } - pkt = new Packet(req, cmd); + pkt = read ? Packet::createRead(req) : Packet::createWrite(req); } void |