serialize

Outputs the fields of a complex data type one after the other. All fields need to have the same data type.

serialize(din) → Queue[din[0]]

In this example an Array is serialized:

drv(t=Array[Uint[8], 4], seq=[(1, 2, 3, 4), (5, 6, 7, 8)]) \
    | serialize \
    | check(ref=[[1, 2, 3, 4], [5, 6, 7, 8]])
serialize(din, active: Uint) → Queue[din["val"]]

Optionaly an active input that specifies which portion of the din data should be serialized (i.e which portion is “active”) can be connected:

din = drv(t=Array[Uint[8], 4], seq=[(1, 2, 3, 4), (5, 6, 7, 8)])
active = drv(t=Uint[2], seq=[2, 3])

serialize(din, active) \
    | check(ref=[[1, 2], [5, 6, 7]])