Commit graph

208 commits

Author SHA1 Message Date
Wanda bfe541a6d7 Implement RFC 50: Print and string formatting.
Co-authored-by: Catherine <whitequark@whitequark.org>
2024-03-11 09:42:43 +00:00
Wanda 127fe1fd2e hdl._xfrm: Get rid of _insert_resets, move the logic downstream. 2024-03-03 19:34:35 +00:00
Wanda ea561378ac hdl._nir: Remove ArrayMux, use AssignmentList instead. 2024-03-03 18:52:21 +00:00
Wanda fc9369b8e1 hdl._xfrm: Simplify EnableInserter logic. 2024-03-03 18:38:20 +00:00
Wanda 7d295b040a test_hdl_ir: Add a bunch of tests for NIR emitter. 2024-03-03 18:09:08 +00:00
Wanda 2400d39730 lib.io: Make Pin.name return the whole path.
This prevents duplicate pin names.
2024-02-29 20:32:43 +00:00
Wanda 76a7dc396c hdl._ir: Handle duplicate fragment names. 2024-02-29 20:03:38 +00:00
Wanda 047b64d02c test_hdl_ir: Add NIR testcases for Instance. 2024-02-29 19:39:20 +00:00
Wanda 2bf1b4dafc hdl._ast: Make AST nodes immutable.
Fixes #1067.
2024-02-29 18:56:46 +00:00
Wanda f8e2d26b8f hdl._ir: Inline AssignmentLegalizer into netlist building.
Fixes #1150.
2024-02-28 15:15:42 +00:00
Wanda f2dab705ee lib.io: Expose Pin path and name as attributes. 2024-02-28 11:49:35 +00:00
Wanda 1dd2e6150c lib.io: Add missing __repr__ to signature type. 2024-02-28 09:11:53 +00:00
Wanda 8af9fe2606 lib.memory: Add missing __eq__ to signature types. 2024-02-28 09:06:49 +00:00
Wanda c6bc9b47ef hdl.ir: add IOBufferInstance. 2024-02-27 18:56:24 +00:00
Wanda 85bb5ee77c hdl._dsl: Change FSM codegen to avoid mutating AST nodes.
Fixes #1066.
2024-02-27 16:20:25 +00:00
Wanda f524dd041a lib.io, build.res: Make Pin and related objects interfaces.
Fixes #1040.
2024-02-27 11:40:25 +00:00
Wanda 751e0f4b57 ir: kill Fragment.ports 2024-02-27 08:26:30 +00:00
Amelia Cuss a586df89ad lib.wiring.connect: diagnostic when no connection made.
If a connect() call results in no connections being made, and it's
because there were no outputs specified at all, issue an error.
Tests enumerate cases per
https://github.com/amaranth-lang/amaranth/pull/1153#issuecomment-1962810678.

Co-authored-by: Catherine <whitequark@whitequark.org>
2024-02-25 09:33:46 +00:00
Catherine 09029cdd91 hdl._ir: remember origins of a fragment during elaboration.
This isn't expected to result in a significant increase in memory use,
so for now it's enabled by default. Elaboration chains where it is not
desired to preserve origins can delete the `origins` attribute from
the fragment and nothing will be stored.

The interface `Fragment.origins` remains private, as is the rest of
the `Fragment` interface (including itself), but it enables certain
codebases that currently use a much more invasive technique to rely on
reading a single private field.
2024-02-22 19:03:55 +00:00
Amelia Cuss c40cfc9fb5 lib.enum: honor enum.nonmember.
Use _EnumDict._member_names to determine which members to consider.
This way we don't need to redo sunder/dunder checks, and `nonmember`s
(introduced in py3.11) are correctly excluded.

