Пример #1
0
def OpenLibrary(libname):
    ns=openaccess22.oaNativeNS()
    slibname=openaccess22.oaScalarName(ns,libname)

    # set mode to apped
    oas=openaccess22.oaString("lib.defs")
    liblist=openaccess22.oaLibDefList.static_get(oas,'r')

    found=0
    # We only check top level members for the entry
    for libdefmem in liblist.getMembersIter():
      if (libdefmem.getType().oaTypeEnum()!=openaccess22.oacLibDefType): continue
      sname=openaccess22.oaScalarName()
      libdefmem.getLibName(sname)
      sname.get(ns,oas)
      name=str(oas)
      if (name==libname):
        ostr=openaccess22.oaString()
        libdefmem.getLibPath(ostr)
        libpath=str(ostr)
        found=1
        break
    liblist.destroy()
    if (not found):
      return None
     
    lib=openaccess22.oaLib.static_find(slibname)
    if (not lib):
      lib=openaccess22.oaLib.static_open(slibname,libpath)
    access=openaccess22.oaLibAccessLevelEnum(openaccess22.oacReadLibAccessLevel)
    access=openaccess22.oaLibAccess(access)
    lib.getAccess(access)
    return lib
Пример #2
0
 def trace_net(self, net, dir, depth):
     self.trace_enet(net, dir, depth)
     for enet in net.getEquivalentNetsIter():
         rep = ""
         for i in range(depth - 1):
             rep = rep + "  "
         repname = openaccess22.oaString()
         if enet.isOccObject():
             enet.getPathName(self.mNS, repname)
         else:
             enet.getName(self.mNS, repname)
         rep = rep + " EqNet: " + str(repname)
         self.mReport.append(rep)
         self.trace_enet(enet, self.mDir, depth)
     for mnet in net.getSingleBitMembersIter():
         if mnet == net:
             continue
         rep = ""
         for i in range(depth - 1):
             rep = rep + "  "
         repname = openaccess22.oaString()
         if mnet.isOccObject():
             mnet.getPathName(self.mNS, repname)
         else:
             mnet.getName(self.mNS, repname)
         rep = rep + " MemNet: " + str(repname)
         self.mReport.append(rep)
         self.trace_net(mnet, self.mDir, depth)
Пример #3
0
def OpenLibrary(libname):
    ns = openaccess22.oaNativeNS()
    slibname = openaccess22.oaScalarName(ns, libname)

    # set mode to apped
    oas = openaccess22.oaString("lib.defs")
    liblist = openaccess22.oaLibDefList.static_get(oas, "r")

    found = 0
    # We only check top level members for the entry
    for libdefmem in liblist.getMembersIter():
        if libdefmem.getType().oaTypeEnum() != openaccess22.oacLibDefType:
            continue
        sname = openaccess22.oaScalarName()
        libdefmem.getLibName(sname)
        sname.get(ns, oas)
        name = str(oas)
        if name == libname:
            ostr = openaccess22.oaString()
            libdefmem.getLibPath(ostr)
            libpath = str(ostr)
            found = 1
            break
    liblist.destroy()
    if not found:
        return None

    lib = openaccess22.oaLib.static_find(slibname)
    if not lib:
        lib = openaccess22.oaLib.static_open(slibname, libpath)
    access = openaccess22.oaLibAccessLevelEnum(openaccess22.oacReadLibAccessLevel)
    access = openaccess22.oaLibAccess(access)
    lib.getAccess(access)
    return lib
Пример #4
0
    def trace_instance_list(self, cmd, names):
        list = self.validate(cmd, names)
        for instname in list:
            name = openaccess22.oaSimpleName(self.mNS, instname)
            inst = None
            typname = self.mDesign.getType().oaTypeEnum()
            if typname == openaccess22.oacBlockType:
                inst = openaccess22.oaInst.static_find(self.mDesign, name)
            if typname == openaccess22.oacModuleType:
                inst = openaccess22.oaModInst.static_find(self.mDesign, name)
            if typname == openaccess22.oacOccurrenceType:
                inst = openaccess22.oaOccInst.static_find(self.mDesign.getTopOccurrence(), name)
            if inst == None:
                print "Can't Find Instance: ", instname
                continue

            instname = openaccess22.oaString()
            if inst.isOccObject():
                inst.getPathName(self.mNS, instname)
            else:
                inst.getName(self.mNS, instname)
            instname = str(instname)
            rep = "Inst: " + instname
            self.mReport.append(rep)
            if self.mFirstObj == None:
                self.mFirstObj = inst
            self.trace_instance(inst, self.mDir, 1)
        self.log_report(cmd, names)
