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
It can be overly verbose to specify the "nth element from the end" for an array. Also, because of the supported negative slice indices for bit slices, users may expect this to work for array indices as well.
Current best alternative workaround (limit 100 words)
Use the explicit length of the array and subtract n, i.e. N - n for the nth element from the end.
Your view of the "best case XLS enhancement" (limit 100 words)
As mentioned in the referenced docs, if we can specify "Python style" slices with offsets for bit slices, it would be useful to be able to do so for arrays.
I think this is probably documented in other issues but they'd probably be harder to find vs repeating here. :-)
The challenge is that you want static behavior and dynamic behavior to match. I expect that dynamically (at hardware runtime) testing the high bit and then using an adder to do a subtraction is probably going to be consider too hardware costly, and maybe surprising, for hardware engineers.
Bit slices support negative indexing only because they must be compile-time constants. They're compile time constant because the type of the result must be known (i.e. constexpr bitcount).
meheff
added
the
dslx
DSLX (domain specific language) implementation / front-end
label
Jun 25, 2024
What's hard to do? (limit 100 words)
It can be overly verbose to specify the "nth element from the end" for an array. Also, because of the supported negative slice indices for bit slices, users may expect this to work for array indices as well.
Current best alternative workaround (limit 100 words)
Use the explicit length of the array and subtract
n
, i.e.N - n
for the nth element from the end.Your view of the "best case XLS enhancement" (limit 100 words)
As mentioned in the referenced docs, if we can specify "Python style" slices with offsets for bit slices, it would be useful to be able to do so for arrays.
Counter argument: Rust does not support this (yet?): rust-lang/rfcs#2249
The text was updated successfully, but these errors were encountered: