

module serial_prbs23 (

	clk,
	reset,
	prbs_seed ,
	load ,
	//lsfr_out,
	dataout
	);
	


input		clk ;
input		reset ;
input	[23:1]	prbs_seed ;
input		load ;

output		dataout ;

/////////////////////////////////////////////////////////////////////////////
wire	 	dataout20 ;
wire	[23:1]	prbs_seed ;

//reg	[23:1]	temp 	;
//reg	[23:1]	result ;
reg	[23:1]	prbs23 ; 



/*
always @ ( prbs23 ) begin
	 temp	= #1 prbs23 ;

  begin : for_i_loop
	integer  i ;
	for(i=0; i<=19 ; i=i+1) begin: lsfrloop
	
		result	 	= #1 {temp[22:1], temp[23] ^ temp[18]} ;
		temp		= #1 result ;
	end
  end
end
*/

always @ (posedge clk or posedge reset)
begin
  if (reset ) begin
  	prbs23	<= #1 23'h00_0001 ;
  end
  else if ( load ) 
  	prbs23	<= #1 prbs_seed ;
  else
	prbs23	<= #1 {prbs23[22:1], prbs23[23] ^ prbs23[18]} ;
end

assign	dataout = prbs23[23] ;



endmodule 



