IKI10201 05a-Combinatorial Components Bobby Nazief Semester-I 2005 - 2006 The materials on these slides are adopted from those in CS231’s Lecture Notes.

Slides:



Advertisements
Similar presentations
Combinational Circuits
Advertisements

Combinational Circuits. Analysis Diagram Designing Combinational Circuits In general we have to do following steps: 1. Problem description 2. Input/output.
Comparator.
Arithmetic Functions and Circuits
Henry Hexmoor1 Chapter 5 Arithmetic Functions Arithmetic functions –Operate on binary vectors –Use the same subfunction in each bit position Can design.
ECE 331 – Digital System Design
CSE-221 Digital Logic Design (DLD)
ECE C03 Lecture 61 Lecture 6 Arithmetic Logic Circuits Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
1  1998 Morgan Kaufmann Publishers Chapter Four Arithmetic for Computers.
Chapter 5 Arithmetic Logic Functions. Page 2 This Chapter..  We will be looking at multi-valued arithmetic and logic functions  Bitwise AND, OR, EXOR,
IKI a-Simplification of Boolean Functions Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture.
Building Adders & Sub tractors Dr Ahmed Telba. Introducing adder circuits Adder circuits are essential inside microprocessors as part of the ALU, or arithmetic.
 Arithmetic circuit  Addition  Subtraction  Division  Multiplication.
CS 105 Digital Logic Design
Chap 3. Chap 3. Combinational Logic Design. Chap Combinational Circuits l logic circuits for digital systems: combinational vs sequential l Combinational.
IKI a-Boolean Algebra Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture Notes at UIUC,
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Basic Arithmetic (adding and subtracting)
+ CS 325: CS Hardware and Software Organization and Architecture Combinational Circuits 1.
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
Chapter 6-1 ALU, Adder and Subtractor
June 19, 2002Addition and multiplication1 Delays in the ripple carry adder The diagram below shows a 4-bit adder completely drawn out. This is called a.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
IKI Register-transfer Design
Basic Arithmetic (adding and subtracting)
IKI Data Types & Representations Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture Notes.
Module 9.  Digital logic circuits can be categorized based on the nature of their inputs either: Combinational logic circuit It consists of logic gates.
Lecture 9 Topics: –Combinational circuits Basic concepts Examples of typical combinational circuits –Half-adder –Full-adder –Ripple-Carry adder –Decoder.
CHAPTER 4 Combinational Logic
Logic Gates Logic gates are electronic digital circuit perform logic functions. Commonly expected logic functions are already having the corresponding.
IKI b-Arithmetic Logic Unit (ALU) Bobby Nazief Semester-I The materials on these slides are adopted from: CS231’s Lecture Notes at UIUC,
Computing Systems Designing a basic ALU.
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
CHAPTER 4 Combinational Logic Design- Arithmetic Operation (Section 4.6&4.9)
COE 202: Digital Logic Design Combinational Circuits Part 2 KFUPM Courtesy of Dr. Ahmad Almulhem.
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Logic and Computer Design.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 8 Arithmetic.
COMP541 Arithmetic Circuits
Combinational Circuits
Sep 29, 2004Subtraction (lvk)1 Negative Numbers and Subtraction The adders we designed can add only non-negative numbers – If we can represent negative.
COMP541 Arithmetic Circuits
1 KU College of Engineering Elec 204: Digital Systems Design Lecture 10 Multiplexers MUX: –Selects binary information from one of many input lines and.
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
Addition and multiplication Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
1 Lecture 14 Binary Adders and Subtractors. 2 Overview °Addition and subtraction of binary data is fundamental Need to determine hardware implementation.
Lecture #23: Arithmetic Circuits-1 Arithmetic Circuits (Part I) Randy H. Katz University of California, Berkeley Fall 2005.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
IKI b-Analysis of Sequential Logic Bobby Nazief Semester-I The materials on these slides are adopted from: CS231’s Lecture Notes at.
President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University
Explain Half Adder and Full Adder with Truth Table.
LOGIC CIRCUITLOGIC CIRCUIT. Goal To understand how digital a computer can work, at the lowest level. To understand what is possible and the limitations.
Logic Design (CE1111 ) Lecture 4 (Chapter 4) Combinational Logic Prepared by Dr. Lamiaa Elshenawy 1.
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
Addition and multiplication1 Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
Negative Numbers and Subtraction
Addition and multiplication
ECE 331 – Digital System Design
CSE Winter 2001 – Arithmetic Unit - 1
Digital Logic.
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Digital Logic.
Addition and multiplication
Addition and multiplication
Chapter-4 Combinational Logic
Presentation transcript:

IKI a-Combinatorial Components Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture Notes at UIUC, which is derived from Howard Huang’s work and developed by Jeff Carlyle.

2 Road Map Boolean Algebra Logic Gates & Flip-flops Register-Transfer Design Finite-State Machines Binary Systems & Data Represent. Generalized FSM Sequential Design Techniques Logic Design Techniques Combinatorial Components Storage Components Processor Components

3 Digital components Combinatorial components: Sequential components:

4 Usage of combinatorial components Data transformation – arithmetic operation (add, subtract, multiply, divide) – logic operation (AND, OR,...) – data comparison (greater-than, equal, less-than,...) – bit manipulation (shift, rotate,...) Data conversion – data encoding – data decoding Components of interconnection unit – source & destination selection – bus connections & interface Components of control unit

5 Design Principles Encapsulation – define simple building blocks Iterration – replicate building blocks as much as possible Hierarchy – compose larger building blocks from smaller ones

6 Full adder

7 Adding two bits We’ll make a hardware adder by copying the human addition algorithm. We start with a half adder, which adds two bits and produces a two-bit result: a sum (the right bit) and a carry out (the left bit). Here are truth tables, equations, circuit and block symbol. 0+ 0= = = = 10 C= XY S= X’ Y + X Y’ = X  Y

8 Adding three bits But what we really need to do is add three bits: the augend and addend, and the carry in from the right = = = = = = = =

9 Full adder equations A full adder circuit takes three bits of input, and produces a two-bit output consisting of a sum and a carry out. Using Boolean algebra, we get the equations shown here. – XOR operations simplify the equations a bit. – We used algebra because you can’t easily derive XORs from K-maps. S=  m(1,2,4,7) = X’ Y’ C in + X’ Y C in ’ + X Y’ C in ’ + X Y C in = X’ (Y’ C in + Y C in ’) + X (Y’ C in ’ + Y C in ) = X’ (Y  C in ) + X (Y  C in )’ = X  Y  C in C out =  m(3,5,6,7) = X’ Y C in + X Y’ C in + X Y C in ’ + X Y C in = (X’ Y + X Y’) C in + XY(C in ’ + C in ) = (X  Y) C in + XY

10 Full adder circuit These things are called half adders and full adders because you can build a full adder by putting together two half adders! S= X  Y  C in C out = (X  Y) C in + XY

11 A 4-bit ripple-carry adder Four full adders together make a 4-bit adder. There are nine total inputs: – Two 4-bit numbers, A3 A2 A1 A0 and B3 B2 B1 B0 – An initial carry in, CI The five outputs are: – A 4-bit sum, S3 S2 S1 S0 – A carry out, CO Imagine designing a nine-input adder without this hierarchical structure—you’d have a 512-row truth table with five outputs!

12 An example of 4-bit addition Let’s try our initial example: A=1011 (eleven), B=1110 (fourteen) Fill in all the inputs, including CI=0 1 5.Use C3 to compute CO and S3 ( = 11) 0 2.The circuit produces C1 and S0 ( = 01) Use C1 to find C2 and S1 ( = 10) Use C2 to compute C3 and S2 ( = 10) 0 Woohoo! The final answer is (twenty-five).

13 Hierarchical adder design When you add two 4-bit numbers the carry in is always 0, so why does the 4-bit adder have a CI input? One reason is so we can put 4-bit adders together to make even larger adders! This is just like how we put four full adders together to make the 4-bit adder in the first place. Here is an 8-bit adder, for example. CI is also useful for subtraction.

