def test_quartus(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['vlogdefine', 'vlogparam'] name = 'test_quartus_0' tool = 'quartus' tool_options = { 'family': 'Cyclone V', 'device': '5CSXFC6D6F31C8ES', 'quartus_options': ['some', 'quartus_options'], } (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure(args) compare_files(ref_dir, work_root, ['Makefile', 'config.mk', name + '.tcl']) backend.build() compare_files(ref_dir, work_root, [ 'ip-generate.cmd', 'quartus_asm.cmd', 'quartus_fit.cmd', 'quartus_sh.cmd', 'quartus_sta.cmd', ])
def test_spyglass_defaults(): """ Test if the SpyGlass backend picks up the tool defaults """ import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'defaults') paramtypes = ['vlogdefine', 'vlogparam'] name = 'test_spyglass_0' tool = 'spyglass' tool_options = {} (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure(args) compare_files(ref_dir, work_root, [ 'Makefile', 'spyglass-run-design_read.tcl', 'spyglass-run-lint_lint_rtl.tcl', name + '.prj', ]) backend.build() compare_files(ref_dir, work_root, [ 'spyglass.cmd', ])
def test_vpr(params, tmpdir): import os import edalize from edalize_common import compare_files, tests_dir test_name = "vpr" ref_dir = os.path.join(tests_dir, __name__, test_name) os.environ["PATH"] = ( os.path.join(tests_dir, "mock_commands") + ":" + os.environ["PATH"] ) tool = "vpr" name = "test_vpr_{}_0".format(test_name) work_root = str(tmpdir) edam = { "name": name, "flow_options": { "arch": "xilinx", "arch_xml": "/tmp/k6_N10_mem32K_40nm.xml", "vpr_options": [], }, } vpr_flow = edalize.get_flow("vpr") vpr_backend = vpr_flow(edam=edam, work_root=work_root) vpr_backend.configure() config_file_list = [ "Makefile", ] compare_files(ref_dir, work_root, config_file_list)
def test_vivado_minimal(): import os import shutil import tempfile from edalize import get_edatool from edalize_common import compare_files, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'minimal') os.environ['PATH'] = os.path.join(tests_dir, 'mock_commands')+':'+os.environ['PATH'] tool = 'vivado' name = 'test_vivado_minimal_0' work_root = tempfile.mkdtemp(prefix=tool+'_') edam = {'name' : name} backend = get_edatool(tool)(edam=edam, work_root=work_root) backend.configure([]) compare_files(ref_dir, work_root, [ 'Makefile', name+'.tcl', name+'_run.tcl', ]) backend.build() compare_files(ref_dir, work_root, [ 'vivado.cmd', ])
def test_ascentlint_defaults(): """ Test the default configuration of Ascent Lint """ import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'defaults') paramtypes = ['vlogdefine', 'vlogparam'] name = 'test_ascentlint' tool = 'ascentlint' tool_options = {} (backend, args, work_root) = setup_backend( paramtypes, name, tool, tool_options) backend.configure(args) compare_files(ref_dir, work_root, [ 'Makefile', 'run-ascentlint.tcl', 'sources.f', ]) backend.build() compare_files(ref_dir, work_root, [ 'ascentlint.cmd', ])
def test_isim(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['plusarg', 'vlogdefine', 'vlogparam'] name = 'test_isim_0' tool = 'isim' tool_options = { 'fuse_options': ['some', 'fuse_options'], 'isim_options': ['a', 'few', 'isim_options'], } (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure(args) compare_files( ref_dir, work_root, ['config.mk', 'Makefile', 'run_test_isim_0.tcl', 'test_isim_0.prj']) dummy_exe = 'test_isim_0' shutil.copy(os.path.join(ref_dir, dummy_exe), os.path.join(work_root, dummy_exe)) backend.run([]) compare_files(ref_dir, work_root, ['run.cmd'])
def test_radiant_minimal(tmpdir): import os from edalize import get_edatool from edalize_common import compare_files, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'minimal') os.environ['PATH'] = os.path.join( tests_dir, 'mock_commands') + ':' + os.environ['PATH'] tool = 'radiant' tool_options = { 'part': 'LIFCL-40-9BG400C', } name = 'test_{}_minimal_0'.format(tool) work_root = str(tmpdir) edam = {'name': name, 'tool_options': {tool: tool_options}} backend = get_edatool(tool)(edam=edam, work_root=work_root) backend.configure() compare_files(ref_dir, work_root, [ name + '.tcl', name + '_run.tcl', ]) backend.build() compare_files(ref_dir, work_root, [ 'radiantc.cmd', ])
def test_ise(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['vlogdefine', 'vlogparam'] name = 'test_ise_0' tool = 'ise' tool_options = { 'family': 'spartan6', 'device': 'xc6slx45', 'package': 'csg324', 'speed': '-2' } (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure(args) compare_files(ref_dir, work_root, [ 'Makefile', 'config.mk', name + '.tcl', name + '_run.tcl', ]) #f = os.path.join(work_root, 'pcf_file.pcf') #with open(f, 'a'): # os.utime(f, None) backend.build() compare_files(ref_dir, work_root, ['xtclsh.cmd'])
def test_diamond_minimal(): import os import shutil import tempfile from edalize import get_edatool from edalize_common import compare_files, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'minimal') os.environ['PATH'] = os.path.join(tests_dir, 'mock_commands')+':'+os.environ['PATH'] tool = 'diamond' tool_options = { 'part' : 'LFE5U-85F-6BG381C', } name = 'test_{}_minimal_0'.format(tool) work_root = tempfile.mkdtemp(prefix=tool+'_') edam = {'name' : name, 'tool_options' : {tool : tool_options} } backend = get_edatool(tool)(edam=edam, work_root=work_root) backend.configure() compare_files(ref_dir, work_root, [ name+'.tcl', name+'_run.tcl', ]) backend.build() compare_files(ref_dir, work_root, [ 'diamondc.cmd', ])
def test_vivado_minimal(): import os import shutil import tempfile import yaml from edalize import get_edatool from edalize_common import compare_files, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'minimal') os.environ['PATH'] = os.path.join( tests_dir, 'mock_commands') + ':' + os.environ['PATH'] tool = 'vivado' name = 'test_vivado_minimal_0' work_root = tempfile.mkdtemp(prefix=tool + '_') eda_api_file = os.path.join(work_root, name + '.eda.yml') with open(eda_api_file, 'w') as f: f.write(yaml.dump({'name': name})) backend = get_edatool(tool)(eda_api_file=eda_api_file) backend.configure([]) compare_files(ref_dir, work_root, [ 'Makefile', name + '.tcl', name + '_run.tcl', ]) backend.build() compare_files(ref_dir, work_root, [ 'vivado.cmd', ])
def test_diamond(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['generic', 'vlogdefine', 'vlogparam'] tool = 'diamond' name = 'test_{}_0'.format(tool) tool_options = { 'part' : 'LFE5U-85F-6BG381C', } (backend, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure() compare_files(ref_dir, work_root, [ name+'.tcl', name+'_run.tcl', ]) backend.build() compare_files(ref_dir, work_root, [ 'diamondc.cmd', ])
def test_quartus(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir paramtypes = ['vlogdefine', 'vlogparam'] name = 'test_quartus_0' tool = 'quartus' tool_options = { 'family': 'Cyclone V', 'device': '5CSXFC6D6F31C8ES', 'quartus_options': ['some', 'quartus_options'], } # Test each edition of Quartus for edition in ["Standard", "Pro"]: # Each edition has its own set of representative files ref_dir = os.path.join(tests_dir, __name__, edition) # Ensure we test the edition we intend to, even if quartus_sh is present os.environ["FUSESOC_QUARTUS_EDITION"] = edition (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options) # Each edition performs checks on the QSYS files present, so provide # a minimal example with open(os.path.join(work_root, "qsys_file"), 'w') as f: f.write(qsys_file.format(qsys_fill[edition])) backend.configure(args) compare_files(ref_dir, work_root, ['Makefile', name + '.tcl']) backend.build() compare_files(ref_dir, work_root, test_sets[edition])
def test_vivado(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['vlogdefine', 'vlogparam'] name = 'test_vivado_0' tool = 'vivado' tool_options = { 'part' : 'xc7a35tcsg324-1', } (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure(args) compare_files(ref_dir, work_root, [ 'Makefile', name+'.tcl', name+'_run.tcl', ]) backend.build() compare_files(ref_dir, work_root, [ 'vivado.cmd', ])
def test_spyglass_tooloptions(): """ Test passing tool options to the Spyglass backend """ import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'tooloptions') paramtypes = ['vlogdefine', 'vlogparam'] name = 'test_spyglass_0' tool = 'spyglass' tool_options = { 'methodology': 'GuideWare/latest/block/rtl_somethingelse', 'goals': ['lint/lint_rtl', 'some/othergoal'], 'spyglass_options': ['handlememory yes'], 'rule_parameters': ['handle_static_caselabels yes'], } (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure(args) compare_files(ref_dir, work_root, [ 'Makefile', 'spyglass-run-design_read.tcl', 'spyglass-run-lint_lint_rtl.tcl', 'spyglass-run-some_othergoal.tcl', name + '.prj', ]) backend.build() compare_files(ref_dir, work_root, [ 'spyglass.cmd', ])
def test_icarus(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['plusarg', 'vlogdefine', 'vlogparam'] name = 'test_icarus_0' tool = 'icarus' tool_options = { 'iverilog_options': ['some', 'iverilog_options'], 'timescale': '1ns/1ns', } (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options, use_vpi=True) backend.configure(args) compare_files(ref_dir, work_root, [ 'Makefile', name + '.scr', 'timescale.v', ]) backend.build() compare_files(ref_dir, work_root, ['iverilog.cmd']) compare_files(ref_dir, work_root, ['iverilog-vpi.cmd']) backend.run(args) compare_files(ref_dir, work_root, ['vvp.cmd'])
def test_vivado_minimal(params, tmpdir, make_edalize_test): import os import edalize from edalize_common import compare_files, tests_dir test_name, synth_tool = params ref_dir = os.path.join(tests_dir, __name__, test_name) os.environ["PATH"] = (os.path.join(tests_dir, "mock_commands") + ":" + os.environ["PATH"]) tool = "vivado" tool_options = { "part": "xc7a35tcsg324-1", } name = "test_vivado_{}_0".format(test_name) work_root = str(tmpdir) edam = { "name": name, "flow_options": { "synth": synth_tool, "part": "xc7a35tcsg324-1" }, } vivado_flow = edalize.get_flow("vivado") vivado_backend = vivado_flow(edam=edam, work_root=work_root) vivado_backend.configure() config_file_list = [ "Makefile", name + ".tcl", name + "_run.tcl", name + "_pgm.tcl", ] if synth_tool == "yosys": config_file_list.append("edalize_yosys_procs.tcl") config_file_list.append("edalize_yosys_template.tcl") else: config_file_list.append(name + "_synth.tcl") compare_files(ref_dir, work_root, config_file_list) build_file_list = ["vivado.cmd"] if synth_tool == "yosys": build_file_list.append("yosys.cmd") vivado_backend.build() compare_files(ref_dir, work_root, build_file_list)
def test_icestorm_nextpnr(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'nextpnr') paramtypes = ['vlogdefine', 'vlogparam'] name = 'test_icestorm_0' tool = 'icestorm' tool_options = { 'yosys_synth_options': ['some', 'yosys_synth_options'], 'arachne_pnr_options': ['a', 'few', 'arachne_pnr_options'], 'nextpnr_options': ['multiple', 'nextpnr_options'], 'pnr': 'next', } (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure(args) compare_files(ref_dir, work_root, ['Makefile', name + '.ys']) f = os.path.join(work_root, 'pcf_file.pcf') with open(f, 'a'): os.utime(f, None) backend.build() compare_files(ref_dir, work_root, ['yosys.cmd']) compare_files(ref_dir, work_root, ['nextpnr-ice40.cmd']) compare_files(ref_dir, work_root, ['icepack.cmd'])
def test_icestorm_minimal(): import os import shutil from edalize_common import compare_files, setup_backend_minimal, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'minimal') name = 'test_icestorm_0' tool = 'icestorm' (backend, work_root) = setup_backend_minimal(name, tool, [{ 'name': 'pcf_file.pcf', 'file_type': 'PCF' }]) backend.configure('') compare_files(ref_dir, work_root, ['Makefile', name + '.ys']) f = os.path.join(work_root, 'pcf_file.pcf') with open(f, 'a'): os.utime(f, None) backend.build() compare_files(ref_dir, work_root, ['yosys.cmd']) compare_files(ref_dir, work_root, ['arachne-pnr.cmd']) compare_files(ref_dir, work_root, ['icepack.cmd'])
def test_vivado_minimal(params, tmpdir): import os from edalize import get_edatool from edalize_common import compare_files, tests_dir test_name, synth_tool = params ref_dir = os.path.join(tests_dir, __name__, test_name) os.environ['PATH'] = os.path.join( tests_dir, 'mock_commands') + ':' + os.environ['PATH'] tool = 'vivado' tool_options = { 'part': 'xc7a35tcsg324-1', 'synth': synth_tool, } name = 'test_vivado_{}_0'.format(test_name) work_root = str(tmpdir) edam = {'name': name, 'tool_options': {'vivado': tool_options}} backend = get_edatool(tool)(edam=edam, work_root=work_root) backend.configure() config_file_list = [ 'Makefile', name + '.tcl', name + '_run.tcl', name + '_pgm.tcl', ] if synth_tool == "yosys": config_file_list.append(name + '.mk') config_file_list.append('edalize_yosys_procs.tcl') config_file_list.append('edalize_yosys_template.tcl') else: config_file_list.append(name + '_synth.tcl') compare_files(ref_dir, work_root, config_file_list) build_file_list = ['vivado.cmd'] if synth_tool == "yosys": build_file_list.append('yosys.cmd') backend.build() compare_files(ref_dir, work_root, build_file_list)
def test_symbiflow(pnr_tool): import os import shutil import tempfile from edalize import get_edatool from edalize_common import compare_files, tests_dir ref_dir = os.path.join(tests_dir, __name__, pnr_tool) os.environ["PATH"] = (os.path.join(tests_dir, "mock_commands") + ":" + os.environ["PATH"]) tool = "symbiflow" tool_options = { "part": "xc7a35tcsg324-1", "package": "csg324-1", "vendor": "xilinx", "pnr": pnr_tool, "vpr_options": "--fake_option 1000" } name = "test_vivado_{}_0".format(pnr_tool) work_root = tempfile.mkdtemp(prefix=tool + "_") files = [{"name": "top.xdc", "file_type": "xdc"}] if pnr_tool == "nextpnr": files.append({"name": "chipdb.bin", "file_type": "bba"}) edam = { "files": files, "name": name, "tool_options": { "symbiflow": tool_options }, } backend = get_edatool(tool)(edam=edam, work_root=work_root) backend.configure() config_file_list = [ "Makefile", ] if pnr_tool == "nextpnr": config_file_list.append(name + ".mk") config_file_list.append(name + ".tcl") config_file_list.append(name + "-nextpnr.mk") compare_files(ref_dir, work_root, config_file_list)
def test_verilator_run(): import os.path import tempfile from edalize import get_edatool ref_dir_cc = os.path.join(ref_dir, 'cc') work_root = tempfile.mkdtemp() eda_api_file = os.path.join(ref_dir_cc, core_name)+ '.eda.yml' backend = get_edatool(tool)(eda_api_file=eda_api_file, work_root=work_root) dummy_exe = 'V'+backend.tool_options['top_module'] shutil.copy(os.path.join(ref_dir, dummy_exe), os.path.join(work_root, dummy_exe)) backend.run(params) compare_files(ref_dir, work_root, ['run.cmd'])
def test_xcelium(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['plusarg', 'vlogdefine', 'vlogparam'] name = 'test_xcelium_0' tool = 'xcelium' tool_options = { 'xmvhdl_options': ['various', 'xmvhdl_options'], 'xmvlog_options': ['some', 'xmvlog_options'], 'xmsim_options': ['a', 'few', 'xmsim_options'], 'xrun_options': ['plenty', 'of', 'xrun_options'], } #FIXME: Add VPI tests (backend, work_root) = setup_backend(paramtypes, name, tool, tool_options, use_vpi=False) backend.configure() compare_files(ref_dir, work_root, [ 'Makefile', 'edalize_build_rtl.f', 'edalize_main.f', ]) orig_env = os.environ.copy() os.environ['PATH'] = '{}:{}'.format( os.path.join(tests_dir, 'mock_commands/xcelium'), os.environ['PATH']) # For some strange reason, writing to os.environ['PATH'] doesn't update the environment. This # leads to test fails, but only when running multiple tests. When running this test by itself, # everything works fine without the 'putenv'. os.putenv('PATH', os.environ['PATH']) backend.build() os.makedirs(os.path.join(work_root, 'work')) backend.run() compare_files(ref_dir, work_root, ['xrun.cmd']) os.environ = orig_env
def test_vunit_codegen(): from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['cmdlinearg'] name = 'test_vunit_0' tool = 'vunit' tool_options = {} (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options, use_vpi=False) backend.configure(args) compare_files(ref_dir, work_root, ['run.py'])
def test_modelsim(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['plusarg', 'vlogdefine', 'vlogparam'] name = 'test_modelsim_0' tool = 'modelsim' tool_options = { 'vcom_options': ['various', 'vcom_options'], 'vlog_options': ['some', 'vlog_options'], 'vsim_options': ['a', 'few', 'vsim_options'], } #FIXME: Add VPI tests (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options, use_vpi=False) backend.configure(args) compare_files(ref_dir, work_root, [ 'Makefile', 'edalize_build_rtl.tcl', 'edalize_main.tcl', ]) orig_env = os.environ.copy() os.environ['MODEL_TECH'] = os.path.join(tests_dir, 'mock_commands') backend.build() os.makedirs(os.path.join(work_root, 'work')) compare_files(ref_dir, work_root, ['vsim.cmd']) backend.run(args) with open(os.path.join(ref_dir, 'vsim2.cmd')) as fref, open( os.path.join(work_root, 'vsim.cmd')) as fgen: assert fref.read() == fgen.read() os.environ = orig_env
def test_veriblelint_default(): """ Test the lint mode of Verible """ import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'lint') paramtypes = ['vlogdefine', 'vlogparam'] name = 'test_verible' tool = 'veriblelint' tool_options = {} (backend, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure() backend.build() backend.run() compare_files(ref_dir, work_root, [ 'verilog_lint.cmd', ])
def test_rivierapro(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['plusarg', 'vlogdefine', 'vlogparam'] name = 'test_rivierapro_0' tool = 'rivierapro' tool_options = { 'vlog_options': ['some', 'vlog_options'], 'vsim_options': ['a', 'few', 'vsim_options'], } #FIXME: Add VPI tests (backend, work_root) = setup_backend(paramtypes, name, tool, tool_options, use_vpi=False) backend.configure() compare_files(ref_dir, work_root, [ 'edalize_build_rtl.tcl', 'edalize_launch.tcl', 'edalize_main.tcl', ]) orig_env = copy.deepcopy(os.environ) os.environ['ALDEC_PATH'] = os.path.join(tests_dir, 'mock_commands') backend.build() os.makedirs(os.path.join(work_root, 'work')) compare_files(ref_dir, work_root, ['vsim.cmd']) backend.run() with open(os.path.join(ref_dir, 'vsim2.cmd')) as fref, open( os.path.join(work_root, 'vsim.cmd')) as fgen: assert fref.read() == fgen.read() os.environ = orig_env
def test_icarus_minimal(tmpdir): import os from edalize import get_edatool from edalize_common import compare_files, tests_dir ref_dir = os.path.join(tests_dir, __name__, 'minimal') os.environ['PATH'] = os.path.join( tests_dir, 'mock_commands') + ':' + os.environ['PATH'] tool = 'icarus' name = 'test_' + tool + '_minimal_0' work_root = str(tmpdir) edam = {'name': name, 'toplevel': 'top'} backend = get_edatool(tool)(edam=edam, work_root=work_root) backend.configure() compare_files(ref_dir, work_root, [ 'Makefile', name + '.scr', ]) backend.build() compare_files(ref_dir, work_root, ['iverilog.cmd']) backend.run() compare_files(ref_dir, work_root, ['vvp.cmd'])
def test_xsim(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['plusarg', 'vlogdefine', 'vlogparam'] name = 'test_xsim_0' tool = 'xsim' tool_options = { 'xelab_options': ['some', 'xelab_options'], 'xsim_options': ['a', 'few', 'xsim_options'] } (backend, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure() compare_files(ref_dir, work_root, [ 'config.mk', 'Makefile', name + '.prj', ]) backend.build() compare_files(ref_dir, work_root, ['xelab.cmd']) xsimkdir = os.path.join(work_root, 'xsim.dir', name) os.makedirs(xsimkdir) with open(os.path.join(xsimkdir, 'xsimk'), 'w') as f: f.write("I am a compiled simulation kernel\n") backend.run() compare_files(ref_dir, work_root, ['xsim.cmd'])
def test_verilator_cc(): import os.path import shutil from edalize_common import compare_files, setup_backend, tests_dir mode = 'cc' ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['cmdlinearg', 'plusarg', 'vlogdefine', 'vlogparam'] name = 'test_verilator_0' tool = 'verilator' tool_options = { 'libs' : ['-lelf'], 'mode' : mode, 'verilator_options' : ['-Wno-fatal', '--trace'], 'make_options' : ['OPT_FAST=-O2'], } (backend, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure() compare_files(ref_dir, work_root, ['Makefile']) compare_files(os.path.join(ref_dir, mode), work_root, ['config.mk', name+'.vc']) dummy_exe = 'Vtop_module' shutil.copy(os.path.join(ref_dir, dummy_exe), os.path.join(work_root, dummy_exe)) backend.run() compare_files(ref_dir, work_root, ['run.cmd'])
def test_ghdl(): import os import shutil from edalize_common import compare_files, setup_backend, tests_dir ref_dir = os.path.join(tests_dir, __name__) paramtypes = ['vlogparam'] name = 'test_ghdl' tool = 'ghdl' tool_options = { 'analyze_options': ['some', 'analyze_options'], 'run_options': ['a', 'few', 'run_options'] } (backend, args, work_root) = setup_backend(paramtypes, name, tool, tool_options) backend.configure(args) compare_files(ref_dir, work_root, ['Makefile']) backend.build() compare_files(ref_dir, work_root, ['analyze.cmd']) backend.run(args) compare_files(ref_dir, work_root, ['elab-run.cmd'])