Commit graph

1451 commits

Author SHA1 Message Date
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
Catherine 4627d8d3c8 pyproject: depend on setuptools>=67.0 instead of ~=67.0.
The latter is overly strict and breaks installation with PDM (which
is more principled than our other PEP517 build backends).
2023-07-21 03:57:06 +00:00
Catherine 1d200f1e4f README: add Matrix channel. 2023-07-19 22:21:51 +00:00
Catherine d1ca9c46a5 lib.data: allow Const as value of Layout.const(...) field.
Fixes #838.
2023-07-18 14:35:57 +00:00
Catherine 385b10d743 lib.data: improve diagnostics for field access on array layout view.
Fixes #837.
2023-07-18 14:35:49 +00:00
Darrell Harmon ea36c80663 vendor.xilinx: recognize Artix Ultrascale+ part numbers 2023-07-10 20:39:45 +00:00
Jean-François Nguyen 4be5e81012 lib.data: remove unused import. 2023-07-10 01:52:57 +00:00
Charlotte 7e438180e0 lib.enum: allow empty enums. 2023-07-04 10:28:22 +00:00
Marcelina Kościelnicka e6d8d5a354 lib.io: allow 0-width Pin
The main purpose of this change is migrating glasgow from the compat
`TSTriple` (which allows 0 width) to `Pin`.  This sort of change would
normally require a RFC, but `Pin` is already slated for
removal/replacement, so that was deemed to be unnecessary.
2023-07-03 23:06:14 +00:00
Charlotte f4b013ac73 lib.data: no loop required, we return or die. 2023-07-02 05:31:42 +00:00
Charlotte cdf8fcc32f lib.enum: allow import * from amaranth.lib.enum.
There's an actual `py_enum.member` (which we briefly overwrite our loop
index with (!)).  We delete our `member`, but it's still in the
`__all__` that came from `py_enum`, so `import *` fails.
2023-06-29 04:24:38 +00:00
Adam Greig 45b9730786 Implement RFC 6: CRC Generator
See amaranth-lang/rfcs#6 and #681.
2023-06-29 02:42:47 +00:00
Charlotte 60c2a1b4b8 sim._pyrtl: don't blow parser stack on older Pythons.
Python pre-3.9 can't handle parentheses nested this deeply.

* https://github.com/amaranth-lang/amaranth/pull/681 -- motivating
  example.
* https://github.com/amaranth-lang/amaranth/pull/827 -- what added
  enough extra parentheses to make this only break now.
* https://peps.python.org/pep-0617/ -- new parser as of 3.9.
2023-06-29 01:28:44 +00:00
Charlotte fd4e25df42 test_sim: failing test case. 2023-06-29 01:28:44 +00:00
Catherine b77e33f16a Drop support for Python 3.7. 2023-06-28 14:50:30 +00:00
Charlotte 99417d6499 sim._pyrtl: mask bitwise binary operands.
Boolean negation produces negative integers, which when unmasked
drastically affects the result of these operations.
2023-06-24 06:34:48 +00:00
Charlotte 59a83cf7eb test_sim: add failing test case for bitwise binary ops.
See https://github.com/amaranth-lang/amaranth/pull/826#event-9609577585.
2023-06-24 06:34:48 +00:00
Charlotte 4ec9cbbffe sim._pyrtl: py3.12+: convert to int before bitwise negating.
Amaranth bitwise negation `~` compiles to Python bitwise negation `~` in
simulation; the same holds for comparison operators such as `==`. Thus
an expression such as `~(a == b)` in simulation will compile to Python
that takes the bitwise negation of the comparison result, which will be
an actual bool.

On 3.12, the result is a `DeprecationWarning` emitted only at simulation
run-time.

When negating in simulation, coerce the value to an int. `mask` is
sufficient as we do no further arithmetic here.
2023-06-22 17:37:30 +00:00
Charlotte 63f9976267 tests.test_sim.SimulatorRegressionTestCase.test_bug_588: fix for Windows paths. 2023-06-22 03:52:55 +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
Catherine 20db537162 CI: add PyPy3.8 and PyPy3.9. 2023-06-07 14:51:46 +00:00
Catherine 46433268cd docs/changes: update. 2023-06-07 13:50:04 +00:00