cjdrake / seqlogic

Sequential Logic
1 stars 0 forks source link

Struct __init__ doesn't check input type #12

Closed cjdrake closed 5 months ago

cjdrake commented 5 months ago
class MyStruct(VecStruct):
    x: Vec[4]
    y: Vec[4]

>>> MyStruct(x=vec("3b111"), y=vec("5b11111"))
MyStruct(x=Vec[4](0b00101010), y=Vec[4](0b10101010))

The first one should fail b/c it has 3 bits instead of 4. The second one should fail b/c it overflows the field.