2023-02-11 21:52:59 +08:00
|
|
|
#include "circuit.h"
|
2023-07-31 05:55:25 +00:00
|
|
|
#include "simulator.h"
|
2023-07-18 04:05:32 +00:00
|
|
|
#include "paras.h"
|
2023-02-11 21:52:59 +08:00
|
|
|
|
2023-07-18 04:05:32 +00:00
|
|
|
int main(int argc, char *argv[]) {
|
2023-07-03 06:52:47 +00:00
|
|
|
|
|
|
|
// 初始化命令行参数
|
|
|
|
INIT_ARGS
|
2023-02-11 21:52:59 +08:00
|
|
|
|
2023-08-09 07:47:50 +00:00
|
|
|
srand(OPT(seed));
|
2023-02-16 18:51:31 +08:00
|
|
|
|
2023-07-18 04:05:32 +00:00
|
|
|
Circuit *circuit = new Circuit();
|
2023-07-31 05:55:25 +00:00
|
|
|
Simulator* simulator = new Simulator();
|
2023-02-11 21:52:59 +08:00
|
|
|
|
2023-07-18 04:05:32 +00:00
|
|
|
printf("parsing file %s ...\n", OPT(instance).c_str());
|
2023-07-03 06:52:47 +00:00
|
|
|
circuit->parse_from_file(OPT(instance).c_str());
|
2023-07-31 05:55:25 +00:00
|
|
|
simulator->parse_from_file(OPT(instance).c_str());
|
2023-07-18 04:05:32 +00:00
|
|
|
circuit->init_topo_index();
|
2023-07-31 05:55:25 +00:00
|
|
|
simulator->init_topo_index();
|
2023-08-09 07:47:50 +00:00
|
|
|
// circuit->
|
2023-07-18 04:05:32 +00:00
|
|
|
|
|
|
|
printf("building lut circuit ...\n");
|
|
|
|
LUTCircuit *C = circuit->build_lut_circuit();
|
2023-07-31 05:55:25 +00:00
|
|
|
C->simulator = simulator;
|
2023-02-16 18:51:31 +08:00
|
|
|
|
2023-02-11 21:52:59 +08:00
|
|
|
printf("====== Circuit Statistics ====== \n");
|
2023-02-20 13:08:25 +08:00
|
|
|
printf("PI:\t%ld\n", circuit->PIs.size());
|
|
|
|
printf("PO:\t%ld\n", circuit->POs.size());
|
2023-07-18 04:05:32 +00:00
|
|
|
printf("Gate:\t%ld\n", circuit->gates.size());
|
|
|
|
printf("LUT:\t%ld\n", C->luts.size());
|
|
|
|
// printf("================================ \n");
|
2023-02-12 16:22:32 +08:00
|
|
|
|
2023-08-09 07:47:50 +00:00
|
|
|
|
|
|
|
C->print();
|
2023-07-18 04:05:32 +00:00
|
|
|
C->ls_main();
|
2023-02-21 19:07:40 +08:00
|
|
|
|
2023-02-11 21:52:59 +08:00
|
|
|
return 0;
|
2023-07-18 04:05:32 +00:00
|
|
|
}
|