lecture6 - ECE 4514 Digital Design II Spring 2008 Lecture...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECE 4514 Digital Design II Spring 2008 Lecture 6: Patrick Schaumont Spring 2008 ECE 4514 Digital Design II Lecture 6: A Random Number Generator in Verilog A Random Number Generator in Verilog A Design Lecture Patrick Schaumont What is a random number generator? Random Number enerator 11, 86, 82, 52, 60, 46, 64, 10, 98, 2, ... Patrick Schaumont Spring 2008 ECE 4514 Digital Design II Lecture 6: A Random Number Generator in Verilog Generator What do I do with randomness? b Play games! s Have the monsters appear in different rooms every time b Do statistical simulations s Simulate customers in a shopping center (find the best spot for a new Chuck E Cheese) b Run security protocols Patrick Schaumont Spring 2008 ECE 4514 Digital Design II Lecture 6: A Random Number Generator in Verilog s Make protocol resistent against replay b Encrypt documents s Use random numbers as key stream Encrypt Documents Random Number enerator XOR stream of bytes plaintext encrypted stream of bytes ryptext Patrick Schaumont Spring 2008 ECE 4514 Digital Design II Lecture 6: A Random Number Generator in Verilog Generator XOR cryptext decrypted stream of bytes plaintext 'one-time pad' Random numbers by physical methods b Use dice, coin flips, roulette b Use thermal noise (diodes and resistors) b Use clock jitter (use ring oscillators) b Use radioactive decay se Lava Lamps Patrick Schaumont Spring 2008 ECE 4514 Digital Design II Lecture 6: A Random Number Generator in Verilog b Use Lava Lamps s Patented! Random numbers by computational methods b Not truly random, but pseudo random s meaning, after some time the same sequence returns b Linear Congruential Generator x(n+1) = [ a.x(b) + b ] mod m , b, m must be chosen carefully! Patrick Schaumont Spring 2008 ECE 4514 Digital Design II Lecture 6: A Random Number Generator in Verilog Eg. a = 15, b = 5, m = 7 X(0) = 1 X(1) = (15 + 5) mod 7 = 6 x(2) = (15*6 + 5) mod 7 = 4 x(3) = 2 x(4) = 0 x(5) = 5 x(6) = 3 x(7) = 1 x(8) = ... a, b, m must be chosen carefully! for a maximum lenth sequence A quick way to generate random numbers b Verilog has a buildin random number generator module random(q); output [0:31] q; reg [0:31] q; initial r_seed = 2; Patrick Schaumont Spring 2008 ECE 4514 Digital Design II Lecture 6: A Random Number Generator in Verilog always #10 q = $random(r_seed) ; endmodule b Nice, but only for testbenches b Instead, we want an hardware implementation Linear Feedback Shift Register b Pseudo Random Numbers in Digital Hardware shift register Patrick Schaumont Spring 2008 ECE 4514 Digital Design II Lecture 6: A Random Number Generator in Verilog feedback network Linear Feedback Shift Register b All zeroes s not very useful ... Patrick Schaumont Spring 2008 ECE 4514 Digital Design II Lecture 6: A Random Number Generator in Verilog Linear Feedback Shift Register b Non-zero state is more interesting 1 Patrick Schaumont Spring 2008 ECE 4514 Digital Design II Lecture 6: A Random Number Generator in Verilog 1 1 Linear Feedback Shift Register...
View Full Document

Page1 / 73

lecture6 - ECE 4514 Digital Design II Spring 2008 Lecture...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online