def list_components(self, libraryname=None): """ Return a list with all library components """ if libraryname is None: libraryname = self.lib_name official_component_type = self.official_libraries() componentlist = [] if libraryname in official_component_type: componentlist =\ sy.list_dir(SETTINGS.path + LIBRARYPATH + "/" + libraryname) elif libraryname in self.personnal_libraries(): componentlist =\ sy.list_dir(self.get_pers_lib_path(libraryname)) elif libraryname in self.get_component_lib_name(): componentlist =\ sy.list_dir(self.get_component_lib_path(libraryname)) return componentlist
def complete_selectprojecttree(self, text, line, begidx, endidx): """complete selectprojecttree command directories """ path = line.split(" ")[1] if path.find("/") == -1: # sub path = "" elif text.split() == "": # sub/sub/ path = "/".join(path) + "/" else: # sub/sub path = "/".join(path.split("/")[0:-1]) + "/" listdir = sy.list_dir(path) return self.completelist(line, text, listdir)
def copy_bsp_drivers(self): """ delete all directories under POD dir, then copy drivers in.""" bspdir = self.get_bsp_dir() if bspdir is None: raise PodError("Set directory before", 0) # deleting all directory in POD dir sy.del_all_dir(bspdir) for directory in \ sy.list_dir(self.project.projectpath + DRIVERSPATH + "/"): sy.cp_dir(self.project.projectpath + DRIVERSPATH + "/" + directory, self.get_bsp_dir())
def complete_load(self, text, line, begidx, endidx): """ complete load command with files under directory """ path = line.split(" ")[1] if path.find("/") == -1: # sub path = "" elif text.split() == "": # sub/sub/ path = "/".join(path) + "/" else: # sub/sub path = "/".join(path.split("/")[0:-1]) + "/" listdir = sy.list_dir(path) listfile = sy.list_file_type(path, XMLEXT[1:]) listfile.extend(listdir) return self.completelist(line, text, listfile)
def check_lib(self, path): """ check if lib and component are not duplicated """ libname = path.split("/")[-1] # check if lib name exist if libname in self.libraries: raise PodError("Library " + libname + " already exist", 0) # check if components under library are new componentlist = sy.list_dir(path) for component in componentlist: for libraryname in self.libraries: if component in self.list_components(libraryname): raise PodError("Library " + libname + " contain a component that exist in '" + libraryname + "' : " + component, 0)
def check_lib(self, path): """ check if lib and component are not duplicated """ libname = path.split("/")[-1] # check if lib name exist if libname in self.libraries: raise PodError("Library " + libname + " already exist", 0) # check if components under library are new componentlist = sy.list_dir(path) for component in componentlist: for libraryname in self.libraries: if component in self.list_components(libraryname): raise PodError( "Library " + libname + " contain a component that exist in '" + libraryname + "' : " + component, 0)
def generate_tcl(self, filename=None): """ generate tcl script """ if filename is None: filename = self.project.name + TCLEXT tclfile = open( self.project.projectpath + SYNTHESISPATH + "/" + filename, "w") tclfile.write("# TCL script automaticaly generated by POD\n") # create project tclfile.write("cd .." + OBJSPATH + "\n") tclfile.write(self.project_base_creation()) # Configuration tclfile.write("# configure platform params\n") tclfile.write(self.project_base_configuration()) # Source files tclfile.write("## add components sources file\n") tclfile.write("# add top level sources file\n") tclfile.write( self.add_file_to_tcl(".." + SYNTHESISPATH + "/top_" + self.project.name + VHDLEXT)) for directory in sy.list_dir(self.project.projectpath + SYNTHESISPATH): for afile in sy.list_files(self.project.projectpath + SYNTHESISPATH + "/" + directory): tclfile.write( self.add_file_to_tcl(".." + SYNTHESISPATH + "/" + directory + "/" + afile)) # Constraints files tclfile.write("# add constraint file\n") tclfile.write( self.add_constraints_file(SYNTHESISPATH + "/" + self.project.name)) tclfile.write(self.insert_tools_specific_commands()) tclfile.write(self.insert_tools_gen_cmds()) DISPLAY.msg("TCL script generated with name : " + self.project.name + TCLEXT) self.tcl_scriptname = self.project.name + TCLEXT return self.tcl_scriptname
def generate_tcl(self, filename=None): """ generate tcl script """ if filename is None: filename = self.project.name + TCLEXT tclfile = open(self.project.projectpath + SYNTHESISPATH + "/" + filename, "w") tclfile.write("# TCL script automaticaly generated by POD\n") # create project tclfile.write("cd .." + OBJSPATH + "\n") tclfile.write(self.project_base_creation()) # Configuration tclfile.write("# configure platform params\n") tclfile.write(self.project_base_configuration()) # Source files tclfile.write("## add components sources file\n") tclfile.write("# add top level sources file\n") tclfile.write(self.add_file_to_tcl(".." + SYNTHESISPATH + "/top_" + self.project.name + VHDLEXT)) for directory in sy.list_dir(self.project.projectpath + SYNTHESISPATH): for afile in sy.list_files(self.project.projectpath + SYNTHESISPATH + "/" + directory): tclfile.write(self.add_file_to_tcl(".." + SYNTHESISPATH + "/" + directory + "/" + afile)) # Constraints files tclfile.write("# add constraint file\n") tclfile.write(self.add_constraints_file(SYNTHESISPATH + "/" + self.project.name)) tclfile.write(self.insert_tools_specific_commands()) tclfile.write(self.insert_tools_gen_cmds()) DISPLAY.msg("TCL script generated with name : " + self.project.name + TCLEXT) self.tcl_scriptname = self.project.name + TCLEXT return self.tcl_scriptname
def availables_plat(cls): """ List all supported platforms names """ platformlist = sy.list_dir(SETTINGS.path + PLATFORMPATH) return platformlist
def get_synthesis_toolchains(cls): """ list all toolchains availables """ filelist = sy.list_dir(SETTINGS.path + TOOLCHAINPATH + SYNTHESISPATH) return filelist
def get_driver_toolchains(cls): """ list all toolchains availables """ filelist = sy.list_dir(SETTINGS.path + TOOLCHAINPATH + DRIVERSPATH) return filelist
def get_simulation_toolchains(cls): """ list all toolchain availables """ filelist = sy.list_dir(SETTINGS.path + TOOLCHAINPATH + SIMULATIONPATH) return filelist
def libraries(self): """ Return a list of libraries availables """ componentlist = sy.list_dir(SETTINGS.path + LIBRARYPATH) componentlist.extend(self.personnal_libraries()) componentlist.extend(self.get_component_lib_name()) return componentlist
def official_libraries(cls): """ Get list of official libraries""" return sy.list_dir(SETTINGS.path + LIBRARYPATH)