コード例 #1
0
    def run(self):
        with Timed(self, 'total'):
            with Timed(self, 'prepare'):
                os.makedirs(self.out_dir, exist_ok=True)
                for f in self.srcs:
                    if f.endswith(".vhd") or f.endswith(".vhdl"):
                        self.files.append({
                            'name': os.path.realpath(f),
                            'file_type': 'vhdlSource'
                        })
                    elif f.endswith(".v"):
                        self.files.append({
                            'name': os.path.realpath(f),
                            'file_type': 'verilogSource'
                        })

                self.files.append({
                    'name': os.path.realpath(self.xdc),
                    'file_type': 'xdc'
                })

                chip = self.family + self.device + self.package

                vivado_settings = os.getenv('VIVADO_SETTINGS')

                vivado_options = {
                    'part': chip,
                    'synth': self.synthtool,
                    'vivado-settings': vivado_settings,
                    'yosys_synth_options': self.synthoptions,
                }
                if hasattr(self, 'library_files'):
                    vivado_options['library_files'] = self.library_files

                self.edam = {
                    'files': self.files,
                    'name': self.project_name,
                    'toplevel': self.top,
                    'parameters': {
                        'VIVADO': {
                            'paramtype': 'vlogdefine',
                            'datatype': 'int',
                            'default': 1,
                        },
                    },
                    'tool_options': {
                        'vivado': vivado_options
                    }
                }
                self.backend = edalize.get_edatool('vivado')(
                    edam=self.edam, work_root=self.out_dir)
                self.backend.configure("")

            self.backend.build()

        self.add_runtimes()
        self.add_maximum_memory_use()
コード例 #2
0
    def run_steps(self):
        self.backend.build_main(self.top + '.eblif')
        self.backend.build_main(self.top + '.net')
        self.backend.build_main(self.top + '.place')
        self.backend.build_main(self.top + '.route')
        self.backend.build_main(self.top + '.fasm')
        with Timed(self, 'bitstream'):
            self.backend.build_main(self.top + '.bit')

        with Timed(self, 'fasm2bels'):
            self.backend.build_main('timing_summary.rpt')
コード例 #3
0
ファイル: symbiflow.py プロジェクト: SymbiFlow/fpga-tool-perf
    def run(self):
        with Timed(self, 'total'):
            with Timed(self, 'prepare'):
                os.environ[
                    "EDALIZE_LAUNCHER"] = f"source {os.path.abspath('env.sh') + ' quicklogic'} &&"
                os.makedirs(self.out_dir, exist_ok=True)

                edam, _ = self.prepare_edam(self.device)
                self.backend = edalize.get_edatool('symbiflow')(
                    edam=edam, work_root=self.out_dir)
                self.backend.configure("")

            self.run_steps()
コード例 #4
0
    def run_steps(self):
        self.backend.build_main(self.top + '.eblif')
        with Timed(self, 'pack_all', unprinted_runtime=True):
            self.backend.build_main(self.top + '.net')

        with Timed(self, 'place_all', unprinted_runtime=True):
            self.backend.build_main(self.top + '.place')

        with Timed(self, 'route_all', unprinted_runtime=True):
            self.backend.build_main(self.top + '.route')

        self.backend.build_main(self.top + '.fasm')
        with Timed(self, 'bitstream'):
            self.backend.build_main(self.top + '.bit')
コード例 #5
0
ファイル: vivado.py プロジェクト: SymbiFlow/fpga-tool-perf
    def run(self):
        with Timed(self, 'total'):
            with Timed(self, 'prepare'):
                os.makedirs(self.out_dir, exist_ok=True)

                edam = self.prepare_edam()
                self.backend = edalize.get_edatool('vivado')(
                    edam=edam, work_root=self.out_dir)
                self.backend.configure("")

            self.backend.build()

        self.add_runtimes()
        self.add_maximum_memory_use()
コード例 #6
0
ファイル: toolchain.py プロジェクト: vmskhan/fpga-tool-perf
    def cmd(self, cmd, argstr, env=None):
        print("Running: %s %s" % (cmd, argstr))
        self.cmds.append('%s %s' % (cmd, argstr))

        # Use this to checkpoint various stages
        # If a command fails, we'll have everything up to it
        self.write_metadata(all=False)

        cmd_base = os.path.basename(cmd)
        with open("%s/%s.txt" % (self.out_dir, cmd_base), "w") as f:
            f.write("Running: %s %s\n\n" % (cmd_base, argstr))
        with Timed(self, cmd_base):
            if self.verbose:
                cmdstr = "(%s %s) |&tee -a %s.txt; (exit $PIPESTATUS )" % (
                    cmd, argstr, cmd
                )
                print("Running: %s" % cmdstr)
                print("  cwd: %s" % self.out_dir)
            else:
                cmdstr = "(%s %s) >& %s.txt" % (cmd, argstr, cmd_base)
            subprocess.check_call(
                cmdstr,
                shell=True,
                executable='bash',
                cwd=self.out_dir,
                env=env
            )
コード例 #7
0
ファイル: nextpnr.py プロジェクト: SymbiFlow/fpga-tool-perf
    def generic_run(self, prepare_edam):
        with Timed(self, 'total'):
            with Timed(self, 'prepare'):
                self.edam = prepare_edam()
                os.environ["EDALIZE_LAUNCHER"] = f"source {self.env_script} &&"
                self.backend = edalize.get_edatool('symbiflow')(
                    edam=self.edam, work_root=self.out_dir
                )
                self.backend.configure("")
            try:
                self.backend.build_main(self.project_name + '.fasm')
                self.run_steps()
            finally:
                del os.environ['EDALIZE_LAUNCHER']

        self.add_runtimes()
        self.add_wirelength()
コード例 #8
0
ファイル: symbiflow.py プロジェクト: SymbiFlow/fpga-tool-perf
    def run_steps(self):
        try:
            self.backend.build_main(self.top + '.eblif')
            with Timed(self, 'pack_all', unprinted_runtime=True):
                self.backend.build_main(self.top + '.net')

            with Timed(self, 'place_all', unprinted_runtime=True):
                self.backend.build_main(self.top + '.place')

            with Timed(self, 'route_all', unprinted_runtime=True):
                self.backend.build_main(self.top + '.route')

            self.backend.build_main(self.top + '.fasm')
            with Timed(self, 'bitstream'):
                self.backend.build_main(self.top + '.bit')
        finally:
            del os.environ['EDALIZE_LAUNCHER']
コード例 #9
0
ファイル: nextpnr.py プロジェクト: SymbiFlow/fpga-tool-perf
    def run(self):
        with Timed(self, 'total'):
            with Timed(self, 'prepare'):
                self.edam = self.prepare_edam()
                os.environ["EDALIZE_LAUNCHER"] = f"source {self.env_script} &&"
                self.backend = edalize.get_edatool('oxide')(
                    edam=self.edam, work_root=self.out_dir
                )
                self.backend.configure("")
            try:
                with Timed(self, 'fasm'):
                    self.backend.build_main(self.project_name + '.fasm')
                with Timed(self, 'bitstream'):
                    self.backend.build_main(self.project_name + '.bit')
            finally:
                del os.environ['EDALIZE_LAUNCHER']

        self.add_runtimes()
        self.add_wirelength()
コード例 #10
0
ファイル: nextpnr.py プロジェクト: SymbiFlow/fpga-tool-perf
    def run(self):
        with Timed(self, 'total'):
            with Timed(self, 'prepare'):
                self.edam = self.prepare_edam()
                os.environ["EDALIZE_LAUNCHER"] = f"source {self.env_script} &&"
                self.backend = edalize.get_edatool('symbiflow')(
                    edam=self.edam, work_root=self.out_dir
                )
                self.backend.configure("")

            self.backend.build_main(self.project_name + '.phys')
            self.run_steps()

        with Timed(self, 'report_timing'):
            self.backend.build_main(self.project_name + '.timing')

        del os.environ["EDALIZE_LAUNCHER"]

        self.add_runtimes()
        self.add_wirelength()
コード例 #11
0
ファイル: symbiflow.py プロジェクト: SymbiFlow/fpga-tool-perf
    def run(self):
        with Timed(self, 'total'):
            with Timed(self, 'prepare'):
                os.environ[
                    "EDALIZE_LAUNCHER"] = f"source {os.path.abspath('env.sh') + ' xilinx-' + self.device} &&"
                os.makedirs(self.out_dir, exist_ok=True)

                edam, tool_params = self.prepare_edam(self.family +
                                                      self.device)

                if tool_params:
                    os.environ[
                        "EDALIZE_LAUNCHER"] += ' VPR_OPTIONS="--echo_file on"'

                self.backend = edalize.get_edatool('symbiflow')(
                    edam=edam, work_root=self.out_dir)
                self.backend.configure("")

            self.run_steps()

        self.add_runtimes()
        self.add_wirelength()
        self.add_maximum_memory_use()
コード例 #12
0
ファイル: icestorm.py プロジェクト: SymbiFlow/fpga-tool-perf
    def run(self, pnr, args):
        with Timed(self, 'total'):
            os.makedirs(self.out_dir, exist_ok=True)

            self.env_script = os.path.abspath('env.sh') + ' nextpnr'
            os.environ["EDALIZE_LAUNCHER"] = f"source {self.env_script} &&"

            edam = self.prepare_edam(pnr, args)
            self.backend = edalize.get_edatool('icestorm')(
                edam=edam, work_root=self.out_dir)
            self.backend.configure("")
            self.backend.build()
            self.backend.build_main('timing')
        del os.environ["EDALIZE_LAUNCHER"]
コード例 #13
0
ファイル: icecube.py プロジェクト: SymbiFlow/fpga-tool-perf
    def run(self):
        with Timed(self, 'bit-all'):
            print('top: %s' % self.top)
            env = os.environ.copy()
            env["SRCS"] = ' '.join(self.srcs)
            env["TOP"] = self.top
            env["ICECUBEDIR"] = self.icecubedir
            #env["ICEDEV"] = 'hx8k-ct256'
            env["ICEDEV"] = self.device + '-' + self.package
            args = "--syn %s" % (self.syn(), )
            if self.strategy:
                args += " --strategy %s" % (self.strategy, )
            self.cmd(root_dir + "/icecubed.sh", args, env=env)
            self.cmd("iceunpack", "my.bin my.asc")

        self.cmd("icetime", "-tmd %s my.asc" % (self.device, ))
コード例 #14
0
ファイル: radiant.py プロジェクト: SymbiFlow/fpga-tool-perf
    def run(self):
        # acceptable for either device
        assert (self.device, self.package) in [
            ('up3k', 'uwg30'), ('up5k', 'uwg30'), ('up5k', 'sg48')
        ]

        with Timed(self, 'bit-all'):
            env = os.environ.copy()
            env["SRCS"] = ' '.join(self.srcs)
            env["TOP"] = self.top
            env["RADIANTDIR"] = self.radiantdir
            env["RADDEV"] = self.device + '-' + self.package
            syn = self.syn()
            args = "--syn %s" % (syn, )
            self.cmd(root_dir + "/radiant.sh", args, env=env)
            self.cmd("iceunpack", "my.bin my.asc")

        self.cmd("icetime", "-tmd up5k my.asc")
コード例 #15
0
ファイル: toolchain.py プロジェクト: SymbiFlow/fpga-tool-perf
    def cmd(self, cmd, argstr, env=None):
        print("Running: %s %s" % (cmd, argstr))
        self.cmds.append('%s %s' % (cmd, argstr))

        cmd_base = os.path.basename(cmd)
        with open("%s/%s.txt" % (self.out_dir, cmd_base), "w") as f:
            f.write("Running: %s %s\n\n" % (cmd_base, argstr))
        with Timed(self, cmd_base):
            if self.verbose:
                cmdstr = "(%s %s) |&tee -a %s.txt; (exit $PIPESTATUS )" % (
                    cmd, argstr, cmd)
                print("Running: %s" % cmdstr)
                print("  cwd: %s" % self.out_dir)
            else:
                cmdstr = "(%s %s) >& %s.txt" % (cmd, argstr, cmd_base)
            subprocess.check_call(cmdstr,
                                  shell=True,
                                  executable='bash',
                                  cwd=self.out_dir,
                                  env=env)
コード例 #16
0
ファイル: icestorm.py プロジェクト: vmskhan/fpga-tool-perf
    def run(self, pnr, args):
        with Timed(self, 'total'):
            os.makedirs(self.out_dir, exist_ok=True)
            for f in self.srcs:
                self.files.append({
                    'name': os.path.realpath(f),
                    'file_type': 'verilogSource'
                })

            if self.pcf is not None:
                self.files.append({
                    'name': os.path.realpath(self.pcf),
                    'file_type': 'PCF'
                })

            self.edam = {
                'files': self.files,
                'name': self.project_name,
                'toplevel': self.top,
                'tool_options': {
                    'icestorm': {
                        'nextpnr_options':
                        args.split(),
                        'arachne_pnr_options':
                        args.split(),
                        'pnr':
                        pnr,
                        'part':
                        self.device,
                        'environment_script':
                        os.path.abspath('env.sh') + ' nextpnr'
                    }
                }
            }

            self.backend = edalize.get_edatool('icestorm')(
                edam=self.edam, work_root=self.out_dir)
            self.backend.configure("")
            self.backend.build()
            self.backend.build_main('timing')
