Skip to content
Discussion options

You must be logged in to vote

I just noticed that the masking only gives defined behavior if N is a power of 2. The correct specification should be:

function shift( a : Bits<N>, b : UInt<M> ) -> Bits<N> // <=> a shift (b % N)

Of course this should be optimized to b & zext(N-1) if N is a power of 2.

Anton also thinks that this would be the best definition.

I will give best practice code in the reference manual how to specify other behaviors with our primitive which should guide the optimizations in the generators.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Jozott00
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
language Language changes
2 participants