hdl.ast: allow typed int enums in Value.cast.

This commit is contained in:
Arusekk 2023-01-22 22:37:49 +01:00 committed by Catherine
parent 91d4513682
commit 58a0c68279
3 changed files with 31 additions and 4 deletions

View file

@ -235,6 +235,9 @@ Casting a value from an integer ``i`` is a shorthand for ``Const(i)``:
>>> Value.cast(5)
(const 3'd5)
.. note::
If a value subclasses :class:`enum.IntEnum` or its class otherwise inherits from both :class:`int` and :class:`Enum`, it is treated as an enumeration.
Values from enumeration members
-------------------------------
@ -247,6 +250,10 @@ Casting a value from an enumeration member ``m`` is a shorthand for ``Const(m.va
(const 2'd1)
.. note::
If a value subclasses :class:`enum.IntEnum` or its class otherwise inherits from both :class:`int` and :class:`Enum`, it is treated as an enumeration.
.. _lang-signals:
Signals