build.plat: sby mode override; cosmetic fixes.

main
Jean-François Nguyen 3 years ago
parent 96bbd85e83
commit 28a239724e

@ -1,6 +1,8 @@
from amaranth import * from amaranth import *
from amaranth.build import * from amaranth.build import *


from .. import tb



__all__ = ["SymbiYosysPlatform"] __all__ = ["SymbiYosysPlatform"]


@ -11,7 +13,7 @@ class SymbiYosysPlatform(TemplatedPlatform):
* ``yosys`` * ``yosys``
* ``sby`` * ``sby``


Required tools for VHDL support: Required tools for VHDL support (experimental):
* ``ghdl`` * ``ghdl``
* ``ghdl-yosys-plugin`` * ``ghdl-yosys-plugin``


@ -45,11 +47,11 @@ class SymbiYosysPlatform(TemplatedPlatform):
"{{name}}.sby": r""" "{{name}}.sby": r"""
# {{autogenerated}} # {{autogenerated}}
[options] [options]
mode bmc mode {{get_override("mode")}}
expect pass,fail expect pass,fail
append 0 append 0
depth {{get_override("sby_depth")}} depth {{get_override("depth")}}
skip {{get_override("sby_skip")}} skip {{get_override("skip")}}


[engines] [engines]
smtbmc smtbmc
@ -72,12 +74,11 @@ class SymbiYosysPlatform(TemplatedPlatform):
read_verilog {{get_override("read_verilog_opts")|default("-sv")}} {{file}} read_verilog {{get_override("read_verilog_opts")|default("-sv")}} {{file}}
{% endfor %} {% endfor %}
{% if platform.iter_files(".vhdl")|first is defined -%} {% if platform.iter_files(".vhdl")|first is defined -%}
ghdl {{get_override("ghdl_opts")|options}} {{platform.iter_files(".vhdl")|join(" ")}} -e {{get_override("ghdl_top")|default("top")}} ghdl {{get_override("ghdl_opts")|options}} {{platform.iter_files(".vhdl")|join(" ")}} -e {{get_override("ghdl_top")|default("toplevel")}}
{% endif %} {% endif %}
read_ilang {{name}}.il read_ilang {{name}}.il
delete w:$verilog_initial_trigger delete w:$verilog_initial_trigger
{{get_override("script_after_read")|default("# (script_after_read placeholder)")}} {{get_override("script_after_read")|default("# (script_after_read placeholder)")}}
write_ilang debug.il
prep {{get_override("prep_opts")|default("-flatten -nordff")}} -top {{name}} prep {{get_override("prep_opts")|default("-flatten -nordff")}} -top {{name}}
chformal {{get_override("chformal_opts")|default("-early")}} chformal {{get_override("chformal_opts")|default("-early")}}
""", """,
@ -85,8 +86,8 @@ class SymbiYosysPlatform(TemplatedPlatform):
command_templates = [ command_templates = [
r""" r"""
{{invoke_tool("sby")}} {{invoke_tool("sby")}}
--yosys={{invoke_tool("yosys")}}
{{get_override("sby_opts")|default("-f")}} {{get_override("sby_opts")|default("-f")}}
--yosys={{invoke_tool("yosys")}}
{{name}}.sby {{name}}.sby
""", """,
] ]
@ -111,5 +112,12 @@ class SymbiYosysPlatform(TemplatedPlatform):
] ]
return m return m


def build(self, elaboratable, *, sby_depth, sby_skip, **kwargs): def build(self, tb, **kwargs):
return super().build(elaboratable, sby_depth=sby_depth, sby_skip=sby_skip, **kwargs) if not isinstance(tb, tb.Testbench):
raise TypeError("Testbench must be an instance of power_fv.tb.Testbench")

mode = tb.check.mode
skip = tb.t_post
depth = skip + 1

return super().build(tb, mode=mode, depth=depth, skip=skip, **kwargs)

Loading…
Cancel
Save