def __test(): '''for test only''' import netlist_util as nu fname = raw_input("plz enter file name:") info = nu.vm_parse(fname) m_list = info['m_list'] nu.mark_the_circut(m_list) nu.rules_check(m_list) g1 = CircuitGraph(m_list, include_pipo = True) g2 = CircuitGraph(m_list, include_pipo = False) if len(m_list) <= 20: for eachPrim in m_list: eachPrim.__print__() verbose_info =True else: verbose_info = False print "Info: THE m_list is too long >20. should not inspected by hand. ignore..." print "----NO PIPO-----------" g2.info(verbose_info) print "----Including PIPO----" g1.info(verbose_info) #g1.paint() return True
def insert_scan_chain_new(fname,verbose=False,presult=True,\ input_file_dir=os.getcwd(),output_file_dir=os.getcwd(),\ K=6): '''para: fname ,input file name in current path verbose, if True print 调用的各个函数的 redandunt infomation presult ,if True 打印最终的各种统计信息 input_file_dir, default os.getcwd(), output_file_dir, default os.getcwd() ''' input_file = os.path.join(input_file_dir, fname) #file -->> m_list info = np.vm_parse(input_file) m_list = info['m_list'] port_decl_list = info['port_decl_list'] signal_decl_list = info['signal_decl_list'] assign_stm_list = [] if info.has_key('assign_stm_list'): assign_stm_list = info['assign_stm_list'] nu.mark_the_circut(m_list) #m_list -->>all info need lut_type_cnt = [0, 0, 0, 0, 0, 0] all_fd_dict = nu.get_all_fd(m_list, verbose) all_lut_dict = nu.get_all_lut(m_list, lut_type_cnt, verbose) ##下面两个列表记录了需要进行修改的LUT和D触发器的 lut_out2_FD_dict, FD_din_lut_list = nu.get_lut_cnt2_FD( m_list, all_fd_dict, verbose, K) ##CE优化所需要的netlist信息 ce_signal_list, fd_has_ce_list = nu.get_ce_in_fd(all_fd_dict, verbose) lut_cnt2_ce, un_opt_ce_list = nu.get_lut_cnt2_ce(m_list, ce_signal_list, K, verbose) fd_ce_cnt = len(fd_has_ce_list) #gt.generate_testbench(m_list[0],fd_cnt=len(all_fd_dict),output_dir=output_file_dir) ##################################################################### counter = 0 scan_out_list = [] gatedce_list = [] #cnt for debug only fd_replace_cnt = 0 cnt_edited_lut = 0 #cnt for debug only name_base = os.path.splitext(fname)[0] output_file = os.path.join(output_file_dir, name_base + '_insert_scan_chain.v') try: fobj = open(output_file, 'w') except IOError, e: print "Error: file open error:", e raise SystemExit
def get_graph_from_raw_input(): '''for test only''' import netlist_util as nu fname = raw_input("plz enter file name:") info = nu.vm_parse(fname) m_list = info['m_list'] print "Top module is:" m_list[0].__print__() nu.mark_the_circut(m_list) nu.rules_check(m_list) g1 = CircuitGraph(m_list, include_pipo = True) return g1
def insert_scan_chain_new(fname,verbose=False,presult=True,\ input_file_dir=os.getcwd(),output_file_dir=os.getcwd(),\ K=6): '''para: fname ,input file name in current path verbose, if True print 调用的各个函数的 redandunt infomation presult ,if True 打印最终的各种统计信息 input_file_dir, default os.getcwd(), output_file_dir, default os.getcwd() ''' input_file=os.path.join(input_file_dir,fname) #file -->> m_list info=np.vm_parse(input_file) m_list=info['m_list'] port_decl_list =info['port_decl_list'] signal_decl_list=info['signal_decl_list'] assign_stm_list=[] if info.has_key('assign_stm_list'): assign_stm_list=info['assign_stm_list'] nu.mark_the_circut(m_list) #m_list -->>all info need lut_type_cnt=[0,0,0,0,0,0] all_fd_dict =nu.get_all_fd(m_list,verbose) all_lut_dict=nu.get_all_lut(m_list,lut_type_cnt,verbose) ##下面两个列表记录了需要进行修改的LUT和D触发器的 lut_out2_FD_dict,FD_din_lut_list =nu.get_lut_cnt2_FD(m_list,all_fd_dict,verbose,K) ##CE优化所需要的netlist信息 ce_signal_list,fd_has_ce_list =nu.get_ce_in_fd(all_fd_dict,verbose) lut_cnt2_ce,un_opt_ce_list =nu.get_lut_cnt2_ce(m_list,ce_signal_list,K,verbose) fd_ce_cnt=len(fd_has_ce_list) #gt.generate_testbench(m_list[0],fd_cnt=len(all_fd_dict),output_dir=output_file_dir) ##################################################################### counter=0 scan_out_list=[] gatedce_list = [] #cnt for debug only fd_replace_cnt=0 cnt_edited_lut=0 #cnt for debug only name_base=os.path.splitext(fname)[0] output_file=os.path.join(output_file_dir,name_base+'_insert_scan_chain.v') try: fobj=open(output_file,'w') except IOError,e: print "Error: file open error:",e raise SystemExit
def get_graph(fname): info = nu.vm_parse(fname) m_list = info['m_list'] nu.mark_the_circut(m_list) nu.rules_check(m_list) # 原图 g1 = CircuitGraph(m_list, include_pipo = True) g1.info() # cloud_reg 图 cloud_reg1=CloudRegGraph(g1) cloud_reg1.info() # BALLAST ballas = Ballaster(cloud_reg1) cloud_reg1.info() print "After Reg2Arc" print nx.info(ballas.intgraph) ballas.feedbackset() print "After removed FAS " print nx.info(ballas.intgraph) # # # S图 # s1=g1.get_s_graph() # print nx.info(s1) # # #打印 画图 # plt.figure("Original_Circut") # g1.paint() # plt.figure("Cloud_reg") # cloud_reg1.paint() # plt.figure("S_Graph") # s1.paint(display_pipo,paint_order) return True