48 #define MAX(a,b) ((a > b) ? (a) : (b))
55 bool more_records =
true;
65 p.baseline_fault_vector_database[
i +
78 int record_temperature =
82 static int first_record =
true;
84 for (
int temperature = 0; temperature < record_temperature;
92 if (
p.temperature_weights_database[
i +
103 return "data_corruption__few_bits";
105 return "data_corruption__all_bits";
107 return "flit_conservation__flit_duplication";
109 return "flit_conservation__flit_loss_or_split";
113 return "credit_conservation__credit_generation";
115 return "credit_conservation__credit_loss";
117 return "erroneous_allocation__VC";
119 return "erroneous_allocation__switch";
121 return "unfair_arbitration";
132 int number_of_outputs,
133 int number_of_vcs_per_input,
134 int number_of_buff_per_data_vc,
135 int number_of_buff_per_ctrl_vc)
138 if (number_of_inputs <= 0 || number_of_outputs <= 0 ||
139 number_of_vcs_per_input <= 0 || number_of_buff_per_data_vc <= 0 ||
140 number_of_buff_per_ctrl_vc <= 0){
141 fatal(
"Fault Model: ERROR in argument of FaultModel_declare_router!");
143 int number_of_buffers_per_vc =
MAX(number_of_buff_per_data_vc,
144 number_of_buff_per_ctrl_vc);
145 int total_vcs = number_of_inputs * number_of_vcs_per_input;
147 fatal(
"Fault Model: ERROR! Number inputs*VCs (MAX_VCs) unsupported");
150 fatal(
"Fault Model: ERROR! buffers/VC (MAX_BUFFERS_per_VC) too high");
156 if ((
configurations[record].buff_per_vc == number_of_buffers_per_vc)&&
161 if (record_hit == -1){
162 panic(
"Fault Model: ERROR! configuration not found in DB. BUG?");
167 static int router_index = 0;
168 return router_index++;
173 int temperature_input,
174 float fault_vector[])
179 if (routerID < 0 || routerID >= ((
int)
routers.size())){
180 warn(
"Fault Model: ERROR! unknown router ID argument.");
181 fatal(
"Fault Model: Did you enable the fault model flag)?");
185 int temperature = temperature_input;
188 warn_once(
"Fault Model: Temperature exceeded simulated upper bound.");
189 warn_once(
"Fault Model: The fault model is not accurate any more.");
191 }
else if (temperature_input < 0){
193 warn_once(
"Fault Model: Temperature exceeded simulated lower bound.");
194 warn_once(
"Fault Model: The fault model is not accurate any more.");
208 int temperature_input,
209 float *aggregate_fault_prob)
211 *aggregate_fault_prob = 1.0;
215 if (routerID < 0 || routerID >= ((
int)
routers.size())){
216 warn(
"Fault Model: ERROR! unknown router ID argument.");
217 fatal(
"Fault Model: Did you enable the fault model flag)?");
221 int temperature = temperature_input;
224 warn_once(
"Fault Model: Temperature exceeded simulated upper bound.");
225 warn_once(
"Fault Model: The fault model is not accurate any more.");
227 }
else if (temperature_input < 0){
229 warn_once(
"Fault Model: Temperature exceeded simulated lower bound.");
230 warn_once(
"Fault Model: The fault model is not accurate any more.");
236 *aggregate_fault_prob= *aggregate_fault_prob *
237 ( 1.0 - (
routers[routerID].fault_type[
i] *
240 *aggregate_fault_prob = 1.0 - *aggregate_fault_prob;
248 std::cout <<
"--- PRINTING configurations ---\n";
250 std::cout <<
"(" << record <<
") ";
252 std::cout <<
"Buff/VC=" <<
configurations[record].buff_per_vc <<
" [";
253 for (
int fault_type_num = 0;
262 std::cout <<
"--- PRINTING temperature weights ---\n";
264 std::cout <<
"temperature=" << record <<
" => ";