diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2015-01-22 05:00:53 -0500 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2015-01-22 05:00:53 -0500 |
commit | f49830ce0ba79c54c65c9c4b25bc3c6184aaf2a9 (patch) | |
tree | 00b2f9f0131ef65a411c9fd81339caecfc946b47 /src/cpu/testers | |
parent | be3a952394e1f337d1c372448ee099203336181a (diff) | |
download | gem5-f49830ce0ba79c54c65c9c4b25bc3c6184aaf2a9.tar.xz |
mem: Clean up Request initialisation
This patch tidies up how we create and set the fields of a Request. In
essence it tries to use the constructor where possible (as opposed to
setPhys and setVirt), thus avoiding spreading the information across a
number of locations. In fact, setPhys is made private as part of this
patch, and a number of places where we callede setVirt instead uses
the appropriate constructor.
Diffstat (limited to 'src/cpu/testers')
-rw-r--r-- | src/cpu/testers/memtest/memtest.cc | 6 | ||||
-rw-r--r-- | src/cpu/testers/networktest/networktest.cc | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/cpu/testers/memtest/memtest.cc b/src/cpu/testers/memtest/memtest.cc index 53c01b7f7..a94f6950d 100644 --- a/src/cpu/testers/memtest/memtest.cc +++ b/src/cpu/testers/memtest/memtest.cc @@ -300,16 +300,16 @@ MemTest::tick() bool do_functional = (random_mt.random(0, 100) < percentFunctional) && !uncacheable; - Request *req = new Request(); + Request *req = nullptr; uint8_t *result = new uint8_t[8]; if (issueDmas) { paddr &= ~((1 << dma_access_size) - 1); - req->setPhys(paddr, 1 << dma_access_size, flags, masterId); + req = new Request(paddr, 1 << dma_access_size, flags, masterId); req->setThreadContext(id,0); } else { paddr &= ~((1 << access_size) - 1); - req->setPhys(paddr, 1 << access_size, flags, masterId); + req = new Request(paddr, 1 << access_size, flags, masterId); req->setThreadContext(id,0); } assert(req->getSize() == 1); diff --git a/src/cpu/testers/networktest/networktest.cc b/src/cpu/testers/networktest/networktest.cc index 8ad32d140..4a79d5a17 100644 --- a/src/cpu/testers/networktest/networktest.cc +++ b/src/cpu/testers/networktest/networktest.cc @@ -198,9 +198,6 @@ NetworkTest::generatePkt() destination = dest_y*networkDimension + dest_x; } - Request *req = new Request(); - Request::Flags flags; - // The source of the packets is a cache. // The destination of the packets is a directory. // The destination bits are embedded in the address after byte-offset. @@ -234,21 +231,24 @@ NetworkTest::generatePkt() // MemCmd::Command requestType; + Request *req = nullptr; + Request::Flags flags; + unsigned randomReqType = random_mt.random(0, 2); if (randomReqType == 0) { // generate packet for virtual network 0 requestType = MemCmd::ReadReq; - req->setPhys(paddr, access_size, flags, masterId); + req = new Request(paddr, access_size, flags, masterId); } else if (randomReqType == 1) { // generate packet for virtual network 1 requestType = MemCmd::ReadReq; flags.set(Request::INST_FETCH); - req->setVirt(0, 0x0, access_size, flags, 0x0, masterId); + req = new Request(0, 0x0, access_size, flags, masterId, 0x0, 0, 0); req->setPaddr(paddr); } else { // if (randomReqType == 2) // generate packet for virtual network 2 requestType = MemCmd::WriteReq; - req->setPhys(paddr, access_size, flags, masterId); + req = new Request(paddr, access_size, flags, masterId); } req->setThreadContext(id,0); |