def buildPairsTable(Mod): Nets = list(Mod.netTable.keys()) Num = 0 for Net in Nets: if Net in Mod.nets: Dir, WW = Mod.nets[Net] Ext = is_external_dir(Dir) List = Mod.netTable[Net] if len(List) == 2: Inst0, _, Pin0 = List[0] Inst1, _, Pin1 = List[1] if (Inst0, Pin0) in PINDIRS: Dir0 = PINDIRS[(Inst0, Pin0)] else: Dir0 = 'inout' if (Inst1, Pin1) in PINDIRS: Dir1 = PINDIRS[(Inst1, Pin1)] else: Dir1 = 'inout' if (Dir0, Dir1) == ('input', 'output'): recordPair(Inst1, Inst0, Net) elif (Dir1, Dir0) == ('input', 'output'): recordPair(Inst0, Inst1, Net) else: logs.log_warning('DIRECTIONS %s %s=%s %s=%s' % (Net, Inst0, Dir0, Inst1, Dir1))
def make2Renames(self): self.Translation = {} Nets = list(self.Mod.nets.keys()) for Net in Nets: Dir,Wid = self.Mod.nets[Net] if is_external_dir(Dir): Invent = self.fubarname() self.Translation[Net] = Invent self.Mod.nets[Invent] = 'wire',Wid self.TRANS.append((Dir,Net,Invent)) self.renameDeep()
def scanFunctions(wrds, Env, Mod): Res = [] for Word in wrds: if Word.startswith('ahbconn('): Job = Word[8:-1] if ',' in Job: wx = Job.split(',') SL = wx[0] PI = wx[1] else: SL = Job PI = '' Str = AHBX.replace('YY', PI) Str = Str.replace('XX', SL) Res.extend(Str.split()) elif Word.startswith('apbconn('): Job = Word[8:-1] Str = APBX.replace('XX', Job) Res.extend(Str.split()) elif Word.startswith('conns('): Son = Word[6:-1] Env.try_and_load_module(Son, Env) if Son in Env.Modules: Sonobj = Env.Modules[Son] for Net in Sonobj.nets: Dir, Wid = Sonobj.nets[Net] if is_external_dir(Dir): if (type(Wid) is tuple) and (len(Wid) == 2): Sup = module_class.support_set(Wid) for Param in Sup: if Param in Sonobj.parameters: Mod.parameters[Param] = Sonobj.parameters[ Param] elif Param in Sonobj.localparams: Mod.localparams[ Param] = Sonobj.localparams[Param] Str = '%s=%s%s' % (Net, Net, wids(Wid)) Res.append(Str) else: logs.log_error('module %s could not be loaded' % Son) else: Res.append(Word) return Res
def makeRenames(self): Nets = list(self.Mod.nets.keys()) for Net in Nets: Dir,Wid = self.Mod.nets[Net] if not is_external_dir(Dir): Invent = self.fubarname() self.Translation[Net] = Invent self.Mod.nets.pop(Net) self.Mod.nets[Invent] = Dir,Wid # else: # Invent = self.fubarname() # self.Translation[Net] = Invent # self.Mod.nets[Invent] = 'wire',Wid # self.TRANS.append((Dir,Net,Invent)) Prms = list(self.Mod.localparams.keys()) for Prm in Prms: Val = self.Mod.localparams[Prm] Invent = self.fubarname() self.Translation[Prm] = Invent self.Mod.localparams.pop(Prm) self.Mod.localparams[Invent] = Val
def report_connectivity(Mod, Env): Mod.prepareNetTable() reportNetTable(Mod) Mod.mergeNetTableBusses() buildPinDirs(Mod, Env) Nets = list(Mod.netTable.keys()) Num = 0 Singles = {} Fines = [] for Net in Nets: if Net in Mod.nets: Dir, WW = Mod.nets[Net] if not is_external_dir(Dir): List = Mod.netTable[Net] if len(List) == 1: Inst, Type, Pin = List[0] if Inst not in Singles: Singles[Inst] = [(Type, Pin, Net)] else: Singles[Inst].append((Type, Pin, Net)) else: DD = [] for Inst, Type, Pin in List: if Type in Env.Modules: if Pin in Env.Modules[Type].nets: D1, _ = Env.Modules[Type].nets[Pin] if 'output' in D1: D1 = 'output' DD.append(D1) if not reasonableDirs(DD): logs.log_error('net %s has a problem %s' % (Net, DD)) else: print('WWWWW', Net) for Inst in Mod.insts: if Inst not in Singles: Type = Mod.insts[Inst].Type Fines.append((Inst, Type)) for Inst in Singles: LL = Singles[Inst] (Type, _, _) = LL[0] logs.log_info('SINGLE ____ %s %s' % (Inst, Type)) for Type, Pin, Net in LL: if Net in Mod.nets: Dir, Wid = Mod.nets[Net] if type(Wid) is tuple: Net = '%s[%s:%s]' % (Net, Wid[0], Wid[1]) Dir = '.' if (Inst, Pin) in PINDIRS: Dir = PINDIRS[(Inst, Pin)] logs.log_info(' #%d %-50s %s' % (Num, Net, Dir)) Num += 1 Date = datetime.date.today() Time = datetime.datetime.now() DDD = str(Date.day) + '/' + str(Date.month) + '/' + str( Date.year) + ' ' + str(Time.hour) + 'h,%s' % (os.environ['HOST']) CSVDATE = 'd' + str(Date.day) + '_m' + str(Date.month) + '_' + str( Date.year) + '_' + str(Time.hour) + 'h' Fcsv = open('missing_%s.csv' % CSVDATE, 'w') Fcsv.write('generated on,%s\n' % DDD) Fcsv.write( 'MODULE,Instance,Type,Orphan Connect,Port Dir,Suggested Buddy\n') Num = 0 for Inst in Singles: LL = Singles[Inst] (Type, _, _) = LL[0] Fcsv.write('cell ,%s,%s\n' % (Inst, Type)) for Type, Pin, Net in LL: Dir = '.' if (Inst, Pin) in PINDIRS: Dir = PINDIRS[(Inst, Pin)] if Net in Mod.nets: _, Wid = Mod.nets[Net] if type(Wid) is tuple: Net = '%s[%s:%s]' % (Net, Wid[0], Wid[1]) Fcsv.write('%d,,,%s,%s,\n' % (Num, Net, Dir)) Num += 1 Fcsv.write('MODULE,Fully Covered\n') for Inst, Type in Fines: Fcsv.write('cell ,%s,%s\n' % (Inst, Type)) Fcsv.close()