Catherine
7d99981d57
Implement RFC 15: Lifting shape-castable objects.
...
See amaranth-lang/rfcs#15 and #784 .
Note that this RFC breaks the existing syntax for initializing a view
with a new signal. Instances of `View(layout)` *must* be changed to
`Signal(layout)`.
2023-05-15 19:42:12 +01:00
Jean-François Nguyen
e9975587bf
build.plat: replace -+ characters in _all_toolchain_env_vars.
...
Mixed-case variables are allowed since af7c1144
, but '-' or '+' must be
replaced to avoid invalid names (e.g. "$AMARANTH_ENV_oss-cad-suite").
2023-05-15 18:25:49 +01:00
Catherine
a70cfa05cd
lib.data: fix incorrect and very misleading example in documentation.
...
Found while working on amaranth/rfcs#15 . The new code is also robust
in the face of RFC 15 itself (the value returned by Signal will change
but that will save work for the programmer).
2023-05-15 10:55:44 +01:00
Catherine
54d5c4c047
Implement RFC 9: Constant initialization for shape-castable objects.
...
See amaranth-lang/rfcs#9 and #771 .
2023-05-12 23:41:57 +01:00
Catherine
ea5a150155
lib.data: fix documentation style. NFC
2023-05-12 23:41:57 +01:00
Catherine
7166455a6a
lib.data: implement extensibility as specified in RFC 8.
...
See amaranth-lang/rfcs#8 and #772 .
2023-05-12 20:03:08 +01:00
Catherine
68e292c681
lib.data: add reference documentation.
2023-05-12 19:54:47 +01:00
Catherine
a5ffa38e64
CI: fix publish-docs job.
2023-05-12 17:31:23 +00:00
Catherine
61a8f21319
CI: simplify publish-docs job.
2023-05-12 18:22:36 +01:00
Catherine
2d379d0010
CI: publish docs to GitHub pages in forks, per branch.
...
This is useful for previewing how documentation renders in a PR.
2023-05-12 18:22:36 +01:00
Catherine
4f70cd6294
CI: split document and publish steps, and skip publish in forks.
2023-05-12 18:22:36 +01:00
Catherine
4398575322
lib.enum: accept any const-castable expression as member value.
...
This behavior was introduced by amaranth-lang/rfcs#4. See #755 .
2023-05-12 16:39:02 +01:00
Catherine
bf8bbb0f63
lib.enum: check member value shapes before subclassing. NFCI
...
This commit is a preparation for accepting const-castable expressions
as enum member values.
See #755 .
2023-05-12 16:39:02 +01:00
Catherine
5f6b36e91f
Add a workaround for python-poetry/poetry#7702 .
2023-03-22 10:37:06 +00:00
Catherine
46e0a00a08
Add a workaround for setuptools erroring out on stale git checkouts.
2023-03-22 02:09:43 +00:00
Arusekk
5f094a23eb
hdl.ast: Test *Castable subclasses on definition.
...
The __init_subclass__ method fires on class definition rather than use.
It also has the bonus impact that no __new__ method is defined, so the
classes can be correctly detected as mix-in classes by modules such as
enum.
2023-03-21 23:22:47 +00:00
Josuah Demangeon
a0307c343d
docs: disambiguate Cat(a, b, ...) support for more than 2 arguments
...
I had this confusion while reading the doc.
Someone else also likely did:
https://github.com/bl0x/learn-fpga-amaranth/blob/main/06_alu/soc.py#L111
2023-03-21 14:16:27 +00:00
Catherine
80343d1c4c
hdl.ast: warn on fencepost error in Signal(range(x), reset=x)
.
...
Also, relax the language reference inset from "warning" to "note"
since this is no longer something developers have to keep in mind
explicitly.
2023-03-13 20:38:41 +00:00
Catherine
32eabd9372
hdl.ast: remove Value.__hash__
.
...
This is already undefined when defining `Value.__eq__`, and it makes
typecheckers (mypy, pyright/pylance) unhappy.
2023-03-06 19:44:53 +00:00
Catherine
ae1aeff0f2
lib.data: at most one Union
field can have annotation with a default.
2023-03-04 09:34:50 +00:00
Jonathan Neuschäfer
e2ce959c90
build.run: Handle UTF-8 encoding errors in SSH output gracefully
...
In some cases, a toolchain might produce shell output that isn't correct
UTF-8. To avoid crashing in such cases, pass errors="replace" to
bytes.decode.
For example, Lattice Diamond uses the Latin-1 encoding for some reason.
This recently broke my setup because the month turned to "März" in a
German locale:
--- Start Time: Fr. M�r 3 20:01:41 2023
2023-03-04 00:51:29 +00:00
Catherine
16be75e02c
lib.data: fix typo.
2023-03-03 09:03:53 +00:00
Catherine
0c4fda92fe
hdl.ast: accept any constant-castable expression in Signal(reset=)
.
...
See amaranth-lang/rfcs#4 .
This functionality was not explicitly specified in the RFC but it
falls under "anywhere an integer or an enumeration is accepted".
2023-03-03 06:22:56 +00:00
Catherine
f77a335abf
lib.enum: change shape mismatch warning category to SyntaxWarning
.
2023-03-03 06:14:53 +00:00
Catherine
c1b9c64e10
lib.data: ignore Python typing annotations in aggregate base class.
2023-03-03 03:45:12 +00:00
mndza
90b374c17a
build.plat: fix strings as build option overrides.
...
This was broken in 097da99.
2023-03-02 10:50:14 +00:00
Marcelina Kościelnicka
e3e542afff
vendor.xilinx: fix a SyntaxWarning.
2023-03-01 00:51:13 +00:00
Catherine
14e73a73de
hdl.ast: do not cast comparand to shape in Shape.__eq__
.
...
This doesn't match how other Python comparison operators work.
E.g. `1 == int("1")` but `1 != "1"`.
2023-02-28 15:52:50 +00:00
Catherine
35561ea11a
lib.data: improve reset value handling for Union
.
...
* Reject union initialization with more than one reset value.
* Replace the reset value specified in the class definition with
the one provided during initalization instead of merging.
2023-02-28 15:38:20 +00:00
Catherine
c7ef05c894
lib.data: improve annotation handling for Struct
and Union
.
...
* Annotations like `s: unsigned(4) = 1` are recognized and
the assigned value is used as the reset value for the implicitly
created `Signal`.
* Base classes inheriting from `Struct` and `Union` without
specifying a layout are recognized.
* Classes that both inherit from a base class with a layout and
specify a layout are rejected.
2023-02-28 15:38:18 +00:00
Catherine
0ee5de036c
hdl.ast: deprecate Sample
, Past
, Rose
, Fell
, Stable
.
...
See #526 .
2023-02-28 14:30:04 +00:00
Catherine
9ec7f5b507
build.plat: accept lists as build option overrides.
...
This was unintentionally removed in 9eb208c3
.
Fixes #727 .
2023-02-28 13:40:59 +00:00
Catherine
0b7adcbd10
back.verilog: pass -norom
to -proc
if available.
...
Fixes #746 .
2023-02-28 13:34:14 +00:00
Catherine
7ea2e175e4
lib.enum: fix shape calculation for const-castable member values.
2023-02-28 13:30:26 +00:00
Catherine
de36e3c162
lib.enum: add Python 3.7..3.8 compatibility shim.
2023-02-28 13:26:52 +00:00
Catherine
57612f1dce
lib.enum: add Enum wrappers that allow specifying shape.
...
See #756 and amaranth-lang/rfcs#3 .
2023-02-28 13:00:41 +00:00
Catherine
ef2e9fa809
hdl.ast: Value.matches()
with no arguments should return C(1)
.
...
The behavior of the following must be always the same:
- `with m.Switch(v): with m.Case(*pats):`
- `with m.If(v.matches(*pats)):`
2023-02-28 09:09:27 +00:00
Catherine
9aeb22311f
docs/changes: add changes from RFC 4.
2023-02-28 09:06:49 +00:00
Catherine
58721ee4fe
hdl: implement constant-castable expressions.
...
See #755 and amaranth-lang/rfcs#4 .
2023-02-27 22:38:38 +00:00
Catherine
bef2052c1e
hdl.ast: implement Value.__pos__
.
2023-02-27 22:31:17 +00:00
Catherine
342fd5f8bd
docs: fix doctests and run them in CI workflow.
2023-02-27 19:47:51 +00:00
Catherine
5d872096a7
docs/changes: link to RFC.
2023-02-27 18:28:52 +00:00
Catherine
f602ce1f8f
hdl.ast: deprecate Const.normalize
.
...
Tracking issue #754 .
2023-02-27 18:19:59 +00:00
Catherine
fcc4f54367
lib.data: make Field() immutable.
...
Mutability of Field isn't specified by the RFC and can cause issues
if the objects stored in Layout subclasses are mutated. There isn't
any reason to do that (the subclasses themselves are mutable and
handle that correctly), so disallow it.
2023-02-21 17:58:28 +00:00
Catherine
e2f0519774
docs: upgrade Sphinx.
2023-02-17 09:59:19 +00:00
Catherine
12a81f24bd
docs/install: pip>=23.0 is required.
...
Fixes #745 .
2023-02-16 22:09:14 +00:00
Catherine
ca77de5ed3
docs/install: update deprecated pip syntax.
...
Fixes #750 .
2023-02-16 20:41:31 +00:00
Catherine
7e3e10e733
lib.data: implement RFC 1 "Aggregate data structure library".
...
See amaranth-lang/rfcs#1 .
2023-02-15 10:10:01 +00:00
Jean THOMAS
a7fec279aa
hdl,back: add support for name= in property checks (Assert, ...).
...
Co-authored-by: Jean THOMAS <virgule@jeanthomas.me>
2023-02-12 11:21:31 +00:00
Catherine
666ee27fd0
build.run: ensure shell script is run with /bin/sh.
...
Fixes #665 .
2023-02-06 17:08:39 +00:00