Skip to content
Discussion options

You must be logged in to vote

Since the value of the shift amount must be known during synthesis, a more concise equivalent of your ror32 SyReC module could look like this:

module ror32(out o(32), in shift(5), in word(32))
 // TODO: Define maximum shift amount as upper bound of loop (i.e. as 2^(#shift))
 for $i = 0 to 32 do 
   if ($i = shift) then
    // Perform 'shift' logical shift of qubits [shift, #word - 1] of 'word' qubits and store result in 'o'
    for $l = 0 to (#word - $i) do
     o.$l ^= word.($i + $l)
    rof;
   // Perform circular shift of qubits [0, shift - 1) of 'word' qubits and store result in 'o'
    for $r = 0 to $i do
     o.((#word - $i) + $r) ^= word.$r
    rof
   else
    skip
   fi ($i = shif…

Replies: 3 comments 1 reply

Comment options

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

You must be logged in to vote
1 reply
@TooMuchDakka
Comment options

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
None yet
2 participants