Computer Arithmetic, Multiplexers Prof. Sin-Min Lee Department of Computer Science.

Slides:



Advertisements
Similar presentations
Modular Combinational Logic
Advertisements

Functions and Functional Blocks
Prof. Sin-Min Lee Department of Computer Science
COE 202: Digital Logic Design Combinational Circuits Part 3 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office: Ahmad Almulhem, KFUPM.
Arithmetic Operations and Circuits
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
Cache Memory Midterm 2 Revision 2 Prof. Sin-Min Lee Department of Computer Science.
Combinational Logic1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
EE2174: Digital Logic and Lab
Lecture 3. Boolean Algebra, Logic Gates
Multiplexer MUX. 2 Multiplexer Multiplexer (Selector)  2 n data inputs,  n control inputs,  1 output  Used to connect 2 n points to a single point.
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
Chapter 7 Arithmetic Operations and Circuits Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits.
Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,
CS 105 Digital Logic Design
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Building Functions.
Decoders and Multiplexers Prof. Sin-Min Lee Department of Computer Science San Jose State University.
1 CHAPTER 4: PART I ARITHMETIC FOR COMPUTERS. 2 The MIPS ALU We’ll be working with the MIPS instruction set architecture –similar to other architectures.
Binary Numbers.
1 COMBINATIONAL LOGIC One or more digital signal inputs One or more digital signal outputs Outputs are only functions of current input values (ideal) plus.
Chap 3. Chap 3. Combinational Logic Design. Chap Combinational Circuits l logic circuits for digital systems: combinational vs sequential l Combinational.
Dr. Ahmed El-Bialy, Dr. Sahar Fawzy Combinational Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
CSI-2111 Computer Architecture Ipage Revision  Objective : To examine basic concepts of: –2.1 Numbering Systems –2.2 Binary Numbers –2.3 Boolean.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Digital Logic Problems (II) Prof. Sin-Min Lee Department of Mathematics and Computer Science.
Combinational Design, Part 3: Functional Blocks
1 Combinational Logic Design Digital Computer Logic Kashif Bashir
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.
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
1 CS 151: Digital Design Chapter 4: Arithmetic Functions and Circuits 4-1,2: Iterative Combinational Circuits and Binary Adders.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 8 Arithmetic.
CSE221- Logic Design, Spring 2003
CS 105 DIGITAL LOGIC DESIGN Chapter 4 Combinational Logic 1.
Computer Arithmetic, K-maps Prof. Sin-Min Lee Department of Computer Science.
Fundamentals of digital electronics Prepared by - Anuradha Tandon Assistant Professor, Instrumentation & Control Engineering Branch, IT, NU.
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
1 Fundamentals of Computer Science Combinational Circuits.
Mid3 Revision 3 Prof. Sin-Min Lee Department of Computer Science.
Chapter 3 Digital Logic Structures
MSI Combinational logic circuits
LECTURE 4 Logic Design. LOGIC DESIGN We already know that the language of the machine is binary – that is, sequences of 1’s and 0’s. But why is this?
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
Simple ALU  Half adder  Full adder  Constructing 4 bits adder  ALU does several operations  General ALU structure  Timing diagram of adder  Overflow.
Midterm 3 Revision 2 Prof. Sin-Min Lee Department of Computer Science.
Chapter4: Combinational Logic Part 4 Originally By Reham S. Al-Majed Imam Muhammad Bin Saud University.
CS151 Introduction to Digital Design Chapter 4: Arithmetic Functions and HDLs 4-1: Iterative Combinational Circuits 4-2: Binary Adders 1Created by: Ms.Amany.
Discrete Systems I Lecture 10 Adder and ALU Profs. Koike and Yukita.
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.
K-maps and Decoders Prof. Sin-Min Lee Department of Computer Science.
©2010 Cengage Learning SLIDES FOR CHAPTER 4 APPLICATIONS OF BOOLEAN ALGEBRA MINTERM AND MAXTERM EXPANSIONS Click the mouse to move to the next page. Use.
Prof. Sin-Min Lee Department of Computer Science
Prof. Sin-Min Lee Department of Computer Science
CS221: Digital Logic Design Combinational Circuits 3
Combinational Functions and Circuits
Lecture 4: Combinational Functions and Circuits
Computer Architecture CST 250
Fundamentals & Ethics of Information Systems IS 201
COE 202: Digital Logic Design Combinational Circuits Part 3
COMS 361 Computer Organization
Chapter-4 Combinational Logic
Digital System Design Combinational Logic
Arithmetic Circuits.
Computer Architecture
Presentation transcript:

