You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is Not Ideal for a number of reasons: doesn't work at all with Pylance's type inferencing, ugly, isn't compatible with Amaranth's all-new lib.data module, doesn't support enums, and probably others.
As an incremental step towards fixing all these, we should add support for using Python type annotation syntax here, so that the annotation syntax becomes identical to Amaranth's:
(The fields currently lacking a name i.e. listed as None in the field lists would become _1 and so on. No need to be too clever here.)
The actual implementation of bitstruct should remain the same for compatibility, such that no applet code changes are required. The class would therefore become a ShapeCastable (and its instances ValueCastable) for Amaranth purposes (desugaring down to a simple amaranth.lib.data.StructLayout, probably), promoting code reuse between software and gateware, and enabling future transmigration of applet code from software to gateware for acceleration purposes.
This will also serve as an excellent testbed for Amaranth's shape-castable and value-castable extensibility systems.
Do you think you could take a look, @mwkmwkmwk? This seems like something up your alley.
The text was updated successfully, but these errors were encountered:
Right now we have structure definitions that look like this:
This is Not Ideal for a number of reasons: doesn't work at all with Pylance's type inferencing, ugly, isn't compatible with Amaranth's all-new
lib.data
module, doesn't support enums, and probably others.As an incremental step towards fixing all these, we should add support for using Python type annotation syntax here, so that the annotation syntax becomes identical to Amaranth's:
(The fields currently lacking a name i.e. listed as
None
in the field lists would become_1
and so on. No need to be too clever here.)The actual implementation of
bitstruct
should remain the same for compatibility, such that no applet code changes are required. The class would therefore become aShapeCastable
(and its instancesValueCastable
) for Amaranth purposes (desugaring down to a simpleamaranth.lib.data.StructLayout
, probably), promoting code reuse between software and gateware, and enabling future transmigration of applet code from software to gateware for acceleration purposes.This will also serve as an excellent testbed for Amaranth's shape-castable and value-castable extensibility systems.
Do you think you could take a look, @mwkmwkmwk? This seems like something up your alley.
The text was updated successfully, but these errors were encountered: