module oh_lfsr
  #(parameter N    =  32,      // length of LFSR
    parameter TYPE = "GALOIS"  // lfsr type (only galois supported ...)
    )
   (
    input 	       clk,
    input 	       nreset, //async reset
    input 	       en, // enables (advances) lfsr
    input [N-1:0]      taps, // taps
    input [N-1:0]      seed, // seed
    output reg [N-1:0] out  // output value/state vector
    );

   generate
      if (TYPE == "GALOIS") begin
	 always @ (posedge clk or negedge nreset)
	   if(~nreset)
	     out[N-1:0] <= seed[N-1:0];
	   else if(en)
	     out[N-1:0] <= ({(N){out[0]}} & taps[N-1:0]) ^
	                   (out[N-1:0] >> 1);
      end
      else if (TYPE == "FIBONACCI") begin
	 initial
	   $display("UNSUPPORTED");
      end
   endgenerate

endmodule // oh_lfsr