Computer Arithmetic, Multiplexers Prof. Sin-Min Lee Department of Computer Science

Bit-Serial and Ripple-Carry Adders Half-adder (HA): Truth table and block diagram Full-adder (FA): Truth table and block diagram

Half-Adder Implementations c Three implementations of a half-adder.

Full-Adder Implementations

Converting whole part w:(105) ten = (?) five Repeatedly divide by fiveQuotientRemainder Therefore, (105) ten = (410) five Converting fractional part v:( ) ten = (410.?) five Repeatedly multiply by fiveWhole PartFraction Therefore, ( ) ten  ( ) five Radix Conversion: Old-Radix Arithmetic

Radix Conversion: New-Radix Arithmetic Converting whole part w: (22033) five = (?) ten ((((2  5) + 2)  5 + 0)  5 + 3)  |-----| : : : : 10 : : : : | | : : : 12 : : : | | : : 60 : : | | : 303 : | | 1518 Converting fractional part v: ( ) five = (105.?) ten ( ) five  5 5 =(22033) five =(1518) ten 1518 / 5 5 =1518 / 3125 = Therefore, ( ) five = ( ) ten Horner’s rule is also applicable: Proceed from right to left and use division instead of multiplication

Horner’s Rule for Fractions Converting fractional part v: ( ) five = (?) ten (((((3 / 5) + 3) / 5 + 0) / 5 + 2) / 5 + 2) / 5 |-----| : : : : 0.6 : : : : | | : : : 3.6 : : : | | : : 0.72 : : | | : : | | | | Horner’s rule used to convert ( )five to decimal

Signed-Magnitude Representation Four-bit signed-magnitude number representation system for integers

Two’s- and 1’s-Complement Numbers Two’s complement = radix complement system for r = 2 M = 2 k 2 k – x = [(2 k – ulp) – x] + ulp = x compl + ulp Range of representable numbers in with k whole bits: from –2 k–1 to 2 k–1 – ulp A 4-bit 2’s-complement number representation system for integers.

Why 2’s-Complement Is the Universal Choice Adder/subtractor architecture for 2’s-complement numbers.

Signed-Magnitude vs 2’s-Complement Two’s-complement adder/subtractor needs very little hardware other than a simple adder Fig. 2.7 Signed-magnitude adder/subtractor is significantly more complex than a simple adder

Some commonly used components Decoders: n inputs, 2 n outputs. –the inputs are used to select which output is turned on. At any time exactly one output is on. Multiplexors: 2 n inputs, n selection bits, 1 output. –the selection bits determine which input will become the output. Adder: 2n inputs, 2n outputs. –Computer Arithmetic.

Multiplexer “ Selects ” binary information from one of many input lines and directs it to a single output line. Also known as the “ selector ” circuit, Selection is controlled by a particular set of inputs lines whose # depends on the # of the data input lines. For a 2 n -to-1 multiplexer, there are 2 n data input lines and n selection lines whose bit combination determines which input is selected.

MUX 2 n Data Inputs Data Output Input Select n Enable