This is a defacto public API, given it remains usable from py3.8
until py3.12 inclusive.  (_member_names changes from a list to a
keys-only dict for performance reasons in py3.11, but they iterate the
same.) In current Python main (i.e. what will most likely be 3.13), a
"member_names" property is added which returns those keys.
2024-02-19 23:06:22 +00:00
Wanda 890e099ec3 Implement RFC 45: Move hdl.Memory to lib.Memory. 2024-02-19 22:24:58 +00:00
Wanda 6d65dc1366 hdl, back.rtlil: track and emit module/submodule locations. 2024-02-19 21:41:32 +00:00
Wanda 6058ad35cf hdl._ast: make Shape immutable and hashable.
Fixes #1127.
2024-02-16 15:21:05 +00:00
Wanda 24a392887a Implement RFC 43: Rename reset= to init=. 2024-02-15 22:52:24 +00:00
Wanda e3324e1456 hdl._dsl: fix using 0-width Switch with integer keys.
Fixes #1133.
2024-02-14 19:13:14 +00:00
Wanda 5ffb48b5fb hdl._ast: fix using 0-width Switch with integer keys.
This comes up in `AssignmentLegalizer`-produced `Switch`es for
`ArrayProxy`.
2024-02-14 11:52:35 +00:00
Wanda 0ecd06a7e5 sim: fix using 0-width Switch. 2024-02-14 11:51:19 +00:00
Wanda 0da439cce1 hdl._ast: deprecate ValueCastable.lowermethod. 2024-02-13 05:06:06 +00:00
Wanda e2fd819742 hdl._ast: fix shift_right and as_signed edge cases. 2024-02-13 04:52:38 +00:00
Catherine 0056e982c5 docs/reference: document Value, ValueCastable, ValueLike.
Co-authored-by: Wanda <wanda@phinode.net>
Co-authored-by: mcclure <mcclure@users.noreply.github.com>
2024-02-13 03:22:04 +00:00
Wanda 4014f6429c Implement RFC 27 amendment: deprecate add_sync_process, not add_process. 2024-02-12 18:26:48 +00:00
Wanda 2d42d649ee tests: stop using implicit ports. 2024-02-12 13:24:54 +00:00
Catherine 6f44438e58 hdl._ir,hdl._nir,back.rtlil: new intermediate representation.
The new intermediate representation will enable global analyses
on Amaranth code without lowering it to another representation
such as RTLIL.

This commit also changes the RTLIL builder to use the new IR.

Co-authored-by: Wanda <wanda@phinode.net>
2024-02-11 09:03:49 +00:00
Catherine 78981232d9 hdl.xfrm: add assignment legalizer.
Co-authored-by: Wanda <wanda@phinode.net>
2024-02-11 09:03:49 +00:00
Wanda 45dbce13df hdl: consistently use "comb" for combinatorial domain.
Fixes #1097.
2024-02-09 19:32:55 +00:00
Wanda b6c5294e50 hdl.MemoryInstance: refactor and add first-class simulation support. 2024-02-09 17:36:15 +00:00
Wanda f4daf74634 sim: Add tests for memory access. 2024-02-09 17:36:15 +00:00
Wanda 6e06fc013f hdl.ir: associate statements with domains.
Fixes #1079.
2024-02-09 05:33:16 +00:00
Wanda 09854fa775 hdl.ast: make it impossible to construct *Castable instances.
Fixes #1072.
2024-02-09 05:26:58 +00:00
Catherine 9e75962c35 Implement RFC 27: Testbench processes for the simulator.
Co-authored-by: Wanda <wanda@phinode.net>
2024-02-06 23:12:07 +00:00
Wanda f48b8650c4 sim: fix simulation loop when process catches an injected exception. 2024-02-06 18:55:11 +00:00
Vegard Storheil Eriksen 5e2f3b7992 Implement RFC 42: Const from shape-castable. 2024-02-06 10:18:12 +00:00
Wanda 089213e19f Implement RFC 46: Change Shape.cast(range(1)) to unsigned(0). 2024-02-06 10:05:10 +00:00
Catherine 357ffb680c hdl: remove Repl per RFC 10.
Closes #770.
2024-01-31 03:01:35 +00:00
Catherine ea3d6c9557 docs/reference: document compat guarantee, importing, shapes.
This commit also contains a related semantic change: it adds `Shape`
and `ShapeCastable` to the `__all__` list in `amaranth.hdl`. This is
consistent with the policy that is laid out in the new documentation,
which permits such additions without notice.

Co-authored-by: mcclure <mcclure@users.noreply.github.com>
2024-01-30 22:54:18 +00:00
Catherine 5dd1223cf8 amaranth.hdl: start all private names with an underscore.
This change completes commit 9dc0617e and makes all the tests pass.
It corresponds with the ongoing langauge reference documentation effort.

Fixes #781.
2024-01-30 17:20:45 +00:00
Catherine 8678d5fa14 hdl.dsl: warn if a case is defined after a default case. 2024-01-30 02:54:48 +00:00
Wanda e9299ccd0e hdl.ast: change warning on out-of-range reset to an error, improve it.
Fixes #1019.
2024-01-30 02:35:26 +00:00
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 ae36b596bb hdl.mem: Switch to first-class IR representation for memories.
Fixes #611.
2024-01-17 08:10:28 +00:00