Пример #1
0
    def generate_bitstream(self):
        """ generate the bitstream """
        commandname = self.synthesis_toolcommandname
        scriptpath = os.path.join(self.parent.projectpath + SYNTHESISPATH,
                                  self.tcl_scriptname)

        pwd = sy.pwd()
        sy.del_all(self.project.projectpath + OBJSPATH)
        sy.chdir(self.project.projectpath + SYNTHESISPATH)

        commandname += " -mode tcl"
        scriptname = "-source " + scriptpath + " -tclargs build"
        binpath = self.project.projectpath + OBJSPATH + "/" + \
            self.project.name + ".runs/impl_1/"

        for line in sy.launch_as_shell(commandname, scriptname):
            if SETTINGS.color() == 1:
                print(COLOR_SHELL + line + COLOR_END),
            else:
                print("SHELL>" + line),
        for ext_file in self.ext_files:
            try:
                sy.cp_file(
                    binpath + BINARY_PREFIX + self.project.name + ext_file,
                    self.project.projectpath + BINARYPROJECTPATH + "/")
            except IOError:
                raise PodError("Can't copy bitstream")
        sy.chdir(pwd)
Пример #2
0
    def generate_bitstream(self):
        """ generate the bitstream """
        commandname = self.synthesis_toolcommandname
        scriptpath = os.path.join(self.parent.projectpath + SYNTHESISPATH,
                                  self.tcl_scriptname)

        pwd = sy.pwd()
        sy.del_all(self.project.projectpath + OBJSPATH)
        sy.chdir(self.project.projectpath + SYNTHESISPATH)

        commandname += " -mode tcl"
        scriptname = "-source " + scriptpath + " -tclargs build"
        binpath = self.project.projectpath + OBJSPATH + "/" + \
            self.project.name + ".runs/impl_1/"

        for line in sy.launch_as_shell(commandname, scriptname):
            if SETTINGS.color() == 1:
                print(COLOR_SHELL + line + COLOR_END),
            else:
                print("SHELL>" + line),
        for ext_file in self.ext_files:
            try:
                sy.cp_file(binpath + BINARY_PREFIX + self.project.name +
                           ext_file,
                           self.project.projectpath + BINARYPROJECTPATH + "/")
            except IOError:
                raise PodError("Can't copy bitstream")
        sy.chdir(pwd)
Пример #3
0
def main():
    CLI = Cli()
    SETTINGS = Settings()
    SETTINGS.path = os.path.expanduser(POD_PATH)
    SETTINGS.projectpath = sy.pwd()
    # load command file if in command params
    if len(sys.argv)==2:
        CLI.do_source(sys.argv[1])
    # infinite command loop
    CLI.cmdloop()
Пример #4
0
def main(argv):
    """ Main command line prog for pod """
    try:
        opts, _ = getopt.getopt(argv[1:], "hvs:l:", ["help",
                                                     "version",
                                                     "source=",
                                                     "load="])
    except getopt.GetoptError as error:
        print(error)
        usage()
        sys.exit(2)
    options = [arg[0] for arg in opts]

    if "help" in options or "-h" in options:
        usage()
        sys.exit(0)

    if "version" in options or "-v" in options:
        print("Peripherals On Demand version " + VERSION)
        sys.exit(0)

    cli = ProjectCli()
    SETTINGS.projectpath = sy.pwd()
    SETTINGS.version = VERSION

    # load command file if in command params
    if "--source" in options or "-s" in options:
        for opt, arg in opts:
            if opt == "--source" or opt == "-s":
                argument = arg
                break
        if not os.path.exists(argument):
            print("[ERROR] script " + argument + " doesn't exist")
            usage()
            return
        cli.do_source(argument)
    elif "--load" in options or "-l" in options:
        for opt, arg in opts:
            if opt == "--load" or opt == "-l":
                argument = arg.strip('/')
                break
            if not os.path.exists(argument):
                print("[ERROR] project " + argument +
                      " doesn't exist")
                usage()
                return

        tmpfile = open(TMPFILENAME, "w")
        tmpfile.write("load " + argument)
        tmpfile.close()
        print("Loading project " + argument + " :\n")
        cli.do_source(TMPFILENAME)

    # infinite command loop
    cli.cmdloop()
