48#define MAX(a,b) ((a > b) ? (a) : (b))
60 bool more_records =
true;
70 p.baseline_fault_vector_database[
i +
83 int record_temperature =
87 static int first_record =
true;
89 for (
int temperature = 0; temperature < record_temperature;
97 if (
p.temperature_weights_database[
i +
108 return "data_corruption__few_bits";
110 return "data_corruption__all_bits";
112 return "flit_conservation__flit_duplication";
114 return "flit_conservation__flit_loss_or_split";
118 return "credit_conservation__credit_generation";
120 return "credit_conservation__credit_loss";
122 return "erroneous_allocation__VC";
124 return "erroneous_allocation__switch";
126 return "unfair_arbitration";
137 int number_of_outputs,
138 int number_of_vcs_per_input,
139 int number_of_buff_per_data_vc,
140 int number_of_buff_per_ctrl_vc)
143 if (number_of_inputs <= 0 || number_of_outputs <= 0 ||
144 number_of_vcs_per_input <= 0 || number_of_buff_per_data_vc <= 0 ||
145 number_of_buff_per_ctrl_vc <= 0){
146 fatal(
"Fault Model: ERROR in argument of FaultModel_declare_router!");
148 int number_of_buffers_per_vc =
MAX(number_of_buff_per_data_vc,
149 number_of_buff_per_ctrl_vc);
150 int total_vcs = number_of_inputs * number_of_vcs_per_input;
152 fatal(
"Fault Model: ERROR! Number inputs*VCs (MAX_VCs) unsupported");
155 fatal(
"Fault Model: ERROR! buffers/VC (MAX_BUFFERS_per_VC) too high");
161 if ((
configurations[record].buff_per_vc == number_of_buffers_per_vc)&&
166 if (record_hit == -1){
167 panic(
"Fault Model: ERROR! configuration not found in DB. BUG?");
172 static int router_index = 0;
173 return router_index++;
178 int temperature_input,
179 float fault_vector[])
184 if (routerID < 0 || routerID >= ((
int)
routers.size())){
185 warn(
"Fault Model: ERROR! unknown router ID argument.");
186 fatal(
"Fault Model: Did you enable the fault model flag)?");
190 int temperature = temperature_input;
193 warn_once(
"Fault Model: Temperature exceeded simulated upper bound.");
194 warn_once(
"Fault Model: The fault model is not accurate any more.");
196 }
else if (temperature_input < 0){
198 warn_once(
"Fault Model: Temperature exceeded simulated lower bound.");
199 warn_once(
"Fault Model: The fault model is not accurate any more.");
213 int temperature_input,
214 float *aggregate_fault_prob)
216 *aggregate_fault_prob = 1.0;
220 if (routerID < 0 || routerID >= ((
int)
routers.size())){
221 warn(
"Fault Model: ERROR! unknown router ID argument.");
222 fatal(
"Fault Model: Did you enable the fault model flag)?");
226 int temperature = temperature_input;
229 warn_once(
"Fault Model: Temperature exceeded simulated upper bound.");
230 warn_once(
"Fault Model: The fault model is not accurate any more.");
232 }
else if (temperature_input < 0){
234 warn_once(
"Fault Model: Temperature exceeded simulated lower bound.");
235 warn_once(
"Fault Model: The fault model is not accurate any more.");
241 *aggregate_fault_prob= *aggregate_fault_prob *
242 ( 1.0 - (
routers[routerID].fault_type[
i] *
245 *aggregate_fault_prob = 1.0 - *aggregate_fault_prob;
253 std::cout <<
"--- PRINTING configurations ---\n";
255 std::cout <<
"(" << record <<
") ";
257 std::cout <<
"Buff/VC=" <<
configurations[record].buff_per_vc <<
" [";
258 for (
int fault_type_num = 0;
267 std::cout <<
"--- PRINTING temperature weights ---\n";
269 std::cout <<
"temperature=" << record <<
" => ";
#define MAX_BUFFERS_per_VC
Abstract superclass for simulation objects.
std::vector< system_conf > routers
std::string fault_type_to_string(int fault_type_index)
@ erroneous_allocation__switch
@ credit_conservation__credit_loss
@ flit_conservation__flit_loss_or_split
@ credit_conservation__credit_generation
@ erroneous_allocation__VC
@ data_corruption__all_bits
@ flit_conservation__flit_duplication
@ data_corruption__few_bits
std::vector< int > temperature_weights
bool fault_prob(int routerID, int temperature, float *aggregate_fault_prob)
@ conf_record_buff_per_vc
@ conf_record_first_fault_type
@ temperature_record_temp
@ temperature_record_weight
@ fields_per_temperature_record
FaultModel(const Params &p)
int declare_router(int number_of_inputs, int number_of_outputs, int number_of_vcs_per_vnet, int number_of_buff_per_data_vc, int number_of_buff_per_ctrl_vc)
std::vector< system_conf > configurations
bool fault_vector(int routerID, int temperature, float fault_vector[])
#define panic(...)
This implements a cprintf based panic() function.
#define fatal(...)
This implements a cprintf based fatal() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
float fault_type[number_of_fault_types]