// This module generates random 32-bit sequences using the // simple pseudorandom number generator where each random number // is computed as 69069 * (previous random number) + 1. // This sequence will iterate through all 2^32 possible values // before repeating itself. // // The circuit avoids multiplication through adding shifted values; // note that 69069 = 2^16 + 2^12 - 2^9 - 2^6 + 2^4 - 2^2 + 1, module Sequence (Clock, Result); input Clock; output [31:0] Result; reg [31:0] Result; wire [31:0] Next; // Note that the next value will begin to be computed as soon as the // current result changes. This allows for immediate update // of the sequence as soon as the clock goes from 0 to 1. assign Next = (Result << 16) + (Result << 12) - (Result << 9) - (Result << 6) + (Result << 4) - (Result << 2) + Result + 1; initial begin Result = 32'hE4E4E4E4; end always @(posedge Clock) begin Result = Next; end endmodule