def read_cts_icc( filename , TOP=None ): global debug print( "Info : read_cts_icc '%s'" % filename ) F = open(filename,'r') if TOP == None : CTS = CTSNode( filename, None, level=-2 ) else : CTS = CTSNode( filename, TOP ) clk = '' for line in F : ## clock declaration m = re.match('Printing structure within exceptions of (\w+) at root pin ',line) if m : clk = m.group(1) CLK = CTSNode( clk, CTS ) hier = list() hier.append(CLK) continue if clk == '' : continue ## tool warnings if re.match('.* reconvergent clock path found',line) : print("Warning : " + clk + line) continue ## line matches tree structure m = re.match(' *\((\d+)\) (.*?)( |\[\w+:)',line) if not m : continue level = m.group(1) inst = m.group(2) ## test FF if re.search('SINK PIN|MACRO',line) : is_ff = True else : is_ff = False ## test level + hier level = int(level) if level+1 < len(hier) : # step up in hier hier = hier[0:level+1] # level included UP = hier[-1] CURRENT = CTSNode( line.rstrip() , UP , is_ff=is_ff ) hier.append(CURRENT) if debug : print "\nUP = %s\nCURRENT = %s" % (UP,CURRENT) F.close() CTS.statistics() return CTS
def read_cts_ccopt( filename , TOP=None ): global debug print( "Info : read_cts_ccopt '%s'" % filename ) F = open(filename,'r') if TOP == None : CTS = CTSNode( filename, None, level=-2 ) else : CTS = CTSNode( filename, TOP ) clk = None for line in F : line = line.rstrip() ## clock declaration m = re.match('Dump of clock tree (\S+)',line) if m : clk = m.group(1) CLK = CTSNode( clk, CTS ) hier = list() hier.append(CLK) continue if line == '' : continue # ## tool warnings # if re.match('.* reconvergent clock path found',line) : # print("Warning : " + clk + line) # continue ## line matches tree structure m = re.match('R\(\S+\):',line) is_ff = False if m : level = 0 else : m = re.match('([ \|]*._ )(\S+[:=])',line) # how to grab '\' (backslash) ? if (not m) : continue indent = m.group(1) level = indent_to_level( indent ) if (m.group(2) == 'Pin=') : is_ff = True ## test level + hier if level+1 < len(hier) : # step up in hier hier = hier[0:level+1] # level included UP = hier[-1] CURRENT = CTSNode( line , UP , is_ff=is_ff ) hier.append(CURRENT) if debug : print "\nUP = %s\nCURRENT = %s" % (UP,CURRENT) F.close() CTS.statistics() return CTS
def read_cts_at91cts( filename , TOP=None ): global debug print( "Info : read_cts_at91cts '%s'" % filename ) F = open(filename,'r') if TOP == None : CTS = CTSNode( filename, None, level=-2 ) else : CTS = CTSNode( filename, TOP ) clk = None prev = None for line in F : line = line.rstrip() ## clock declaration m = re.match('-I- ( *)\*DEPTH (0): (.*?) ',line) if m : clk = m.group(3) CLK = CTSNode( clk, CTS ) hier = list() hier.append(CLK) if line == '' : clk = None if clk == None : continue # ## tool warnings # if re.match('.* reconvergent clock path found',line) : # print("Warning : " + clk + line) # continue ## line matches tree structure m1 = re.match('-I- ( *)\*DEPTH (\d+):',line) m2 = re.match('-I- ( *)\((\w+)\)\S+/(\w+)',line) # (2) = (Leaf|Sync|Excl|Gating|Preserve|Data) if (not m1) and (not m2) : continue is_ff = False if m1 : (indent,level) = m1.group(1,2) check_indent_vs_level( indent , level ) if prev != None : line += prev if m2 : indent = m2.group(1) level = indent_to_level( indent ) ## test level + hier if level+1 < len(hier) : # step up in hier hier = hier[0:level+1] # level included ## Gating pins : don't print now , append to next line if m2.group(2) in ('Gating','gating','Preserve','preserve','Through','through') : prev = ' (%s %s)' % m2.group(2,3) continue else : prev = None ## FF pins if m2.group(2) in ('Sync','sync','Leaf','leaf') : is_ff = True UP = hier[-1] CURRENT = CTSNode( line , UP , is_ff=is_ff ) if m1 : hier.append(CURRENT) if debug : print "\nUP = %s\nCURRENT = %s" % (UP,CURRENT) F.close() CTS.statistics() return CTS