President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University

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.
EET 1131 Unit 7 Arithmetic Operations and Circuits
Lab 10 : Arithmetic Systems : Adder System Layout: Slide #2 Slide #3 Slide #4 Slide #5 Arithmetic Overflow: 2’s Complement Conversions: 8 Bit Adder/Subtractor.
ECE 331 – Digital System Design
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
ECE 301 – Digital Electronics
ENGIN112 L14: Binary Adder Subtractor October 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 14 Binary Adders and Subtractors.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
CS 105 Digital Logic Design
Dr. Bernard Chen Ph.D. University of Central Arkansas
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
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.
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Basic Arithmetic (adding and subtracting)
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
Chapter 6-1 ALU, Adder and Subtractor
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Basic Arithmetic (adding and subtracting)
ECEN 248 Lab 4: Multiplexer Based Arithmetic Logic Unit
Digital Electronics Lecture 6 Combinational Logic Circuit Design.
Digital Electronics and Computer Interfacing
Lecture 9 Topics: –Combinational circuits Basic concepts Examples of typical combinational circuits –Half-adder –Full-adder –Ripple-Carry adder –Decoder.
Numbers and Arithmetic Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University See: P&H Chapter , 3.2, C.5 – C.6.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
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.
Logic Gates Logic gates are electronic digital circuit perform logic functions. Commonly expected logic functions are already having the corresponding.
Logic Design CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Half Adder & Full Adder Patrick Marshall. Intro Adding binary digits Half adder Full adder Parallel adder (ripple carry) Arithmetic overflow.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 8 Arithmetic.
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.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
1 Fundamentals of Computer Science Combinational Circuits.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
Digital Systems Section 11 Decoders and Encoders.
Combinational Circuit Design. Digital Circuits Combinational CircuitsSequential Circuits Output is determined by current values of inputs only. Output.
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.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
Number Representation (Part 2) Computer Architecture (Fall 2006)
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
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.
Combinational Circuits
Negative Numbers and Subtraction
CSCI206 - Computer Organization & Programming
Digital Systems Section 8 Multiplexers. Digital Systems Section 8 Multiplexers.
Digital Systems Section 14 Registers. Digital Systems Section 14 Registers.
King Fahd University of Petroleum and Minerals
Week 7: Gates and Circuits: PART II
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Instructor: Alexander Stoytchev
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
Instructor: Alexander Stoytchev
Instructor: Alexander Stoytchev
ECE 352 Digital System Fundamentals
Combinational Circuits
Instructor: Alexander Stoytchev
Presentation transcript:

President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University

President UniversityErwin SitompulDigital Systems 7/2 Section 8 Multiplexers Digital Systems

President UniversityErwin SitompulDigital Systems 7/3 Multiplexer (Mux) A multiplexer (mux) is a digital circuit building block which is used to select and transmit one of its 2 n inputs to its one output, based on n select bit. A multiplexer allows for conditional data transfer. A 4-input mux needs 2 select bit to indicate which input to route through. An 8-input mux needs 3 select bits, and so on. ● A railway switch LectureDigital Systems

President UniversityErwin SitompulDigital Systems 7/4 Multiplexer (Mux) LectureDigital Systems Four data are possible to be displayed: Air temperature (T), average km/l (A), instantaneous km/l (I), and kilometer remaining (M), each 8-bit wide. We can chose which to display by using two inputs X and Y. In this case, an 8-bit 4-to-1 multiplexer is used.

President UniversityErwin SitompulDigital Systems 7/5 2-to-1 Multiplexer LectureDigital Systems A multiplexer with one select bit is shown below, or 2-to-1 multiplexer. If S = 0, then Y = I 0, if S = 1, then Y = I 1. ● Circuit of 2-to-1 multiplexer ● Symbol

President UniversityErwin SitompulDigital Systems 7/6 2-to-1 Multiplexer SI0I0 I1I1 F(S,I 0,I 1 ) 0 1 I0I0 I1I1 S LectureDigital Systems ● Truth table ● Compact truth table ● Determine the Boolean expression for Y as a function of I 0, I 1, and S. ? ● Y = S’I 0 + SI 1 A

President UniversityErwin SitompulDigital Systems 7/7 4-to-1 Multiplexers LectureDigital Systems A 4-to-1 multiplexer is shown below. ● Determine the Boolean expression for Y as a function of D i and S i. ?

