同步代码
This commit is contained in:
parent
482069812f
commit
34f17a7b2e
@ -17,11 +17,11 @@ int Circuit::check_circuit() {
|
||||
|
||||
assert(g->value_satisfied == ( g->cal_value() == g->value ));
|
||||
|
||||
int changed = 0;
|
||||
bool changed = 0;
|
||||
if(!changed && g->cal_fault_detected(0) != g->fault_detected[0]) changed = 1;
|
||||
if(!changed && g->cal_fault_detected(1) != g->fault_detected[1]) changed = 1;
|
||||
if(!changed && g->cal_propagate_len(0) != g->cal_propagate_len(0)) changed = 1;
|
||||
if(!changed && g->cal_propagate_len(1) != g->cal_propagate_len(1)) changed = 1;
|
||||
if(!changed && g->cal_propagate_len(0) != g->fault_propagated_len[0]) changed = 1;
|
||||
if(!changed && g->cal_propagate_len(1) != g->fault_propagated_len[1]) changed = 1;
|
||||
|
||||
assert(changed == g->fault_need_update);
|
||||
|
||||
|
@ -103,13 +103,8 @@ void Circuit::ls_flip(Gate* gate) {
|
||||
g->update_gate_statistics();
|
||||
}
|
||||
|
||||
// for(Gate *g : gates) {
|
||||
// g->score = g->cal_score();
|
||||
// }
|
||||
|
||||
gate->score = gate->cal_score();
|
||||
|
||||
std::unordered_set<Gate*> t;
|
||||
int cal_cnt = 0;
|
||||
|
||||
for(Gate* g : gate->fanouts) {
|
||||
@ -127,8 +122,6 @@ void Circuit::ls_flip(Gate* gate) {
|
||||
}
|
||||
}
|
||||
|
||||
printf("t: %d cal_cnt: %d\n", t.size(), cal_cnt);
|
||||
|
||||
for(Gate* g : gates) {
|
||||
if(g->score != g->cal_score(true) ){
|
||||
printf("bug3: %s\n", g->name.c_str());
|
||||
|
@ -45,7 +45,7 @@ int Gate::cal_score(int debug) {
|
||||
this->fault_detected[0] = origin_fault_detected[0];
|
||||
this->fault_detected[1] = origin_fault_detected[1];
|
||||
|
||||
return - score_value_unsatisfied_cost - score_fault_update_cost
|
||||
return - score_value_unsatisfied_cost - score_fault_update_cost
|
||||
+ score_fault_propagated_weight[0] + score_fault_propagated_weight[1]
|
||||
+ score_fault_detected_weight[0] + score_fault_detected_weight[1];
|
||||
}
|
||||
@ -92,8 +92,8 @@ int Gate::cal_score_fault_update_cost() {
|
||||
bool changed = 0;
|
||||
if(!changed && g->cal_fault_detected(0) != g->fault_detected[0]) changed = 1;
|
||||
if(!changed && g->cal_fault_detected(1) != g->fault_detected[1]) changed = 1;
|
||||
if(!changed && g->cal_propagate_len(0) != g->cal_propagate_len(0)) changed = 1;
|
||||
if(!changed && g->cal_propagate_len(1) != g->cal_propagate_len(1)) changed = 1;
|
||||
if(!changed && g->cal_propagate_len(0) != g->fault_propagated_len[0]) changed = 1;
|
||||
if(!changed && g->cal_propagate_len(1) != g->fault_propagated_len[1]) changed = 1;
|
||||
|
||||
if(!g->fault_need_update && changed) {
|
||||
res += g->fault_need_update_cost;
|
||||
|
Loading…
x
Reference in New Issue
Block a user