Пример #5
0
    def generate_bitstream(self):
        """ generate the bitstream """
        commandname = self.synthesis_toolcommandname
        scriptpath = os.path.join(self.parent.projectpath + SYNTHESISPATH,
                                  self.tcl_scriptname)
        default_path = SETTINGS.get_synthesis_value("quartus", "default_path")
        if default_path is not None:
            rbf_commandname = os.path.join(default_path, self.RBF_CMD)
        else:
            rbf_commandname = self.RBF_CMD

        result_file = os.path.join(
            self.project.projectpath + BINARYPROJECTPATH,
            BINARY_PREFIX + self.project.name + ALTERA_BITSTREAM_SUFFIX)

        cnv_result_file = os.path.join(
            self.project.projectpath + BINARYPROJECTPATH,
            BINARY_PREFIX + self.project.name + ALTERA_BINARY_SUFFIX)

        pwd = sy.pwd()
        sy.del_all(self.project.projectpath + OBJSPATH)
        sy.chdir(self.project.projectpath + SYNTHESISPATH)
        commandname = commandname + " -t "

        list_qsys_comp = self.needqsys()
        if len(list_qsys_comp):
            qsys_path = self.get_synthesis_value("qsys_path")
            if qsys_path is not None:
                qsys_commandname = os.path.join(default_path, qsys_path,
                                                self.QSYS_SCRIPT)
            else:
                qsys_commandname = self.QSYS_SCRIPT

            for component in list_qsys_comp:
                self.launch_as_shell(
                    qsys_commandname, " --script=" + os.path.join(
                        self.project.projectpath + "/" + SYNTHESISPATH,
                        component.name + "_qsys.tcl"))

        self.launch_as_shell(commandname, scriptpath)

        try:
            output_format = self.project.platform.output_format
            commandarg = "-c " + result_file + " " + cnv_result_file
            if output_format == "cvp":
                self.launch_as_shell(rbf_commandname, "--cvp " + commandarg)
            elif output_format == "rbf":
                self.launch_as_shell(rbf_commandname, commandarg)
            elif output_format == "rbfComp":
                self.launch_as_shell(
                    rbf_commandname,
                    "--option=bitstream_compression=on " + commandarg)
        except IOError:
            raise PodError("Can't copy bitstream")
        sy.chdir(pwd)
Пример #6
0
    def generate_bitstream(self):
        """ generate the bitstream """
        commandname = self.synthesis_toolcommandname
        scriptpath = os.path.join(self.parent.projectpath + SYNTHESISPATH, self.tcl_scriptname)
        default_path = SETTINGS.get_synthesis_value("quartus", "default_path")
        if default_path is not None:
            rbf_commandname = os.path.join(default_path, self.RBF_CMD)
        else:
            rbf_commandname = self.RBF_CMD

        result_file = os.path.join(
            self.project.projectpath + BINARYPROJECTPATH, BINARY_PREFIX + self.project.name + ALTERA_BITSTREAM_SUFFIX
        )

        cnv_result_file = os.path.join(
            self.project.projectpath + BINARYPROJECTPATH, BINARY_PREFIX + self.project.name + ALTERA_BINARY_SUFFIX
        )

        pwd = sy.pwd()
        sy.del_all(self.project.projectpath + OBJSPATH)
        sy.chdir(self.project.projectpath + SYNTHESISPATH)
        commandname = commandname + " -t "

        list_qsys_comp = self.needqsys()
        if len(list_qsys_comp):
            qsys_path = self.get_synthesis_value("qsys_path")
            if qsys_path is not None:
                qsys_commandname = os.path.join(default_path, qsys_path, self.QSYS_SCRIPT)
            else:
                qsys_commandname = self.QSYS_SCRIPT

            for component in list_qsys_comp:
                self.launch_as_shell(
                    qsys_commandname,
                    " --script="
                    + os.path.join(self.project.projectpath + "/" + SYNTHESISPATH, component.name + "_qsys.tcl"),
                )

        self.launch_as_shell(commandname, scriptpath)

        try:
            output_format = self.project.platform.output_format
            commandarg = "-c " + result_file + " " + cnv_result_file
            if output_format == "cvp":
                self.launch_as_shell(rbf_commandname, "--cvp " + commandarg)
            elif output_format == "rbf":
                self.launch_as_shell(rbf_commandname, commandarg)
            elif output_format == "rbfComp":
                self.launch_as_shell(rbf_commandname, "--option=bitstream_compression=on " + commandarg)
        except IOError:
            raise PodError("Can't copy bitstream")
        sy.chdir(pwd)
