Esempio n. 1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-ckt",
                        type=str,
                        help="name of the ircuit, e.g. c17, no extension")
    args = parser.parse_args()
    circuit = Circuit(args.ckt)
    circuit.read_circuit()
    circuit.lev()

    #observability() need to follow controllability()
    # circuit.controllability()
    circuit.SCOAP_CC()
    # circuit.observability()
    circuit.SCOAP_CO()

    circuit.STAFAN_CS(100)
    circuit.STAFAN_B()
    # circuit.STAFAN(1, num_proc=1)
    circuit.co_ob_info()
    graph = circuit.gen_graph()
Esempio n. 2
0
elif args.func == "saveStatTP":
    """ generate stafan stat file based on orig-TPs, and given tp 
    The version must be added to the name of .stat file"""

    tp_path = "../data/patterns/{}_TP{}.tp".format(args.ckt, args.tpLoad)
    if not os.path.exists(tp_path):
        raise NameError("no file found in {}".format(tp_path))
    config.STAFAN_C_MIN = 1.0 / (10 * args.tp)
    time_start = time.time()
    circuit = Circuit(ckt_name)
    LoadCircuit(circuit, "v")
    circuit.lev()
    circuit.SCOAP_CC()
    circuit.SCOAP_CO()
    circuit.STAFAN_CS(args.tp, tp_fname=tp_path)
    circuit.STAFAN_B()
    # print("Zeros: \t{}".format(circuit.c_zero_count))
    print("Time: \t{:.3}".format(time.time() - time_start))
    fname = "../data/stafan-data/" + ckt_name + "-TP" + str(
        args.tp) + ".stafan"
    print("Saving circuit with STAFAN values in " + fname)
    circuit.save_circuit(fname)

elif args.func == "saveEntropyTP":
    """ generate stafan stat file based on orig-TPs, and given tp 
    The version must be added to the name of .stat file"""

    tp_path = "../data/patterns/{}_TP{}.tp".format(args.ckt, args.tpLoad)
    if not os.path.exists(tp_path):
        raise NameError("no file found in {}".format(tp_path))
    config.STAFAN_C_MIN = 1.0 / (10 * args.tp)