本文整理汇总了Python中vunit.ostools.Process类的典型用法代码示例。如果您正苦于以下问题:Python Process类的具体用法?Python Process怎么用?Python Process使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Process类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _create_vsim_process
def _create_vsim_process(self):
"""
Create the vsim process
"""
ident = threading.current_thread().ident
with self._lock:
try:
vsim_process = self._vsim_processes[ident]
if vsim_process.is_alive():
return vsim_process
except KeyError:
pass
transcript_id = self._transcript_id
self._transcript_id += 1
vsim_process = Process([join(self._prefix, "vsim"), "-c",
"-l", join(dirname(self._modelsim_ini), "transcript%i" % transcript_id)])
self._vsim_processes[ident] = vsim_process
vsim_process.write("#VUNIT_RETURN\n")
try:
consumer = SilentOutputConsumer()
vsim_process.consume_output(consumer)
except Process.NonZeroExitCode:
# Print output if background vsim process startup failed
LOGGER.error("Failed to start re-usable background vsim process")
print(consumer.output)
raise
return vsim_process
开发者ID:VLSI-EDA,项目名称:vunit,代码行数:32,代码来源:modelsim_interface.py
示例2: _create_vsim_process
def _create_vsim_process(self):
"""
Create the vsim process
"""
ident = threading.current_thread().ident
with self._lock:
try:
vsim_process = self._vsim_processes[ident]
if vsim_process.is_alive():
return vsim_process
except KeyError:
pass
transcript_id = self._transcript_id
self._transcript_id += 1
vsim_process = Process([
join(self._prefix, "vsim"), "-c", "-l",
join(dirname(self._modelsim_ini),
"transcript%i" % transcript_id)])
self._vsim_processes[ident] = vsim_process
vsim_process.write("#VUNIT_RETURN\n")
vsim_process.consume_output(silent_output_consumer)
return vsim_process
开发者ID:suoto,项目名称:vunit,代码行数:25,代码来源:modelsim_interface.py
示例3: simulate
def simulate(self, # pylint: disable=too-many-arguments, too-many-locals
output_path, library_name, entity_name, architecture_name, config):
"""
Simulate with entity as top level using generics
"""
assert config.pli == []
ghdl_output_path = join(output_path, self.name)
data_file_name = join(ghdl_output_path, "wave.%s" % self._gtkwave)
if not exists(ghdl_output_path):
os.makedirs(ghdl_output_path)
launch_gtkwave = self._gtkwave is not None and not config.elaborate_only
status = True
try:
cmd = []
cmd += ['--elab-run']
cmd += ['--std=%s' % self._std_str()]
cmd += ['--work=%s' % library_name]
cmd += ['--workdir=%s' % self._libraries[library_name]]
cmd += ['-P%s' % path for path in self._libraries.values()]
if self._has_output_flag():
cmd += ['-o', join(ghdl_output_path, "%s-%s" % (entity_name, architecture_name))]
cmd += config.options.get("ghdl_flags", [])
cmd += [entity_name, architecture_name]
for name, value in config.generics.items():
cmd += ['-g%s=%s' % (name, value)]
cmd += ['--assert-level=%s' % ("warning" if config.fail_on_warning else "error")]
if config.disable_ieee_warnings:
cmd += ["--ieee-asserts=disable"]
if config.elaborate_only:
cmd += ["--no-run"]
if launch_gtkwave:
if exists(data_file_name):
os.remove(data_file_name)
if self._gtkwave == "ghw":
cmd += ['--wave=%s' % data_file_name]
elif self._gtkwave == "vcd":
cmd += ['--vcd=%s' % data_file_name]
proc = Process(['ghdl'] + cmd)
proc.consume_output()
except Process.NonZeroExitCode:
status = False
if launch_gtkwave:
cmd = ["gtkwave"] + shlex.split(self._gtkwave_args) + [data_file_name]
stdout.write("%s\n" % " ".join(cmd))
subprocess.call(cmd)
return status
开发者ID:jcparrad,项目名称:vunit,代码行数:59,代码来源:ghdl_interface.py
示例4: compile_verilog_file
def compile_verilog_file(self, source_file_name, library_name):
try:
proc = Process(['vlog', '-sv', '-quiet', '-modelsimini', self._modelsim_ini,
'-work', library_name, source_file_name])
proc.consume_output()
except Process.NonZeroExitCode:
return False
return True
开发者ID:tomasnilefrost,项目名称:vunit,代码行数:8,代码来源:modelsim_interface.py
示例5: compile_vhdl_file
def compile_vhdl_file(self, source_file_name, library_name, vhdl_standard):
try:
proc = Process(['vcom', '-quiet', '-modelsimini', self._modelsim_ini,
'-' + vhdl_standard, '-work', library_name, source_file_name])
proc.consume_output()
except Process.NonZeroExitCode:
return False
return True
开发者ID:tomasnilefrost,项目名称:vunit,代码行数:8,代码来源:modelsim_interface.py
示例6: test_parses_stderr
def test_parses_stderr(self):
python_script = self.make_file("run_err.py", r"""
from sys import stderr
stderr.write("error\n")
""")
process = Process([sys.executable, python_script])
output = []
process.consume_output(output.append)
self.assertEqual(output, ["error"])
开发者ID:darwinbeing,项目名称:vunit,代码行数:9,代码来源:test_ostools.py
示例7: test_parses_stderr
def test_parses_stderr(self):
python_script = self.make_file("run_err.py", r"""
from sys import stderr
stderr.write("error\n")
""")
process = Process(["python", python_script])
output = []
process.consume_output(lambda line: output.append(line))
self.assertEqual(output, ["error"])
self.assertEqual(process.output, "error\n")
开发者ID:tomasnilefrost,项目名称:vunit,代码行数:10,代码来源:test_ostools.py
示例8: create_library
def create_library(self, library_name, path):
if not file_exists(dirname(path)):
os.makedirs(dirname(path))
if not file_exists(path):
proc = Process(['vlib', '-unix', path])
proc.consume_output(callback=None)
try:
proc = Process(['vmap', '-modelsimini', self._modelsim_ini, library_name])
proc.consume_output(callback=None)
except Process.NonZeroExitCode:
pass
match = self._vmap_pattern.search(proc.output)
if match:
do_vmap = not file_exists(match.group('dir'))
else:
do_vmap = False
if 'No mapping for library' in proc.output:
do_vmap = True
if do_vmap:
proc = Process(['vmap','-modelsimini', self._modelsim_ini, library_name, path])
proc.consume_output(callback=None)
开发者ID:tomasnilefrost,项目名称:vunit,代码行数:27,代码来源:modelsim_interface.py
示例9: test_run_basic_subprocess
def test_run_basic_subprocess(self):
python_script = self.make_file("run_basic.py", r"""
from sys import stdout
stdout.write("foo\n")
stdout.write("bar\n")
""")
output = []
process = Process([sys.executable, python_script])
process.consume_output(output.append)
self.assertEqual(output, ["foo", "bar"])
开发者ID:darwinbeing,项目名称:vunit,代码行数:11,代码来源:test_ostools.py
示例10: run_command
def run_command(command, cwd=None, env=None):
"""
Run a command
"""
try:
proc = Process(command, cwd=cwd, env=env)
proc.consume_output()
return True
except Process.NonZeroExitCode:
pass
return False
开发者ID:barri,项目名称:vunit,代码行数:11,代码来源:simulator_interface.py
示例11: run_command
def run_command(command):
"""
Run a command
"""
try:
proc = Process(command)
proc.consume_output()
return True
except Process.NonZeroExitCode:
pass
return False
开发者ID:darwinbeing,项目名称:vunit,代码行数:11,代码来源:simulator_interface.py
示例12: compile_vhdl_file
def compile_vhdl_file(self, source_file_name, library_name, vhdl_standard):
"""
Compiles a vhdl file into a specific library using a specfic vhdl_standard
"""
try:
proc = Process([join(self._prefix, 'vcom'), '-dbg', '-quiet', '-j', dirname(self._library_cfg),
'-' + vhdl_standard, '-work', library_name, source_file_name])
proc.consume_output()
except Process.NonZeroExitCode:
return False
return True
开发者ID:varunnagpaal,项目名称:vunit,代码行数:11,代码来源:rivierapro_interface.py
示例13: supports_vhdl_package_generics
def supports_vhdl_package_generics(cls):
"""
Returns True when this simulator supports VHDL package generics
"""
proc = Process([join(cls.find_prefix(), 'vcom'), '-version'], env=cls.get_env())
consumer = VersionConsumer()
proc.consume_output(consumer)
if consumer.major is not None:
return consumer.minor >= 1 if consumer.major == 10 else consumer.major > 10
return False
开发者ID:barri,项目名称:vunit,代码行数:11,代码来源:activehdl_interface.py
示例14: get_osvvm_coverage_api
def get_osvvm_coverage_api(cls):
"""
Returns simulator name when OSVVM coverage API is supported, None otherwise.
"""
proc = Process([join(cls.find_prefix(), 'vcom'), '-version'])
consumer = VersionConsumer()
proc.consume_output(consumer)
if consumer.year is not None:
if (consumer.year == 2016 and consumer.month >= 10) or (consumer.year > 2016):
return cls.name
return None
开发者ID:KevinKes,项目名称:vunit,代码行数:12,代码来源:rivierapro_interface.py
示例15: test_run_basic_subprocess
def test_run_basic_subprocess(self):
python_script = self.make_file("run_basic.py", r"""
from sys import stdout
stdout.write("foo\n")
stdout.write("bar\n")
""")
output = []
process = Process(["python", python_script])
process.consume_output(lambda line: output.append(line))
self.assertEqual(output, ["foo", "bar"])
self.assertEqual(process.output, "foo\nbar\n")
开发者ID:tomasnilefrost,项目名称:vunit,代码行数:12,代码来源:test_ostools.py
示例16: test_output_is_parallel
def test_output_is_parallel(self):
python_script = self.make_file("run_timeout.py", r"""
from time import sleep
from sys import stdout
stdout.write("message\n")
stdout.flush()
sleep(1000)
""")
process = Process([sys.executable, python_script])
message = process.next_line()
process.terminate()
self.assertEqual(message, "message")
开发者ID:darwinbeing,项目名称:vunit,代码行数:13,代码来源:test_ostools.py
示例17: _run_batch_file
def _run_batch_file(self, batch_file_name, gui=False):
"""
Run a test bench in batch by invoking a new vsim process from the command line
"""
try:
args = [join(self._prefix, "vsim"), "-gui" if gui else "-c",
"-l", join(dirname(batch_file_name), "transcript"),
'-do', "source \"%s\"" % fix_path(batch_file_name)]
proc = Process(args, cwd=dirname(self._sim_cfg_file_name))
proc.consume_output()
except Process.NonZeroExitCode:
return False
return True
开发者ID:KevinKes,项目名称:vunit,代码行数:15,代码来源:vsim_simulator_mixin.py
示例18: compile_verilog_file
def compile_verilog_file(self, source_file_name, library_name, include_dirs):
"""
Compiles a verilog file into a specific library
"""
args = [join(self._prefix, 'vlog'), '-quiet', '-sv2k12', '-lc', self._library_cfg,
'-work', library_name, source_file_name]
for library in self._libraries.values():
args += ["-l", library.name]
for include_dir in include_dirs:
args += ["+incdir+%s" % include_dir]
try:
proc = Process(args)
proc.consume_output()
except Process.NonZeroExitCode:
return False
return True
开发者ID:varunnagpaal,项目名称:vunit,代码行数:16,代码来源:rivierapro_interface.py
示例19: _run_batch_file
def _run_batch_file(self, batch_file_name, gui=False):
try:
args = ['vsim', '-quiet',
"-l", join(dirname(batch_file_name), "transcript"),
'-do', "do %s" % fix_path(batch_file_name)]
if gui:
args.append('-gui')
else:
args.append('-c')
proc = Process(args)
proc.consume_output()
except Process.NonZeroExitCode:
return False
return True
开发者ID:tomasnilefrost,项目名称:vunit,代码行数:16,代码来源:modelsim_interface.py
示例20: compile_vhdl_file
def compile_vhdl_file(self, source_file_name, library_name, library_path, vhdl_standard):
"""
Compile a vhdl file
"""
try:
cmd = ['ghdl', '-a', '--workdir=%s' % library_path,
'--work=%s' % library_name,
'--std=%s' % self._std_str()]
for library_name, library_path in self._libraries.items():
cmd += ["-P%s" % library_path]
cmd += [source_file_name]
proc = Process(cmd)
proc.consume_output()
except Process.NonZeroExitCode:
return False
return True
开发者ID:varunnagpaal,项目名称:vunit,代码行数:16,代码来源:ghdl_interface.py
注:本文中的vunit.ostools.Process类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论