Wanda
b40c18fb00
hdl.ast: suggest bit_select or word_select when indexing with Value.
...
Fixes #1044 .
2024-01-18 20:06:55 +00:00
Wanda
bf8faea51e
hdl.ast: raise a sensible error for xxx in Value
2024-01-14 00:36:44 +00:00
Wanda
86d14f584e
Implement RFC 39: Change semantics of no-argument m.Case()
.
2024-01-13 22:33:54 +00:00
Wanda
7f76914b74
Implement RFC 17: Remove log2_int
.
...
Reexports of `amaranth.utils` functions are removed from
`amaranth._utils` to avoid a circular import issue (for `deprecated`).
Since this is a private module, this should not be a problem.
2024-01-11 04:45:17 +00:00
Wanda
7e18786c97
hdl.ast: use operator.index
instead of int
.
...
This ensures things like `Const(1.5)` raise an error.
`int(operator.index())` is used since `operator.index(True)` on Python
3.9 and earlier returns `True` instead of `1`.
2024-01-10 18:07:48 +00:00
Jaro Habiger
cc9fe89049
hdl.ast: fix Array not being indexable by ValueCastable
2024-01-03 13:46:16 +00:00
Wanda
0849e1af0b
hdl.ast: make Slice
const-castable.
...
Fixes #1006 .
2023-12-30 11:28:03 +00:00
Wanda
6780c838b2
hdl.ast: fix Const.cast(Cat(...))
handling for signed numbers.
2023-12-30 11:27:08 +00:00
Catherine
9d4ffab104
compat: remove.
...
Fixes #692 .
2023-12-13 11:20:12 +00:00
Catherine
750cbbc3c7
hdl: remove deprecated Sample
, Past
, Stable
, Rose
, Fell
.
2023-12-13 11:13:14 +00:00
Catherine
597b1b8839
Implement RFC 5: Remove Const.normalize
.
...
Closes #754 .
2023-12-13 09:53:54 +00:00
Wanda
e9545efb22
Implement RFC 35: Add ShapeLike
, ValueLike
.
2023-12-09 13:57:30 +00:00
Catherine
4bfe2cde6f
sim: add support for dumping structure fields in VCD.
...
See #790 .
This commit adds an entirely private API for describing formatting of
values that is used in the standard library, in departure from our
standing policy of not using private APIs in the standard library.
This is a temporary measure intended to get the version 0.4 released
faster, as it has been years in the making. It is expected that this
API will be made public in the version 0.5 after going through the usual
RFC process.
This commit only adds VCD lines for fields defined in `lib.data.Layout`
when using `sim.pysim`. The emitted RTLIL and Verilog remain the same.
It is expected that when `sim.cxxsim` lands, RTLIL/Verilog output will
include aliases for layout fields as well.
The value representation API also handles formatting of enumerations,
with no changes visible to the designer. The implementation of
`Signal(decoder=)` is changed as well to use the new API, with full
backwards compatibility and no public API changes.
Co-authored-by: Wanda <wanda@phinode.net>
2023-11-27 19:03:13 +00:00
Catherine
f9da3c0d16
Pyupgrade to 3.8+. NFCI
2023-11-14 13:07:21 +00:00
Vegard Storheil Eriksen
879601380d
ast: allow overriding Value operators.
2023-10-30 20:17:51 +00:00
Catherine
57933b974d
ast: fix pylance's type inference on Value._rhs_signals(). NFC
2023-09-25 14:15:11 +00:00
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
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
Catherine
f95fe45186
Implement RFC 22: Add ValueCastable.shape()
.
...
Fixes #794 .
Closes #876 .
2023-08-23 10:48:48 +00:00
Charlotte
d218273b9b
hdl.ast: deprecate Repl
and remove from AST; add Value.replicate
.
2023-06-22 03:52:55 +00:00
Marcelina Kościelnicka
b1cce87630
hdl.ast: make Value.__abs__
return unsigned shape.
2023-06-07 23:20:26 +00:00
Marcelina Kościelnicka
51391be1ae
hdl.ast: ensure Value.cast
in Part
and Slice
constructors.
2023-06-07 19:53:16 +00:00
Marcelina Kościelnicka
1b0fb1afbc
hdl.ast: fix src_loc
for Slice
.
2023-06-07 19:52:14 +00:00
Marcelina Kościelnicka
3d3846e996
hdl.ast: fix ValueKey.__eq__
.
2023-06-07 15:32:21 +00:00
Marcelina Kościelnicka
1d5e090580
hdl.ast: fix shape for subtraction.
...
Fixes #813 .
2023-06-07 12:34:30 +00:00
Marcelina Kościelnicka
3180a17fd9
hdl.ast: fix Slice
validation.
...
Fixes #810 .
2023-06-07 12:26:36 +00:00
Marcelina Kościelnicka
c7984463c7
hdl.ast: fix range handling in Shape.cast
.
...
Fixes #803 .
2023-06-07 12:26:30 +00:00
Marcelina Kościelnicka
a6e33abc5f
hdl.ast: guard rotate_*
against 0-width values.
...
Fixes #808 .
2023-06-07 12:12:24 +01:00
Marcelina Kościelnicka
656db317d2
hdl.ast: fix signed Const
normalization.
...
Fixes #805 .
2023-06-07 11:22:52 +01:00
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
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
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
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
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
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
0ee5de036c
hdl.ast: deprecate Sample
, Past
, Rose
, Fell
, Stable
.
...
See #526 .
2023-02-28 14:30:04 +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
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
f602ce1f8f
hdl.ast: deprecate Const.normalize
.
...
Tracking issue #754 .
2023-02-27 18:19:59 +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
5a79c351e3
Remove features deprecated in version 0.3.
2023-01-31 21:38:27 +00:00
Catherine
7044e09110
hdl.ast: remove Shape<>tuple comparisons.
...
See #691 .
I missed this in commit 29502442
.
2023-01-31 15:23:06 +00:00
Catherine
29502442fb
hdl.ast: remove Shape<>tuple casts.
...
Closes #691 .
2023-01-31 12:58:29 +00:00
Arusekk
de6b69370f
hdl.ast: Do not warn on int Enums in Cat.
...
This aligns with the behavior for plain Enums.
2023-01-22 23:40:39 +00:00
Arusekk
58a0c68279
hdl.ast: allow typed int enums in Value.cast.
2023-01-22 23:40:39 +00:00
J. Neuschäfer
91d4513682
Fix several typos. NFC.
2023-01-20 19:48:29 +00:00