traffic_gen.cc (9720:090935b1b797) | traffic_gen.cc (9721:dd486672c9d0) |
---|---|
1/* 2 * Copyright (c) 2012-2013 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 301 unchanged lines hidden (view full) --- 310 is >> currState; 311 312 DPRINTF(TrafficGen, "Initial state: %d\n", currState); 313 } 314 } 315 } 316 317 // resize and populate state transition matrix | 1/* 2 * Copyright (c) 2012-2013 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 301 unchanged lines hidden (view full) --- 310 is >> currState; 311 312 DPRINTF(TrafficGen, "Initial state: %d\n", currState); 313 } 314 } 315 } 316 317 // resize and populate state transition matrix |
318 transitionMatrix.resize(transitions.size()); 319 for (size_t i = 0; i < transitions.size(); i++) { 320 transitionMatrix[i].resize(transitions.size()); | 318 transitionMatrix.resize(states.size()); 319 for (size_t i = 0; i < states.size(); i++) { 320 transitionMatrix[i].resize(states.size()); |
321 } 322 323 for (vector<Transition>::iterator t = transitions.begin(); 324 t != transitions.end(); ++t) { 325 transitionMatrix[t->from][t->to] = t->p; 326 } 327 328 // ensure the egress edges do not have a probability larger than 329 // one | 321 } 322 323 for (vector<Transition>::iterator t = transitions.begin(); 324 t != transitions.end(); ++t) { 325 transitionMatrix[t->from][t->to] = t->p; 326 } 327 328 // ensure the egress edges do not have a probability larger than 329 // one |
330 for (size_t i = 0; i < transitions.size(); i++) { | 330 for (size_t i = 0; i < states.size(); i++) { |
331 double sum = 0; | 331 double sum = 0; |
332 for (size_t j = 0; j < transitions.size(); j++) { | 332 for (size_t j = 0; j < states.size(); j++) { |
333 sum += transitionMatrix[i][j]; 334 } 335 336 // avoid comparing floating point numbers 337 if (abs(sum - 1.0) > 0.001) 338 fatal("%s has transition probability != 1 for state %d\n", 339 name(), i); 340 } --- 99 unchanged lines hidden --- | 333 sum += transitionMatrix[i][j]; 334 } 335 336 // avoid comparing floating point numbers 337 if (abs(sum - 1.0) > 0.001) 338 fatal("%s has transition probability != 1 for state %d\n", 339 name(), i); 340 } --- 99 unchanged lines hidden --- |