コード例 #17
0
    def run(self):
        with Timed(self, 'total'):
            with Timed(self, 'prepare'):
                os.makedirs(self.out_dir, exist_ok=True)

                for f in self.srcs:
                    self.files.append({
                        'name': os.path.realpath(f),
                        'file_type': 'verilogSource'
                    })

                if self.pcf:
                    self.files.append({
                        'name': os.path.realpath(self.pcf),
                        'file_type': 'PCF'
                    })
                if self.sdc:
                    self.files.append({
                        'name': os.path.realpath(self.sdc),
                        'file_type': 'SDC'
                    })

                if self.xdc:
                    self.files.append({
                        'name': os.path.realpath(self.xdc),
                        'file_type': 'xdc'
                    })

                chip = self.family + self.device

                tool_params = []
                symbiflow_options = {
                    'part':
                    self.device,
                    'package':
                    self.package,
                    'vendor':
                    'quicklogic',
                    'builddir':
                    '.',
                    'pnr':
                    'vpr',
                    'options':
                    tool_params,
                    'fasm2bels':
                    self.fasm2bels,
                    'dbroot':
                    self.dbroot,
                    'clocks':
                    self.clocks,
                    'seed':
                    self.seed,
                    'environment_script':
                    os.path.abspath('env.sh') + ' quicklogic',
                }

                self.edam = {
                    'files': self.files,
                    'name': self.project_name,
                    'toplevel': self.top,
                    'tool_options': {
                        'symbiflow': symbiflow_options
                    }
                }
                self.backend = edalize.get_edatool('symbiflow')(
                    edam=self.edam, work_root=self.out_dir)
                self.backend.configure("")

            self.run_steps()
コード例 #18
0
    def run(self):
        with Timed(self, 'total'):
            with Timed(self, 'prepare'):
                os.makedirs(self.out_dir, exist_ok=True)

                for f in self.srcs:
                    self.files.append({
                        'name': os.path.realpath(f),
                        'file_type': 'verilogSource'
                    })

                assert self.xdc
                self.files.append({
                    'name': os.path.realpath(self.xdc),
                    'file_type': 'xdc'
                })

                chip = self.family + self.device

                out = subprocess.run(["find", ".", "-name", "nextpnr-xilinx"],
                                     stdout=subprocess.PIPE)
                nextpnr_locations = out.stdout.decode('utf-8').split('\n')

                for location in nextpnr_locations:
                    if "/bin/nextpnr-xilinx" in location:
                        nextpnr_location = os.path.abspath(
                            os.path.dirname(location))
                        break

                assert nextpnr_location

                share_dir = os.path.join(nextpnr_location, '..', 'share')

                chipdb = os.path.join(
                    share_dir, 'nextpnr-xilinx',
                    '{}{}.bin'.format(self.family, self.part))
                self.files.append({
                    'name': os.path.realpath(chipdb),
                    'file_type': 'bba'
                })

                if self.fasm2bels:
                    symbiflow = os.getenv('SYMBIFLOW', None)
                    assert symbiflow

                    device_aliases = {"a35t": "a50t"}

                    chip_replace = chip
                    for k, v in device_aliases.items():
                        chip_replace = chip.replace(k, v)

                    device_path = os.path.join(symbiflow, 'share', 'symbiflow',
                                               'arch',
                                               '{}_test'.format(chip_replace))

                    self.files.append({
                        'name':
                        os.path.realpath(
                            os.path.join(device_path, '*rr_graph.real.bin')),
                        'file_type':
                        'RRGraph'
                    })

                    self.files.append({
                        'name':
                        os.path.realpath(
                            os.path.join(device_path, 'vpr_grid_map.csv')),
                        'file_type':
                        'VPRGrid'
                    })

                symbiflow_options = {
                    'part':
                    chip,
                    'package':
                    self.package,
                    'vendor':
                    'xilinx',
                    'builddir':
                    '.',
                    'pnr':
                    'nextpnr',
                    'yosys_synth_options': [
                        "-flatten", "-nowidelut", "-abc9", "-arch xc7",
                        "-nocarry", "-nodsp"
                    ],
                    'fasm2bels':
                    self.fasm2bels,
                    'dbroot':
                    self.dbroot,
                    'clocks':
                    self.clocks,
                    'environment_script':
                    os.path.abspath('env.sh') + ' nextpnr xilinx-' +
                    self.device,
                    'options':
                    '--timing-allow-fail'
                }

                if self.fasm2bels:
                    bitstream_device = None
                    if self.device.startswith('a'):
                        bitstream_device = 'artix7'
                    if self.device.startswith('z'):
                        bitstream_device = 'zynq7'
                    if self.device.startswith('k'):
                        bitstream_device = 'kintex7'

                    assert bitstream_device

                    part_json = os.path.join(self.dbroot, bitstream_device,
                                             self.family + self.part,
                                             'part.json')
                    symbiflow_options['yosys_additional_commands'] = [
                        "plugin -i xdc",
                        "yosys -import",
                        "read_xdc -part_json {} {}".format(
                            part_json, os.path.realpath(self.xdc)),
                        "clean",
                        "write_blif -attr -param {}.eblif".format(
                            self.project_name),
                    ]

                self.edam = {
                    'files': self.files,
                    'name': self.project_name,
                    'toplevel': self.top,
                    'tool_options': {
                        'symbiflow': symbiflow_options,
                    }
                }
                self.backend = edalize.get_edatool('symbiflow')(
                    edam=self.edam, work_root=self.out_dir)
                self.backend.configure("")

            self.backend.build_main(self.project_name + '.fasm')
            self.run_steps()

        self.add_runtimes()
        self.add_wirelength()
