Esempio n. 1
0
    def _build_port_objects(self):
        """ Build Drawing_Object()s for each of the ports in the current module.
        Add them to the drawing object dictionary.
        """

        if self.module.port_name_list:
            for port in self.module.port_dict.values():

                # Unitless positions for the meantime
                drawobj = Drawing_Object(name='port',
                                         parent=None,
                                         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 any!"
Esempio n. 2
0
    def _build_passthru_objects(self, graph_edges_dict):
        """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 graph_edges_dict.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=None,
                    label=node,
                    obj_type='passthru',
                )

                drawobj.lhs_ports.append('_i')
                drawobj.rhs_ports.append('_o')
                drawobj.startpt = Point(0, 0)
                drawobj.endpt = Point(20, 0)

                self.drawing_object_dict[node] = drawobj

                passthru_id += 1
Esempio n. 3
0
    def _build_instn_objects(self):
        """ Build Drawing_Object()s for each of the instantiations in a module.
        Add them to the drawing object dictionary.
        """

        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=None,
                    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=None,
                                     label='_here',
                                     obj_type='module')

            self.drawing_object_dict['_Nothing'] = drawobj
Esempio n. 4
0
    def _build_passthru_objects(self, graph_edges_dict):
        """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 graph_edges_dict.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=None, 
                                          label=node,
                                          obj_type='passthru',
                                        )                

                drawobj.lhs_ports.append( '_i' )
                drawobj.rhs_ports.append( '_o' )
                drawobj.startpt = Point(0,0)
                drawobj.endpt   = Point(20,0)

                self.drawing_object_dict[node] = drawobj

                passthru_id += 1
Esempio n. 5
0
    def _build_port_objects(self):
        """ Build Drawing_Object()s for each of the ports in the current module.
        Add them to the drawing object dictionary.
        """

        if self.module.port_name_list:
            for port in self.module.port_dict.values():
            
                # Unitless positions for the meantime
                drawobj = Drawing_Object( name='port',
                                           parent=None,
                                           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 any!"
Esempio n. 6
0
    def run(self):
        trace_id = 0
        self._determine_glue_points()

        for conn1,conn2 in self.connections:
            name = 'conn_%d' %(trace_id)
            drawobj = Drawing_Object( name=name,
                                      parent=None,
                                      label=conn1,
                                      obj_type='conn' )
            
            drawobj.startpt  = self.glue_points[conn1]
            drawobj.endpt    = self.glue_points[conn2]
            self.obj_dict[name] = drawobj
            trace_id += 1
Esempio n. 7
0
    def run(self):
        trace_id = 0
        self._determine_glue_points()

        for conn1, conn2 in self.connections:
            name = 'conn_%d' % (trace_id)
            drawobj = Drawing_Object(name=name,
                                     parent=None,
                                     label=conn1,
                                     obj_type='conn')

            drawobj.startpt = self.glue_points[conn1]
            drawobj.endpt = self.glue_points[conn2]
            self.obj_dict[name] = drawobj
            trace_id += 1
Esempio n. 8
0
    def run(self):
        trace_id = 0
        self._build_port_layer_dict()
        self._determine_glue_points()

        #print self.G.display()
        
        # Build up drawing objects, and their hypernets
        #  All connections with the same net name in the same layer will be
        # collated in a single Hypernet object.
        for i_layer in self.G.edges:
            track = 1
            hypernet_dict = {}
            for e in self.G.edges.get(i_layer, []):
                if e.name not in hypernet_dict:
                    name = 'hypernet_%d' %(trace_id)
                    drawobj = Drawing_Object( name=name,
                        parent=None,
                        label=e.name,
                        obj_type='hypernet' )

                    hnet = hypernet.Hypernet(e.name)
                    hnet.set_track(track)
                    drawobj.set_hypernet(hnet)

                    hypernet_dict[e.name] = hnet
                    self.obj_dict[name] = drawobj
                    track += 1
                    trace_id += 1
                else:
                    hnet = hypernet_dict[e.name]

                # add connection to hypernet
                #print "+%d : %s.%s -> %s.%s" % (i_layer, e.source, e.source_port,
                #    e.target, e.target_port )
                #print e.source
                start_point = self.glue_points[(e.source, e.source_port)]
                end_point   = self.glue_points[(e.target, e.target_port)]
                hnet.add_connection(start_point, end_point)

            assign_tracks(hypernet_dict.values())
Esempio n. 9
0
    def run(self):
        trace_id = 0
        self._build_port_layer_dict()
        self._determine_glue_points()

        # print self.G.display()

        # Build up drawing objects, and their hypernets
        #  All connections with the same net name in the same layer will be
        # collated in a single Hypernet object.
        for i_layer in self.G.edges:
            track = 1
            hypernet_dict = {}
            for e in self.G.edges.get(i_layer, []):
                if e.name not in hypernet_dict:
                    name = "hypernet_%d" % (trace_id)
                    drawobj = Drawing_Object(name=name, parent=None, label=e.name, obj_type="hypernet")

                    hnet = hypernet.Hypernet(e.name)
                    hnet.set_track(track)
                    drawobj.set_hypernet(hnet)

                    hypernet_dict[e.name] = hnet
                    self.obj_dict[name] = drawobj
                    track += 1
                    trace_id += 1
                else:
                    hnet = hypernet_dict[e.name]

                # add connection to hypernet
                # print "+%d : %s.%s -> %s.%s" % (i_layer, e.source, e.source_port,
                #    e.target, e.target_port )
                # print e.source
                start_point = self.glue_points[(e.source, e.source_port)]
                end_point = self.glue_points[(e.target, e.target_port)]
                hnet.add_connection(start_point, end_point)

            assign_tracks(hypernet_dict.values())