President UniversityErwin SitompulDigital Systems 7/8 I0I0 I1I1 0 1 I2I2 I3I3 0 1 F 0 1 S0S0 S1S1 4-to-1 Multiplexers A 4-to-1 multiplexer can also be made by using two 2-to-1 multiplexers, as shown below: LectureDigital Systems

President UniversityErwin SitompulDigital Systems 7/9 Quadruple 2-to-1 Multiplexer LectureDigital Systems A quadruple 2-to-1 multiplexer is shown below.

President UniversityErwin SitompulDigital Systems 7/10 Design Exercise: Multiplexer LectureDigital Systems Design a multiplexer with 8 inputs (A1, A2, B1, B2, C1, C2, D1, D2), with 2 outputs and 4 possibilities of transmission: (A1, A2), (B1, B2), (C1, C2), and (D1, D2). Give the logic expression and the logic circuit of the multiplexer. A2A2 B2B2 O2O2 O1O1 C2C2 D2D2 A1A1 B1B1 C1C1 D1D1

President UniversityErwin SitompulDigital Systems 7/11 Exercise: Crossbar Switch LectureDigital Systems Find out the truth table of the following circuit? What can the function of this circuit? X1X1 0 1 X2X2 0 1 S Y1Y1 Y2Y2 X1X1 X2X2 S Y1Y1 Y2Y2 This crossbar switch circuit is capable to connect any input to any output. Here X 1 and X 2 can be set to pass through Y 1 or Y 2. 0 X1X1 X2X2 X1X1 SX1X1 X2X2 Y1Y1 X2X2 Y2Y2 1 X1X1 X2X2 X2X2 X1X1 (Straight) (Crossed)

President UniversityErwin SitompulDigital Systems 7/12 Section 9 Binary Adders Digital Systems

President UniversityErwin SitompulDigital Systems 7/13 Binary Adders LectureDigital Systems Addition of binary data is very fundamental in digital systems. The hardware implementation needs to be determined. The inputs are: single bit values, carry in The outputs are: sum, carry out. After creating a single-bit adder, we can chain multiple adders together. Overflow must also be considered. Overflow is the situation where the result of addition exceeds the magnitude which can be represented with the allocated number of bits.

President UniversityErwin SitompulDigital Systems 7/14 Half Adder A half adder adds two binary numbers. The inputs: A 0, B 0 (single bit inputs). The outputs: S 0 (single bit sum) and C 1 (carry out). LectureDigital Systems ● Truth Table of Half Adder ● Circuit of Half Adder

President UniversityErwin SitompulDigital Systems 7/15 Multiple Bit Addition LectureDigital Systems Consider the addition of 2 binary numbers, A and B. Addition of each bit position A i and B i creates a sum S i and a carry C i+1.

President UniversityErwin SitompulDigital Systems 7/16 Full Adder LectureDigital Systems A full adder adds two binary numbers but also include a carry in. The inputs: A i, B i, C i (single bit inputs). The outputs: S i (single bit sum) and C i+1 (carry out). ● Truth Table of Half Adder ● K-Map for S i ● K-Map for C i+1

President UniversityErwin SitompulDigital Systems 7/17 Full Adder LectureDigital Systems S i = A i ’B i ’C i + A i ’B i C i ’ + A i B i ’C i ’ + A i B i C i Let us now simplify Boolean function for S by using Boolean algebra. S i = C i ·(A i  B i )’ + C i ’·(A i  B i ) S i = C i  (A i  B i ) Hint: A  B = A·B’ + A’·B (A·B)’= A’ + B’ (A+B)’= A’ · B’ S i = C i ·(A i ’B i ’ + A i B i ) + C i ’·(A i ’B i + A i B i ’)

President UniversityErwin SitompulDigital Systems 7/18 Full Adder LectureDigital Systems C i+1 = A i B i + A i C i +B i C i (previous result) Let us now simplify Boolean function for C i+1 by using Boolean algebra. Hint: A  B = A·B’ + A’·B (A·B)’= A’ + B’ (A+B)’= A’ · B’ C i+1 = A i B i + C i A i ’B i +C i A i B i ’(as shown by K-map below) C i+1 = A i B i + C i ·(A i ’B i + A i B i ’) C i+1 = A i B i + C i ·(A i  B i )

