[Libre-soc-bugs] [Bug 458] PartitionedSignal needs nmigen constructs "m.If", Switch etc
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Sat Oct 2 20:00:54 BST 2021
https://bugs.libre-soc.org/show_bug.cgi?id=458
--- Comment #20 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
https://git.libre-soc.org/?p=nmigen.git;a=blob;f=nmigen/hdl/dsl.py;h=982b3a574fd4aad475878b0ff9a927f11dae5a07;hb=refs/heads/libresoc-partsig#l184
an earlier analysis missed the fact that in both m.Switch and
m.If/Elif, Value.cast was being used on the switch value and
condition test, respectively.
to achieve 100% abstraction of Type 2 (dsl.Module) from Type 1 (ast)
nmigen language constructs, Module has to be told what Ast type
it is permitted to use to cast to. this defaults to ast.Value
on instantiating a Partition-aware dsl.Module, this argument may
be set to PartitionedSignal (or, PartitionedBool if such a thing
is ever created).
this neatly solves the issue in _pop_ctrl where the tests were
being Value.cast()ed followed by dropping to bool(), because
with the AST type being optionally set to PartitionedSignal,
that now becomes a PartitionedSignal.cast followed by a
PartitionedSignal.bool() which of course is exactly the desired
behaviour.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list