Building a Computer Adder

Similar documents
Looking at a two binary digit sum shows what we need to extend addition to multiple binary digits.

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

XOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure.

Digital Logic (2) Boolean Algebra

Binary addition example worked out

Implementation of Boolean Logic by Digital Circuits

Boolean Algebra & Digital Logic

Combinational Logic. By : Ali Mustafa

UNSIGNED BINARY NUMBERS DIGITAL ELECTRONICS SYSTEM DESIGN WHAT ABOUT NEGATIVE NUMBERS? BINARY ADDITION 11/9/2018

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

CSC9R6 Computer Design. Practical Digital Logic

2 Application of Boolean Algebra Theorems (15 Points - graded for completion only)

Design of Sequential Circuits

Fundamentals of Digital Design

ECE/CS 250 Computer Architecture

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

Carry Look Ahead Adders

Chapter 3 Combinational Logic Design

Every time has a value associated with it, not just some times. A variable can take on any value within a range

COMBINATIONAL LOGIC FUNCTIONS

CSE 20 DISCRETE MATH. Fall

THE LOGIC OF COMPOUND STATEMENTS

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

WEEK 3.1 MORE ON KARNAUGH MAPS

Computer organization

Computer Organization: Boolean Logic

9/29/2016. Task: Checking for a Lower-Case Letter. ECE 120: Introduction to Computing. Change C 5 to C 5 to Obtain L(C) from U(C)

Module 2. Basic Digital Building Blocks. Binary Arithmetic & Arithmetic Circuits Comparators, Decoders, Encoders, Multiplexors Flip-Flops

Combinational Logic. Review of Combinational Logic 1

Systems I: Computer Organization and Architecture

CS1800: Hex & Logic. Professor Kevin Gold

Unit 8A Computer Organization. Boolean Logic and Gates

A B OUT_0 OUT_1 OUT_2 OUT_

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

Binary addition by hand. Adding two bits

Combinational Logic Design Arithmetic Functions and Circuits

UNIVERSITI TENAGA NASIONAL. College of Information Technology

Binary addition (1-bit) P Q Y = P + Q Comments Carry = Carry = Carry = Carry = 1 P Q

Chapter 2 (Lect 2) Canonical and Standard Forms. Standard Form. Other Logic Operators Logic Gates. Sum of Minterms Product of Maxterms

Experiment 7: Magnitude comparators

Adders - Subtractors

Lecture 10: Synchronous Sequential Circuits Design

Chapter 4. Combinational: Circuits with logic gates whose outputs depend on the present combination of the inputs. elements. Dr.

CSE 140L Spring 2010 Lab 1 Assignment Due beginning of the class on 14 th April

ECE/CS 250: Computer Architecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Benjamin Lee

CHAPTER1: Digital Logic Circuits Combination Circuits

UC Berkeley College of Engineering, EECS Department CS61C: Representations of Combinational Logic Circuits

SAMPLE ANSWERS MARKER COPY

Hakim Weatherspoon CS 3410 Computer Science Cornell University

Midterm Exam Two is scheduled on April 8 in class. On March 27 I will help you prepare Midterm Exam Two.

CS61c: Representations of Combinational Logic Circuits

Introduction to Karnaugh Maps

Function of Combinational Logic ENT263

14:332:231 DIGITAL LOGIC DESIGN

Contents. Chapter 3 Combinational Circuits Page 1 of 36

Cs302 Quiz for MID TERM Exam Solved

Chapter 03: Computer Arithmetic. Lesson 03: Arithmetic Operations Adder and Subtractor circuits Design

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Adders, subtractors comparators, multipliers and other ALU elements

Combinational Logic Trainer Lab Manual

Chapter 2 Combinational Logic Circuits

CPE100: Digital Logic Design I

Latches. October 13, 2003 Latches 1

1.10 (a) Function of AND, OR, NOT, NAND & NOR Logic gates and their input/output.

1 Boolean Algebra Simplification

