FORDHAM UNIVERSITY CISC 3593. Dept. of Computer and Info. Science Spring, 2011. Lab 2. The Full-Adder



Similar documents
Gates, Circuits, and Boolean Algebra

FORDHAM UNIVERSITY CISC Dept. of Computer and Info. Science Spring, The Binary Adder

EGR 278 Digital Logic Lab File: N278L3A Lab # 3 Open-Collector and Driver Gates

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.

ELEC EXPERIMENT 1 Basic Digital Logic Circuits

Binary Adders: Half Adders and Full Adders

Lab 1: Full Adder 0.0

Figure 8-1 Four Possible Results of Adding Two Bits

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

Basic Logic Gates Richard E. Haskell

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

CHAPTER 3 Boolean Algebra and Digital Logic

Digital Electronics Detailed Outline

3.Basic Gate Combinations

Digital circuits make up all computers and computer systems. The operation of digital circuits is based on

The components. E3: Digital electronics. Goals:

CHAPTER 11: Flip Flops

ENGI 241 Experiment 5 Basic Logic Gates

DEPARTMENT OF INFORMATION TECHNLOGY

Two's Complement Adder/Subtractor Lab L03

Counters and Decoders

Understanding Logic Design

Design and Development of Virtual Instrument (VI) Modules for an Introductory Digital Logic Course

Karnaugh Maps. Circuit-wise, this leads to a minimal two-level implementation

RUTGERS UNIVERSITY Department of Electrical and Computer Engineering 14:332:233 DIGITAL LOGIC DESIGN LABORATORY

Digital Fundamentals. Lab 8 Asynchronous Counter Applications

earlier in the semester: The Full adder above adds two bits and the output is at the end. So if we do this eight times, we would have an 8-bit adder.

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors

exclusive-or and Binary Adder R eouven Elbaz reouven@uwaterloo.ca Office room: DC3576

Objectives: Part 1: Build a simple power supply. CS99S Laboratory 1

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

BOOLEAN ALGEBRA & LOGIC GATES

ECEN 1400, Introduction to Analog and Digital Electronics

Combinational Logic Design

Conversion Between Analog and Digital Signals

Gates & Boolean Algebra. Boolean Operators. Combinational Logic. Introduction

Digital Logic Elements, Clock, and Memory Elements

CSE140 Homework #7 - Solution

Logic in Computer Science: Logic Gates

1.1 The 7493 consists of 4 flip-flops with J-K inputs unconnected. In a TTL chip, unconnected inputs

Sistemas Digitais I LESI - 2º ano

CS311 Lecture: Sequential Circuits

United States Naval Academy Electrical and Computer Engineering Department. EC262 Exam 1

Systems I: Computer Organization and Architecture

Lecture #21 April 2, 2004 Relays and Adder/Subtractors

COMBINATIONAL CIRCUITS

2 : BISTABLES. In this Chapter, you will find out about bistables which are the fundamental building blocks of electronic counting circuits.

Chapter 3 Digital Basics

6 Series Parallel Circuits

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path

Lecture 8: Synchronous Digital Systems

Decimal Number (base 10) Binary Number (base 2)

Lab 11 Digital Dice. Figure Digital Dice Circuit on NI ELVIS II Workstation

Circuits and Boolean Expressions

Upon completion of unit 1.1, students will be able to

Systems I: Computer Organization and Architecture

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

6.004 Computation Structures Spring 2009

Chapter 6 TRANSISTOR-TRANSISTOR LOGIC. 3-emitter transistor.

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Chapter 10 Advanced CMOS Circuits

Lab 5 Operational Amplifiers

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Chapter 2 Logic Gates and Introduction to Computer Architecture

Seven-Segment LED Displays

List of Experiment. 8. To study and verify the BCD to Seven Segments DECODER.(IC-7447).

RAM & ROM Based Digital Design. ECE 152A Winter 2012

3-Digit Counter and Display