President UniversityErwin SitompulDigital Systems 7/19 Full Adder LectureDigital Systems The logic circuit of the full adder can be shown as: S i = C i  (A i  B i ) C i+1 = A i B i + C i ·(A i  B i ) A full adder can be made from 2 half adders and an OR Gate. Such structure repetition simplifies circuit design. Half adder

President UniversityErwin SitompulDigital Systems 7/20 Full Adder LectureDigital Systems = This single bit full adder will be the building block of large adders.

President UniversityErwin SitompulDigital Systems 7/21 n × Full Adder = n-bit Ripple Carry Adder LectureDigital Systems ● 4-bit ripple-carry adder MSB positionLSB position

President UniversityErwin SitompulDigital Systems 7/22 Section 10 Signed Numbers Digital Systems

President UniversityErwin SitompulDigital Systems 7/23 How to Represent Signed Numbers For decimal numbers, it is common to use the sign + and –, as for +25, –16, +433, –2775. For computers, where operations are done using binary digits, it is desirable to represent signed numbers also in bits. There are 3 representations of signed binary numbers: 1.Signed magnitude 2.1’s complement 3.2’s complement LectureDigital Systems In each case, the left-most bit indicates the sign: 0 means positive, 1 means negative.

President UniversityErwin SitompulDigital Systems 7/24 How to Represent Signed Numbers LectureDigital Systems b n–1 Magnitude MSB ● Unsigned number b1b1 b0b0 Magnitude Sign 0 denotes 1 denotes + –MSB ● Signed number b n–1 b1b1 b0b0 b n–2

President UniversityErwin SitompulDigital Systems 7/25 Signed Numbers ● Number circle for 4-bit 2’s complement numbers LectureDigital Systems ● 4-bit signed binary number comparison – – 3– 4– 5– 6– 7– 8– 0

President UniversityErwin SitompulDigital Systems 7/26 Signed Numbers LectureDigital Systems ● 4-bit signed binary number comparison

President UniversityErwin SitompulDigital Systems 7/27 As mentioned before, in signed magnitude, the left-most bit is used to indicate the sign. 0 means positive, 1 means negative. Signed Magnitude Representation LectureDigital Systems By using signed magnitude, n bits can be used to represent integers N in the range of: 2 n–1 – 1 ≤ N ≤ 2 n–1 – 1 For example, the range of an unsigned 4-bit binary number is from 0 to 15. The range of a signed 4-bit binary number is –7 to + 7 (or to ) For signed magnitude, there are two representations for zero. For example, with n = 4, 0000 and = Sign bitMagnitude = –12 10 Sign bitMagnitude

President UniversityErwin SitompulDigital Systems 7/28 1’s Complement Representation LectureDigital Systems The 1’s complement of a binary number involves inverting all bits. 1s become 0s, and 0s become 1s. As example, 1’s complement of is ’s complement of is Thus, for an n-bit number N, the 1’s complement is 2 n – 1 – N. To find the negative of a number, take the 1’s complement of that number. For 1’s complement, there are two representations for zero. For example, with n = 4, 0000 and = Sign bitMagnitude = –12 10 Sign bitMagnitude

President UniversityErwin SitompulDigital Systems 7/29 1’s Complement Addition / Subtraction LectureDigital Systems As Example 1, suppose we wish to add = = in 1’s complement 1 10 = = in 1’s complement Step 1: Add the binary numbers Step 2: Add the carry to lowest-order bit = 13 10

President UniversityErwin SitompulDigital Systems 7/30 1’s Complement Addition / Subtraction LectureDigital Systems Step 1: Add the binary numbers Step 2: Add the carry to lowest-order bit As Example 2, suppose we wish to substract – = = in 1’s complement –1 10 = – = in 1’s complement = 11 10

President UniversityErwin SitompulDigital Systems 7/31 1’s Complement Addition / Subtraction LectureDigital Systems Step 1: Add the binary numbers Step 2: Add the carry to lowest-order bit As Example 3, suppose we wish to substract –5 10 – –5 10 = – = in 1’s complement –4 10 = – = in 1’s complement = – = –9 10