Logic. Combinational. inputs. outputs. the result. system can

Total Time = 90 Minutes, Total Marks = 100. Total /10 /25 /20 /10 /15 /20

Total Time = 90 Minutes, Total Marks = 50. Total /50 /10 /18

Review: Additional Boolean operations

CMPUT 329. Circuits for binary addition

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Part 1: Digital Logic and Gates. Analog vs. Digital waveforms. The digital advantage. In real life...

Intro To Digital Logic

CS/COE0447: Computer Organization and Assembly Language

EECS Variable Logic Functions

Class Website:

Boolean Logic Continued Prof. James L. Frankel Harvard University

Digital Logic. Lecture 5 - Chapter 2. Outline. Other Logic Gates and their uses. Other Logic Operations. CS 2420 Husain Gholoom - lecturer Page 1

of Digital Electronics

ELCT201: DIGITAL LOGIC DESIGN

L2: Combinational Logic Design (Construction and Boolean Algebra)

Overview. Multiplexor. cs281: Introduction to Computer Systems Lab02 Basic Combinational Circuits: The Mux and the Adder

Chapter 2: Switching Algebra and Logic Circuits

CS/COE1541: Introduction to Computer Architecture. Logic Design Review. Sangyeun Cho. Computer Science Department University of Pittsburgh

Digital System Design Combinational Logic. Assoc. Prof. Pradondet Nilagupta

Laboratory Exercise #10 An Introduction to High-Speed Addition

EEE130 Digital Electronics I Lecture #4

Logic Design. Digital Logic. Goal: to become literate in most common concepts and terminology of digital electronics

CprE 281: Digital Logic

control in out in out Figure 1. Binary switch: (a) opened or off; (b) closed or on.

Combinational Logic. Mantıksal Tasarım BBM231. section instructor: Ufuk Çelikcan

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

School of Computer Science and Electrical Engineering 28/05/01. Digital Circuits. Lecture 14. ENG1030 Electrical Physics and Electronics

Logic design? Transistor as a switch. Layered design approach. CS/COE1541: Introduction to Computer Architecture. Logic Design Review.

EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits)

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part A Combinational Logic Building Blocks

Additional Gates COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

CS311 Lecture: Introduction to Digital Logic

Outline. EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) Combinational Logic (CL) Defined

Transcription:

Logic Gates are used to translate Boolean logic into circuits. In the abstract it is clear that we can build AND gates that perform the AND function and OR gates that perform the OR function and so on. So, What you should be asking? How does this do anything in the real world or even anything inside the computer? The world doesn t really think in ANDs and ORs despite what logicians might think. Well we know computers can add and we know that computers use a special type of arithmetic so that from the computer s view point subtraction can use adder hardware. This Great Idea made the building of early computers much easier. If we could build an ADDER out of simple gates we would have something actually useful to the computer. Let s review what goes into adding binary numbers: 0 0 1 1 + 0 + 1 + 0 + 1 ------ ------ ------ ------ 0 1 1 1 0 As you recall from our discussion of binary arithmetic, the identified above, becomes a Carry In when the binary numbers being added contain more than one bit (a single binary digit). So, the only other possible addition fact involved in adding binary number is: 1 Carry In from previous digit 1 + 1 -------- 1 1 This last piece of information (1+1+1 =) will be important shortly. Going back to the four addition possibilities we listed above, we can list them as a logic table as follows: A represents one of the digits being added, B represents the other, and S represents the SUM. A B S 0 0 0 0 1 1 1 0 1 1 1 (1) 0 The 1 in this line is really a Cary Out. Let s ignore this for now. When we look at this logic table, we see that this is NOT the output produced from any of the gates we have learned about so far. This table does not describe an AND gate and it does not describe an OR gate (and the NOT only has two options rather than four). It is close to an OR gate but not quite. The last entry on the bottom right is different.

