Commit graph

1326 commits

Author SHA1 Message Date
Wanda 05cb82b8fc ast: fix const-castable expression handling in Signal(reset=).
The code to accept const-castable expressions was previously added in
0c4fda92fe, but it was untested and had
a few bugs.

Fixes #911.
2023-09-24 02:46:43 +00:00
crzwdjk 11d5bb19eb vendor._lattice_ice40: add an icepack_opts override
Add an icepack_opts override in case the user wants to pass
extra options to icepack as part of the build process.
2023-09-13 20:05:01 +00:00
Catherine ecba1a1863 back.rtlil: put hierarchy in module name instead of an attribute.
The attribute sees essentially no use and the information is much
better served by putting it in the module name. In addition this
means that the entire tree can be renamed simply by renaming the top
module.

Tools like GTKWave show the names of the instances, not the modules,
so they are not affected by the longer names.
2023-09-13 12:46:46 +00:00
Catherine d32ca04326 pyproject: migrate to PDM build backend.
`.git_archival.txt` and the functionality of deriving SCM version
from a GitHub generated archive is removed pending implementation of
pdm-project/pdm-backend#194.
2023-09-12 01:40:48 +00:00
Catherine a9d03805ff lib.io: add a deprecation warning on Pin.eq.
This will stop working once `Pin` is no longer inheriting from
`Record`.
2023-09-05 14:07:33 +00:00
Catherine 1d3a62093b docs/changes: call out backwards incompatibility with Pin. 2023-09-05 14:07:33 +00:00
Catherine 6683c3a916 hdl.mem: fix INIT parameter of emitted $mem_v2 cell.
Unspecified memory slots are initialized to zero, not uninitialized.
2023-09-05 13:25:55 +00:00
Catherine c53eee961c back.rtlil: fix MEMID parameter to match $mem_v2 cell name. 2023-09-05 13:25:55 +00:00
Catherine 525c7e2be0 back.rtlil: do not translate empty subfragments at all.
It was thought previously (by me) that adding a wire that does
nothing to an empty subfragment is enough to prevent it from being
treated as a blackbox. This is enough for Yosys but not Vivado.
Another workaround could probably be used that satisfies both, but
instead let's just not translate any empty subfragments.

This doesn't account for the case of the empty toplevel, but that
does not seem worth addressing.

Fixes #899.
2023-09-05 06:29:57 +00:00
Catherine 4e078322a0 lib.io: make Pin an interface object.
Tracking #879.

The directions of signals in `Pin` make it convenient to use a pin
signature in a component, such as in:

    class LEDDriver(Component):
        pins: Out(Signature({"o": Out(1)}))

    led_driver = LEDDriver()
    connect(led_driver.pins, platform.request("led"))