Remember the 2 – 4 Decoder? S1S1 S0S0 Sel(3) Sel(2) Sel(1) Sel(0) Mutually Exclusive (Only one O/P asserted at any time

4 to 1 MUX Decoder Control DataFlow D3:D0 4 Sel(3:0) 4 S1:S0 2 Dout

4-to-1 MUX (Gate level) Three of these signal inputs will always be 0. The other will depend on the data value selected Control Section

Until now, we have examined single-bit data selected by a MUX. What if we want to select m-bit data/words?  Combine MUX blocks in parallel with common select and enable signals Example: Construct a logic circuit that selects between 2 sets of 4-bit inputs (see next slide for solution). Multiplexer (cont.)

Example: Quad 2-to-1 MUX Uses four 4-to-1 MUXs with common select (S) and enable (E). Select line chooses between A i ’ s and B i ’ s. The selected four-wire digital signal is sent to the Y i ’ s Enable line turns MUX on and off (E=1 is on).

Implementing Boolean functions with Multiplexers Any Boolean function of n variables can be implemented using a 2 n-1 -to-1 multiplexer. A MUX is basically a decoder with outputs ORed together, hence this isn ’ t surprising. The SELECT signals generate the minterms of the function. The data inputs identify which minterms are to be combined with an OR.

Example F(X,Y,Z) = X’Y’Z + X’YZ’ + XYZ’ + XYZ = Σm(1,2,6,7) 2 2 -to-1 MUXThere are n=3 inputs, thus we need a 2 2 -to-1 MUX The first n-1 (=2) inputs serve as the selection linesThe first n-1 (=2) inputs serve as the selection lines

Efficient Method for implementing Boolean functions For an n-variable function (e.g., f(A,B,C,D)): –Need a 2 n-1 line MUX with n-1 select lines. –Enumerate function as a truth table with consistent ordering of variables (e.g., A,B,C,D) –Attach the most significant n-1 variables to the n-1 select lines (e.g., A,B,C) –Examine pairs of adjacent rows (only the least significant variable differs, e.g., D=0 and D=1). –Determine whether the function output for the (A,B,C,0) and (A,B,C,1) combination is (0,0), (0,1), (1,0), or (1,1). –Attach 0, D, D ’, or 1 to the data input corresponding to (A,B,C) respectively.

Another Example Consider F(A,B,C) =  m(1,3,5,6). We can implement this function using a 4-to-1 MUX as follows. The index is ABC. Apply A and B to the S 1 and S 0 selection inputs of the MUX (A is most sig, S 1 is most sig.) Enumerate function in a truth table.

MUX Example (cont.) ABCF When A=B=0, F=C When A=0, B=1, F=C When A=1, B=0, F=C When A=B=1, F=C’

MUX implementation of F(A,B,C) =  m(1,3,5,6) A B C C C C’ F

2 Input Multiplexor Inputs: I 0 and I 1 Selector: S Output: O If S is a 0: O=I 0 If S is a 1: O=I 1 Mux I0I0 I1I1 O S

2-Mux Logic Design I1I1 I0I0 S O I 0 && !S I 1 && S

4 Input Multiplexor Inputs: I 0 I 1 I 2 I 3 Selectors: S 0 S 1 Output: O Mux I0I0 I2I2 O S0S0 S0S0 S1S1 O 00I0I0 01I1I1 10I2I2 11I3I3 I1I1 I3I3 S1S1

One Possible 4-Mux 2-Decoder I0I0 I1I1 I2I2 I3I3 S0S0 S1S1 O

Adder We want to build a box that can add two 32 bit numbers. –Assume 2s complement representation We can start by building a 1 bit adder.

Addition We need to build a 1 bit adder –compute binary addition of 2 bits. We already know that the result is 2 bits. ABO0O0 O1O A + B O 0 O 1 This is addition!

One Implementation A B O0O0 !A B A !B O1O1 A && B (!A && B) || (A && !B)

Binary addition and our adder What we really want is something that can be used to implement the binary addition algorithm. –O 0 is the carry –O 1 is the sum Carry

What about the second column? We are adding 3 bits –new bit is the carry from the first column. –The output is still 2 bits, a sum and a carry Carry

Truth Table for Addition ABCarry In Carry Out Sum