President UniversityErwin SitompulDigital Systems 7/32 1’s Complement Addition / Subtraction LectureDigital Systems Step 1: Add the binary numbers Step 2: Add the carry to lowest-order bit As Example 4, suppose we wish to substract – –5 10 = – = in 1’s complement –4 10 = – = in 1’s complement = – = –1 10

President UniversityErwin SitompulDigital Systems 7/33 2’s Complement Representation LectureDigital Systems The 2’s complement of a binary number involves inverting all bits and adding 1. As example, 2’s complement of is ’s complement of is Thus, for an n-bit number N, the 2’s complement is 2 n – 1 – N + 1 = 2 n – N. To find the negative of a number, take the 2’s complement of that number. For 2’s complement more negative numbers than positive = Sign bitMagnitude = –12 10 Sign bitMagnitude

President UniversityErwin SitompulDigital Systems 7/34 2’s Complement Addition / Subtraction LectureDigital Systems Step 1: Add the binary numbers Step 2: Discard the carry As Example 5, suppose we wish to add – –5 10 = – = in 2’s complement –9 10 = – = in 2’s complement = 4 10

President UniversityErwin SitompulDigital Systems 7/35 2’s Complement Addition / Subtraction LectureDigital Systems Step 1: Add the binary numbers Step 2: Discard the carry As Example 6, suppose we wish to add –5 10 – –5 10 = – = in 2’s complement –9 10 = – = in 2’s complement = – = –14 10

President UniversityErwin SitompulDigital Systems 7/36 1 2’s Complement Addition / Subtraction LectureDigital Systems Step 1: Add the binary numbers Step 2: Discard the carry As Example 7, suppose we wish to substract – = – = in 2’s complement –5 10 = – = in 2’s complement = 8 10

President UniversityErwin SitompulDigital Systems 7/37 2’s Complement Addition / Subtraction LectureDigital Systems Step 1: Add the binary numbers Step 2: Discard the carry As Example 8, suppose we wish to substract 5 10 – = – = in 2’s complement –12 10 = – = in 2’s complement = – = –7 10

President UniversityErwin SitompulDigital Systems 7/38 Adder-Subtractor Circuit LectureDigital Systems The following circuit is called an adder-subtractor. This circuit is capable of adding and subtracting binary numbers. When D = 0, the circuit performs addition, S = A + B. When D = 1, the circuit performs subtraction, S = A – B. The XOR Gates invert the value of B to its 2’s complement (C 0 = 1). D

President UniversityErwin SitompulDigital Systems 7/39 Comparing the Signed Numbers LectureDigital Systems 1.Signed magnitude:  Negating is very easy  Just change the sign bit  Adding or subtracting is difficult  If the signs are the same, add the magnitudes and keep the sign. If the signs are different, subtract the smaller operand from the larger operand. The sign of the result is the same as the sign of the larger operand.  Rather complex circuit is required. 2.1’s complement:  Negating is easy  Invert the number but keep the sign bit.  Adding and subtracting is much easier  Include the sign bits, add directly. If there is carry, add it to the sum  Simple but must differentiate cases where carry is 0 or ’s complement:  Negating is not easy  Invert the number, keep the sign, add 1.  Adding and subtracting is easy  Include the sign bits, add directly. Ignore the carry, directly get the result.  Simple circuit

President UniversityErwin SitompulDigital Systems 7/40 Overflow in Binary Addition and Subtraction LectureDigital Systems When two numbers of the same sign are added, the answer may not fit the number of bits provided. In this case, the answer exceeds the magnitude which can be represented with the allotted number of bits. This is called overflow. In 2’s complement, overflow occurs when a transition is made from 2 n–1 –1 to –2 n–1 when adding or from –2 n–1 to 2 n–1 – – – 3– 4– 5– 6– 7– 8– 0

President UniversityErwin SitompulDigital Systems 7/41 Overflow in 4-bit 2 Complement Number LectureDigital Systems Overflow 3 6 – –2 –3 – Overflow –3 – –4 – –2 4 2

President UniversityErwin SitompulDigital Systems 7/42 Homework 7 1.Create a full adder by using NOR Gates only. 2.Convert to decimal from i.signed magnitude ii.1’s complement iii.2’s complement 3.Calculate the following equations using signed magnitude: –8 10 – = – = 4.Calculate each of the following equations using 1’s and 2’s complement: –3 10 – = – = LectureDigital Systems Deadline: 11 November 2015.