#include "circuit.h"
#include "simulator.h"
#include "paras.h"

int main(int argc, char *argv[]) {

    // 初始化命令行参数
    INIT_ARGS

    srand(19260817);

    Circuit *circuit = new Circuit();
    Simulator* simulator = new Simulator();

    printf("parsing file %s ...\n", OPT(instance).c_str());
    circuit->parse_from_file(OPT(instance).c_str());
    simulator->parse_from_file(OPT(instance).c_str());
    circuit->init_topo_index();
    simulator->init_topo_index();

    printf("building lut circuit ...\n");
    LUTCircuit *C = circuit->build_lut_circuit();
    C->simulator = simulator;

    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->gates.size());
    printf("LUT:\t%ld\n", C->luts.size());
    // printf("================================ \n");

    C->ls_main();

    return 0;
}