2.0 Chapter Overview. 2.1 Boolean Algebra

Cornerstone Electronics Technology and Robotics I Week 15 Voltage Comparators Tutorial

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

0832 Dot Matrix Green Display Information Board User s Guide

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

PLL frequency synthesizer

Using Logic to Design Computer Components

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

Digital Electronics Part I Combinational and Sequential Logic. Dr. I. J. Wassell

CMOS Binary Full Adder

A Digital Timer Implementation using 7 Segment Displays

Multiplexers Two Types + Verilog

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

EXPERIMENT 3: TTL AND CMOS CHARACTERISTICS

Lab 17: Building a 4-Digit 7-Segment LED Decoder

Adder.PPT(10/1/2009) 5.1. Lecture 13. Adder Circuits

BINARY CODED DECIMAL: B.C.D.

INTEGRATED CIRCUITS. For a complete data sheet, please also download:

ERROR DETECTION AND CORRECTION

Lecture 5: Gate Logic Logic Optimization

MIDECO 64-outputs MIDI note decoder USER MANUAL. Roman Sowa 2012

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Content Map For Career & Technology

Step Response of RC Circuits

EXPERIMENT 8. Flip-Flops and Sequential Circuits

Lab 1: Study of Gates & Flip-flops

Experiment 4 ~ Resistors in Series & Parallel

Lab 3 Rectifier Circuits

Transcription:

FORDHAM UNIVERSITY CISC 3593 Fordham College Lincoln Center Computer Organization Dept. of Computer and Info. Science Spring, 2011 Lab 2 The Full-Adder 1 Introduction In this lab, the student will construct a full-adder, which adds two data bits and a carry bit. Optionally, students may connect their full-adders together to form a circuit that adds two multi-bit binary numbers. This lab also introduces the use of a buffer circuit to provide an LED readout of a gate output with reduced loading of the gate. 1.1 Equipment needed Breadboard with +5 V DC supply 1.2 Components needed 1 7400 Quad 2-input NAND gate 1 7486 Quad 2-input XOR gate 1 7406 Hex inverter buffer/driver 5 LED 1 Quad DIP switch 3 resistor, 2.2 kω 5 resistor, 330 Ω 2 The Full-Adder Circuit The binary adder circuit is an important building block of digital arithmetic circuits. Its purpose is to form the arithmetic sum of two binary numbers. In this section we will see how to design a binary adder out of basic gates. 1

2 Lab 2 1 0 0 1 1 0 1 = 13 + 0 1 1 0 = 6 1 0 0 1 1 = 19 Figure 1: Sample 4-bit binary addition problem. The carries are shown above the two numbers being added. 2.1 Binary Addition The design of a binary adder begins by considering the process of addition in base 2, illustrated in Figure 1. 1 In this example, the two numbers to be added, 1101 + 0110, are written one above the other. The carries from one position to the next are written above them. The result is the 5-bit number 10011. Interpreting the values of the binary numbers, this sum corresponds to the decimal addition 13 + 6 = 19. From this example, we observe that the problem of adding two 4-bit numbers can be reduced to the problem of adding a column of two or three bits and passing the carry along to the next column. (For the sake of regularity, we can fill in a 0 as the input carry in the rightmost column, so then each column is always the sum of three bits.) 2.2 One-bit Full-Adder A circuit that adds a column of three bits is called a full-adder. 2 We can design such a circuit by making a table listing the outputs for all possible input combinations. Note that in each column there is a sum bit which is put at the bottom and a carry bit that is taken to the next column. So we need to specify two output bits for each input combination. Let us call the two data bits x and y. (These are the bits in the two bottom rows of the sum, corresponding to the given numbers to be added.) We call the input carry z. The output bits will be S for the sum bit and C for the output carry. The summation is shown symbolically in Figure 2, together with the table giving the outputs for each input combination. Each row of the table is filled in simply by writing in binary the sum of the three bits x + y + z, using 0 = 00, 1 = 01, 2 = 10, and 3 = 11. Upon inspection of this table, we can see that the sum bit S = 1 whenever an odd number of input bits are equal to 1. A boolean function that can provide this result is the exclusive-or, XOR, symbolized by x y, which is 1 if either x or y is 1, but not both. It is easy to verify that S = (x y) z. (The parentheses could be omitted, since XOR is an associative operator.) The carry-out is 1 whenever a majority of inputs are 1. A clever way to implement this is as C = xy + (x y)z. This allows the full-adder to be constructed as shown in Figure 3. One drawback of this design is that it uses three different types of gates, requiring three different IC packages, even though there are only five gates. We can easily redesign the circuit to replace all the AND and OR gates by NAND gates. Then we will need only two IC packages to implement the circuit. Here is how it works: for brevity, let w = x y so that we can write C = xy + wz. Using double negation and DeMorgan s 1 This addition could be performed by a single IC chip such as the TTL 7483. Here, we are interested in seeing how such a chip could be constructed from elementary gates. 2 The name full-adder comes from the fact that it can be constructed by combining two half-adders, each of which adds only two bits.

