Ejemplo n.º 1
0
 def __init__(self, parent):
     self.parent = parent
     filepath = self.parent.projectpath + "/" +\
         SIMULATIONPATH + "/simulation" + XMLEXT
     if not sy.file_exist(filepath):
         raise PodError("No simulation project found", 3)
     WrapperXml.__init__(self, file=filepath)
Ejemplo n.º 2
0
 def __init__(self,project):
     self.project = project
     filepath = settings.projectpath+"/"+DRIVERSPATH+"/drivers"+XMLEXT
     if not sy.fileExist(filepath):
         raise Error("No driver project found",3)
     WrapperXml.__init__(self,file=filepath)
     self.bspdir = None
Ejemplo n.º 3
0
    def loadInstance(self,instancename):
        """ Load an instance from project directory
        """
        # load xml file
        WrapperXml.__init__(self,file=settings.projectpath + COMPONENTSPATH +"/"\
                + instancename + "/" + instancename + XMLEXT)

        # Fill objects list
        if self.getNode("interfaces") != None:
            for element in self.getSubNodeList("interfaces","interface"):
                self.interfaceslist.append(Interface(self,node=element))

        if self.getNode("generics") != None:
            for element in self.getSubNodeList("generics","generic"):
                self.genericslist.append(Generic(self,node=element))

        if self.getNode("hdl_files")!= None:
            for element in self.getSubNodeList("hdl_files","hdl_file"):
                self.hdl_fileslist.append(Hdl_file(self,node=element))

        if self.getNode("driver_files")!=None:
            for element in self.getSubNodeList("driver_files","driver_templates"):
                self.driver_templateslist.append(Driver_Templates(self,node=element))

        if self.getNode("interrupts")!=None:
            for element in self.getSubNodeList("interrupts","interrupt"):
                self.interruptslist.append(
                        self.getInterface(
                            element.getAttributeValue("interface")).getPort(
                                element.getAttributeValue("port")))

        self.setInstanceName(instancename)
Ejemplo n.º 4
0
 def __init__(self,parent):
     self.parent = parent
     filepath = settings.projectpath+"/"+SYNTHESISPATH+"/synthesis"+XMLEXT
     if not sy.fileExist(filepath):
         raise Error("No synthesis project found",3)
     WrapperXml.__init__(self,file=filepath)
     # adding path for toolchain plugin
     sys.path.append(settings.path+TOOLCHAINPATH+\
             SYNTHESISPATH+"/"+self.getName())
Ejemplo n.º 5
0
 def __init__(self, parent, **keys):
     """ init driver_templates,
         __init__(self,parent,node)
         __init__(self,parent,nodestring)
     """
     self.parent = parent
     if "node" in keys:
         WrapperXml.__init__(self, node=keys["node"])
     elif "nodestring" in keys:
         WrapperXml.__init__(self, nodestring=keys["nodestring"])
     else:
         raise PodError("Keys unknown in DriverTemplates init()", 0)
Ejemplo n.º 6
0
 def __init__(self, parent, **keys):
     """ init Generic,
         __init__(self,parent,node)
         __init__(self,parent,nodestring)
     """
     self.parent = parent
     if "node" in keys:
         WrapperXml.__init__(self, node=keys["node"])
     elif "nodestring" in keys:
         WrapperXml.__init__(self, nodestring=keys["nodestring"])
     else:
         raise PodError("Keys unknown in SimulationLib init()", 0)
Ejemplo n.º 7
0
 def __init__(self,filename):
     self.filename = os.path.expanduser(filename)
     if os.path.exists(self.filename):
         WrapperXml.__init__(self,file=self.filename)
     else:
         print filename + " doesn't exist, be created"
         WrapperXml.__init__(self,nodename="podconfig")
         self.addNode(nodename="libraries")
         self.savefile()
     # fill library path list:
     self.personal_lib_list =\
         [node.getAttribute("path") 
                 for node in self.getSubNodeList("libraries","lib")]
Ejemplo n.º 8
0
 def __init__(self, parent, **keys):
     """ init Slave,
         __init__(self,parent,node)
         __init__(self,parent,instancename,interfacename)
     """
     self.parent = parent
     if "node" in keys:
         WrapperXml.__init__(self, node=keys["node"])
     elif "instancename" in keys:
         WrapperXml.__init__(self, nodename="slave")
         self.instancename = keys["instancename"]
         self.interfacename = keys["interfacename"]
     else:
         raise PodError("Keys unknowns in Slave init()", 0)
Ejemplo n.º 9
0
 def __init__(self,parent,**keys):
     """ Init Hdl_file,
         __init__(self,parent,node)
         __init__(self,filename,istop,scope)
     """
     self.parent = parent
     self.parser = None
     if "node" in keys:
         WrapperXml.__init__(self,node=keys["node"])
     elif "filename" in keys:
         self.__initfilename(filename=keys["filename"],
                             istop=keys["istop"],scope=keys["scope"])
     else:
         raise Error("Keys unknown in Hdl_file",0)
