Hello Nikos Nikoleris,

I'd like you to do a code review. Please visit

    https://gem5-review.googlesource.com/11517

to review the following change.


Change subject: cpu: Support trace termination in BaseTrafficGen
......................................................................

cpu: Support trace termination in BaseTrafficGen

Make the BaseTrafficGen handle cases where getNextPacket() can't find
a new packet and returns NULL. In that case, assume the generator has
run out of packets and switch to the next generator.

Change-Id: I5ca6ead550005812fb849ed9ce6b5007a65ddfa7
Signed-off-by: Andreas Sandberg <[email protected]>
Reviewed-by: Nikos Nikoleris <[email protected]>
---
M src/cpu/testers/traffic_gen/base.cc
1 file changed, 12 insertions(+), 4 deletions(-)



diff --git a/src/cpu/testers/traffic_gen/base.cc b/src/cpu/testers/traffic_gen/base.cc
index 95878f0..fe25778 100644
--- a/src/cpu/testers/traffic_gen/base.cc
+++ b/src/cpu/testers/traffic_gen/base.cc
@@ -169,13 +169,13 @@

         // suppress packets that are not destined for a memory, such as
         // device accesses that could be part of a trace
-        if (system->isMemAddr(pkt->getAddr())) {
+        if (pkt && system->isMemAddr(pkt->getAddr())) {
             numPackets++;
             if (!port.sendTimingReq(pkt)) {
                 retryPkt = pkt;
                 retryPktTick = curTick();
             }
-        } else {
+        } else if (pkt) {
             DPRINTF(TrafficGen, "Suppressed packet %s 0x%x\n",
                     pkt->cmdString(), pkt->getAddr());

@@ -229,11 +229,19 @@
 void
 BaseTrafficGen::scheduleUpdate()
 {
+    // Has the generator run out of work? In that case, force a
+    // transition if a transition period hasn't been configured.
+    while (activeGenerator &&
+           nextPacketTick == MaxTick && nextTransitionTick == MaxTick) {
+        transition();
+    }
+
+    if (!activeGenerator)
+        return;
+
     // schedule next update event based on either the next execute
     // tick or the next transition, which ever comes first
const Tick nextEventTick = std::min(nextPacketTick, nextTransitionTick);
-    if (nextEventTick == MaxTick)
-        return;

     DPRINTF(TrafficGen, "Next event scheduled at %lld\n", nextEventTick);


--
To view, visit https://gem5-review.googlesource.com/11517
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I5ca6ead550005812fb849ed9ce6b5007a65ddfa7
Gerrit-Change-Number: 11517
Gerrit-PatchSet: 1
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to