Skip to content

backends: s/ilang/rtlil as a result of YosysHQ/yosys#4704 #1575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: v0.4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ jobs:
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- 'pypy-3.8'
- 'pypy-3.9'
- 'pypy-3.10'
allow-failure:
Expand Down
4 changes: 2 additions & 2 deletions amaranth/back/cxxrtl.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def _convert_rtlil_text(rtlil_text, black_boxes, *, src_loc_at=0):
script = []
if black_boxes is not None:
for box_name, box_source in black_boxes.items():
script.append(f"read_ilang <<rtlil\n{box_source}\nrtlil")
script.append(f"read_ilang <<rtlil\n{rtlil_text}\nrtlil")
script.append(f"read_rtlil <<rtlil\n{box_source}\nrtlil")
script.append(f"read_rtlil <<rtlil\n{rtlil_text}\nrtlil")
script.append("write_cxxrtl")

return yosys.run(["-q", "-"], "\n".join(script), src_loc_at=1 + src_loc_at)
Expand Down
2 changes: 1 addition & 1 deletion amaranth/back/verilog.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def _convert_rtlil_text(rtlil_text, *, strip_internal_attrs=False, write_verilog
yosys = find_yosys(lambda ver: ver >= (0, 38))

script = []
script.append(f"read_ilang <<rtlil\n{rtlil_text}\nrtlil")
script.append(f"read_rtlil <<rtlil\n{rtlil_text}\nrtlil")
script.append("proc -nomux -norom")
script.append("memory_collect")

Expand Down
4 changes: 2 additions & 2 deletions amaranth/vendor/_gowin.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ def _osc_div(self):
read_verilog -sv {{get_override("read_verilog_opts")|options}} {{file}}
{% endfor %}
{% for file in platform.iter_files(".il") -%}
read_ilang {{file}}
read_rtlil {{file}}
{% endfor %}
read_ilang {{name}}.il
read_rtlil {{name}}.il
{{get_override("script_after_read")|default("# (script_after_read placeholder)")}}
synth_gowin {{get_override("synth_opts")|options}} -top {{name}} -json {{name}}.syn.json
{{get_override("script_after_synth")|default("# (script_after_synth placeholder)")}}
Expand Down
6 changes: 3 additions & 3 deletions amaranth/vendor/_intel.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class IntelPlatform(TemplatedPlatform):
* ``verbose``: enables logging of informational messages to standard error.
* ``read_verilog_opts``: adds options for ``read_verilog`` Yosys command.
* ``synth_opts``: adds options for ``synth_intel_alm`` Yosys command.
* ``script_after_read``: inserts commands after ``read_ilang`` in Yosys script.
* ``script_after_read``: inserts commands after ``read_rtlil`` in Yosys script.
* ``script_after_synth``: inserts commands after ``synth_intel_alm`` in Yosys script.
* ``yosys_opts``: adds extra options for ``yosys``.
* ``nextpnr_opts``: adds extra options for ``nextpnr-mistral``.
Expand Down Expand Up @@ -194,9 +194,9 @@ class IntelPlatform(TemplatedPlatform):
read_verilog -sv {{get_override("read_verilog_opts")|options}} {{file}}
{% endfor %}
{% for file in platform.iter_files(".il") -%}
read_ilang {{file}}
read_rtlil {{file}}
{% endfor %}
read_ilang {{name}}.il
read_rtlil {{name}}.il
{{get_override("script_after_read")|default("# (script_after_read placeholder)")}}
synth_intel_alm {{get_override("synth_opts")|options}} -top {{name}}
{{get_override("script_after_synth")|default("# (script_after_synth placeholder)")}}
Expand Down
6 changes: 3 additions & 3 deletions amaranth/vendor/_lattice_ecp5.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LatticeECP5Platform(TemplatedPlatform):
* ``verbose``: enables logging of informational messages to standard error.
* ``read_verilog_opts``: adds options for ``read_verilog`` Yosys command.
* ``synth_opts``: adds options for ``synth_ecp5`` Yosys command.
* ``script_after_read``: inserts commands after ``read_ilang`` in Yosys script.
* ``script_after_read``: inserts commands after ``read_rtlil`` in Yosys script.
* ``script_after_synth``: inserts commands after ``synth_ecp5`` in Yosys script.
* ``yosys_opts``: adds extra options for ``yosys``.
* ``nextpnr_opts``: adds extra options for ``nextpnr-ecp5``.
Expand Down Expand Up @@ -114,9 +114,9 @@ class LatticeECP5Platform(TemplatedPlatform):
read_verilog -sv {{get_override("read_verilog_opts")|options}} {{file}}
{% endfor %}
{% for file in platform.iter_files(".il") -%}
read_ilang {{file}}
read_rtlil {{file}}
{% endfor %}
read_ilang {{name}}.il
read_rtlil {{name}}.il
{{get_override("script_after_read")|default("# (script_after_read placeholder)")}}
synth_ecp5 {{get_override("synth_opts")|options}} -top {{name}}
{{get_override("script_after_synth")|default("# (script_after_synth placeholder)")}}
Expand Down
6 changes: 3 additions & 3 deletions amaranth/vendor/_lattice_ice40.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class LatticeICE40Platform(TemplatedPlatform):
* ``verbose``: enables logging of informational messages to standard error.
* ``read_verilog_opts``: adds options for ``read_verilog`` Yosys command.
* ``synth_opts``: adds options for ``synth_ice40`` Yosys command.
* ``script_after_read``: inserts commands after ``read_ilang`` in Yosys script.
* ``script_after_read``: inserts commands after ``read_rtlil`` in Yosys script.
* ``script_after_synth``: inserts commands after ``synth_ice40`` in Yosys script.
* ``yosys_opts``: adds extra options for ``yosys``.
* ``nextpnr_opts``: adds extra options for ``nextpnr-ice40``.
Expand Down Expand Up @@ -116,9 +116,9 @@ class LatticeICE40Platform(TemplatedPlatform):
read_verilog -sv {{get_override("read_verilog_opts")|options}} {{file}}
{% endfor %}
{% for file in platform.iter_files(".il") -%}
read_ilang {{file}}
read_rtlil {{file}}
{% endfor %}
read_ilang {{name}}.il
read_rtlil {{name}}.il
{{get_override("script_after_read")|default("# (script_after_read placeholder)")}}
synth_ice40 {{get_override("synth_opts")|options}} -top {{name}}
{{get_override("script_after_synth")|default("# (script_after_synth placeholder)")}}
Expand Down
6 changes: 3 additions & 3 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ System requirements

.. |yosys-version| replace:: 0.35 (or newer)

Amaranth HDL requires Python 3.8; it works on CPython_ 3.8 (or newer), and works faster on PyPy3.8_ 7.3.7 (or newer). Installation requires pip_ 23.0 (or newer).
Amaranth HDL requires Python 3.9; it works on CPython_ 3.9 (or newer), and works faster on PyPy3.9_ 7.3.7 (or newer). Installation requires pip_ 23.0 (or newer).

For most workflows, Amaranth requires Yosys_ |yosys-version|. A compatible version of Yosys is distributed via PyPI_ for most popular platforms.

Expand All @@ -17,8 +17,8 @@ Synthesizing, placing and routing an Amaranth design for an FPGA requires the FP
.. TODO: Link to FPGA family docs here

.. _CPython: https://www.python.org/
.. _PyPy3.8: https://www.pypy.org/
.. _pip: https://pip.pypa.io/
.. _PyPy3.9: https://www.pypy.org/
.. _pip: https://pip.pypa.io/en/stable/
.. _Yosys: https://yosyshq.net/yosys/
.. _PyPI: https://pypi.org/
.. _GTKWave: http://gtkwave.sourceforge.net/
Expand Down
13 changes: 13 additions & 0 deletions docs/lang.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ Specifying a shape with a range is convenient for counters, indexes, and all oth

Python ranges are *exclusive* or *half-open*, meaning they do not contain their ``.stop`` element. Because of this, values with shapes cast from a ``range(stop)`` where ``stop`` is a power of 2 are not wide enough to represent ``stop`` itself:

.. doctest::
:hide:

>>> import warnings
>>> _warning_filters_backup = warnings.catch_warnings()
>>> _warning_filters_backup.__enter__() # have to do this horrific hack to make it work with `PYTHONWARNINGS=error` :(
>>> warnings.simplefilter("default", amaranth.hdl.dsl.SyntaxWarning)

.. doctest::

>>> fencepost = C(256, range(256))
Expand All @@ -182,6 +190,11 @@ Specifying a shape with a range is convenient for counters, indexes, and all oth
>>> fencepost.value
0

.. doctest::
:hide:

>>> _warning_filters_backup.__exit__()

Amaranth detects uses of :class:`Const` and :class:`Signal` that invoke such an off-by-one error, and emits a diagnostic message.

.. note::
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ readme = "README.md"
authors = [{name = "Amaranth HDL contributors"}]
license = {file = "LICENSE.txt"}

requires-python = "~=3.8"
requires-python = "~=3.9"
dependencies = [
"importlib_resources; python_version<'3.9'", # for amaranth._toolchain.yosys
"pyvcd>=0.2.2,<0.5", # for amaranth.sim.pysim
"Jinja2~=3.0", # for amaranth.build
]
Expand Down Expand Up @@ -56,7 +55,7 @@ test = [
docs = [
"sphinx~=7.1",
"sphinxcontrib-platformpicker~=1.3",
"sphinx-rtd-theme~=1.2",
"sphinx-rtd-theme~=2.0",
"sphinx-autobuild",
]
examples = [
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def assertFormal(self, spec, mode="bmc", depth=1):
smtbmc
[script]
read_ilang top.il
read_rtlil top.il
prep
{script}
Expand Down
Loading