changeset dd486672c9d0 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=dd486672c9d0
description:
        cpu: Fix bug when reading in TrafficGen state transitions

        This patch fixes a bug with the traffic generator which occured when
        reading in the state transitions from the configuration
        file. Previously, the size of the vector which stored the transitions
        was used to get the size of the transitions matrix, rather than using
        the number of states. Therefore, if there were more transitions than
        states, i.e. some transitions has a probability of less than 1, then
        the traffic generator would fatal when trying to check the
        transitions.

        This issue has been addressed by using the number of input states,
        rather then the number of transitions.

diffstat:

 src/cpu/testers/traffic_gen/traffic_gen.cc |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (28 lines):

diff -r 090935b1b797 -r dd486672c9d0 src/cpu/testers/traffic_gen/traffic_gen.cc
--- a/src/cpu/testers/traffic_gen/traffic_gen.cc        Thu May 30 12:54:06 
2013 -0400
+++ b/src/cpu/testers/traffic_gen/traffic_gen.cc        Thu May 30 12:54:07 
2013 -0400
@@ -315,9 +315,9 @@
     }
 
     // resize and populate state transition matrix
-    transitionMatrix.resize(transitions.size());
-    for (size_t i = 0; i < transitions.size(); i++) {
-        transitionMatrix[i].resize(transitions.size());
+    transitionMatrix.resize(states.size());
+    for (size_t i = 0; i < states.size(); i++) {
+        transitionMatrix[i].resize(states.size());
     }
 
     for (vector<Transition>::iterator t = transitions.begin();
@@ -327,9 +327,9 @@
 
     // ensure the egress edges do not have a probability larger than
     // one
-    for (size_t i = 0; i < transitions.size(); i++) {
+    for (size_t i = 0; i < states.size(); i++) {
         double sum = 0;
-        for (size_t j = 0; j < transitions.size(); j++) {
+        for (size_t j = 0; j < states.size(); j++) {
             sum += transitionMatrix[i][j];
         }
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to