diff --git a/amaranth-stubs b/amaranth-stubs index c92fccb8c..886d1b3b5 160000 --- a/amaranth-stubs +++ b/amaranth-stubs @@ -1 +1 @@ -Subproject commit c92fccb8c04dbb7633ad99cdf6f10ec58e5b38a5 +Subproject commit 886d1b3b5cb1aa268b9f59168918765a11b5b45f diff --git a/requirements.txt b/requirements.txt index 4596816f7..7d70b711d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ ./amaranth-stubs/ # can't use -e -- pyright doesn't see the stubs then :( -amaranth-yosys==0.38.0.0.post88 -git+https://github.com/amaranth-lang/amaranth@6d65dc1366da2313e8e6a77d5093ddd6acdec8aa +amaranth-yosys==0.40.0.0.post100 +git+https://github.com/amaranth-lang/amaranth@9bd536bbf96b07720d6e4a8709b30492af8ddd13 dataclasses-json==0.6.3 diff --git a/test/transactron/test_assign.py b/test/transactron/test_assign.py index dab0225bf..7398570fa 100644 --- a/test/transactron/test_assign.py +++ b/test/transactron/test_assign.py @@ -3,7 +3,7 @@ from amaranth import * from amaranth.lib import data from amaranth.lib.enum import Enum -from amaranth.hdl._ast import ArrayProxy, Slice +from amaranth.hdl._ast import ArrayProxy, SwitchValue, Slice from transactron.utils._typing import MethodLayout from transactron.utils import AssignType, assign @@ -143,11 +143,14 @@ def test_assign_a(self, name, layout1: MethodLayout, layout2: MethodLayout, atyp self.assertIs_AP(alist[0].rhs, self.extrr(rhs).a) def assertIs_AP(self, expr1, expr2): # noqa: N802 - if isinstance(expr1, ArrayProxy) and isinstance(expr2, ArrayProxy): + expr1 = Value.cast(expr1) + expr2 = Value.cast(expr2) + if isinstance(expr1, SwitchValue) and isinstance(expr2, SwitchValue): # new proxies are created on each index, structural equality is needed - self.assertIs(expr1.index, expr2.index) - assert len(expr1.elems) == len(expr2.elems) - for x, y in zip(expr1.elems, expr2.elems): + self.assertIs(expr1.test, expr2.test) + assert len(expr1.cases) == len(expr2.cases) + for (px, x), (py, y) in zip(expr1.cases, expr2.cases): + self.assertEqual(px, py) self.assertIs_AP(x, y) elif isinstance(expr1, Slice) and isinstance(expr2, Slice): self.assertIs_AP(expr1.value, expr2.value) diff --git a/transactron/lib/metrics.py b/transactron/lib/metrics.py index 6f63e27e9..78f5c5e53 100644 --- a/transactron/lib/metrics.py +++ b/transactron/lib/metrics.py @@ -175,6 +175,10 @@ def add_registers(self, regs: list[HwMetricRegister]): def metrics_enabled(self) -> bool: return DependencyContext.get().get_dependency(HwMetricsEnabledKey()) + # To restore hashability lost by dataclass subclassing + def __hash__(self): + return object.__hash__(self) + class HwCounter(Elaboratable, HwMetric): """Hardware Counter diff --git a/transactron/utils/assign.py b/transactron/utils/assign.py index 7b0b3eab7..4257d2df6 100644 --- a/transactron/utils/assign.py +++ b/transactron/utils/assign.py @@ -217,7 +217,7 @@ def has_explicit_shape(val: ValueLike): if valuelike_shape(lhs) != valuelike_shape(rhs): raise ValueError( "Shapes not matching: lhs: {} {} rhs: {} {}".format( - valuelike_shape(lhs), lhs, valuelike_shape(rhs), rhs + valuelike_shape(lhs), repr(lhs), valuelike_shape(rhs), repr(rhs) ) )