Ejemplo n.º 10
0
    def __init__(self, parent, **keys):
        """ init Pin,
            __init__(self,parent,node)
            __init__(self,parent,num)
        """

        self.parent = parent

        if "node" in keys:
            WrapperXml.__init__(self, node=keys["node"])
        elif "num" in keys:
            WrapperXml.__init__(self, nodename="pin")
            self.num = keys["num"]
        else:
            raise PodError("Keys unknown in Pin", 0)
Ejemplo n.º 11
0
    def __init__(self, parent, **keys):
        """ Init HdlFile,
            __init__(self, parent, node)
            __init__(self, filename, istop, scope)
        """
        self.parent = parent
        self.parser = None
        if "node" in keys:
            WrapperXml.__init__(self,
                                node=keys["node"])

        elif "filename" in keys:
            WrapperXml.__init__(self, nodename="hdl_file")
            if keys["istop"] == 1:
                self.settop()
            self.scope = keys["scope"]
            self.filename = keys["filename"]
        else:
            raise PodError("Keys unknown in HdlFile", 0)
Ejemplo n.º 12
0
    def __init__(self, parent, **keys):
        """ Init port,
            __init__(self, parent, name)
            __init__(self, parent, wxml)
        """

        self.parent = parent

        if "name" in keys:
            WrapperXml.__init__(self, nodename="port")
            self.set_attr("name", keys["name"])
        elif "node" in keys:
            WrapperXml.__init__(self, node=keys["node"])
        else:
            raise PodError("Keys not known in Port ", 0)

        self.pinlist = []
        for element in self.get_nodes("pin"):
            pin = Pin(self, node=element)
            self.pinlist.append(pin)
Ejemplo n.º 13
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
Ejemplo n.º 14
0
 def createComponent(self,componentname,libraryname,versionname):
     """ Creating new component 'componentname' for 
         library 'libraryname'
     """
     librarypath = settings.active_library.getLibraryPath(libraryname)
     componentpath = os.path.join(librarypath,componentname)
     # verify if component and version exist
     if sy.fileExist(os.path.join(componentpath,versionname+XMLEXT)):
             settings.active_component = None
             raise Error("Component version "+componentname+"."+versionname+\
                         " already exist")
     # make directories if component is really new
     if not sy.dirExist(componentpath):
         sy.makeDirectory(componentpath)
         sy.makeDirectory(os.path.join(componentpath,"hdl"))
         sy.makeDirectory(os.path.join(componentpath,"doc"))
         sy.makeDirectory(os.path.join(componentpath,"drivers_templates"))
     
     # create xml file
     WrapperXml.__init__(self,nodename="component")
     self.setName(componentname)
     self.saveComponent(os.path.join(componentpath,versionname))
     self.setVersionName(versionname)
Ejemplo n.º 15
0
    def __init__(self, projectpathname, void=0,
                 description="insert a description here"):
        """ create project if doesn't exist
        """
        self.void = void
        WrapperXml.__init__(self, nodename="void")
        self._instanceslist = []
        self._vhdl_version = "vhdl87"

        self.simulation = None
        self.synthesis = None
        self.driver = None

        self._library = Library(self)

        self.bspdir = None
        self.bspos = None
        if not self.void:
            if projectpathname.find(XMLEXT) >= 0:
                try:
                    self._projectpath =\
                        os.path.abspath(os.path.dirname(projectpathname))
                except IOError as error:
                    raise PodError(str(error), 0)
            else:
                self._projectpath = projectpathname
            SETTINGS.projectpath = self.projectpath
            SETTINGS.author = ""
            SETTINGS.active_project = self
            name = os.path.basename(projectpathname)
            if sy.file_exist(projectpathname):
                self.load_project(projectpathname)
            else:
                self.create_project(name)
            self.description = description

            SETTINGS.active_project = self
Ejemplo n.º 16
0
 def __init__(self, filename):
     self.filename = os.path.expanduser(filename)
     self.configfile = None
     if os.path.exists(self.filename):
         WrapperXml.__init__(self, file=self.filename)
     else:
         print(filename + " doesn't exist, be created")
         WrapperXml.__init__(self, nodename="podconfig")
         self.add_node(nodename="libraries")
         self.savefile()
     # fill library path list:
     try:
         self.personal_lib_list =\
             [node.get_attr_value("path") for
                 node in self.get_subnodes("libraries", "lib")]
     except PodError:
         self.personal_lib_list = []
     try:
         self.personal_platformlib_list = \
             [node.get_attr_value("path")
                 for node in self.get_subnodes("platforms",
                                               "platform")]
     except PodError:
         self.personal_platformlib_list = []
Ejemplo n.º 17
0
 def __init__(self, parent, **keys):
     """ init Generic,
         __init__(self,parent,node)
         __init__(self,parent,nodestring)
         __init__(self,parent,name)
     """
     self.parent = parent
     if "node" in keys:
         WrapperXml.__init__(self, node=keys["node"])
     elif "nodestring" in keys:
         WrapperXml.__init__(self, nodestring=keys["nodestring"])
     elif "name" in keys:
         WrapperXml.__init__(self, nodename="generic")
         self.name = keys["name"]
     else:
         raise PodError("Keys unknown in Generic init()", 0)
