I am trying to create a simple, synthesizable module that randomly maps bits of an output to bits of the input without duplicates. For example, something like this for 8-bit in/out:
module Scrambler(in, out);
parameter WIDTH = 8;
input wire [WIDTH-1:0] in;
output wire [WIDTH-1:0] out;
assign out[0] = in[6];
assign out[1] = in[5];
assign out[2] = in[3];
assign out[3] = in[7];
assign out[4] = in[1];
assign out[5] = in[4];
assign out[6] = in[0];
assign out[7] = in[2];
endmodule
I want to replace the series of assign statements with a generate block so the width of the input/output can be fully parameterized. I just cannot think of a way to create a cyclic series of random values only at synthesis time. The mapping will never need to change after synthesis.
Thanks for any help!