同步代码

This commit is contained in:
YuhangQ 2023-05-10 11:41:00 +08:00
parent 482069812f
commit 34f17a7b2e
4 changed files with 6 additions and 13 deletions

BIN
atpg

Binary file not shown.

View File

@ -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);

View File

@ -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());

View File

@ -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;