def main(): parser = argparse.ArgumentParser() parser.add_argument("-ckt", type=str, required=True, help="name of the ircuit, e.g. c17, no extension") parser.add_argument("-tp", type=int, required=True, help="name of the ircuit, e.g. c17, no extension") parser.add_argument("-cpu", type=int, required=True, help="name of the ircuit, e.g. c17, no extension") args = parser.parse_args() print("\n======================================================") print("Run | circuit: {} | Test Count: {} | CPUs: {}".format( args.ckt, args.tp, args.cpu)) start_time = time.time() circuit = Circuit(args.ckt) circuit.read_circuit() circuit.lev() # inputnum = len(circuit.input_num_list) # limit = [0, pow(2, inputnum)-1] # for i in range(100): # b = ('{:0%db}'%inputnum).format(randint(limit[0], limit[1])) # list_to_logicsim = [] # for j in range(inputnum): # list_to_logicsim.append(int(b[j])) # circuit.logic_sim(list_to_logicsim) # print(b) # # print_nodes(circuit) # observability() need to follow controllability() circuit.SCOAP_CC() circuit.SCOAP_CO() # circuit.STAFAN_CS(100) # circuit.STAFAN_B() circuit.STAFAN(args.tp, num_proc=args.cpu) # circuit.co_ob_info() graph = circuit.gen_graph() suffix = round(math.log10(args.tp)) fname = ("10e" + str(suffix)) if (suffix % 1 == 0) else str(args.tp) fname = "./../data/graph/" + args.ckt + "_" + fname + ".graphml" print("Saving graph in ", fname) nx.write_graphml(graph, fname) print("Saved!") print("Total simulation ime: {:.2f} seconds".format(time.time() - start_time)) print()
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()
LoadCircuit(circuit, "v") circuit.lev() justNode = circuit.nodes_lev[3] print(justNode) if args.func not in [ "saveStat", "saveStatTP", "gen_stil", "genTP", "genV_TMAXOP", "analysisOB", "test" ]: fname = "../data/stafan-data/{}-TP{}.stafan".format(ckt_name, args.tpLoad) print("Loading circuit with STAFAN values in " + fname) circuit = Circuit(ckt_name) LoadCircuit(circuit, "v") circuit.lev() circuit.SCOAP_CC() circuit.SCOAP_CO() if args.func == "genTP": """ generate original test pattern file, orig-TP Important note, if synv is selected, will generate for the synthesized version But it does not have any differece! """ path = "../data/patterns/{}_TP{}.tp".format(args.ckt, args.tp) print("generating test patterns for {} with {} tps in {}".format( ckt_name, args.tp, path)) circuit = Circuit(ckt_name) LoadCircuit(circuit, "v") circuit.lev() circuit.gen_tp_file(args.tp, path) elif args.func == "saveStatTP": """ generate stafan stat file based on orig-TPs, and given tp