50 #define MAX(a,b) ((a > b) ? (a) : (b))
57 bool more_records =
true;
67 p->baseline_fault_vector_database[
i +
80 int record_temperature =
84 static int first_record =
true;
86 for (
int temperature = 0; temperature < record_temperature;
94 if (
p->temperature_weights_database[
i +
105 return "data_corruption__few_bits";
107 return "data_corruption__all_bits";
109 return "flit_conservation__flit_duplication";
111 return "flit_conservation__flit_loss_or_split";
115 return "credit_conservation__credit_generation";
117 return "credit_conservation__credit_loss";
119 return "erroneous_allocation__VC";
121 return "erroneous_allocation__switch";
123 return "unfair_arbitration";
134 int number_of_outputs,
135 int number_of_vcs_per_input,
136 int number_of_buff_per_data_vc,
137 int number_of_buff_per_ctrl_vc)
140 if (number_of_inputs <= 0 || number_of_outputs <= 0 ||
141 number_of_vcs_per_input <= 0 || number_of_buff_per_data_vc <= 0 ||
142 number_of_buff_per_ctrl_vc <= 0){
143 fatal(
"Fault Model: ERROR in argument of FaultModel_declare_router!");
145 int number_of_buffers_per_vc =
MAX(number_of_buff_per_data_vc,
146 number_of_buff_per_ctrl_vc);
147 int total_vcs = number_of_inputs * number_of_vcs_per_input;
149 fatal(
"Fault Model: ERROR! Number inputs*VCs (MAX_VCs) unsupported");
152 fatal(
"Fault Model: ERROR! buffers/VC (MAX_BUFFERS_per_VC) too high");
158 if ((
configurations[record].buff_per_vc == number_of_buffers_per_vc)&&
163 if (record_hit == -1){
164 panic(
"Fault Model: ERROR! configuration not found in DB. BUG?");
169 static int router_index = 0;
170 return router_index++;
175 int temperature_input,
176 float fault_vector[])
181 if (routerID < 0 || routerID >= ((
int)
routers.size())){
182 warn(
"Fault Model: ERROR! unknown router ID argument.");
183 fatal(
"Fault Model: Did you enable the fault model flag)?");
187 int temperature = temperature_input;
190 warn_once(
"Fault Model: Temperature exceeded simulated upper bound.");
191 warn_once(
"Fault Model: The fault model is not accurate any more.");
193 }
else if (temperature_input < 0){
195 warn_once(
"Fault Model: Temperature exceeded simulated lower bound.");
196 warn_once(
"Fault Model: The fault model is not accurate any more.");
210 int temperature_input,
211 float *aggregate_fault_prob)
213 *aggregate_fault_prob = 1.0;
217 if (routerID < 0 || routerID >= ((
int)
routers.size())){
218 warn(
"Fault Model: ERROR! unknown router ID argument.");
219 fatal(
"Fault Model: Did you enable the fault model flag)?");
223 int temperature = temperature_input;
226 warn_once(
"Fault Model: Temperature exceeded simulated upper bound.");
227 warn_once(
"Fault Model: The fault model is not accurate any more.");
229 }
else if (temperature_input < 0){
231 warn_once(
"Fault Model: Temperature exceeded simulated lower bound.");
232 warn_once(
"Fault Model: The fault model is not accurate any more.");
238 *aggregate_fault_prob= *aggregate_fault_prob *
239 ( 1.0 - (
routers[routerID].fault_type[
i] *
242 *aggregate_fault_prob = 1.0 - *aggregate_fault_prob;
250 cout <<
"--- PRINTING configurations ---\n";
252 cout <<
"(" << record <<
") ";
255 for (
int fault_type_num = 0;
258 cout << (100 *
configurations[record].fault_type[fault_type_num]);
263 cout <<
"--- PRINTING temperature weights ---\n";
265 cout <<
"temperature=" << record <<
" => ";
272 FaultModelParams::create()