Laboratory 5 and Homework 5
Multilevel Gate Networks

Laboratory 5

Purpose
The exercise is to implement a 3-bit full adder and, building upon Homework 4, using the 7-segment display for output. The full adder will serve as the foundation of an arithmetic unit for a CPU in a later exercise. The exercise follows Homework 3 which exploited the use of hierarchical design methods. In this exercise, a 1-bit full adder serves as the base of the hierarchy for a 3-bit full adder.

One Bit Full Adder

3-Bit Full Adder

The 3-bit full adder is implemented as a hierarchy of three one bit full adders. A one bit full adder that computes the ith sum and cout bit given the ith x, y, and cin bits is represented as a computation block as:
A general 3-bit full adder could then be implemented as:


The hierarchical block diagram above should help in translating to VHDL, such as determining what are the inputs, outputs, and internal signals. An example can help. The following computes:

        cin210    1 110
          x210      101    5
         +y210 =   +111 = +7
  cout2 sum210    1 100    12

Inputs:        Because cin0 is always 0, the inputs are x210 and y210.
Outputs:     The sum210 and cout2 are both outputs since adding two 3-bit numbers (000-111) can produce
                    a 4 bit result (0000-1110).
Signals:       Internal signals are cin210. Signal cin0 should be assigned as cin0 <=  '0'.
VHDL:       A corresponding VHDL ENTITY and ARCHITECTURE definition for a 3-bit full adder is:
 
ENTITY fulladd3 IS
 PORT (              x2, x1, x0 : IN BIT;
                           y2, y1, y0 : IN BIT;
    sum3, sum2, sum1, sum0 : OUT BIT);  -- cout is renamed sum3 to allow grouping
END fulladd3;                                          -- in simulator.

ARCHITECTURE structural OF fulladd3 IS
 COMPONENT fulladd
       PORT (   xi, yi, cini : IN BIT; 
                    sumi, couti : OUT BIT); 
 END COMPONENT;

The port mapping for adding bits 0 using the one bit full adder could be:
 U0 : fulladd PORT MAP(x0, y0, c0, sum0, c1);
Testing:
The 3-bit adder can be tested by simulation as in Homework 3. Group x2, x1, x0; y2, y1, y0; and s3, s2, s1, s0 as below. Given that there are 64 different additions possible, it is not necessary to simulate exhaustively.

3-bit Full Adder with 7-segment Output

To fully test the full adder it is necessary to use the UP1. Input to the adder comes from rocker switches as in Homework 3 and output from the adder (the sum of the switch inputs)  can be displayed on the 7-segment LED using Homework 4. The block diagram is at right.

Inputs:        x210 and y210.
Outputs:     The sum is a 4 bit result (0000-1110). To display the 4 bit result on an LED
                    requires controlling each LED segment.
Signals:       Internal signals is the sum3210 bits output by the 3-bit adder and input by
                    the 7-segment display.
VHDL:       A corresponding VHDL ENTITY and ARCHITECTURE definition is:
 

ENTITY fulladd7 IS
 PORT (      x2, x1, x0 : IN BIT;
                   y2, y1, y0 : IN BIT;
          a, b, c, d, e, f, g : OUT BIT);
END fulladd7;

ARCHITECTURE structural OF fulladd7 IS
 COMPONENT fulladd3
     PORT (           x2, x1, x0 : IN BIT;
                            y2, y1, y0 : IN BIT;
     sum3, sum2, sum1, sum0 : OUT BIT);
 END COMPONENT;

 COMPONENT segment7
   PORT( x3, x2, x1, x0 : IN BIT;
                 a,b,c,d,e,f,g  : OUT BIT);
 END COMPONENT;

Testing:
Program the UP1 as in Homework 4. Use the same LED pin assignments for a-g segments. For input of x210 and y210 use any 6 pins near the MAX-SW1 rocker switches (e.g. 34-36 and 50-52). Test using some of the same values from the earlier simulation.


Homework 5

EQUIPMENT ASSIGNMENT
Part 1 - Design (complete truth table and simplified function) and implement in VHDL or graphically a 1-bit full adder. The adder output should be a sum bit and the carry out bit. The design should be simulated only.

Part 2 - Design and implement in VHDL or graphically a 3-bit full adder. The adder output should be four bits consisting of the three sum bits and the final carry out bit. The design should be simulated.

Part 3 - Implement the 3-bit full adder of Part 2 on the UP1. The implementation should input two 3-bit binary numbers from six switches and output the 4-bit result to a 7-segment display.

TURN IN
  1. Cover Page - Your name, date, and Homework 5. Staple all pages together.
  2. VHDL (recommended) or graphical design listing of Parts 1 and 2.
  3. Simulation of Part 1 and 2.
  4. Verify UP1 implementation by demonstrating operation of Part 3 to instructor. All team members should be present. Demonstration can be performed before or after assignment due date as scheduling permits.

Document last modified: