lib.data: allow Const as value of Layout.const(...) field.

Fixes #838.
This commit is contained in:
Catherine 2023-07-18 14:20:05 +00:00
parent 385b10d743
commit d1ca9c46a5
2 changed files with 5 additions and 1 deletions

View file

@ -424,6 +424,10 @@ class LayoutTestCase(FHDLTestCase):
r"that it casts to, unsigned\(8\), and not unsigned\(1\)$"):
sl.const({"f": "01"})
def test_const_field_const(self):
sl = StructLayout({"f": unsigned(1)})
self.assertRepr(sl.const({"f": Const(1)}), "(const 1'd1)")
def test_signal_reset(self):
sl = StructLayout({
"a": unsigned(1),