Ejemplo n.º 18
0
    def __init__(self, parent, **keys):
        """ Init register,
            __init__(self,parent,node)
            __init__(self,parent,nodestring)
            __init__(self,parent,register_name)
        """
        if "node" in keys:
            WrapperXml.__init__(self, node=keys["node"])
        elif "nodestring" in keys:
            WrapperXml.__init__(self, nodestring=keys["nodestring"])
        elif "register_name" in keys:
            WrapperXml.__init__(self, nodename="register")
            self.name = keys["register_name"]
        else:
            raise PodError("Keys not known in Register", 0)

        self.parent = parent
Ejemplo n.º 19
0
    def __init__(self, parent, **keys):
        """ Create interface object
            if node is a node or name.
            __init__(self,parent,name)
            __init__(self,parent,node)
            __init__(self,parent,nodestring)
        """

        self._parent = parent

        if "name" in keys:
            WrapperXml.__init__(self, nodename="interface")
            self.name = keys["name"]
        elif "node" in keys:
            WrapperXml.__init__(self, node=keys["node"])
        elif "wxml" in keys:
            WrapperXml.__init__(self, nodestring=keys["wxml"])
        else:
            raise PodError("Keys unknown in Interface", 0)

        self._registerslist = []
        self.portslist = []
        self._slaveslist = []
        self._bus = None

        if self.interface_class == "master":
            self.alloc_mem = AllocMem(self)
        if self.interface_class == "slave":
            self.interfacemaster = None

        if self.get_node("slaves") is not None:
            for element in self.get_subnodes("slaves", "slave"):
                self._slaveslist.append(Slave(self, node=element))

        if self.get_node("registers") is not None:
            for element in self.get_subnodes("registers", "register"):
                self._registerslist.append(Register(self, node=element))

        if self.get_node("ports") is not None:
            for node in self.get_subnodes("ports", "port"):
                self.portslist.append(Port(self, node=node))

        # set bus
        if self.bus_name is not None:
            self.bus = self.bus_name
Ejemplo n.º 20
0
    def __init__(self, parent, node=None, afile=None):
        """ Init Component,
            __init__(self)
        """

        if node is not None:
            WrapperXml.__init__(self, node=node)
        elif afile is not None:
            WrapperXml.__init__(self, file=afile)
        else:
            WrapperXml.__init__(self, nodename="void")

        self._interfaceslist = []
        self._genericslist = []
        self._hdl_fileslist = []
        self._driver_templateslist = []
        self._interruptslist = []
        self._constraintslist = []

        # Project that use the component
        self.parent = parent
        self.void = 0
Ejemplo n.º 21
0
    def __init__(self, parent, node=None, afile=None):
        """ Init Component,
            __init__(self)
        """

        if node is not None:
            WrapperXml.__init__(self, node=node)
        elif afile is not None:
            WrapperXml.__init__(self, file=afile)
        else:
            WrapperXml.__init__(self, nodename="void")

        self._interfaceslist = []
        self._genericslist = []
        self._hdl_fileslist = []
        self._driver_templateslist = []
        self._interruptslist = []
        self._constraintslist = []

        # Project that use the component
        self.parent = parent
        self.void = 0
Ejemplo n.º 22
0
 def __initname(self,name):
     WrapperXml.__init__(self,nodename="generic")
     self.setName(name)
Ejemplo n.º 23
0
 def __init__(self, parent, name):
     self.parent = parent
     WrapperXml.__init__(self, file=(SETTINGS.path + BUSPATH + "/" + name + "/" + name + ".xml"))
Ejemplo n.º 24
0
 def __initnode(self,node):
     WrapperXml.__init__(self,node=node)
Ejemplo n.º 25
0
 def __initname(self,name):
     WrapperXml.__init__(self,nodename="interface")
     self.setAttribute("name",name)
Ejemplo n.º 26
0
 def __initwxml(self,nodestring):
     WrapperXml.__init__(self,nodestring=nodestring)
Ejemplo n.º 27
0
 def __initfilename(self,filename,istop,scope):
     WrapperXml.__init__(self,nodename="hdl_file")
     if istop == 1:
         self.setTop()
     self.setScope(scope)
     self.setFileName(filename)
Ejemplo n.º 28
0
 def __init__(self, parent, name):
     self.parent = parent
     WrapperXml.__init__(self,
                         file=(SETTINGS.path + BUSPATH + "/" + name + "/" +
                               name + ".xml"))
Ejemplo n.º 29
0
 def __initname(self,name):
     WrapperXml.__init__(self,nodename="port")
     self.setAttribute("name",name)
Ejemplo n.º 30
0
 def __init__(self,parent,name,setting=settings):
     self.parent = parent
     self.setting = setting
     WrapperXml.__init__(self,file=(setting.path + BUSPATH+"/" \
         + name +"/"+name+ ".xml"))
Ejemplo n.º 31
0
 def __initfile(self,file):
     WrapperXml.__init__(self,file=file)
Ejemplo n.º 32
0
 def __initnum(self,num):
     WrapperXml.__init__(self,nodename="pin")
     self.setNum(num)