def _build_layered_connection_dict(self, debug=False): """ First cut routing of the nets. This works layer by layer. The space between the layers is divided into tracks and only one net section may be on a track. """ self.layered_connection_dict = {} self._determine_glue_points() # Keep track on which tracks we're routing the horizontal # sections of the nets on. Forcing each horizontal section # to be on a unique track will prevent them from running on # top of each other. Consult this dictionary before assigning # horizontal tracks. # Keys are horizontal routing channel ids, '0' is the channel # between the inputs and the first layer of modules. The # value is the next available track. track_dictionary = {} # hypernet_list = [] net_id = 0 for start_conn, end_conn in self.connection_list: # Track info for horizontal sections layer = self._get_layer(start_conn) track = track_dictionary.setdefault(layer, 0) netname = 'hypernet_' + str(net_id) # Get start point start_point = self.glue_points[start_conn] end_point = self.glue_points[end_conn] # Prepare drawing object drawobj = Drawing_Object(name=netname, parent=self, label=netname, obj_type='hypernet') drawobj.layer = layer drawobj.track = track drawobj.start_conn = start_conn drawobj.end_conn = end_conn # Midway point - this is the x co-ord for the horizontal section drawobj.horizontal_origin = (((end_point.x - start_point.x) / 2) + start_point.x) drawobj.hypernet_tree = [ start_point.x, start_point.y, 0, # horizontal section position end_point.y, end_point.x ] drawobj.update_horizontal_position() # ... self.layered_connection_dict.setdefault(layer, []).append(drawobj) net_id += 1 track_dictionary[layer] += 1 if debug: print "FROM:", start_conn, " TO:", end_conn print " X:", start_point.x, end_point.x print " ", drawobj.hypernet_tree
def _build_layered_connection_dict( self, debug=False ): """ First cut routing of the nets. This works layer by layer. The space between the layers is divided into tracks and only one net section may be on a track. """ self.layered_connection_dict = {} self._determine_glue_points() # Keep track on which tracks we're routing the horizontal # sections of the nets on. Forcing each horizontal section # to be on a unique track will prevent them from running on # top of each other. Consult this dictionary before assigning # horizontal tracks. # Keys are horizontal routing channel ids, '0' is the channel # between the inputs and the first layer of modules. The # value is the next available track. track_dictionary = {} # hypernet_list = [] net_id = 0 for start_conn, end_conn in self.connection_list: # Track info for horizontal sections layer = self._get_layer( start_conn ) track = track_dictionary.setdefault( layer, 0 ) netname = 'hypernet_'+str(net_id) # Get start point start_point = self.glue_points[start_conn] end_point = self.glue_points[end_conn] # Prepare drawing object drawobj = Drawing_Object(name=netname, parent=self, label=netname, obj_type='hypernet') drawobj.layer = layer drawobj.track = track drawobj.start_conn = start_conn drawobj.end_conn = end_conn # Midway point - this is the x co-ord for the horizontal section drawobj.horizontal_origin = ( ( ( end_point.x - start_point.x ) / 2 ) + start_point.x ) drawobj.hypernet_tree = [ start_point.x, start_point.y, 0, # horizontal section position end_point.y, end_point.x ] drawobj.update_horizontal_position() # ... self.layered_connection_dict.setdefault( layer, [] ).append( drawobj ) net_id += 1 track_dictionary[layer] += 1 if debug: print "FROM:", start_conn, " TO:", end_conn print " X:", start_point.x, end_point.x print " ", drawobj.hypernet_tree
def _build_drawing_object_dict(self, debug=False): """ Build the list of objects to display on the screen. Add the instance modules and ports.""" self.drawing_object_dict = {} # Add module instanciations to the list # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if self.module.inst_dict.values(): for iii, inst in enumerate(self.module.inst_dict.values()): drawobj = Drawing_Object( name=inst.module_ref.name, parent=self, #hmmm, for flightlines only! FIXME label=inst.name, obj_type='module', ) submod = inst.module_ref for port_name in submod.port_name_list: port = submod.port_dict[ port_name] # This preserves port ordering if port.direction == 'input': drawobj.lhs_ports.append(port.GetLabelStr()) else: drawobj.rhs_ports.append(port.GetLabelStr()) # Add to drawing object dict self.drawing_object_dict[inst.name] = drawobj else: # a wee fake thingy for modules with no sub modules drawobj = Drawing_Object( name='_Nothing_', parent=self, #hmmm, for flightlines only! FIXME label='_here', obj_type='module') self.drawing_object_dict['_Nothing'] = drawobj # Add the port instances # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if self.module.port_name_list: for port in self.module.port_dict.values(): if port.direction == 'input': key = '_iport' else: key = '_oport' # Unitless positions for the meantime #x_pos += 2 # inst_col_dict[key] drawobj = Drawing_Object( name='port', parent=self, #hmmm label=port.GetLabelStr(), obj_type='port') #print port.direction if port.direction == 'output': drawobj.mirror = True drawobj._update_sizes() # Add to drawing object dict self.drawing_object_dict[port.GetLabelStr()] = drawobj else: print "Woops, modules should have ports, " + \ self.module.name + " doesn't seem to have ones!" # Add any passthrus as they are needed. These are vertice # names in the graph dictionary which are not covered by # inst or port names. passthru_id = 0 for node in self.graph_edges.keys(): if not self.drawing_object_dict.get(node, None): if node == '_iport': continue if debug: print "Found a new thang..", node drawobj = Drawing_Object( name=node + '_' + str(passthru_id), parent=self, #hmmm, for flightlines only! FIXME label=node, obj_type='passthru', ) drawobj.lhs_ports.append('_in') drawobj.rhs_ports.append('_out') drawobj.startpt = wx.Point(0, 0) drawobj.endpt = wx.Point(20, 0) self.drawing_object_dict[node] = drawobj passthru_id += 1 if debug: libdb.show_dictionary("Drawing Object Dictionary", self.drawing_object_dict)
def _build_drawing_object_dict( self, debug=False): """ Build the list of objects to display on the screen. Add the instance modules and ports.""" self.drawing_object_dict = {} # Add module instanciations to the list # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if self.module.inst_dict.values() : for iii,inst in enumerate(self.module.inst_dict.values()): drawobj = Drawing_Object( name=inst.module_ref.name, parent=self, #hmmm, for flightlines only! FIXME label=inst.name, obj_type='module', ) submod = inst.module_ref for port_name in submod.port_name_list: port = submod.port_dict[ port_name ] # This preserves port ordering if port.direction == 'input': drawobj.lhs_ports.append( port.GetLabelStr() ) else: drawobj.rhs_ports.append( port.GetLabelStr() ) # Add to drawing object dict self.drawing_object_dict[inst.name] = drawobj else: # a wee fake thingy for modules with no sub modules drawobj = Drawing_Object( name='_Nothing_', parent=self, #hmmm, for flightlines only! FIXME label='_here', obj_type='module') self.drawing_object_dict['_Nothing'] = drawobj # Add the port instances # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if self.module.port_name_list: for port in self.module.port_dict.values(): if port.direction == 'input': key = '_iport' else: key = '_oport' # Unitless positions for the meantime #x_pos += 2 # inst_col_dict[key] drawobj = Drawing_Object( name='port', parent=self, #hmmm label=port.GetLabelStr(), obj_type='port' ) #print port.direction if port.direction == 'output': drawobj.mirror = True drawobj._update_sizes() # Add to drawing object dict self.drawing_object_dict[port.GetLabelStr()] = drawobj else: print "Woops, modules should have ports, " + \ self.module.name + " doesn't seem to have ones!" # Add any passthrus as they are needed. These are vertice # names in the graph dictionary which are not covered by # inst or port names. passthru_id = 0 for node in self.graph_edges.keys(): if not self.drawing_object_dict.get( node, None ): if node == '_iport': continue if debug: print "Found a new thang..", node drawobj = Drawing_Object( name=node + '_' + str(passthru_id), parent=self, #hmmm, for flightlines only! FIXME label=node, obj_type='passthru', ) drawobj.lhs_ports.append( '_in' ) drawobj.rhs_ports.append( '_out' ) drawobj.startpt = wx.Point(0,0) drawobj.endpt = wx.Point(20,0) self.drawing_object_dict[node] = drawobj passthru_id += 1 if debug: libdb.show_dictionary( "Drawing Object Dictionary", self.drawing_object_dict )