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
The bit slicing API was introduced in #291 , but it is confusing when it allows reversed slicing, since the ranges in Python are all left-closed right-open, while the reversed slicing breaks this rule. To avoid confusion, I think we should prevent using reversed slicing and force the begin of the slice smaller than the end of the slice. This is also consistent with other hardware-oriented Python DSLs like PyMTL3 (See Page 8 of the documentation).
For reversing the sliced bits, we need to introduce a new API .reverse(). The grammar and behavior is like the one described in the VHLS documentation. Therefore, we have the following example:
>>>a=0xabcd0123>>>a[28:32] # containing the bit of 28, 29, 30, 310xa>>>a[4:24]
0xcd012>>>a[28:32].reverse()
0x5
And we no longer support grammar like a[32:28] which leads to confusion.
The text was updated successfully, but these errors were encountered:
The bit slicing API was introduced in #291 , but it is confusing when it allows reversed slicing, since the ranges in Python are all left-closed right-open, while the reversed slicing breaks this rule. To avoid confusion, I think we should prevent using reversed slicing and force the begin of the slice smaller than the end of the slice. This is also consistent with other hardware-oriented Python DSLs like PyMTL3 (See Page 8 of the documentation).
For reversing the sliced bits, we need to introduce a new API
.reverse()
. The grammar and behavior is like the one described in the VHLS documentation. Therefore, we have the following example:And we no longer support grammar like
a[32:28]
which leads to confusion.The text was updated successfully, but these errors were encountered: