52 #define MAX(a,b) ((a > b) ? (a) : (b))
59 bool more_records =
true;
69 p->baseline_fault_vector_database[
i +
82 int record_temperature =
86 static int first_record =
true;
88 for (
int temperature = 0; temperature < record_temperature;
96 if (p->temperature_weights_database[
i +
107 return "data_corruption__few_bits";
109 return "data_corruption__all_bits";
111 return "flit_conservation__flit_duplication";
113 return "flit_conservation__flit_loss_or_split";
117 return "credit_conservation__credit_generation";
119 return "credit_conservation__credit_loss";
121 return "erroneous_allocation__VC";
123 return "erroneous_allocation__switch";
125 return "unfair_arbitration";
136 int number_of_outputs,
137 int number_of_vcs_per_input,
138 int number_of_buff_per_data_vc,
139 int number_of_buff_per_ctrl_vc)
142 if (number_of_inputs <= 0 || number_of_outputs <= 0 ||
143 number_of_vcs_per_input <= 0 || number_of_buff_per_data_vc <= 0 ||
144 number_of_buff_per_ctrl_vc <= 0){
145 fatal(
"Fault Model: ERROR in argument of FaultModel_declare_router!");
147 int number_of_buffers_per_vc =
MAX(number_of_buff_per_data_vc,
148 number_of_buff_per_ctrl_vc);
149 int total_vcs = number_of_inputs * number_of_vcs_per_input;
151 fatal(
"Fault Model: ERROR! Number inputs*VCs (MAX_VCs) unsupported");
154 fatal(
"Fault Model: ERROR! buffers/VC (MAX_BUFFERS_per_VC) too high");
160 if ((
configurations[record].buff_per_vc == number_of_buffers_per_vc)&&
165 if (record_hit == -1){
166 panic(
"Fault Model: ERROR! configuration not found in DB. BUG?");
171 static int router_index = 0;
172 return router_index++;
177 int temperature_input,
178 float fault_vector[])
183 if (routerID < 0 || routerID >= ((
int)
routers.size())){
184 warn(
"Fault Model: ERROR! unknown router ID argument.");
185 fatal(
"Fault Model: Did you enable the fault model flag)?");
189 int temperature = temperature_input;
192 warn_once(
"Fault Model: Temperature exceeded simulated upper bound.");
193 warn_once(
"Fault Model: The fault model is not accurate any more.");
195 }
else if (temperature_input < 0){
197 warn_once(
"Fault Model: Temperature exceeded simulated lower bound.");
198 warn_once(
"Fault Model: The fault model is not accurate any more.");
204 fault_vector[
i] =
routers[routerID].fault_type[
i] *
212 int temperature_input,
213 float *aggregate_fault_prob)
215 *aggregate_fault_prob = 1.0;
219 if (routerID < 0 || routerID >= ((
int)
routers.size())){
220 warn(
"Fault Model: ERROR! unknown router ID argument.");
221 fatal(
"Fault Model: Did you enable the fault model flag)?");
225 int temperature = temperature_input;
228 warn_once(
"Fault Model: Temperature exceeded simulated upper bound.");
229 warn_once(
"Fault Model: The fault model is not accurate any more.");
231 }
else if (temperature_input < 0){
233 warn_once(
"Fault Model: Temperature exceeded simulated lower bound.");
234 warn_once(
"Fault Model: The fault model is not accurate any more.");
240 *aggregate_fault_prob= *aggregate_fault_prob *
241 ( 1.0 - (
routers[routerID].fault_type[
i] *
244 *aggregate_fault_prob = 1.0 - *aggregate_fault_prob;
252 cout <<
"--- PRINTING configurations ---\n";
254 cout <<
"(" << record <<
") ";
257 for (
int fault_type_num = 0;
260 cout << (100 *
configurations[record].fault_type[fault_type_num]);
265 cout <<
"--- PRINTING temperature weights ---\n";
267 cout <<
"temperature=" << record <<
" => ";
274 FaultModelParams::create()
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)
#define MAX_BUFFERS_per_VC
std::string fault_type_to_string(int fault_type_index)
float fault_type[number_of_fault_types]
FaultModel(const Params *p)
bool fault_prob(int routerID, int temperature, float *aggregate_fault_prob)
std::vector< system_conf > routers
std::vector< int > temperature_weights
bool fault_vector(int routerID, int temperature, float fault_vector[])
std::vector< system_conf > configurations
Abstract superclass for simulation objects.