Exemple #1
0
  def rotate(self, RevGAMT):
    if self.apname in ('Macro',):
      # Construct a rotated macro, see if it's in the GAMT, and set self.dimx
      # to its name if so. If not, add the rotated macro to the GAMT and set
      # self.dimx to the new name. Recall that GAMT maps name to macro
      # (e.g., GAMT['M9'] = ApertureMacro(...)) while RevGAMT maps hash to
      # macro name (e.g., RevGAMT[hash] = 'M9')
      AMR = config.GAMT[self.dimx].rotated()
      hash = AMR.hash()
      try:
        self.dimx = RevGAMT[hash]
      except KeyError:
        AMR = amacro.addToApertureMacroTable(AMR)   # adds to GAMT and modifies name to global name
        self.dimx = RevGAMT[hash] = AMR.name

    elif self.dimy is not None:       # Rectangles and Ovals have a dimy setting and need to be rotated
      t = self.dimx
      self.dimx = self.dimy
      self.dimy = t
Exemple #2
0
def constructApertureTable(fileList):
    # First we construct a dictionary where each key is the
    # string representation of the aperture. Then we go back and assign
    # numbers. For aperture macros, we construct their final version
    # (i.e., 'M1', 'M2', etc.) right away, as they are parsed. Thus,
    # we translate from 'THX10N' or whatever to 'M2' right away.
    GAT = config.GAT  # Global Aperture Table
    GAT.clear()
    GAMT = config.GAMT  # Global Aperture Macro Table
    GAMT.clear()
    RevGAMT = {
    }  # Dictionary keyed by aperture macro hash and returning macro name

    AT = {}  # Aperture Table for this file
    for fname in fileList:
        print 'Reading apertures from %s ...' % fname

        knownMacroNames = {}

        fid = file(fname, 'rt')
        for line in fid:
            # Get rid of CR
            line = line.replace('\x0D', '')

            if tool_pat.match(line):
                break  # When tools start, no more apertures are being defined

            # If this is an aperture macro definition, add its string
            # representation to the dictionary. It might already exist.
            # Ignore %AMOC8* from Eagle for now as it uses a macro parameter.
            if line[:7] == '%AMOC8*':
                continue

            # parseApertureMacro() sucks up all macro lines up to terminating '%'
            AM = amacro.parseApertureMacro(line, fid)
            if AM:
                # Has this macro definition already been defined (perhaps by another name
                # in another layer)?
                try:
                    # If this macro has already been encountered anywhere in any job,
                    # RevGAMT will map the macro hash to the global macro name. Then,
                    # make the local association knownMacroNames[localMacroName] = globalMacroName.
                    knownMacroNames[AM.name] = RevGAMT[AM.hash()]
                except KeyError:
                    # No, so define the global macro and do the translation. Note that
                    # addToApertureMacroTable() MODIFIES AM.name to the new M-name.
                    localMacroName = AM.name
                    AM = amacro.addToApertureMacroTable(AM)
                    knownMacroNames[localMacroName] = AM.name
                    RevGAMT[AM.hash()] = AM.name
            else:
                A = parseAperture(line, knownMacroNames)

                # If this is an aperture definition, add the string representation
                # to the dictionary. It might already exist.
                if A:
                    AT[A.hash()] = A

        fid.close()

    # Now, go through and assign sequential codes to all apertures
    code = 10
    for val in AT.values():
        key = 'D%d' % code
        GAT[key] = val
        val.code = key
        code += 1

    if 0:
        keylist = config.GAT.keys()
        keylist.sort()
        print 'Apertures'
        print '========='
        for key in keylist:
            print '%s' % config.GAT[key]
        sys.exit(0)
Exemple #3
0
def constructApertureTable(fileList):
  # First we construct a dictionary where each key is the
  # string representation of the aperture. Then we go back and assign
  # numbers. For aperture macros, we construct their final version
  # (i.e., 'M1', 'M2', etc.) right away, as they are parsed. Thus,
  # we translate from 'THX10N' or whatever to 'M2' right away.
  GAT = config.GAT      # Global Aperture Table
  GAT.clear()
  GAMT = config.GAMT    # Global Aperture Macro Table
  GAMT.clear()
  RevGAMT = {}          # Dictionary keyed by aperture macro hash and returning macro name

  AT = {}               # Aperture Table for this file
  for fname in fileList:
    #print 'Reading apertures from %s ...' % fname

    knownMacroNames = {}

    fid = file(fname,'rt')
    for line in fid:
      # Get rid of CR
      line = line.replace('\x0D', '')

      if tool_pat.match(line):
        break # When tools start, no more apertures are being defined

      # If this is an aperture macro definition, add its string
      # representation to the dictionary. It might already exist.
      # Ignore %AMOC8* from Eagle for now as it uses a macro parameter.
      if line[:7]=='%AMOC8*':
        continue

      # parseApertureMacro() sucks up all macro lines up to terminating '%'
      AM = amacro.parseApertureMacro(line, fid)
      if AM:
        # Has this macro definition already been defined (perhaps by another name
        # in another layer)?
        try:
          # If this macro has already been encountered anywhere in any job,
          # RevGAMT will map the macro hash to the global macro name. Then,
          # make the local association knownMacroNames[localMacroName] = globalMacroName.
          knownMacroNames[AM.name] = RevGAMT[AM.hash()]
        except KeyError:
          # No, so define the global macro and do the translation. Note that
          # addToApertureMacroTable() MODIFIES AM.name to the new M-name.
          localMacroName = AM.name
          AM = amacro.addToApertureMacroTable(AM)
          knownMacroNames[localMacroName] = AM.name
          RevGAMT[AM.hash()] = AM.name
      else:
        A = parseAperture(line, knownMacroNames)

        # If this is an aperture definition, add the string representation
        # to the dictionary. It might already exist.
        if A:
          AT[A.hash()] = A

    fid.close()

  # Now, go through and assign sequential codes to all apertures
  code = 10
  for val in AT.values():
    key = 'D%d' % code
    GAT[key] = val
    val.code = key
    code += 1

  if 0:
    keylist = config.GAT.keys()
    keylist.sort()
    print 'Apertures'
    print '========='
    for key in keylist:
      print '%s' % config.GAT[key]
    sys.exit(0)