def generateXML(self,masterinterface):
        """ Generate intercon code
        """
        masterinstance = masterinterface.getParent()

        # set name and description
        self.setName(str(masterinstance.getInstanceName()) \
                     + "_" \
                     + str(masterinterface.getName()))
        self.setInstanceName(str(masterinstance.getInstanceName())\
                             + "_"\
                             +str(masterinterface.getName())\
                             + "_intercon")
        self.setDescription("Connect slaves to "\
                            + masterinterface.getName()\
                            + " from "\
                            + masterinstance.getInstanceName())

        # Save to make directories
        self.saveInstance()

        #####
        # Create interface for each component connected on intercon
        # for slaves and master:
        slaveslist = masterinterface.getSlavesList()
        interfaceslist = [slave.getInterface() for slave in slaveslist]
        interfaceslist.append(masterinterface)

        # For each slave and master interface, create interface in intercon
        for interface in interfaceslist:
            instance = interface.getParent()

            #######
            # bus (wishbone,...)
            bus = Interface(self,
                            name=instance.getInstanceName()\
                                    +"_"+interface.getName())
            bus.setClass("intercon")
            # Adding bus interface on intercon
            self.addInterface(bus)

            #Creating port with invert direction value
            for port in interface.getPortsList():
                newport = Port(bus,
                               name=instance.getInstanceName()\
                                       +"_"+port.getName())
                newport.setDir(self.invertDir(port.getDir()))
                newport.setSize(port.getSize())
                # adding port on bus interface
                bus.addPort(newport)
                #connect port new port on instance interface
                port.connectAllPin(newport)



        bus.setClass("intercon")
        self.setNum("0")
Beispiel #2
0
    def generate_xml(self, masterinterface):
        """ Generate intercon code
        """
        masterinstance = masterinterface.parent

        # set name and description
        self.name = str(masterinstance.instancename) +\
            "_" + str(masterinterface.name)
        self.instancename = masterinstance.instancename +\
            "_" + masterinterface.name +\
            "_intercon"
        self.description = "Connect slaves to " + masterinterface.name +\
            " from " + masterinstance.instancename

        # Save to make directories
        self.save()

        # Create interface for each component connected on intercon
        # for slaves and master:
        slaveslist = masterinterface.slaves
        interfaceslist = [slave.get_interface() for slave in slaveslist]
        interfaceslist.append(masterinterface)

        # For each slave and master interface, create interface in intercon
        for interface in interfaceslist:
            instance = interface.parent

            # bus (wishbone,...)
            bus = Interface(self,
                            name=instance.instancename +
                            "_" + interface.name)
            bus.interface_class = "intercon"
            # Adding bus interface on intercon
            self.add_interface(bus)

            # Creating port with invert direction value
            for port in interface.ports:
                newport = Port(bus,
                               name=instance.instancename +
                               "_" + port.name)
                newport.direction = self.inv_direction(port.direction)
                newport.size = port.size
                # adding port on bus interface
                bus.add_port(newport)
                # connect port new port on instance interface
                port.connect_all_pins(newport)

        bus.interface_class = "intercon"
        self.num = "0"
Beispiel #3
0
    def load(self, instancename):
        """ Load an instance from project directory
        """
        # load xml file
        WrapperXml.__init__(self,
                            file=self.parent.projectpath + COMPONENTSPATH +
                            "/" + instancename + "/" + instancename + XMLEXT)

        # Fill objects list
        if self.get_node("interfaces") is not None:
            for element in self.get_subnodes("interfaces", "interface"):
                self._interfaceslist.append(Interface(self, node=element))

        if self.get_node("generics") is not None:
            for element in self.get_subnodes("generics", "generic"):
                self._genericslist.append(Generic(self, node=element))

        if self.get_node("hdl_files") is not None:
            for element in self.get_subnodes("hdl_files", "hdl_file"):
                self._hdl_fileslist.append(HdlFile(self, node=element))

        if self.get_node("driver_files") is not None:
            for element in\
                    self.get_subnodes("driver_files", "driver_templates"):
                self._driver_templateslist.append(
                    DriverTemplates(self, node=element))

        if self.get_node("interrupts") is not None:
            for element in self.get_subnodes("interrupts", "interrupt"):
                self._interruptslist.append(
                    self.get_interface(
                        element.get_attr_value("interface")).get_port(
                            element.get_attr_value("port")))

        if self.get_node("constraints") is not None:
            for element in self.get_subnodes("constraints", "constraint"):
                self._constraintslist.append(element)

        self.instancename = instancename
Beispiel #4
0
    def __init__(self, parent, **keys):
        """ Init Component,
            __init__(self, parent, node)
            __init__(self, parent, file)
        """
        if "node" in keys:
            Component.__init__(self, parent, node=keys["node"])
        elif "file" in keys:
            Component.__init__(self, parent, afile=keys["file"])
        else:
            raise PodError("Keys unknown in Platform constructor", 0)

        if self.get_node("interfaces") is not None:
            for element in self.get_node("interfaces").get_nodes("interface"):
                self._interfaceslist.append(Interface(self, node=element))
        self.librarieslist = []
        if self.get_node("simulation") is not None:
            for library in self.get_node("simulation").get_nodes("simlib"):
                self.librarieslist.append(SimulationLib(self, node=library))

        self.instancename = self.name
        self.parent = parent