The `platform.request` call, correspondingly, returns a flipped `Pin`
object.
2023-09-04 20:48:36 +00:00
Catherine 33c2246311 back.{verilog,rtlil}: in convert(), accept a Component without ports.
Closes #883.
2023-09-04 19:05:49 +00:00
Catherine 87fbcedecf lib.wiring: implement Signature.flatten. 2023-09-04 19:05:49 +00:00
Catherine f135226a79 hdl: disallow signed(0) values with unclear semantics.
Fixes #807.
2023-09-03 04:37:59 +00:00
Catherine 21b5451036 ast: ensure Part offset is unsigned.
Co-authored-by: Marcelina Kościelnicka <mwk@0x04.net>
2023-09-03 04:25:08 +00:00
Marcelina Kościelnicka 8c4a15ab92 hdl.mem: lower Memory directly to $mem_v2 RTLIL cell.
The design decision of using split memory ports in the internal
representation (copied from Yosys) was misguided and caused no end
of misery. Remove any uses of `$memrd`/`$memwr` and lower memories
directly to a combined memory cell, currently the RTLIL one.
2023-09-03 03:27:51 +00:00
Catherine fc85feb30d docs/changes: document deprecation of Record. 2023-09-01 06:48:28 +00:00
Catherine f28b20fc84 lib.wiring: ensure flipped(flipped(intf)) is intf. 2023-09-01 05:42:04 +00:00
Catherine 5a17f94fdc hdl.rec: deprecate in favor of lib.data and lib.wiring.
Tracking #879.
2023-09-01 04:20:16 +00:00
Catherine 7f1397b281 vendor/*: add missing __all__.
This broke code that did e.g.

    from amaranth.vendor.xilinx import *

which is common in amaranth-boards.
2023-09-01 01:30:46 +00:00
Catherine cd4ea96bd1 Implement RFC 19: Remove amaranth.lib.scheduler 2023-09-01 00:56:12 +00:00
Catherine b172d63160 docs/changes: minor cleanups and improvements. 2023-09-01 00:37:48 +00:00
Catherine 796068a192 Implement RFC 18: Reorganize vendor platforms 2023-09-01 00:37:48 +00:00
Catherine 88cbf30128 lib.wiring: use is for type comparison in Component.
This avoids running custom `__eq__` implementations, which could
cause issues such as #882.
2023-08-31 19:26:07 +00:00
Catherine 44d5fac01c lib.wiring: fix equality of FlippedSignature with other object.
Fixes #882.
2023-08-31 19:26:07 +00:00
Catherine cfd4f9c84e docs/enum: emphasize that shape= is optional. 2023-08-31 02:16:26 +00:00
Catherine f95fe45186 Implement RFC 22: Add ValueCastable.shape().
Fixes #794.
Closes #876.
2023-08-23 10:48:48 +00:00
Catherine 7714ce329a Fix broken commit c9fd0d83. 2023-08-22 17:15:15 +00:00
Catherine c9fd0d8391 build.run: prohibit absolute paths in BuildPlan.add_file.
This makes the build impure and also causes the contents of a file
outside of the build directory to be overwritten.

The check in `BuildPlan.execute_local` is also expanded to cover
the possibility of an absolute path sneaking through.
2023-08-22 16:27:51 +00:00
Catherine 4ffadff20d lib.wiring: implement amaranth-lang/rfcs#2.
Co-authored-by: Charlotte <charlotte@lottia.net>
2023-08-22 16:22:09 +00:00
Catherine 6e50559dfa pyproject: add PDM scripts for reporting code coverage. 2023-08-22 16:22:09 +00:00
Catherine 20e8bbdfbd Bring __version__ retrieval up to date. NFCI
Because `importlib.metadata.PackageNotFoundError` inherits from
`ImportError`, the code did not previously work in the way that was
stated in the comment. We should probably deprecate `__version__`
entirely at some point.
2023-08-16 14:40:16 +00:00
Catherine 012f12339d docs/contrib: fix typo. 2023-08-16 09:39:59 +00:00
mcc f976754e15 docs: Minor typo in tutorial.rst 2023-08-10 18:12:07 +00:00
Catherine 7b992672aa docs/contrib: minor fixes. 2023-08-10 14:23:07 +00:00
Catherine 49a56c4467 vendor.gowin: unbreak dir="o" pins with xdr=2. 2023-08-08 19:51:22 +00:00
Catherine 33139ac6cb CI: group all required workflows into one for the status check.
This simplifies repository management.
2023-08-08 13:13:14 +00:00
Bastian Löher 93e89f5632 vendor.gowin: new platform.
Co-authored-by: Catherine <whitequark@whitequark.org>
2023-08-08 12:38:36 +00:00
Catherine 9dfaa931a3 Add CODEOWNERS.
This results in a more flexible workflow than requiring >=1 review.
2023-08-07 11:12:28 +00:00
Catherine b9520050d1 docs/contrib: expand the contribution guide.
Co-authored-by: AllysonProlisko <137875383+AllysonProlisko@users.noreply.github.com>
2023-07-27 13:04:20 +00:00
Catherine a127167c53 docs/lang: capture and verify an expected warning in doctest. 2023-07-24 13:46:48 +00:00
Catherine 7639e84af4 docs/contrib: begin writing a contribution guide. 2023-07-24 13:46:48 +00:00
Catherine 1826fa83bd Formalize test and documentation workflows using PDM. 2023-07-24 13:46:48 +00:00
Catherine d491288e32 Eliminate uses of deprecated abstractproperty() decorator.
Its docstring with the deprecation notice polluted the documentation.
2023-07-24 13:46:48 +00:00
Catherine 7f00f4b99d CI: formatting. NFC 2023-07-24 03:33:12 +00:00
Catherine 92c80957b3 CI: fix spelling. 2023-07-24 03:33:12 +00:00
Catherine cb5b0e38d9 build.run: make BuildPlan.execute_local(env=) override environment.
If it adds to the environment then it ultimately creates the same
kind of problem it was intended to solve--a need to reproduce
the calls to `subprocess` in the code outside. It's not that hard
to merge two dicts, plus much of the time enough you can get by with
having just `PATH` and `AMARANTH_ENV_*` (if even that).

If an override is wanted it can be done easily enough with:

    .execute_local(env={**os.environ, "VAR": "VALUE"})
2023-07-23 17:11:10 +00:00
Catherine a921261215 build.run: add env= argument to BuildPlan.execute_local().
Build scripts are explicitly intended to have overrides that are
done through the use of environment variables, and right now this
would require a very awkward `run_script=False` invocation followed
by copying a bit of code out of the Amaranth codebase, which is
clearly suboptimal.
2023-07-23 04:12:32 +00:00
Catherine a6d67f7477 hdl.ir: use additional heuristic for silencing warning.
Using `sys.excepthook` to silence the must-use warning has some false
negatives: applications may catch the exception and then quit
normally, e.g. becaue the error is well known and does not require
a traceback to be shown (which would be noisy). The current
implementation prints even more noise in that case.

In addition to the existing heuristic, silence the warning if
*nothing* has been elaborated, which is almost always a reliable
sign. It doesn't work if multiple designs are independently created
in the application and some of them are dropped without being used,
but this is unavoidable as it is not distinguishable from the mistake
this warning is attempting to prevent.

Fixes #848.
2023-07-23 04:12:22 +00:00
Marcelina Kościelnicka f6c38061ff lib.data: fix Layout.const masking for signed fields.
Fixes #846.
2023-07-22 00:35:42 +00:00
Catherine 7a9dbc8c11 Add PDM-related files to gitignore. 2023-07-21 03:57:06 +00:00