Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_core(name, has_system=False):
core = None
try:
core = CoreManager().get_core(Vlnv(name))
except RuntimeError as e:
pr_err(str(e))
exit(1)
except DependencyError as e:
pr_err("'" + name + "' or any of its dependencies requires '" + e.value + "', but this core was not found")
exit(1)
if has_system and not core.backend:
pr_err("Unable to find .system file for '{}'".format(name))
exit(1)
return core
def list_cores(args):
cores = CoreManager().get_cores()
print("\nAvailable cores:\n")
if not cores:
cores_root = CoreManager().get_cores_root()
if cores_root:
pr_err("No cores found in "+':'.join(cores_root))
else:
pr_err("cores_root is not defined")
exit(1)
maxlen = max(map(len,cores.keys()))
print('Core'.ljust(maxlen) + ' Cache status')
print("="*80)
for name in sorted(cores.keys()):
core = cores[name]
print(name.ljust(maxlen) + ' : ' + core.cache_status())
pr_err("Failed to configure the system")
pr_err(str(e))
exit(1)
if args.setup:
exit(0)
try:
sim.build()
except RuntimeError as e:
pr_err("Failed to build simulation model")
pr_err(str(e))
exit(1)
if not args.build_only:
try:
sim.run(args.plusargs)
except RuntimeError as e:
pr_err("Failed to run the simulation")
pr_err(str(e))
def _get_core(name, has_system=False):
core = None
try:
core = CoreManager().get_core(Vlnv(name))
except RuntimeError as e:
pr_err(str(e))
exit(1)
except DependencyError as e:
pr_err("'" + name + "' or any of its dependencies requires '" + e.value + "', but this core was not found")
exit(1)
if has_system and not core.backend:
pr_err("Unable to find .system file for '{}'".format(name))
exit(1)
return core
except ImportError:
pr_err("Unknown simulator '{}'".format(sim_name))
exit(1)
except RuntimeError as e:
pr_err(str(e))
exit(1)
if (args.testbench):
sim.toplevel = args.testbench[0]
else:
sim.toplevel = sim.system.simulator['toplevel']
if not args.keep or not os.path.exists(sim.work_root):
try:
sim.configure(args.plusargs)
print('')
except RuntimeError as e:
pr_err("Failed to configure the system")
pr_err(str(e))
exit(1)
if args.setup:
exit(0)
try:
sim.build()
except RuntimeError as e:
pr_err("Failed to build simulation model")
pr_err(str(e))
exit(1)
if not args.build_only:
try:
sim.run(args.plusargs)
except RuntimeError as e:
pr_err("Failed to run the simulation")
pr_err(str(e))
else:
sim.toplevel = sim.system.simulator['toplevel']
if not args.keep or not os.path.exists(sim.work_root):
try:
sim.configure(args.plusargs)
print('')
except RuntimeError as e:
pr_err("Failed to configure the system")
pr_err(str(e))
exit(1)
if args.setup:
exit(0)
try:
sim.build()
except RuntimeError as e:
pr_err("Failed to build simulation model")
pr_err(str(e))
exit(1)
if not args.build_only:
try:
sim.run(args.plusargs)
except RuntimeError as e:
pr_err("Failed to run the simulation")
pr_err(str(e))
def _checkout(self):
pr_info("Using Xilinx Vivado to generate LogiCORE(tm) project " + self.project_file)
if not os.path.isdir(self.files_root):
os.mkdir(self.files_root)
src_files = [self.script_file, self.project_file]
if self.extra_files:
src_files += self.extra_files.split()
for f in src_files:
f_src = os.path.join(self.core_root, f)
f_dst = os.path.join(self.files_root, f)
if(os.path.exists(f_src)):
shutil.copyfile(f_src, f_dst)
else:
pr_err('Cannot find file %s' % f_src)
args = ['-mode', 'batch',
'-source', self.script_file]
Launcher('vivado', args, cwd=self.files_root).run()
def _get_core(name, has_system=False):
core = None
try:
core = CoreManager().get_core(Vlnv(name))
except RuntimeError as e:
pr_err(str(e))
exit(1)
except DependencyError as e:
pr_err("'" + name + "' or any of its dependencies requires '" + e.value + "', but this core was not found")
exit(1)
if has_system and not core.backend:
pr_err("Unable to find .system file for '{}'".format(name))
exit(1)
return core
def build(self):
super(Xsim, self).build()
#Check if any VPI modules are present and display warning
if len(self.vpi_modules) > 0:
modules = [m['name'] for m in self.vpi_modules]
pr_err('VPI modules not supported by Xsim: %s' % ', '.join(modules))
#Build simulation model
args = []
args += [ self.toplevel]
args += ['--prj', 'xsim.prj'] # list of design files
args += ['--timescale', '1ps/1ps'] # default timescale to prevent error if unspecified
args += ['--snapshot', 'fusesoc'] # name of the design to simulate
args += ['--debug', 'typical'] # capture waveforms
for include_dir in self.incdirs:
args += ['-i', include_dir]
for key, value in self.vlogparam.items():
args += ['--generic_top', '{}={}'.format(key, value)]
if self.system.xsim is not None: