summaryrefslogtreecommitdiff
path: root/src/cpu/testers
diff options
context:
space:
mode:
authorSascha Bischoff <sascha.bischoff@arm.com>2013-05-30 12:54:07 -0400
committerSascha Bischoff <sascha.bischoff@arm.com>2013-05-30 12:54:07 -0400
commit04ccc79134d7752b97a36cb922d56c9d450983f9 (patch)
tree3594e546bdeec2cf809321fe24d72d44e58ff6bf /src/cpu/testers
parentfc09bc8678b5e78d553e009105c58e5c5d5befb4 (diff)
downloadgem5-04ccc79134d7752b97a36cb922d56c9d450983f9.tar.xz
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 (limited to 'src/cpu/testers')
-rw-r--r--src/cpu/testers/traffic_gen/traffic_gen.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cpu/testers/traffic_gen/traffic_gen.cc b/src/cpu/testers/traffic_gen/traffic_gen.cc
index f5835f8f4..cb2e6e7bb 100644
--- a/src/cpu/testers/traffic_gen/traffic_gen.cc
+++ b/src/cpu/testers/traffic_gen/traffic_gen.cc
@@ -315,9 +315,9 @@ TrafficGen::parseConfig()
}
// 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 @@ TrafficGen::parseConfig()
// 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];
}