ENGRD 2300: Introduction to Digital Logic Design
Fall 2008
Lab 5: Pseudorandom Number Generator
Lab 5.
Pseudorandom
Number Generator
In this lab you will design, build and test a pseudorandom number generator.
The prelab for this lab is to be turned in no later than 1:25pm, Friday, October 24, 2008.
The Lab
portion is to be completed during your lab section the week of October 27, 2008.
Your final lab
report is due one week following the day your lab section meets, at noon, in the dropbox for your
section.
Part I:
Prelab
For this lab you may work with a partner on the prelab.
If you choose to do so, you should choose a
partner from your lab section so that you can work with the same person in lab.
You will also have to
turn in your prelab as a group in CMS.
For your convenience, a set of template files for this lab has been placed on Blackboard for you to
download.
The toplevel design file is called lab5.bdf and contains all the inputs and outputs that you will
need for this lab.
This template file defines only the required inputs and outputs; you will have to provide
the remaining design elements.
The template files also contain a template file, dualdisplay.v, for a dual
BCD seven segment display driver.
This driver takes a 4bit input, converts it into the decimal numbers
ranging from 00 to 15, and outputs the 14 signals necessary to display this number on a pair of seven
segment displays. The template files also contain a clock divider, clk_div.v that will be used to slow the
50MHz clock.
The pseudorandom number generator that you will build for this lab operates in one of two modes.
In the
first mode it counts normally mod 10, e.g., 0, 1, 2, 3, … 9, 0, 1, … .
In the second mode it generates a
sequence of pseudorandom numbers.
One technique for generating pseudorandom numbers is to use the
following formula:
x
i+1
= a*x
i
+ b (mod m)
For
this lab, we will set a=5, b=7 and m=16.
This formula will generate the sequence 1, 12, 3, 6,…;
repeating every 16 iterations.
The pseudorandom number generator can also be set to count either forwards or backwards.
E.g., 0, 1, 2,
3, … 9, 0, 1, … or …, 1, 0, 9, 8, 7 … in counting mode or …, 1, 12, 3, 6,… or …, 6, 3, 12, 1, … in
pseudorandom number generation mode.
For this lab, you are to design a pseudorandom number circuit using only NAND gates and
no more than
four
D flipflops.
You may use NAND gates with any number of inputs. The toplevel diagram of this
circuit looks like this:
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentENGRD 2300: Introduction to Digital Logic Design
Fall 2008
Lab 5: Pseudorandom Number Generator
Q0
Q1
Q2
Q3
RDM
FWD
RESET
CLK
The inputs defined in lab5.bdf are the following:
•
RDM – controls whether the generator generates pseudorandom numbers or counts sequentially.
The generator outputs pseudorandom numbers when this input is HIGH, and counts sequentially
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 LONG
 partner, Randomness, Monte Carlo method, Pseudorandom number generator

Click to edit the document details