@internal<EOL>def reinterpret_bits_to_hstruct(sigOrVal, hStructT):
container = hStructT.fromPy(None)<EOL>offset = <NUM_LIT:0><EOL>for f in hStructT.fields:<EOL><INDENT>t = f.dtype<EOL>width = t.bit_length()<EOL>if f.name is not None:<EOL><INDENT>s = sigOrVal[(width + offset):offset]<EOL>s = s._reinterpret_cast(t)<EOL>setattr(container, f.name, s)<EOL><DEDENT>offset += width<EOL><DEDENT>return container<EOL>
Reinterpret signal of type Bits to signal of type HStruct