diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index fc5229146..af45b7042 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -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: diff --git a/amaranth/back/cxxrtl.py b/amaranth/back/cxxrtl.py index 0fa657b0a..725bda48a 100644 --- a/amaranth/back/cxxrtl.py +++ b/amaranth/back/cxxrtl.py @@ -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 <= (0, 38)) script = [] - script.append(f"read_ilang <>> 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", SyntaxWarning) + .. doctest:: >>> fencepost = C(256, range(256)) @@ -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:: @@ -677,6 +690,14 @@ Python expression Amaranth expression (boolean operands) When applied to Amaranth boolean values, the ``~`` operator computes negation, and when applied to Python boolean values, the ``not`` operator also computes negation. However, the ``~`` operator applied to Python boolean values produces an unexpected result: + .. 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("ignore", DeprecationWarning) + .. doctest:: >>> ~False @@ -695,6 +716,11 @@ Python expression Amaranth expression (boolean operands) >>> ~use_stb | stb # WRONG! MSB of 2-bit wide OR expression is always 1 (| (const 2'sd-2) (sig stb)) + .. doctest:: + :hide: + + >>> _warning_filters_backup.__exit__() + Amaranth automatically detects some cases of misuse of ``~`` and emits a detailed diagnostic message. .. TODO: this isn't quite reliable, #380 diff --git a/pyproject.toml b/pyproject.toml index de17f1aff..ecc787eb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 ] @@ -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 = [ diff --git a/tests/utils.py b/tests/utils.py index 1f01eb47a..249284a8c 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -62,7 +62,7 @@ def assertFormal(self, spec, mode="bmc", depth=1): smtbmc [script] - read_ilang top.il + read_rtlil top.il prep {script}