2021年5月1日星期六

How to generate a random binary permutation of a string of (length N) and (hamming weight M) in Verilog?

For example the module/function might be formatted like so

module perm(out, N, M);  input[31:0] N, M;  output[N-1:0] out;    // some algorithm...    endmodule  

Example: perm(X,4,2) out => 0110 or out => 1001 or out => 1010 etc...

In theory it should be able to output any of the binary permutations with an equal/even probability distribution, but for the time being I don't even know where to begin, any insight would be useful.

https://stackoverflow.com/questions/67352613/how-to-generate-a-random-binary-permutation-of-a-string-of-length-n-and-hammi May 02, 2021 at 11:00AM

没有评论:

发表评论