Пример #5
0
 def AllObjects(self):
   l=[]
   ns=openaccess22.oaNativeNS()
   s=openaccess22.oaString()
   for obj in self.mDesign.getNetsIter(openaccess22.oacNetIterAll):
     l.append(obj)
   return l
Пример #6
0
 def AllObjects(self):
     l = []
     ns = openaccess22.oaNativeNS()
     s = openaccess22.oaString()
     for obj in self.mDesign.getNetsIter(openaccess22.oacNetIterAll):
         l.append(obj)
     return l
Пример #7
0
 def PickView(self,*v):
   if (self.mInPickLibrary): return
   if (self.mInPickCell): return
   ns=openaccess22.oaNativeNS()
   libtext=self.mLibrary.get()
   libName=openaccess22.oaScalarName(ns,libtext)
   lib=OpenLibrary(libtext)
   if (lib==None): return
   cellName=openaccess22.oaScalarName(ns,self.mCell.get())
   cell=openaccess22.oaCell.static_find(lib,cellName)
   if (cell==None): return
   viewName=openaccess22.oaScalarName(ns,self.mView.get())
   design=openaccess22.oaDesign.static_open(libName,cellName,viewName,'r')
   if (design==None):
     return
   
   self.mInView=1 
   self.EmptyModule()
   self.mModuleNames.append(' -Design-')
   self.mModuleNames.append(' -TopBlock-')
   self.mModuleNames.append(' -TopModule-')
   self.mModuleNames.append(' -TopOccurrence-')
   s=openaccess22.oaString()
   for mod in design.getModulesIter():
     mod.getName(ns,s)
     self.mModuleNames.append(str(s))
   self.mModule.setvalues(self.mModuleNames)
   design.close()
   self.mInView=0
Пример #8
0
    def PickView(self, *v):
        if self.mInPickLibrary:
            return
        if self.mInPickCell:
            return
        ns = openaccess22.oaNativeNS()
        libtext = self.mLibrary.get()
        libName = openaccess22.oaScalarName(ns, libtext)
        lib = OpenLibrary(libtext)
        if lib == None:
            return
        cellName = openaccess22.oaScalarName(ns, self.mCell.get())
        cell = openaccess22.oaCell.static_find(lib, cellName)
        if cell == None:
            return
        viewName = openaccess22.oaScalarName(ns, self.mView.get())
        design = openaccess22.oaDesign.static_open(libName, cellName, viewName, "r")
        if design == None:
            return

        self.mInView = 1
        self.EmptyModule()
        self.mModuleNames.append(" -Design-")
        self.mModuleNames.append(" -TopBlock-")
        self.mModuleNames.append(" -TopModule-")
        self.mModuleNames.append(" -TopOccurrence-")
        s = openaccess22.oaString()
        for mod in design.getModulesIter():
            mod.getName(ns, s)
            self.mModuleNames.append(str(s))
        self.mModule.setvalues(self.mModuleNames)
        design.close()
        self.mInView = 0
Пример #9
0
 def PickCell(self, *v):
     if self.mInPickLibrary:
         return
     ns = openaccess22.oaNativeNS()
     try:
         s = self.mLibrary.get()
     except:
         return
     lib = OpenLibrary(s)
     if lib == None:
         return
     try:
         s = openaccess22.oaScalarName(ns, self.mCell.get())
     except:
         return
     cell = openaccess22.oaCell.static_find(lib, s)
     if cell == None:
         return
     self.mInPickCell = 1
     self.EmptyView()
     s = openaccess22.oaString()
     for cv in cell.getCellViewsIter():
         view = cv.getView()
         view.getName(ns, s)
         self.mViewNames.append(str(s))
     self.mView.setvalues(self.mViewNames)
     self.mInPickCell = 0
