tayyab786
Junior Member level 3
following code not give desired ouput
the desired output is random number having length 510,
instead of given random number it will give following pattern
the desired output is random number having length 510,
instead of given random number it will give following pattern
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 parameter length = 8 ; parameter [1:length-4] initial_state = 4'b1101; //for lFSR parameter [1:length-4] Tap_coefficient = 4'b1001; //for LFSR output reg [1:510]chan_array = 0 ; reg [1:length-4]Y = initial_state ; integer Cell_ptr; integer Cell_ptr1; for (Cell_ptr1 = 1 ; Cell_ptr1 <= 510 ; Cell_ptr1 = Cell_ptr1+2) // As max available prim chan = 255 begin for (Cell_ptr =2 ; Cell_ptr <= (length-4) ; Cell_ptr = Cell_ptr+1) //LFSR algo begin Y[1] <= Y[length-4]; Y[Cell_ptr]<= Tap_coefficient[(length-4) - Cell_ptr +1] ? Y[Cell_ptr -1]^ Y[(length-4)]: Y[Cell_ptr-1]; end //end inner for loop chan_array[Cell_ptr1] = Y[1]; chan_array[Cell_ptr1+1] = Y[3]; end //end top for loop