Forum Discussion
Altera_Forum
Honored Contributor
13 years agoPseudo-random Number Generator
Hi, I have looking for a Pseudo-random number generator with some maximum linit. I know the LFSR approach but I dont know how to limit the maximum number generated by the LFSR. For example if I...
Altera_Forum
Honored Contributor
13 years agoIn theory, you need to change your lfsr_out to the range of 0 to 1 (1 not included) and then scale it by (limit + 1). In your 8-bit case:
wire [15:0] temp = lfsr_out * 16'd201; wire [7:0] result = temp [15:8]; lfsr_out is the output of your LFSR and result is what you are looking for.