Commit graph

1288 commits

Author SHA1 Message Date
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
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
Catherine fcbc8bd46f CI: enable building merge queue. 2023-06-07 13:22:38 +01: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
psentee 0681cb77b1
pyproject: relax pyvcd requirement to include 0.4.
The only breaking change in 0.4 is dropping support for Python 3.6,
which Amaranth has already dropped. It also adds official support for
3.10 and 3.11.

3ad7340072/CHANGELOG.rst
2023-06-04 19:42:05 +00:00
Catherine a4402b507f hdl.dsl: py3.12+: turn off heuristic warning on ~True and ~False.
There is now an upstream deprecation warning for the same.
We don't have to duplicate it.
2023-06-02 13:45:15 +01:00
Catherine 58b8acac0d _toolchain.cxx: remove.
This is causing issues on Python 3.12 and in any case should be
based on the Python `ziglang` package instead of this cursed
setuptools hack.
2023-06-02 13:45:15 +01:00
Marcelina Kościelnicka c343e879d3 tracer: fix STORE_DEREF handling, add EXTENDED_ARG support.
This fixes the following issues:

- on Python 3.10 and earlier, storing to free variables is now handled
  correctly
- on Python 3.11, `_varname_from_oparg` is now used, fixing problems
  with cell variables that are also arguments
- on all supported versions, EXTENDED_ARG is now parsed, ensuring proper
  handling for long functions

Fixes #792.
2023-06-01 19:18:43 +01:00
Catherine 2a45d0e9ad lib.data: warn if a field is shadowed by an attribute of the view.
Fixes #796.
2023-05-31 13:27:20 +01:00
Catherine f96604f667 lib.data: make all layouts immutable.
This is actually an existing correctness requirement (for the similar
reasons that ValueCastable.as_value() must always return the same
value every time) that for some reason wasn't respected.
2023-05-23 23:19:29 +01:00
Catherine 52b9d3f799 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-23 12:37:21 +01:00