From 34f17a7b2e3346122077d7d8b55419e0f3a1cc44 Mon Sep 17 00:00:00 2001 From: YuhangQ Date: Wed, 10 May 2023 11:41:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- atpg | Bin 65633 -> 65633 bytes src/checker.cpp | 6 +++--- src/ls.cpp | 7 ------- src/score.cpp | 6 +++--- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/atpg b/atpg index 788f61c5e091e7125615cbe9139ecf633a2e59f3..a18ba60f16a4d61a48ee9b517ce55e48ad15243e 100755 GIT binary patch delta 6800 zcmaJ`3tUvy_TKx<00W3Hz%V==29$>ii1;pLd_z7#6i`#pd?cb6rkUiRR9aR#F1k=@ z4&MAHof4`jl`Q*g<`IcxogciySUwc|MUBe`+VQ}*4}Hs);=4X ziq%cU>Wyc7HCo0vW9-Hp{0AS6)^dG__VzNFttS&cw;_=yYxln(vqdVI-4CmIGWbXu z_i&kDy`TYg6N_Y>Ns{S_V3d-z8&}Ef0Hw~2umst9v%)Gh)Z6N$J>2KB?1+1dyC&Y+ zCY_nKF*W-U6srgDhqfB^9uHfAiMcu`4=8!)^agVHJ#J zoWS~j#rhpmV2de`W!NQ?J?5lo;5rD>g=+j+h71PlLIeF+hQp272i+N7Ia3wVQit9e zjBo+u>!LgT%Y&7+saVzKcvB4&>-?o=4>+KkqGR4HBly4i5z-P4#()s%ga-@>h>(tW zz^s6HeXZx8=-M2xb!d>Z-KoTW-wf!{yV=uJ6T9A2W8m(2t6ly)q(to0)JSHbFs&}| zqAs}8sz1iJjN%(VGzMdf{m4|4%-IsPyXnR7pBx!6drUO}Jiv35!=b0x$6?v*jm>V5 zn{9U68hl@|O@I|ad6MQ6_(xELSN#=7-|pD94xJu@E;v$Ed(hbh$OtY{HC~Y4ZwF_% z7d>+5^{9HsmKrjTa|`SZHSii}2=(K8Z8t;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R_&V97`JZyqP>@l(!`FfB~- zKd<1Lav4w2GG^+F%T@f&RfGg#TK(kkq=IP|5MHHV+6{y^E0}f#;rA3wyMyo{1=B7e z+^%5SErc&?nUiC{?n?N_XHzo8Z*xO&r}RUCz@+U*dYnQ!2v7NgJqEE@yJ?Dl24sG& z4;3tVkxH!SF*jY z4WK!pFBYs&iT(M#q7s}O|xIb$`LaTLLl7pcT9uU1q7ll`yC z-_uV1qAUDI@n@iE(}xOHj3Ro)W7vJEdUGHXRe}{N(LuTu)%##>(-#X?s6=0h3zB0A zOm@n+7XRoVOm*pLr;O?GLN-wRp9anU>O%!f7E+1kWDk}{se?>Z309~?%bFb`t9-zW zD!~esXk;7pvMLSQQ6*TR674O=AggLY^MyWCutFu8-m*|xRRx)-60A^(R=7)1xq%r~ zf)y&!ATKH^%{Raz{G)>~)w`#iDk-|`Tj8?*aLD{pA1YY# zB9-X9Y79v$#0X|o309~?M~+ie_yYv01S?dcPvl9Thm{BEIp%R_{RYm0k?d^J#V1-IN4|4HQPWLD<+0l`u(HjjOgsGCk-irGE zJsuzbQm}Y@{HS2@_^``3+wnFDusS*Vu1H^xro1;MjEsT+-V% zpFMVFajtdFJ0;&N{Z2pN>h*8#%xPUc*>*Kpf5q#<+zZ3@d@?I>X7QO9=SEg9(@qcn zV8!BxbuX9xC+w=da90213F{+<-Af$s#*rawR;+%vcv@LeudSXf53ZYLJ-*@8q1HWh z!37U}P#$zYe~xWSi0;tF@!NBy$v%9kaxURwEj{)PQ6`_*lGo_OyURlv}Kf6Z-d z$sFExd6mcNiwoBI)SvO$oO>lE|LRb`B~tUxP;9RyljX+ zZG3<1ixdA||3=qOhmS5yAHBP7U)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); diff --git a/src/ls.cpp b/src/ls.cpp index 45d19fe..b52cc00 100644 --- a/src/ls.cpp +++ b/src/ls.cpp @@ -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 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()); diff --git a/src/score.cpp b/src/score.cpp index 019b8fb..6cbe7d2 100644 --- a/src/score.cpp +++ b/src/score.cpp @@ -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;