14 Delays in the ripple carry adder The diagram below shows a 4-bit adder completely drawn out. This is called a ripple carry adder, because the inputs A 0, B 0 and CI “ripple” leftwards until CO and S 3 are produced. Ripple carry adders are slow! – Our example addition with 4-bit inputs required 5 “steps.” – There is a very long path from A 0, B 0 and CI to CO and S 3. – For an n-bit ripple carry adder, the longest path has 2n+1 gates. – Imagine a 64-bit adder. The longest path would have 129 gates!

15 Carry-Look-Ahead Adders

16 A faster way to compute carry outs Instead of waiting for the carry out from all the previous stages, we could compute it directly with a two-level circuit, thus minimizing the delay. First we define two functions. – The “generate” function g i produces 1 when there must be a carry out from position i (i.e., when A i and B i are both 1). g i = A i B i – The “propagate” function p i is true when, if there is an incoming carry, it is propagated (i.e, when A i =1 or B i =1, but not both). p i = A i  B i Then we can rewrite the carry out function: c i+1 = g i + p i c i gigi pipi

17 Algebraic carry out hocus-pocus Let’s look at the carry out equations for specific bits, using the general equation from the previous page c i+1 = g i + p i c i : These expressions are all sums of products, so we can use them to make a circuit with only a two-level delay. c 1 = g 0 + p 0 c 0 c 2 = g 1 + p 1 c 1 = g 1 + p 1 (g 0 + p 0 c 0 ) = g 1 + p 1 g 0 + p 1 p 0 c 0 c 3 = g 2 + p 2 c 2 = g 2 + p 2 (g 1 + p 1 g 0 + p 1 p 0 c 0 ) = g 2 + p 2 g 1 + p 2 p 1 g 0 + p 2 p 1 p 0 c 0 c 4 = g 3 + p 3 c 3 = g 3 + p 3 (g 2 + p 2 g 1 + p 2 p 1 g 0 + p 2 p 1 p 0 c 0 ) = g 3 + p 3 g 2 + p 3 p 2 g 1 + p 3 p 2 p 1 g 0 + p 3 p 2 p 1 p 0 c 0

18 A 4-bit carry lookahead adder circuit “carry-out”, not “c-zero”

19 Carry lookahead adders This is called a carry lookahead adder. By adding more hardware, we reduced the number of levels in the circuit and sped things up. We can “cascade” carry lookahead adders, just like ripple carry adders. (We’d have to do carry lookahead between the adders too.) How much faster is this? – For a 4-bit adder, not much. There are 4 gates in the longest path of a carry lookahead adder, versus 9 gates for a ripple carry adder. – But if we do the cascading properly, a 16-bit carry lookahead adder could have only 8 gates in the longest path, as opposed to 33 for a ripple carry adder. – Newer CPUs these days use 64-bit adders. That’s 12 vs. 129 gates! The delay of a carry lookahead adder grows logarithmically with the size of the adder, while a ripple carry adder’s delay grows linearly. The thing to remember about this is the trade-off between complexity and performance. Ripple carry adders are simpler, but slower. Carry lookahead adders are faster but more complex.

20 Making a subtraction circuit We could build a subtraction circuit directly, similar to the way we made unsigned adders. However, by using two’s complement we can convert any subtraction problem into an addition problem. Algebraically, A - B = A + (-B) So to subtract B from A, we can instead add the negation of B to A. This way we can re-use the unsigned adder hardware.

21 A two’s complement subtraction circuit To find A - B with an adder, we’ll need to: – Complement each bit of B. – Set the adder’s carry in to 1. The net result is A + B’ + 1, where B’ + 1 is the two’s complement negation of B.

22 Small differences The only differences between the adder and subtractor circuits are: – The subtractor has to negate B3 B2 B1 B0. – The subtractor sets the initial carry in to 1, instead of 0. It’s not too hard to make one circuit that does both addition and subtraction.

23 Adders/Subractors XOR gates let us selectively complement the B input. X  0 = XX  1 = X’ When Sub = 0, the XOR gates output B3 B2 B1 B0 and the carry in is 0. The adder output will be A + B + 0, or just A + B. When Sub = 1, the XOR gates output B3’ B2’ B1’ B0’ and the carry in is 1. Thus, the adder output will be a two’s complement subtraction, A - B.