hdl.ast: support division and modulo with negative divisor.

Fixes #621.

This commit bumps the Yosys version requirement to >=0.10.
This commit is contained in:
whitequark 2021-12-11 08:52:14 +00:00
parent 25573c5eff
commit b452e0e871
9 changed files with 41 additions and 90 deletions

View file

@ -4,9 +4,11 @@ Installation
System requirements
===================
.. |yosys-version| replace:: 0.10 (or newer)
Amaranth HDL requires Python 3.6; it works on CPython_ 3.6 (or newer), and works faster on PyPy3.6_ 7.2 (or newer).
For most workflows, Amaranth requires Yosys_ 0.9 (or newer). A compatible version of Yosys is distributed via PyPI_ for most popular platforms.
For most workflows, Amaranth requires Yosys_ |yosys-version|. A compatible version of Yosys is distributed via PyPI_ for most popular platforms.
Simulating Amaranth code requires no additional software. However, a waveform viewer like GTKWave_ is invaluable for debugging.
@ -66,7 +68,7 @@ Installing prerequisites
$ sudo apt-get install yosys
If Yosys 0.9 (or newer) is not available, `build Yosys from source`_.
If Yosys |yosys-version| is not available, `build Yosys from source`_.
.. platform-choice:: arch
:altname: linux
@ -85,7 +87,7 @@ Installing prerequisites
On architectures other than |builtin-yosys-architectures|, install Yosys from the package repository of your distribution.
If Yosys 0.9 (or newer) is not available, `build Yosys from source`_.
If Yosys |yosys-version| is not available, `build Yosys from source`_.
.. _build Yosys from source: https://github.com/YosysHQ/yosys/#setup

View file

@ -421,19 +421,17 @@ While arithmetic computations never result in an overflow, :ref:`assigning <lang
The following table lists the arithmetic operations provided by Amaranth:
============ ========================== ======
Operation Description Notes
============ ========================== ======
============ ==========================
Operation Description
============ ==========================
``a + b`` addition
``-a`` negation
``a - b`` subtraction
``a * b`` multiplication
``a // b`` floor division [#opA1]_
``a % b`` modulo [#opA1]_
``a // b`` floor division
``a % b`` modulo
``abs(a)`` absolute value
============ ========================== ======
.. [#opA1] Divisor must be unsigned; this is an Amaranth limitation that may be lifted in the future.
============ ==========================
.. _lang-cmpops: