

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lab assignment from texas a&m university's computer science department for cpsc 321: computer architecture. The lab focuses on introducing students to verilog, a hardware description language, and designing digital circuits such as half adders, full adders, multi-bit adders, decoders, and multiplexers. Students are required to write verilog code, compile it with vcs, and test the designs using provided test benches.
Typology: Lab Reports
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Release date: 16 October 2006 Due date: One week after the lab
Objective
In this lab, you will be introduced to Verilog. You will work on structural designs and specifications.
A simple example
Implementing a simple arbitrary Boolean function
Using primitive Verilog gates, implement the Boolean function: ab^ + a'. Name this module first_module. Write a test bench - test_first (^) - to examine the outputs for varying input
combinations. Compile the code with VCS and run the executable.
Here is what your Verilog code would look like:
module first_module(out, a, b); input a, b; output out; wire a1, a2;
not n1(a1, a); and and1(a2, a, b); or or1(out,a1,a2); endmodule
module test_first(); reg a, b; wire out;
first_module fm(out,a,b);
initial begin $monitor ($time,"\ta=%b\tb=%b\tout=%b",a,b,out); a = 0; b = 0;
#1 a = 0; b = 1; #1 a = 1; b = 0; #1 a = 1; b = 1; end
endmodule
Enter this code into your text editor (vi or emacs). Compile this code with VCS (Look at the VCS help document for further instructions).
Assignment
1. [10 pts] Half adder
A half-adder is a combinational circuit that adds two 1-bit inputs a and b , and generates 1-bit sum s and
carry out c. The truth-table for a half-adder is shown below:
Structurally define a half-adder. Prepare a test bench to test the half-adder and evaluate with VCS. Test this module completely, since you will be using it as a building block for the full-adder.
2. [10 pts] Full adder
Structurally define a 1-bit full adder using two half adders (from above). The truth table for the full- adder is shown below:
Prepare a test bench to test the full-adder and evaluate with VCS. Test this module completely, since you will be using it as a building block for your multi-bit adders.
a b s c 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1
a b carryIn sum carryOut 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1