def merge(self, other): for member in other.members: self.members.add(member) # Give us a net number if possible if self.number is None: self.number = other.number ''' Any conflicting net status? Conflict VCC and GNDcolor=None Warning? PU/PD and VSS/GND Transition UNKNOWN and X: X ''' # Expect most common case #print 'net merge, potential = (self: %u, other: %u)' %(self.potential, other.potential) if self.potential == other.potential: pass elif self.potential == Net.UNKNOWN: self.potential = other.potential else: p1 = self.potential p2 = other.potential # Sort to reduce cases (want p1 lower) if p1 > p2: p = p1 p1 = p2 p2 = p # Expect most common case: both unknown if p2 == Net.UNKNOWN: pass # One known but not the other? elif p1 == Net.UNKNOWN: self.potential = p2 elif p1 == Net.VDD and p2 == Net.GND: if True: r = PolygonRenderer(title='Shorted net', width=get_debug_width(), height=get_debug_height()) for member in self.members: color = 'blue' if member.net == self: color = 'red' if member.net == other: color = 'orange' r.add_polygon(member, color=color) r.render() raise Exception("Supply shorted") elif (p1 == Net.VDD or p1 == Net.GND) and (p2 == Net.PU or p2 == Net.PD): print 'WARNING: eliminating pullup/pulldown status due to direct supply connection' self.potential = p1 else: print p1 print p2 raise Exception('Unaccounted for net potential merge') #print 'End potential: %u' % self.potential for name in other.names: self.names.add(name)
def merge(self, other): for member in other.members: self.members.add(member) # Give us a net number if possible if self.number is None: self.number = other.number ''' Any conflicting net status? Conflict VCC and GNDcolor=None Warning? PU/PD and VSS/GND Transition UNKNOWN and X: X ''' # Expect most common case #print 'net merge, potential = (self: %u, other: %u)' %(self.potential, other.potential) if self.potential == other.potential: pass elif self.potential == Net.UNKNOWN: self.potential = other.potential else: p1 = self.potential p2 = other.potential # Sort to reduce cases (want p1 lower) if p1 > p2: p = p1 p1 = p2 p2 = p # Expect most common case: both unknown if p2 == Net.UNKNOWN: pass # One known but not the other? elif p1 == Net.UNKNOWN: self.potential = p2 elif p1 == Net.VDD and p2 == Net.GND: if True: r = PolygonRenderer(title='Shorted net', width = get_debug_width(), height=get_debug_height()) for member in self.members: color = 'blue' if member.net == self: color = 'red' if member.net == other: color = 'orange' r.add_polygon(member, color=color) r.render() raise Exception("Supply shorted") elif (p1 == Net.VDD or p1 == Net.GND) and (p2 == Net.PU or p2 == Net.PD): print 'WARNING: eliminating pullup/pulldown status due to direct supply connection' self.potential = p1 else: print p1 print p2 raise Exception('Unaccounted for net potential merge') #print 'End potential: %u' % self.potential for name in other.names: self.names.add(name)
def __init__(self, title=None, width=None, height=None, fork=False): width = width or get_debug_width() or 400 height = height or get_debug_height() or 400 print 'Render width: %d, height: %d' % (width, height) self.width = width self.height = height self.fork = fork # In render order # (polygon, color) self.targets = list() # Polygon color overrides # [polygon] = color # Make this usually not take up memory but can if you really want it self.colors = dict() self.title = title if self.title is None: self.title = 'Polygon render' self.wireframe = False