修复BUG,现在可以统计错误传播层数了

This commit is contained in:
YuhangQ 2023-03-08 07:22:28 +00:00
parent 6be4d80653
commit 041ff6c2e3
4 changed files with 42054 additions and 3353 deletions

BIN
atpg

Binary file not shown.

View File

@ -81,7 +81,7 @@ int* flip_need_update;
std::vector<Gate*> flip_update_queue;
// incremental stem struct
const int STEM_INC = 20;
const int STEM_INC = 100;
const int STEM_WEIGHT_MAX = 1e9;
ll stem_total_weight;
int stem_total_cnt;

41
ls.cpp
View File

@ -323,17 +323,31 @@ void Circuit::ls_block_recal(Gate* stem) {
stem_satisfied[stem->id] = true;
stem_total_weight -= stem_weight[stem->id];
stem_total_cnt += 1;
for(Gate* pre : stem->pre_stems) {
if(flip_need_update[pre->id]) continue;
flip_need_update[pre->id] = true;
flip_update_queue.push_back(pre);
flip_total_weight += flip_weight[pre->id];
flip_total_cnt += 1;
}
}
if(stem->cal_value() != stem->value && stem_satisfied[stem->id]) {
stem_satisfied[stem->id] = false;
stem_total_weight += stem_weight[stem->id];
stem_total_cnt -= 1;
for(Gate* pre : stem->pre_stems) {
if(flip_need_update[pre->id]) continue;
flip_need_update[pre->id] = true;
flip_update_queue.push_back(pre);
flip_total_weight += flip_weight[pre->id];
flip_total_cnt += 1;
}
}
//printf("flip: %s\n", stem->name.c_str());
//stem->value = !stem->value;
if(stem->isPO) {
if(stem->sa[!stem->value] == false) {
@ -398,6 +412,20 @@ void Circuit::ls_block_recal(Gate* stem) {
for(Gate* stem : suc_stems) {
q.push(stem);
int fpl0 = stem->cal_propagate_len(0);
int fpl1 = stem->cal_propagate_len(1);
if(fault_weight[stem->id][0]) {
fault_propagate_tatal_len += fpl0 - stem->fault_propagate_len[0];
}
if(fault_weight[stem->id][1]) {
fault_propagate_tatal_len += fpl1 - stem->fault_propagate_len[1];
}
stem->fault_propagate_len[0] = fpl0;
stem->fault_propagate_len[1] = fpl1;
if(stem->cal_value() == stem->value && !stem_satisfied[stem->id]){
stem_satisfied[stem->id] = true;
stem_total_weight -= stem_weight[stem->id];
@ -441,7 +469,12 @@ void Circuit::ls_block_recal(Gate* stem) {
int fpl0 = in->cal_propagate_len(0);
int fpl1 = in->cal_propagate_len(1);
// if(in->name == "422") {
// printf("%s changed: %d fpl0: %d fpl1: %d \n", in->name.c_str(), (in->fault_propagate_len[0] != fpl0 || in->fault_propagate_len[1] != fpl1), fpl0, fpl1);
// }
if(in->stem && !in->isPI && (in->fault_propagate_len[0] != fpl0 || in->fault_propagate_len[1] != fpl1)) {
for(Gate* pre : in->pre_stems) {
if(flip_need_update[pre->id]) continue;

45364
output.txt

File diff suppressed because it is too large Load Diff