Last active
July 30, 2018 12:47
-
-
Save pervognsen/a66e88ae35c5ebf9ae3b5d2cf9b939be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def funnel_shifter_unit(x, n, dir, shift, arith): | |
s = rep(arith & x[-1], len(x)-1) | |
low = when(dir, x[:-1], when(shift, s, x[1:])) | |
mid = when(dir, x[-1], x[0]) | |
high = when(dir, when(shift, s, x[:-1]), x[1:]) | |
return funnel_shifter(low @ mid @ high, when(dir, n, ~n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment