atpg-ls/main.cpp

42 lines
896 B
C++
Raw Normal View History

#include <cstdio>
#include <cstdlib>
2023-02-12 16:22:32 +08:00
#include <assert.h>
#include "circuit.h"
2023-02-12 18:14:12 +08:00
#include "ls.h"
int main(int args, char* argv[]) {
if(args != 2) {
printf("usage: ./atpg <XXX.bench>\n");
exit(1);
}
Circuit circuit;
printf("parsing file %s...\n", argv[1]);
circuit.parse_from_file(argv[1]);
printf("====== Circuit Statistics ====== \n");
2023-02-12 16:22:32 +08:00
printf("PI:\t%ld\n", circuit.PIs.size());
printf("PO:\t%ld\n", circuit.POs.size());
printf("Gates:\t%ld\n", circuit.name2gate.size());
2023-02-12 18:14:12 +08:00
int cnt = 0;
for(auto& gate: circuit.gates) {
if(gate->outputs.size() > 2) {
cnt++;
}
}
printf("Stem:\t%d\n", cnt);
2023-02-12 16:22:32 +08:00
printf("cal topo index ...\n");
circuit.cal_topo_index();
for(Gate* gate : circuit.gates) {
assert(gate->topo > 0);
}
2023-02-12 18:14:12 +08:00
srand(19260817);
local_search(&circuit);
return 0;
}