In an OR gate the logic table is: A B S 0 0 0 0 1 1 1 0 1 1 1 1 When describing the OR gate we could say: When OR ing two binary digits together If either A or B is 1 the result is 1. In the table described earlier which contains the results of binary addition we could say: A B S 0 0 0 0 1 1 1 0 1 1 1 0 When???ing two binary digits together, If either A or B, but not both, are 1 the result is 1. Computer architects have created a special gate called the Exclusive OR (XOR) gate to represent the table above. So the Exclusive OR (XOR) states: When XOR ing two binary digits together If either A or B, but not both, are 1 the result is 1. This gate is built this using only combinations of the three gates we already know (NOT, AND, OR.) Let s test the inputs from the logic table on the Exclusive OR (XOR) circuit. Exclusive OR (XOR) ( ) A = 0, B = 0

A = 0, B = 1 We can check all four possibilities this way. This circuit exactly and correctly duplicates the logic table created from our binary additions. The above circuitry is all bundled together into a single exclusive OR (XOR) symbol: Notice that an xor gate does correct binary addition for exactly one bit. BUT, we also know that the carry out information is ignored. Clearly, while this is a good first step it does not complete the job in creating a binary adder. More circuits are needed. Let s examine the addition of two binary numbers with more bits (in this example there is no sign bit involved). + 0 1 1 0 0 The leading 0 was placed in the example so that ----------------------- we always have two bits listed in our addition problem. Remember, keeping track of the CARRY is the only difficult part of binary arithmetic. 1 1 1 + 0 1 1 0 1 ----------------------- 1 0 0 0 1 1

The red 1 s above our example s first binary number are the carry digits. Looking at this one column at a time we know that there are only four possibilities A B Sum 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 Looking at this as a truth table: Sum = A B (A xor B) = AB ( A AND B) Therefore, for single digit addition, our circuit could be drawn as: This is fine as far as it goes BUT, going back to our binary addition problem, we find that in reality we are not adding two bits, and getting a two bit answer. Something different is going on. What really happens is that our bit, becomes the Carry In bit for the next column s addition. 1 carry in + 0 1 1 0 1 ----------------------- 1 0 0 0 1 0 1 carry out In fact, we could represent our entire addition problem as either having a 0 or a 1 carrying out of each addition, and acting as the carry in for the next column. 1 1 1 0 1 carry in 0 A + 0 0 1 1 0 1 B ----------------- 1 0 0 0 1 0 S 0 1 1 1 0 1 carry out

Notice, that while we think we are adding two numbers together, what we are really doing is adding 3-bits together (including our carry in) and getting an answer that is 2-bits (including our carry out). A complete or full adder performs operations on 3 bits, C in, A, B. A full adder produces a Sum and a. The truth table that represents all the possible outcomes of these bits would look like this: Cin A B Sum Cout 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 1 0 0 1 1 1 1 1 1 From the truth table the circuit is not obvious. Let s look at the circuit. Half Adder (1) Half Adder (2) A B XOR Sum (Half Adder 1) Cin XOR Sum AND (Half Adder 2) AND (Half Adder 1) OR Sum = (C in (A B)) C out = (A B)(C in ) + AB

To really perform arithmetic, a series of full adders need to be strung together to add all of the bits in our binary number. As the machine is being built, the manufacturer determines exactly how much hardware is available. Commonly this is 8-bits, 16-bits, and so on. The full adder works is capable of adding any binary A with B and accurately keeping track of any Carry In and any of that addition. When solving an addition problem, the initial Carry In is set to zero (0). However, the full adder solves exactly one column in our addition problem. To completely solve a binary addition problem a series of full adders need to be chained together one for each digit in the problem. If we wanted to add the binary numbers 101 2 with 011 2 we would work as follows:

0 Carry In 1 0 1 A + 0 1 1 B 0 Sum 1 If you trace your values through the circuit above you can see how the circuit made up of a series of full adders solves the addition problem. Note the Sum which is the output of each column is what is written out to the computer output device (usually the monitor).