Пример #10
0
 def ObjectName(self,obj):
   ns=openaccess22.oaNativeNS()
   s=openaccess22.oaString()
   if (obj.isOccObject()):
     obj.getPathName(ns,s)
   else:
     obj.getName(ns,s)
   return str(s)
Пример #11
0
 def ObjectName(self, obj):
     ns = openaccess22.oaNativeNS()
     s = openaccess22.oaString()
     if (obj.isOccObject()):
         obj.getPathName(ns, s)
     else:
         obj.getName(ns, s)
     return str(s)
Пример #12
0
def getInstCellviewNames(inst):
  s=openaccess22.oaString()
  ns=openaccess22.oaNativeNS()
  l=[]
  inst.getLibName(ns,s)
  l.append(str(s))
  inst.getCellName(ns,s)
  l.append(str(s))
  inst.getViewName(ns,s)
  l.append(str(s))
  return l
Пример #13
0
def getCellviewNames(design):
  design=design.getDesign()
  s=openaccess22.oaString()
  ns=openaccess22.oaNativeNS()
  l=[]
  design.getLibName(ns,s)
  l.append(str(s))
  design.getCellName(ns,s)
  l.append(str(s))
  design.getViewName(ns,s)
  l.append(str(s))
  return l
Пример #14
0
def getModuleNames(module):
  design=module.getDesign()
  s=openaccess22.oaString()
  ns=openaccess22.oaNativeNS()
  l=[]
  design.getLibName(ns,s)
  l.append(str(s))
  design.getCellName(ns,s)
  l.append(str(s))
  design.getViewName(ns,s)
  l.append(str(s))
  module.getName(ns,s)
  l.append(str(s))
  return l
Пример #15
0
 def PickLibrary(self,*v):
   ns=openaccess22.oaNativeNS()
   try:
     s=self.mLibrary.get()
   except:
     return
   lib=OpenLibrary(s)
   if (lib==None): return
   self.mInPickLibrary=1
   self.EmptyCell()
   s=openaccess22.oaString()
   for cell in lib.getCellsIter():
     cell.getName(ns,s)
     self.mCellNames.append(str(s))
   self.mCell.setvalues(self.mCellNames)
   self.mInPickLibrary=0
Пример #16
0
 def PickLibrary(self, *v):
     ns = openaccess22.oaNativeNS()
     try:
         s = self.mLibrary.get()
     except:
         return
     lib = OpenLibrary(s)
     if lib == None:
         return
     self.mInPickLibrary = 1
     self.EmptyCell()
     s = openaccess22.oaString()
     for cell in lib.getCellsIter():
         cell.getName(ns, s)
         self.mCellNames.append(str(s))
     self.mCell.setvalues(self.mCellNames)
     self.mInPickLibrary = 0
Пример #17
0
def GetLibraryList():
    ns=openaccess22.oaNativeNS()

    # set mode to apped
    oas=openaccess22.oaString("lib.defs")
    liblist=openaccess22.oaLibDefList.static_get(oas,'r')

    result=[]
    # We only check top level members for the entry
    for libdefmem in liblist.getMembersIter():
      if (libdefmem.getType().oaTypeEnum()!=openaccess22.oacLibDefType): continue
      sname=openaccess22.oaScalarName()
      libdefmem.getLibName(sname)
      sname.get(ns,oas)
      name=str(oas)
      result.append(name)
    return result
Пример #18
0
def GetLibraryList():
    ns = openaccess22.oaNativeNS()

    # set mode to apped
    oas = openaccess22.oaString("lib.defs")
    liblist = openaccess22.oaLibDefList.static_get(oas, "r")

    result = []
    # We only check top level members for the entry
    for libdefmem in liblist.getMembersIter():
        if libdefmem.getType().oaTypeEnum() != openaccess22.oacLibDefType:
            continue
        sname = openaccess22.oaScalarName()
        libdefmem.getLibName(sname)
        sname.get(ns, oas)
        name = str(oas)
        result.append(name)
    return result
Пример #19
0
def getDesObjectRepr(obj):
  if (obj.isBlockObject()):
    s='oaBlock: %s'%getCellviewFullname(obj)
  elif (obj.isModObject()):
    s='oaModule: %s'%getModuleFullname(obj)
  elif (obj.isOccObject()):
    s='oaOccurrence: %s '%getCellviewFullname(obj)
    oinst=obj.getOccInst()
    if (oinst):
      ss=openaccess22.oaString()
      ns=openaccess22.oaNativeNS()
      oinst.getPathName(ns,ss)
      s+=str(ss)
    else:
      s+='.'
  else:
    s=str(obj)
  return s  
