コード例 #1
0
 def _ProcessLine(self, line, exclusionList):
     """processes the lines of a netlist  
     Lines that can be processed at this level are processed and lines that
     are unknown are place in a list of unknown lines for upstream processing.  This
     enables derived classes to benefit from what this class knows how to process and
     to simply add specific functionality.  As a simple example, a derived simulator class
     needs to add output probes, and this simple system description class knows nothing of
     this.  
     netlist lines that are handled at this level are:
     - 'device' - addition of devices.
     - 'connect' - handles device connections.
     - 'port' - adds system ports for s-parameter calculation.
     @param exclusionList list of strings representing commands to exclude.  These are either
     commands that are removed from the functionality (i.e. it would not be write to add a system
     port in a simulation), or commands that are withheld until further processing at a later time
     to enforce the order that commands are handled in.  For example, we like the netlist to be agnostic
     about the order of devices listed and device connections, but we cannot connect device ports until
     a device has been declared.
     """
     # pragma: silent exclude
     from SignalIntegrity.Lib.Parsers.Devices.DeviceParser import DeviceParser
     from SignalIntegrity.Lib.Helpers.LineSplitter import LineSplitter
     # pragma: include
     lineList = self.ReplaceArgs(LineSplitter(line))
     if len(lineList) == 0: return
     if self.ProcessVariables(lineList): return
     elif lineList[0] in exclusionList: self.m_ul.append(line)
     elif lineList[0] == 'device':
         argList = lineList[3:]
         if [lineList[2]] + argList in self.m_spcl:
             dev = DeviceParser(self.m_f, int(lineList[2]), None)
             dev.m_spf = self.m_spc[self.m_spcl.index([lineList[2]] +
                                                      argList)][1]
         else:
             dev = DeviceParser(self.m_f, int(lineList[2]), argList)
         self.m_sd.AddDevice(lineList[1], int(lineList[2]), dev.m_sp)
         if not dev.m_spf is None:
             self.m_spc.append((lineList[1], dev.m_spf))
             self.m_spcl.append([lineList[2]] + argList)
     elif lineList[0] == 'connect':
         for i in range(3, len(lineList), 2):
             self.m_sd.ConnectDevicePort(lineList[1], int(lineList[2]),
                                         lineList[i], int(lineList[i + 1]))
     elif lineList[0] == 'port':
         i = 1
         while i < len(lineList):
             port = int(lineList[i])
             # pragma: silent exclude
             if lineList[i + 1] == 'td':
                 if not hasattr(self, 'delayDict'): self.delayDict = {}
                 self.delayDict[port] = float(lineList[i + 2])
                 i = i + 2
             # pragma: include
             dev = lineList[i + 1]
             devPort = int(lineList[i + 2])
             self.m_sd.AddPort(dev, devPort, port, self.m_addThru)
             i = i + 3
     else:
         self.m_ul.append(line)
コード例 #2
0
 def _ProcessDeembedderLine(self, line):
     """processes a line of a netlist, handing deembedding specific commands  
     Lines that can be processed at this level are processed and lines that
     are unknown are place in a list of unknown lines for upstream processing.  This
     enables derived classes to benefit from what this class knows how to process and
     to simply add specific functionality.  As a simple example, a derived simulator class
     needs to add output probes, and this simple system description class knows nothing of
     this.  
     netlist lines that are handled at this level are:
     - 'system' - addition of the system
     - 'unknown' - addition of a device whose s-parameters are unknown.  
     Calls SystemDescriptionParser._ProcessLines(),
     exludes 'connect' and 'port' in first call, then processes simulator lines, then
     calls upstream one more time for the device connections, again excluding 'port'.
     """
     lineList = self.ReplaceArgs(line.split())
     if len(lineList) == 0: return
     if lineList[0] == 'system':
         dev = DeviceParser(self.m_f, None, lineList[1:])
         if not dev.m_spf is None:
             self.m_spc.append(('system', dev.m_spf))
     elif lineList[0] == 'unknown':
         self.m_sd.AddUnknown(lineList[1], int(lineList[2]))
     else:
         self.m_ul.append(line)