Skip to content
Browse files

cpu: Don't count data if send failed in TrafficGen

Use the return value of send() to determine if a memory request was
unsuccessful. In that case, don't update the dataManipulated counter
(used to stop generating requests after a fixed amount of data has
been touched) and don't advance the linear generator to the next
address.
  • Loading branch information...
1 parent 12f912f commit 700092c8c535d200bde5c73a1fd145fc159fcd01 @andysan committed
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/cpu/testers/traffic_gen/traffic_gen.cc
View
20 src/cpu/testers/traffic_gen/traffic_gen.cc
@@ -427,13 +427,13 @@ TrafficGen::StateGraph::LinearGen::execute()
DPRINTF(TrafficGen, "LinearGen::execute: %c to addr %x, size %d\n",
isRead ? 'r' : 'w', nextAddr, blocksize);
- send(nextAddr, blocksize, isRead ? MemCmd::ReadReq : MemCmd::WriteReq);
+ if (send(nextAddr, blocksize, isRead ? MemCmd::ReadReq : MemCmd::WriteReq)) {
+ // increment the address
+ nextAddr += blocksize;
- // increment the address
- nextAddr += blocksize;
-
- // Add the amount of data manipulated to the total
- dataManipulated += blocksize;
+ // Add the amount of data manipulated to the total
+ dataManipulated += blocksize;
+ }
}
Tick
@@ -495,10 +495,10 @@ TrafficGen::StateGraph::RandomGen::execute()
isRead ? 'r' : 'w', addr, blocksize);
// send a new request packet
- send(addr, blocksize, isRead ? MemCmd::ReadReq : MemCmd::WriteReq);
-
- // Add the amount of data manipulated to the total
- dataManipulated += blocksize;
+ if (send(addr, blocksize, isRead ? MemCmd::ReadReq : MemCmd::WriteReq)) {
+ // Add the amount of data manipulated to the total
+ dataManipulated += blocksize;
+ }
}
Tick

0 comments on commit 700092c

Please sign in to comment.
Something went wrong with that request. Please try again.