Пример #20
0
    def trace_net_list(self, cmd, names):
        list = self.validate(cmd, names)
        for netname in list:
            name = openaccess22.oaName(self.mNS, netname)
            net = None
            typname = self.mDesign.getType().oaTypeEnum()
            if typname == openaccess22.oacBlockType:
                net = openaccess22.oaNet.static_find(self.mDesign, name)
            if typname == openaccess22.oacModuleType:
                net = openaccess22.oaModNet.static_find(self.mDesign, name)
            if typname == openaccess22.oacOccurrenceType:
                net = openaccess22.oaOccNet.static_find(self.mDesign.getTopOccurrence(), name)
            if net == None:
                if name.getType().oaNameTypeEnum() == openaccess22.oacVectorBitNameType:
                    sname = openaccess22.oaScalarName()
                    vname = name.getVectorBit()
                    vname.getBaseName(sname)
                    if typname == openaccess22.oacBlockType:
                        net = openaccess22.oaBusNetBit.static_find(self.mDesign, sname, vname.getIndex())
                    if typname == openaccess22.oacModuleType:
                        net = openaccess22.oaModBusNetBit.static_find(self.mDesign, sname, vname.getIndex())
                    if typname == openaccess22.oacOccurrenceType:
                        net = openaccess22.oaOccBusNetBit.static_find(
                            self.mDesign.getTopOccurrence(), sname, vname.getIndex()
                        )
                if net == None:
                    print "Can't Find Net: ", netname
                    continue
            for snet in net.getSingleBitMembersIter():
                net = snet.getPreferredEquivalent()
                fo = self.trace_net_fo(net)

                repname = openaccess22.oaString()
                if net.isOccObject():
                    net.getPathName(self.mNS, repname)
                else:
                    net.getName(self.mNS, repname)
                rep = "Net: " + str(repname) + " { fanout=" + str(fo) + " }"
                self.mReport.append(rep)
                if self.mFirstObj == None:
                    self.mFirstObj = net
                self.trace_net(net, self.mDir, 1)

        self.log_report(cmd, names)
Пример #21
0
 def PickCell(self,*v):
   if (self.mInPickLibrary): return
   ns=openaccess22.oaNativeNS()
   try:
     s=self.mLibrary.get()
   except:
     return
   lib=OpenLibrary(s)
   if (lib==None): return
   try:
     s=openaccess22.oaScalarName(ns,self.mCell.get())
   except:
     return
   cell=openaccess22.oaCell.static_find(lib,s)
   if (cell==None): return
   self.mInPickCell=1
   self.EmptyView()
   s=openaccess22.oaString()
   for cv in cell.getCellViewsIter():
     view=cv.getView()
     view.getName(ns,s)
     self.mViewNames.append(str(s))
   self.mView.setvalues(self.mViewNames)
   self.mInPickCell=0
