Initially a random matrix is to be formed(with ones < or = the no of xor gates based on the architecture in my project)eg. if xor gates=3 only 3 ones or 3-1 ones in matrix.

The problem is as far as I have referred matrix forms cant be used in verilog.The next step is to find det(mat)=0 ;else repeat to step 1.

Then determine the characteristic polynomial of the matrix.Check if its reducible else go to step1.

Finally perform the full primitive test . Can u help me with this?