The Full-Adder 3 z y + x CS x y z C S 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 Figure 2: Symbolic addition of a column of three bits, and truth table specifying the results for each possible combination of inputs. x y z S C Figure 3: Full-adder circuit. Laws, we can rewrite this as C = xy + wz = xy wz, i.e., the NAND of xy and wz, each of which is in turn a NAND. The corresponding redesigned circuit is shown in Figure 4. 2.3 Multi-bit Adder The 1-bit wide full-adder can be replicated to form an adder capable of adding multi-bit numbers by connecting the carry-out of one full-adder to the carry-in of the full-adder for the next more significant bit. A two-bit adder constructed this way is shown in Figure 5. It should be clear how the circuit can be extended in the same way to add two binary numbers with any desired number of bits. This type of adder circuit is called a ripple adder because the carries ripple from one full-adder to the next. x y z S C Figure 4: Full-adder circuit implemented using NAND gates in place of AND and OR.

4 Lab 2 x 2 y 2 C 2 S 2 x 1 y 1 z 1 z 2 S 1 Figure 5: Two-bit ripple-adder circuit. 3 Using a Buffer to Control LED The connection of an LED directly to a logic gate output has the drawback that the gate output can be heavily loaded by the LED. If the gate output must also drive an input of some other chip, the gate may be overloaded, leading to faulty operation of the circuit. For this reason, manufacturers provide special chips, called buffers or drivers, which are constructed to be able to handle larger loads than normal gates. They are also often able to control larger voltages, e.g. 15 or 30 volts, than normal gates. By interposing a buffer between the gate output and the LED, the loading of the gate is reduced. There is one other detail to take account of: recall that for the method of connecting an LED described in Lab 1, the LED is OFF for a logic HIGH, and ON for a logic LOW. It is usual to think of ON as corresponding to a logic 1, and OFF as a logic 0. Therefore, for the positive logic interpretation of a circuit, it is preferable to reverse the states of the LED. This can be done by using an inverting buffer. The connection of a buffer to provide a gate readout is simple: just connect the output of the gate which is to be displayed into the input of the buffer. Then connect the LED to the output of the buffer in the way described in Lab 1. 4 Building a Full Adder A full adder to add two one-bit numbers plus an input carry will now be constructed. The circuit to be built is as shown in Figure 4. Inputs will be provided by DIP switches, connected as described in Lab 1.

