# permute.py from myhdl import always_comb, intbvdefpermute(a, x, mapping): """ permutation: a: input signal x: output signal mapping: specifies which bit of a drives each bit of x. that is: x[i] = a[mapping[i]] a and x must be the same width the length of mapping equals the signal width """ @always_combdeflogic():foriinmapping: x.next[i] = a[mapping[i]]returnlogic