47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <assert.h>
|
|
|
|
#include "circuit.h"
|
|
|
|
int main(int args, char* argv[]) {
|
|
|
|
if(args != 2) {
|
|
printf("usage: ./atpg <XXX.bench>\n");
|
|
exit(1);
|
|
}
|
|
|
|
srand(19260817);
|
|
|
|
Circuit circuit;
|
|
|
|
printf("parsing file %s ...", argv[1]);
|
|
circuit.parse_from_file(argv[1]);
|
|
circuit.init_stems();
|
|
circuit.init_topo_index();
|
|
printf(" Done.\n");
|
|
|
|
printf("====== Circuit Statistics ====== \n");
|
|
printf("PI:\t%ld\n", circuit.PIs.size());
|
|
printf("PO:\t%ld\n", circuit.POs.size());
|
|
printf("Gate:\t%ld\n", circuit.name2gate.size());
|
|
printf("Stem:\t%ld\n", circuit.stems.size());
|
|
printf("================================ \n");
|
|
|
|
std::vector<Fault*> faults;
|
|
|
|
// init faults
|
|
for(auto stem : circuit.stems) {
|
|
faults.push_back(new Fault(stem, Fault::SA0));
|
|
faults.push_back(new Fault(stem, Fault::SA1));
|
|
}
|
|
|
|
auto pattern = circuit.local_search(faults);
|
|
|
|
printf("checking valid circuit ...");
|
|
printf(" result: %d.\n", circuit.is_valid_circuit());
|
|
|
|
|
|
|
|
return 0;
|
|
} |