The Full-Adder 5 4.1 Circuit Construction The full-adder circuit shown in Figure 4 uses two XOR gates and three NAND gates. Since each logic chip package has four gates, the circuit can be built with one 7400 NAND chip and one 7486 XOR chip. LEDs will be used to provide readout of the three input bits x, y, and z and the two output bits C and S. As discussed earlier, to prevent excessive loading of the logic gates, each output bit should be run through a buffer to the LED. Although the DIP switches used to provide the input bits are not subject to loading issues, it is convenient to run them through buffers as well. The reason is that since we are using inverting buffers, for both inputs and outputs an LED will be OFF for 0 and ON for 1. Each 7406 inverting buffer chip package contains 6 inverting buffers, so to buffer the three input bits and two output bits, only one chip is needed. 4.1.1 Circuit Planning When placing components into the breadboard, consider the flow of logic from the input switches to the output LEDs. It will be helpful to keep this flow from left to right, as in the circuit diagram. Thus the DIP switch unit should be placed near the left end. The two IC packages producing the logic result should be to its right. (Remember that because of the need to use pull-up resistors, the switches cannot share breadboard columns directly with the chips. Likewise the LEDs with their current-limiting resistors need their own columns.) Then place the inverting buffer chip further to the right. The most intuitive location for the three LEDs displaying the inputs is to the left, near the input switches. But because their signals are routed through the inverting buffer, this placement will necessitate running some long jumper wires back from the 7406. (To avoid long wires from the switches to the inputs of the 7406, tap off the inputs where they enter the 7486 to pass them to the 7406.) So it is probably preferable to place all the LEDs on the right, near the buffer. Place the input LEDs to the left of the output LEDs, with a gap between the two groups. The two output LEDs should be in order C, S from left to right, so that the numeric value can easily be read as a binary number. A suggested layout is shown in Figure 6. 4.1.2 Procedure Consult the manufacturer s data sheets for pinouts of the chips. Refer to the writeup of Lab 1 for the proper method to connect gate inputs from switches. A hint for more intuitive switch operation: install the quad DIP switch with ON at the bottom, along the ground bus. Then pushing a switch UP (off) will produce a 1 bit while pushing it DOWN (on) will produce a 0 bit. To display the inputs and outputs with LEDs, run the signals to the inputs of the inverting buffer, then connect the buffer outputs to LEDs following the method described in Lab 1. Don t forget the 330-Ω resistors to protect the LEDs from burnout. Leave any unused gate inputs and outputs unconnected. When the single-bit adder is working, you may optionally join it with another student s circuit to make a two-bit adder as in Figure 5. Remove the carry-out of the first full-adder from the input of the buffer running the C LED and connect it as the carry-in z 2 to the second full-adder in place of the switch-provided z bit of the latter. (The second adder needs only two bits of switch-provided input.) Add a third LED to the first full-adder s board, to the left of its now-disconnected C bit. This will be the C 2 of

6 Lab 2 X A B C D E F G H I J 7400 7486 7406 x y z C S Y xy z Figure 6: Suggested layout of the full-adder circuit. From left to right: DIP switches and pullup resistors; IC s; and LED s and their current-limiting resistors. Wiring is not shown. Figure 5. Route the S and C outputs of the inverting buffers of the second full-adder to these two LEDs to display the 3-bit sum. 4.2 Observations 1. Apply all 8 possible combinations of inputs to the full adder. Record the results in a truth table, in the form of 0s and 1s. Because of the use of the inverting buffers, an LED OFF is a 0 and an LED ON is a 1. 2. Interpret the output combination CS on each row as a binary number, and convert to decimal numbers 0 through 3. Verify that on each row, the output number is the number of 1-bits in the input. 5 Exercises Do the following exercise prior to the laboratory. 1. Perform by hand the addition of the two 4-bit binary numbers 1011 + 0111, in the same way as the example in Figure 1. Show the carries explicitly. As a check, interpret these two numbers and their sum in decimal. 6 References 1. David A. Patterson and John L. Hennessy, Computer Organization and Design: the hardware/software interface, 4th ed. (Morgan Kauffman 2009), Appendix C. 2. M. Morris Mano, Digital Logic and Computer Design (Prentice-Hall, 1979), chapters 1, 5.