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()
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))
# all_ckts = ["c432"] for ckt in all_ckts: print("READING CIRCUIT: ", ckt) circuit = Circuit(ckt) circuit.read_circuit() circuit.lev() circuit.SCOAP_CC() circuit.SCOAP_CO() circuit.STAFAN_CS(100) circuit.STAFAN_B() # circuit.STAFAN(10)# , num_proc=2) # circuit.co_ob_info() circuit.get_hist("CC0", plot=False) ''' ckt = "c499" circuit = Circuit(ckt) circuit.read_circuit() circuit.lev() test = circuit.get_random_input_pattern() circuit.logic_sim(test) ''' circuit.STAFAN_CS(1000) circuit.STAFAN_B() graph = circuit.gen_graph() nx.write_graphml(graph, "./g_noon.graphml") temp = nx.read_graphml("./g_noon.graphml") '''