I am trying to list all permutations, for example I have 'a', 'b' and 'c'. We will assume these are ascii using 8 bits each.
I have a wire defined [0:23] that could hold the 3 ascii bytes.
Now the simple (very hard) bit, using verilog if possible how would I go about changing the wire to contain each permutation?
I understand that some sort of soft processor would be the better way to do this. However, its simply for learning.
- Code: Select all
Permutations with repetition (n=3, r=3)
{a,a,a} {a,a,b} {a,a,c}
{a,b,a} {a,b,b} {a,b,c}
{a,c,a} {a,c,b} {a,c,c}
{b,a,a} {b,a,b} {b,a,c}
{b,b,a} {b,b,b} {b,b,c}
{b,c,a} {b,c,b} {b,c,c}
{c,a,a} {c,a,b} {c,a,c}
{c,b,a} {c,b,b} {c,b,c}
{c,c,a} {c,c,b} {c,c,c}