示例#1
0
文件: verilator.py 项目: Limb/fusesoc
    def _verilate(self):
        if self.src_type == 'systemC':
            args = ['--sc']
        else:
            args = ['--cc']
        args += ['-f', self.verilator_file]
        args += ['--top-module', self.top_module]
        args += ['--exe']
        args += ['-LDFLAGS "']
        args += ['-Wl,--start-group']
        args += [os.path.join(self.sim_root, s) for s in self.archives]
        args += ['-Wl,--end-group']
        args += [l for l in self.libs]
        args += ['"']
        args += ['-CFLAGS ' + '-I' + i for i in self.include_dirs]
        args += [os.path.join(self.src_root, self.system.name, self.tb_toplevel)]
        args += self.verilator_options

        cmd = utils.find_verilator()
        if cmd is None:
             raise RuntimeError("VERILATOR_ROOT not set and there is no verilator program in your PATH")
        cmd += ' ' + ' '.join(args)
        l = utils.Launcher(cmd,
                           shell=True,
                           cwd = self.sim_root,
                           stderr = open(os.path.join(self.sim_root,'verilator.log'),'w')
        )
        print('')
        pr_info("Starting Verilator:")
        print(l)
        print('')
        l.run()
示例#2
0
    def _verilate(self):
        if self.src_type == 'systemC':
            args = ['--sc']
        else:
            args = ['--cc']
        args += ['-f', self.verilator_file]
        args += ['--top-module', self.top_module]
        args += ['--exe']
        args += ['-LDFLAGS "']
        args += ['-Wl,--start-group']
        args += [os.path.join(self.work_root, s) for s in self.archives]
        args += ['-Wl,--end-group']
        args += [l for l in self.libs]
        args += ['"']
        args += ['-CFLAGS ' + '-I' + i for i in self.include_dirs]
        args += [
            os.path.join(self.src_root, self.system.sanitized_name,
                         self.tb_toplevel)
        ]
        for key, value in self.vlogparam.items():
            args += ['-G{}={}'.format(key, value)]
        args += self.verilator_options

        cmd = utils.find_verilator()
        if cmd is None:
            raise RuntimeError(
                "VERILATOR_ROOT not set and there is no verilator program in your PATH"
            )
        cmd += ' ' + ' '.join(args)

        if (self.src_type == 'systemC') and not utils.check_systemc_env():
            raise RuntimeError(
                "Need $SYSTEMC_LIBDIR and $SYSTEMC_INCLUDE in environment or when Verilator configured"
            )

        l = utils.Launcher(
            cmd,
            shell=True,
            cwd=self.work_root,
            stderr=open(os.path.join(self.work_root, 'verilator.log'), 'w'),
            stdout=open(os.path.join(self.work_root, 'verilator.out.log'),
                        'w'))
        print('')
        pr_info("Starting Verilator:")
        if Config().verbose:
            pr_info("  Verilator working dir: " + self.work_root)
            pr_info("  Verilator command: " + cmd)
        print('')
        l.run()
示例#3
0
    def _verilate(self):
        if self.src_type == 'systemC':
            args = ['--sc']
        else:
            args = ['--cc']
        args += ['-f', self.verilator_file]
        args += ['--top-module', self.top_module]
        args += ['--exe']
        args += ['-LDFLAGS "']
        args += ['-Wl,--start-group']
        args += [os.path.join(self.sim_root, s) for s in self.archives]
        args += ['-Wl,--end-group']
        args += [l for l in self.libs]
        args += ['"']
        args += ['-CFLAGS ' + '-I' + i for i in self.include_dirs]
        args += [os.path.join(self.src_root, self.system.sanitized_name, self.tb_toplevel)]
        for key, value in self.vlogparam.items():
            args += ['-G{}={}'.format(key, value)]
        args += self.verilator_options

        cmd = utils.find_verilator()
        if cmd is None:
             raise RuntimeError("VERILATOR_ROOT not set and there is no verilator program in your PATH")
        cmd += ' ' + ' '.join(args)

        if (self.src_type == 'systemC') and not utils.check_systemc_env():
            raise RuntimeError("Need $SYSTEMC_LIBDIR and $SYSTEMC_INCLUDE in environment or when Verilator configured")

        l = utils.Launcher(cmd,
                           shell=True,
                           cwd = self.sim_root,
                           stderr = open(os.path.join(self.sim_root,'verilator.log'),'w'),
                           stdout = open(os.path.join(self.sim_root, 'verilator.out.log'),'w')
        )
        print('')
        pr_info("Starting Verilator:")
        if Config().verbose:
             pr_info("  Verilator working dir: " + self.sim_root)
             pr_info("  Verilator command: " + cmd)
        print('')
        l.run()