CS 61C (Fall 2007) |
Lab Assignment 9 |
This week you will get some more experience working with Verilog, building progressively larger module as we work up to proj4. In particular, you will be learning to write your own logic and testbenches for very simple circuits this week. In order to make the assignment easier, we've tied it in with the accumulator example from lecture.
Work with a partner on these exercises. You may wish to try someone new this week.
Copy the contents of ~cs61c/files/lab/9 to a suitable location in
your home directory. Included are a number of Verilog files, including
FullAdder.v
and
Add4.v
for which you will
implement both the module and the associated testbench.
This lab will be quite long if you have not done the reading. Pace yourself, and move quickly. If you get stuck, as your TA for help or talk to the groups around you.
For this exercise you will be filling in the implementation of
FullAdder.v
and FullAdderTestBench.v
.
FullAdder.v
module based on slide 8 of Lecture24.
You may use either continuous assign statements, or primitive gates as shown on the Verilog Green Card.
FullAdderTestBench.v
as a starting place. You may find that section 4 of
the Verilog Tutorial will make your life easier.FullAdder
module to test this feature.For this exercise you will be filling in the implementation of
Add4.v
and Add4TestBench.v
.
Add4.v
module based on slide 9 of Lecture24.
You must implement this module structurally (remember HW7?),
by instantiating your FullAdder
implemented
above. You may add as many wire declarations as you need.
Add4TestBench.v
as a starting place. You may find that section 4 of
the Verilog Tutorial will make your life easier, and you may wish to start from the above code.Add4
module to test this feature.Many of the recent lectures on Synchronous Digital Systems (Lecture21 for example, and Quiz21) have used an accumulator, a circuit which calculates the sum of it's inputs as they are presented one per clock cycle, as an example.
Accumulator4.v
module by instantiating your Add4
implemented
above, and a Register4
. You may add as many wire declarations as you need.Accumulator4TestBench.v
which proves that it works.Accumulator4.v
module to implement a four bit,
binary counter in a separate file: Counter.v
. This circuit will count 0, 1, 2, ..., 15, 0
repeating every 16
clock cycles. This is one of the most important circuits in digital logic, and the basis of many state machines and controllers.