Пример #22
0
    def trace_term_list(self, cmd, names):
        list = self.validate(cmd, names)
        for termname in list:
            name = openaccess22.oaName(self.mNS, termname)
            term = None
            typname = self.mDesign.getType().oaTypeEnum()
            if typname == openaccess22.oacBlockType:
                term = openaccess22.oaTerm.static_find(self.mDesign, name)
            if typname == openaccess22.oacModuleType:
                term = openaccess22.oaModTerm.static_find(self.mDesign, name)
            if typname == openaccess22.oacOccurrenceType:
                term = openaccess22.oaOccTerm.static_find(self.mDesign, name)
            if term == None:
                if name.getType().oaNameTypeEnum() == openaccess22.oacVectorBitNameType:
                    sname = openaccess22.oaScalarName()
                    vname = name.getVectorBit()
                    vname.getBaseName(sname)
                    if typname == openaccess22.oacBlockType:
                        term = openaccess22.oaBusTermBit.static_find(self.mDesign, sname, vname.getIndex())
                    if typname == openaccess22.oacModuleType:
                        term = openaccess22.oaModBusTermBit.static_find(self.mDesign, sname, vname.getIndex())
                    if typname == openaccess22.oacOccurrenceType:
                        term = openaccess22.oaOccBusTermBit.static_find(self.mDesign, sname, vname.getIndex())
                if term == None:
                    print "Can't Find Term: ", termname
                    continue
            termname = openaccess22.oaString()
            term.getName(self.mNS, termname)
            termname = str(termname)
            rep = "Term: " + termname + " ("
            termtype = term.getTermType().oaTermTypeEnum()
            if termtype == "oacInputTermType":
                rep = rep + "I"
            elif termtype == "oacOutputTermType":
                rep = rep + "O"
            elif termtype == "oacInputOutputTermType":
                rep = rep + "B"
            else:
                rep = rep + "X"
            rep = rep + ")"
            if self.mFirstObj == None:
                self.mFirstObj = term
            self.mReport.append(rep)
            net = term.getNet()
            netname = openaccess22.oaString()
            if net.isOccObject():
                net.getPathName(self.mNS, netname)
            else:
                net.getName(self.mNS, netname)
            netname = str(netname)
            rep = "Net: " + netname
            self.mReport.append(rep)
            # self.trace_net(net,self.mDir,1)
            for snet in net.getSingleBitMembersIter():
                net = snet.getPreferredEquivalent()
                fo = self.trace_net_fo(net)

                repname = openaccess22.oaString()
                if net.isOccObject():
                    net.getPathName(self.mNS, repname)
                else:
                    net.getName(self.mNS, repname)
                rep = "Net: " + str(repname) + " { fanout=" + str(fo) + " }"
                self.mReport.append(rep)
                if self.mFirstObj == None:
                    self.mFirstObj = net
                self.trace_net(net, self.mDir, 1)
        self.log_report(cmd, names)
Пример #23
0
def getCellviewName(design):
  design=design.getDesign()
  s=openaccess22.oaString()
  ns=openaccess22.oaNativeNS()
  design.getCellName(ns,s)
  return str(s)
Пример #24
0
def getOccInstOccFullname(inst):
  s=openaccess22.oaString()
  ns=openaccess22.oaNativeNS()
  inst.getPathName(ns,s)
  return str(s)
Пример #25
0
def getInstModuleFullname(inst):
  s=openaccess22.oaString()
  ns=openaccess22.oaNativeNS()
  inst.getMaster().getName(ns,s)
  return str(s)
Пример #26
0
def getInstCellviewName(inst):
  s=openaccess22.oaString()
  ns=openaccess22.oaNativeNS()
  inst.getCellName(ns,s)
  return str(s)
Пример #27
0
 def trace_enet(self, net, dir, depth):
     for p in range(3):
         if p == 1 and dir == 0:
             continue
         if p == 0 and dir == 1:
             continue
         for mnet, index in net.getMemberNetsIter():
             for bterm in mnet.getTermsIter():
                 term = bterm.getBit(index)
                 termtype = term.getTermType().oaTermTypeEnum()
                 if p == 0 and termtype != "oacInputTermType":
                     continue
                 if p == 1 and termtype != "oacOutputTermType":
                     continue
                 if p == 2 and termtype != "oacInputOutputTermType":
                     continue
                 rep = ""
                 for i in range(depth):
                     rep = rep + "  "
                 termname = openaccess22.oaString()
                 term.getName(self.mNS, termname)
                 termname = str(termname)
                 rep = rep + "Term: " + termname + " ("
                 if termtype == "oacInputTermType":
                     rep = rep + "I"
                 elif termtype == "oacOutputTermType":
                     rep = rep + "O"
                 elif termtype == "oacInputOutputTermType":
                     rep = rep + "B"
                 else:
                     rep = rep + "X"
                 rep += ")"
                 self.mReport.append(rep)
     for p in range(3):
         for mnet, index in net.getMemberNetsIter():
             for instterm in mnet.getInstTermsIter():
                 bterm = instterm.getTerm()
                 if bterm == None:
                     continue  # Unbound
                 term = bterm.getBit(index)
                 if term == None:
                     continue  # Unbound
                 termtype = term.getTermType().oaTermTypeEnum()
                 if p == 0 and termtype != "oacOutputTermType":
                     continue
                 if p == 1 and termtype != "oacInputTermType":
                     continue
                 if p == 2 and termtype != "oacInputOutputTermType":
                     continue
                 rep = ""
                 for i in range(depth):
                     rep = rep + "  "
                 inst = instterm.getInst()
                 termname = openaccess22.oaString()
                 # instterm.getTermName(self.mNS,termname)
                 term.getName(self.mNS, termname)
                 termname = str(termname)
                 instname = openaccess22.oaString()
                 if inst.isOccObject():
                     inst.getPathName(self.mNS, instname)
                 else:
                     inst.getName(self.mNS, instname)
                 instname = str(instname)
                 rep = rep + "Inst: " + instname + " (" + termname + ":"
                 if termtype == "oacInputTermType":
                     rep = rep + "I"
                 elif termtype == "oacOutputTermType":
                     rep = rep + "O"
                 elif termtype == "oacInputOutputTermType":
                     rep = rep + "B"
                 else:
                     rep = rep + "X"
                 rep = rep + ")"
                 self.mReport.append(rep)
                 if depth >= self.mMaxDepth:
                     continue
                 self.trace_instance(inst, p, depth + 1)