Пример #7
0
def main(argv):
    """ Main command line prog for pod """
    try:
        opts, _ = getopt.getopt(argv[1:], "hvs:l:",
                                ["help", "version", "source=", "load="])
    except getopt.GetoptError as error:
        print(error)
        usage()
        sys.exit(2)
    options = [arg[0] for arg in opts]

    if "help" in options or "-h" in options:
        usage()
        sys.exit(0)

    if "version" in options or "-v" in options:
        print("Peripherals On Demand version " + VERSION)
        sys.exit(0)

    cli = ProjectCli()
    SETTINGS.projectpath = sy.pwd()
    SETTINGS.version = VERSION

    # load command file if in command params
    if "--source" in options or "-s" in options:
        for opt, arg in opts:
            if opt == "--source" or opt == "-s":
                argument = arg
                break
        if not os.path.exists(argument):
            print("[ERROR] script " + argument + " doesn't exist")
            usage()
            return
        cli.do_source(argument)
    elif "--load" in options or "-l" in options:
        for opt, arg in opts:
            if opt == "--load" or opt == "-l":
                argument = arg.strip('/')
                break
            if not os.path.exists(argument):
                print("[ERROR] project " + argument + " doesn't exist")
                usage()
                return

        tmpfile = open(TMPFILENAME, "w")
        tmpfile.write("load " + argument)
        tmpfile.close()
        print("Loading project " + argument + " :\n")
        cli.do_source(TMPFILENAME)

    # infinite command loop
    cli.cmdloop()
Пример #8
0
def generateBitStream(self,commandname,scriptname):
    """ generate the bitstream """
    pwd = sy.pwd()
    sy.deleteAll(settings.projectpath+OBJSPATH)
    sy.chdir(settings.projectpath+SYNTHESISPATH)
    for line in sy.launchAShell(commandname,scriptname):
        if settings.color()==1:
            print COLOR_SHELL+line+COLOR_END,
        else:
            print "SHELL>"+line,
    try:
        sy.copyFile(settings.projectpath+OBJSPATH+"/"+\
                    BINARY_PREFIX+settings.active_project.getName()+\
                    BINARY_SUFFIX,
                    settings.projectpath+BINARYPROJECTPATH+"/")
    except IOError:
        raise Error("Can't copy bitstream")
    sy.chdir(pwd)
Пример #9
0
 def __init__(self):
     if self.__do_init:
         pathname, scriptname = os.path.split(sys.argv[0])
         self.history = []
         self.historyroot = []
         self.__script_dir = os.path.abspath(pathname)
         self.path = None
         self.projectpath = sy.pwd()
         self.headertpl = "/headervhdl.tpl"
         self.script = 0
         self.color_status = 1
         # init personnal libraries path:
         try:
             self.configfile = ConfigFile(POD_CONFIG)
         except Error, e:
             pass
         try:
             self.personal_lib_path_list = self.configfile.getLibraries()
             self.personal_lib_name_list = \
                 [pathlib.split("/")[-1] for pathlib in self.personal_lib_path_list]
         except Error,e:
             pass
Пример #10
0
        usage()
        sys.exit(2)
    options = [arg[0] for arg in opts]

    if "help" in options or "-h" in options:
        usage()
        sys.exit(2)

    if "version" in options or "-v" in options:
        print "Peripherals On Demand version "+ ver.getVersion()
        sys.exit(2)

    CLI = Cli()
    SETTINGS = Settings()
    SETTINGS.path = POD_PATH
    SETTINGS.projectpath = sy.pwd()
    SETTINGS.version = ver.getVersion()

    # load command file if in command params
    if "--source" in options or "-s" in options:
        for opt,arg in opts:
            if opt=="--source" or opt=="-s":
                argument = arg
                break
        if not os.path.exists(argument):
            print "[ERROR] script "+str(argument)+\
                " doesn't exist"
            usage()
            return
        CLI.do_source(argument)
    elif "--load" in options or "-l" in options:
Пример #11
0
            try:
                self.stdin = open('%s.%s' % (fname, self.default_extension), 'r')
            except IOError:
                print 'Problem opening file %s: \n%s' % (fname, e)
                keepstate.restore()
                return
        self.use_rawinput = False
        self.prompt = self.continuation_prompt = ''
        settings.setScript(1)
        self.cmdloop()
        settings.setScript(0)
        self.stdin.close()
        keepstate.restore()
        self.lastcmd = ''
        return

    def do_version(self,line):
        """\
Usage : version
Print the version of POD
        """
        print "Peripherals On Demand version "+settings.version

if __name__ == "__main__":
    cli = Cli()
    settings = Settings()
    settings.path = "/home/fabien/POD/trunk/pod/"
    settings.projectpath = sy.pwd() 
    cli.cmdloop()