コード例 #19
0
 def run_steps(self):
     with Timed(self, 'bitstream'):
         self.backend.build_main(self.project_name + '.bit')
コード例 #20
0
    def run(self):
        with Timed(self, 'total'):
            with Timed(self, 'prepare'):
                os.makedirs(self.out_dir, exist_ok=True)

                for f in self.srcs:
                    self.files.append({
                        'name': os.path.realpath(f),
                        'file_type': 'verilogSource'
                    })

                if self.pcf:
                    self.files.append({
                        'name': os.path.realpath(self.pcf),
                        'file_type': 'PCF'
                    })
                if self.sdc:
                    self.files.append({
                        'name': os.path.realpath(self.sdc),
                        'file_type': 'SDC'
                    })

                if self.xdc:
                    self.files.append({
                        'name': os.path.realpath(self.xdc),
                        'file_type': 'xdc'
                    })

                chip = self.family + self.device

                tool_params = self.get_tool_params()

                if self.fasm2bels:
                    symbiflow = os.getenv('SYMBIFLOW', None)
                    assert symbiflow

                    device_aliases = {"a35t": "a50t"}

                    chip_replace = chip
                    for k, v in device_aliases.items():
                        chip_replace = chip.replace(k, v)

                    device_path = os.path.join(symbiflow, 'share', 'symbiflow',
                                               'arch',
                                               '{}_test'.format(chip_replace))

                    self.files.append({
                        'name':
                        os.path.realpath(
                            os.path.join(device_path, '*rr_graph.real.bin')),
                        'file_type':
                        'RRGraph'
                    })

                    self.files.append({
                        'name':
                        os.path.realpath(
                            os.path.join(device_path, 'vpr_grid_map.csv')),
                        'file_type':
                        'VPRGrid'
                    })
                symbiflow_options = {
                    'part':
                    chip,
                    'package':
                    self.package,
                    'vendor':
                    'xilinx',
                    'builddir':
                    '.',
                    'pnr':
                    'vpr',
                    'options':
                    tool_params,
                    'fasm2bels':
                    self.fasm2bels,
                    'dbroot':
                    self.dbroot,
                    'clocks':
                    self.clocks,
                    'seed':
                    self.seed,
                    'environment_script':
                    os.path.abspath('env.sh') + ' xilinx-' + self.device,
                }
                self.edam = {
                    'files': self.files,
                    'name': self.project_name,
                    'toplevel': self.top,
                    'tool_options': {
                        'symbiflow': symbiflow_options
                    }
                }
                self.backend = edalize.get_edatool('symbiflow')(
                    edam=self.edam, work_root=self.out_dir)
                self.backend.configure("")

            self.run_steps()

        self.add_runtimes()
        self.add_wirelength()
        self.add_maximum_memory_use()
コード例 #21
0
    def run_steps(self):
        with Timed(self, 'bitstream'):
            self.backend.build_main(self.project_name + '.bit')

        with Timed(self, 'fasm2bels'):
            self.backend.build_main('timing_summary.rpt')