Пример #28
0
 def ObjectName(self,obj):
   ns=openaccess22.oaNativeNS()
   s=openaccess22.oaString()
   obj.getName(ns,s)
   return str(s)
Пример #29
0
 def trace_instance(self, inst, dir, depth):
     rep = ""
     for i in range(depth):
         rep = rep + "  "
     if inst.isBlockObject():
         rep = rep + "Cell: " + oaTracerUtl22.getInstCellviewFullname(inst)
     elif inst.isModObject() and inst.isModDesignInst():
         rep = rep + "Cell: " + oaTracerUtl22.getInstCellviewFullname(inst)
     elif inst.isModObject() and inst.isModModuleInst():
         rep = rep + "Mod: " + oaTracerUtl22.getInstModuleFullname(inst)
     elif inst.isOccObject() and inst.isOccDesignInst():
         rep = rep + "Cell: " + oaTracerUtl22.getInstCellviewFullname(inst)
     elif inst.isOccObject() and inst.isOccModuleInst():
         rep = rep + "Mod: " + oaTracerUtl22.getInstModuleFullname(inst)
     self.mReport.append(rep)
     if inst.isOccObject():
         rep = ""
         for i in range(depth):
             rep = rep + "  "
         rep = rep + "Occ: " + oaTracerUtl22.getOccInstOccFullname(inst)
         self.mReport.append(rep)
     for p in range(3):
         if p == 1 and dir == 0:
             continue
         if p == 0 and dir == 1:
             continue
         for instterm in inst.getInstTermsIter():
             term = instterm.getTerm()
             if term == None:
                 continue  # Unbound
             termtype = term.getTermType().oaTermTypeEnum()
             if p == 0 and termtype != "oacInputTermType":
                 continue
             if p == 1 and termtype != "oacOutputTermType":
                 continue
             if p == 2 and termtype != "oacInputOutputTermType":
                 continue
             net = instterm.getNet()
             if net != None:
                 netname = openaccess22.oaString()
                 if net.isOccObject():
                     net.getPathName(self.mNS, netname)
                 else:
                     net.getName(self.mNS, netname)
                 netname = str(netname)
             else:
                 netname = "OPEN"
             fo = -1
             if depth < self.mMaxDepth and p >= 1 and net != None:
                 fo = self.trace_net_fo(net)
             rep = ""
             for i in range(depth):
                 rep = rep + "  "
             termname = openaccess22.oaString()
             instterm.getTermName(self.mNS, termname)
             termname = str(termname)
             rep = rep + "Net: " + netname + " (" + termname + ":"
             if termtype == "oacInputTermType":
                 rep = rep + "I"
             elif termtype == "oacOutputTermType":
                 rep = rep + "O"
             elif termtype == "oacInputOutputTermType":
                 rep = rep + "B"
             else:
                 rep = rep + "X"
             rep = rep + ") "
             if fo >= 0:
                 rep = rep + " { fanout=" + str(fo) + " }"
             self.mReport.append(rep)
             if depth >= self.mMaxDepth:
                 continue
             if net != None:
                 self.trace_net(net, p, depth + 1)