Digital Systems Roberto Muscedere Images 2013 Pearson Education Inc. 1

Similar documents
Numbering Systems. Contents: Binary & Decimal. Converting From: B D, D B. Arithmetic operation on Binary.

Chapter 1. Binary Systems 1-1. Outline. ! Introductions. ! Number Base Conversions. ! Binary Arithmetic. ! Binary Codes. ! Binary Elements 1-2

Chapter 1 CSCI

CHAPTER 2 NUMBER SYSTEMS

Department of Electrical & Electronics EE-333 DIGITAL SYSTEMS

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

CPE100: Digital Logic Design I

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

COMBINATIONAL LOGIC FUNCTIONS

ENGIN 112 Intro to Electrical and Computer Engineering

of Digital Electronics

Digital Systems and Information Part II

MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

EE260: Digital Design, Spring n Digital Computers. n Number Systems. n Representations. n Conversions. n Arithmetic Operations.

Digital Systems Overview. Unit 1 Numbering Systems. Why Digital Systems? Levels of Design Abstraction. Dissecting Decimal Numbers

hexadecimal-to-decimal conversion

CpE358/CS381. Switching Theory and Logical Design. Summer

Logic and Computer Design Fundamentals. Chapter 5 Arithmetic Functions and Circuits

Digital Techniques. Figure 1: Block diagram of digital computer. Processor or Arithmetic logic unit ALU. Control Unit. Storage or memory unit

Fundamentals of Digital Design

14:332:231 DIGITAL LOGIC DESIGN. Why Binary Number System?

Systems I: Computer Organization and Architecture

Chapter 7 Logic Circuits

NUMBERS AND CODES CHAPTER Numbers

Digital Electronics Part 1: Binary Logic

We say that the base of the decimal number system is ten, represented by the symbol

Cs302 Quiz for MID TERM Exam Solved

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

Why digital? Overview. Number Systems. Binary to Decimal conversion

ENG2410 Digital Design Introduction to Digital Systems. Fall 2017 S. Areibi School of Engineering University of Guelph

Binary addition example worked out

Class Website:

CHAPTER 7. Exercises 17/ / /2 2 0

THE LOGIC OF COMPOUND STATEMENTS

Chapter 1 :: From Zero to One

PAST EXAM PAPER & MEMO N3 ABOUT THE QUESTION PAPERS:

Hakim Weatherspoon CS 3410 Computer Science Cornell University

convert a two s complement number back into a recognizable magnitude.

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Combinational Logic. Course Instructor Mohammed Abdul kader

Number System conversions

Introduction to Digital Logic Missouri S&T University CPE 2210 Subtractors

UNIT II COMBINATIONAL CIRCUITS:

ECE260: Fundamentals of Computer Engineering

ENGIN 112 Intro to Electrical and Computer Engineering

ELEN Electronique numérique

Menu. Review of Number Systems EEL3701 EEL3701. Math. Review of number systems >Binary math >Signed number systems

Logic Theory in Designing of Digital Circuit & Microprocessor

( c) Give logic symbol, Truth table and circuit diagram for a clocked SR flip-flop. A combinational circuit is defined by the function

Digital Logic (2) Boolean Algebra

12/31/2010. Digital Operations and Computations Course Notes. 01-Number Systems Text: Unit 1. Overview. What is a Digital System?

PG - TRB UNIT-X- DIGITAL ELECTRONICS. POLYTECHNIC-TRB MATERIALS

E40M. Binary Numbers. M. Horowitz, J. Plummer, R. Howe 1

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

Combinational Logic Design Arithmetic Functions and Circuits

Lecture 2 Review on Digital Logic (Part 1)

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

Mark Redekopp, All rights reserved. Lecture 1 Slides. Intro Number Systems Logic Functions

Week No. 06: Numbering Systems

Contents. Chapter 2 Digital Circuits Page 1 of 30

IT T35 Digital system desigm y - ii /s - iii

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

Review for Test 1 : Ch1 5

Residue Number Systems Ivor Page 1

Outline. policies for the first part. with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014

Complement Arithmetic

CHW 261: Logic Design

Numbers and Arithmetic

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6201 DIGITAL PRINCIPLES AND SYSTEM DESIGN

UNIVERSITI TENAGA NASIONAL. College of Information Technology

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits.

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Chapter 2 Combinational Logic Circuits

Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173

SAU1A FUNDAMENTALS OF DIGITAL COMPUTERS

Digital Logic and Design (Course Code: EE222) Lecture 1 5: Digital Electronics Fundamentals. Evolution of Electronic Devices

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

Adders - Subtractors

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

ECE380 Digital Logic. Positional representation

JNTU World. Digital Logic Design. Introduction

Chapter 1: Logic systems

0 / 1 Now, Binary value of the given number :-

Sample Marking Scheme

FYSE410 DIGITAL ELECTRONICS [1] [2] [3] [4] [5] A number system consists of an ordered set of symbols (digits).

University of Florida EEL 3701 Fall 2014 Dr. Eric. M. Schwartz Department of Electrical & Computer Engineering Wednesday, 15 October 2014

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

on candidate s understanding. 7) For programming language papers, credit may be given to any other program based on equivalent concept.

Carry Look Ahead Adders

Chapter 5. Digital systems. 5.1 Boolean algebra Negation, conjunction and disjunction

ENEL Digital Circuit Design. Final Examination

Numbers and Arithmetic

CSE 241 Digital Systems Spring 2013

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Chapter 2 Boolean Algebra and Logic Gates

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

CprE 281: Digital Logic

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

CPE100: Digital Logic Design I

Combinational Logic. By : Ali Mustafa

Transcription:

Digital Systems Digital systems have such a prominent role in everyday life The digital age The technology around us is ubiquitous, that is we don t even notice it anymore Digital systems are used in: communication, business transactions, traffic control, spacecraft guidance, medical treatment, weather monitoring, the Internet, and many other commercial, industrial, and scientific enterprises We have: digital telephones, digital televisions, digital versatile discs, digital cameras, handheld devices, and, of course, digital computers, etc. 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 1

Digital Systems We enjoy music and video downloaded directly to our portable media devices (phones) which have very high resolution displays via complex digital communications networks (4G, LTE) These devices have advanced graphical user interfaces (GUIs), which enable them to execute commands that appear to the user to be simple, but which, in fact involve precise execution of a sequence of complex internal instructions Your phone s OS is over 3GB in size! These devices have a general purpose digital computer embedded within them Also contains specific components such as a radio, audio/video encoders/decoders, 3D graphics subsystems 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 2

Digital Systems The digital computer can follow a sequence of instructions, called a program The user can specify and change the program or the data according to the specific need Because of this flexibility, the general purpose digital computer can perform a variety of information processing tasks that range over a wide spectrum of applications Digital systems manipulate discrete elements of information Any set that is restricted to a finite number of elements Examples: 10 decimal digits, 26 letters of the alphabet, 52 playing cards, 64 squares of a chessboard 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 3

Digital Systems Early digital computers were used strictly for numeric computations (for which computer was derived) Discrete elements of information are represented in a digital system by physical quantities called signals which are usually represented as voltages and currents Digital systems today generally use just two discrete values and are therefore said to be binary A binary digit, called a bit, has two values: 0 and 1 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 4

Digital Systems Discrete elements of information are represented with groups of bits called binary codes Decimal digits 0 through 9 could be represented in a digital system with four bits How a pattern of bits is interpreted as a number depends on the code system in which it resides Discrete quantities of information either emerge from the nature of the data being processed or may be quantized from a continuous process The quantization of a process can be performed automatically by an analog-to-digital converter, a device that forms a digital (discrete) representation of an analog (continuous) quantity 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 5

Digital Systems The general purpose digital computer is the best known example of a digital system The major parts of a computer are a memory unit, a central processing unit, and input-output units Memory unit stores programs, input, output, and intermediate data Central processing unit performs arithmetic and data movement Program and data are transferred into memory by an input device An output device receives the results of the computations A digital computer can accommodate many input and output devices 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 6

Digital Systems A digital computer is a powerful instrument that can perform not only arithmetic computations, but also logical operations It can be programmed to make decisions based on internal and external conditions By changing the program the same underlying hardware can be used for many different applications The cost of development to be spread across a wider customer base Advances in digital integrated circuit technology have reduced overall costs As the number of transistors that can be put on a piece of silicon increases to produce complex functions, the cost per unit decreases and digital devices can be bought at an increasingly reduced price 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 7

Digital Systems Digital integrated circuits can perform at a speed of hundreds of millions of operations per second To improve reliability digital systems often utilize error correcting codes For example: Digital communications include additional bits to verify the proper transmission of information All digital storage includes additional bits of information which are used to not only verify but reconstruct data which has been damaged 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 8

Digital Systems A digital system is an interconnection of digital modules It is necessary to have a basic knowledge of digital circuits and their logical function to understand the overall operation of each digital module Modern day digital design methodology uses hardware description languages (HDLs) to describe and simulate the functionality of a digital circuit Resembles a programming language and is suitable for describing digital circuits in textual form Used to simulate a digital system to verify its operation before hardware is built Also used with logic synthesis tools to automate the design process 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 9

Digital Systems Digital systems manipulate discrete quantities of information that are represented in binary form Operands used for calculations may be expressed in the binary number system Other discrete elements, including the decimal digits and characters of the alphabet, are represented in binary codes Digital circuits, also referred to as logic circuits, process data by means of binary logic elements (logic gates) using binary signals Quantities are stored in binary (two-valued) storage elements (flip-flops) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 10

Number Representations Series of digits where the placement of the digits indicates its magnitude or significance a i is the digit, r is the base, i is the position or significance (lower is less), n is the number of digits For the decimal system, r = 10 Each digit ranges from 0 to 9 n 1 y a r i, 0 a r i i i 0 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 11

Decimal Number System Example: r = 10 y = 7392 (10) a 0 = 2, the ones column a 1 = 9, the tens column a 2 = 3, the hundreds column a 3 = 7, the thousands column y a r a r a r a r y y 3 2 1 0 3 2 1 0 710 310 910 210 " a a aa " 7392 3 2 1 0 3 2 1 0 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 12

Decimal Number System Example: r = 10 y = 26.75 (10) a -2 = 5, the hundredths column a -1 = 7, the tenths column a 0 = 6, the ones column a 1 = 2, the tens column Radix point distinguishes where the positive powers switch to negative y a r a r a r a r y y 1 0 1 2 1 0 1 2 210 610 710 510 " aa. a a " 26.75 1 0 1 2 1 0 1 2 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 13

Binary Numbers Digital systems represent information in 0 s and 1 s Almost always built with transistors Circuits operate as switches ( 0 =off, 1 =on) Discrete levels compensate for electronic noise and power fluctuations E.g. 0 is from 0V to 2V, 1 is from 3V to 5V 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 14

Binary Number System (r( = 2) Example: r = 2 y = 11010.11 (2) 12 12 02 12 02 4 3 2 1 0 y 1 2 26.75 (10) 12 12 Always refer to bit positions from right to left (negative to positive) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 15

Other Number System Base 5: Digits between 0 and 4 4021.2 4 5 0 5 2 5 1 5 2 5 511.4 3 2 1 0 1 (5) (10) Base 8: Digits between 0 and 7 127.4 18 28 78 48 87.5 2 1 0 1 (8) (10) Base 16: Digits between 0 and 9, A and F (10 to 15) B65F 11 16 6 16 5 16 15 16 46687 3 2 1 0 (16) (10) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 16

Binary Number System When converting from binary, you can skip 0 bits since they don t contribute: 110101(2) 32 16 4 1 53(10) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 17

Binary Arithmetic Binary operations follow the same rules as decimal Remember to use the proper digits! (0 & 1) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 18

Number Base Conversions Convert 41 (10) to binary (base 2) Starting at position 0 Divide value by r Integer Remainder become coefficient Integer Quotient becomes next value Repeat until next value is 0 Solution is 101001 (2) Integer Quotient Integer Remainder Coefficient 41/2 20 1 a 0 = 1 20/2 10 0 a 1 = 0 10/2 5 0 a 2 = 0 5/2 2 1 a 3 = 1 2/2 1 0 a 4 = 0 1/2 0 1 a 5 = 1 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 19

Number Base Conversions Convert 153 (10) to octal (base 8) 153/8 19/8 2/8 Integer Quotient 19 2 0 Integer Remainder 1 3 2 Coefficient a 0 = 1 a 1 = 3 a 2 = 2 Convert 41394 (10) to hexadecimal (base 16) Integer Quotient Integer Remainder Coefficient 41394/16 2587 2 a 0 = 2 = 2 2587/16 161 11 a 1 = 11 = B 161/16 10 1 a 2 = 1 = 1 10/16 0 10 a 3 = 10 = A 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 20

Number Base Conversions Convert 0.6875 (10) to binary (base 2) Starting at position -1 Multiple value by r Integer Product becomes coefficient Fraction becomes next value Repeat until next value is 0 Solution is 0.1011 (2) Integer Product Fraction Coefficient 0.6875 x 2 1 0.3750 a -1 = 1 0.3750 x 2 0 0.7500 a -2 = 0 0.7500 x 2 1 0.5000 a -3 = 1 0.5000 x 2 1 0 a -4 = 1 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 21

Number Base Conversions Convert 0.513 (10) to octal (base 8) Integer Product Fraction Coefficient 0.513 x 8 4 0.104 a -1 = 4 0.104 x 8 0 0.832 a -2 = 0 0.832 x 8 6 0.656 a -3 = 6 0.656 x 8 5 0.248 a -4 = 5 0.248 x 8 1 0.984 a -5 = 1 0.984 x 8 7 0.872 a -6 = 7 0.872 x 8......... Solution is 0.406517... (8) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 22

Number Base Conversions Full solution:.40651767635544264162540203044672274324 773716662132071260101422335136152375747 331055034530040611156457 (8) Not every base gives a compact answer Base 10 was certainly smaller! 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 23

Number Base Conversions Conversion of both integer and fraction parts is done separately and then combining the two answers For example: 41.6875 (10) = 101001.1011 (2) 153.513 (10) = 231.406517... (8) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 24

Octal and Hexadecimal Numbers Octal: 011001100101111.000110010 (2) 011 001 100 101 111. 000 110 010 (2) 3 1 4 5 7. 0 6 2 (8) 31457.062 (8) Hexadecimal: 0110011001011110.00110010 (2) 0110 0110 0101 1110. 0011 0010 (2) 6 6 5 E. 3 2 (16) 665E.32 (16) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 25

Octal and Hexadecimal Numbers 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 26

Complements of Numbers The larger a circuit becomes, generally the slower it becomes Complements are used to simplify subtraction Two types: Diminished Radix Complement (r-1) s complement (1 s complement in binary, 9 s complement in decimal) Radix Complement r s complement (2 s complement in binary, 10 s complement in decimal) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 27

Diminished Radix Complement Given N in base r having n digits (r-1) s complement of N is: n r 1 N For example (r=10,n=7): 9 s complement of 0546700 is: 9999999-0546700=9453299 9 s complement of 0012398 is: 9999999-0012398=9987601 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 28

Diminished Radix Complement For example (r=2,n=8): 1 s complement of 01011000 is: 11111111-01011000=10100111 1 s complement of 00101101 is: 11111111-00101101=11010010 Quick way: Invert the bits 1 s complement of 01011000 is 10100111 1 s complement of 00101101 is 11010010 For octal or hexadecimal, subtract each digit from 7 or F (15 decimal) respectively 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 29

Radix Complement Given N in base r having n digits r s complement of N is: n r 0, N 0 N, N 0 Can also be obtained by adding 1 to the diminished radix complement since: n n r N r 1 N 1 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 30

Radix Complement For example (r=10,n=7): 10 s complement of 0546700 Add extra 0 s at front to make 7 digits 9 s complement of 0546700 is 9453299 10 s complement is 9453299+1=9453300 10 s complement of 0012398 Add extra 0 s at front to make 7 digits 9 s complement of 0012398 is 9987601 10 s complement is 9987601+1=9987602 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 31

Radix Complement Quick way: Leave all least significant 0 s unchanged Subtract first nonzero least significant digit from 10 Subtract all higher significant digits from 9 10 s complement of 0246700 Leave last 2 zeros unchanged to get 00 Subtract 7 from 10 to get 3 Subtract 0246 digits from 9 s to get 9753 Combine to get 9753300 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 32

Radix Complement For example (r=2, and n=8): 2 s complement of 01011000 Add extra 0 s at front to make 8 digits 1 s complement is 11111111-01011000=10100111 2 s complement is 10100111+1=10101000 2 s complement of 00101101 Add extra 0 s at front to make 8 digits 1 s complement is 11111111-00101101=11010010 2 s complement is 11010011 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 33

Radix Complement Quick way: Leave all least significant 0s and first 1 unchanged Invert remaining 2 s complement of 01101100 10010100 2 s complement of 00110111 11001001 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 34

Radix Complement When a radix point is present Remove point Perform complement Place point back in original place Essentially ignore it The complement of a complement restores the number to its original value 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 35

Subtraction with Complements To subtract two n-digit unsigned numbers M - N in base r: 1. Add the minuend M to the r s complement of the subtrahend N: M + ( r n -N ) = M - N + r n 2. If there is a carry (r n ), discard it 3. If high digit is not zero, solution is in r s complement Take r s complement to get absolute value and place a negative sign in front to get normal form 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 36

Subtraction with Radix Complements Solve: 072532-003250 (r=10,n=6) M 10 s complement of N = = 72532 + 996750 Sum = 1069282 Discard end carry of 10 6 = -1000000 Answer = 69282 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 37

Subtraction with Radix Complements Solve: 003250-072532 (r=10,n=6) M 10 s complement of N Sum High digit not zero, do 10 s complement of Sum Place negative sign = = = = = 003250 + 927468 930718 069282-69282 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 38

Subtraction with Radix Complements r = 2, n = 8, X = 1010100, Y = 1000011 Find: X - Y X 2 s complement of Y = = 01010100 + 10111101 Sum = 100010001 Discard end carry of 2 8 = -100000000 Answer = 10001 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 39

Subtraction with Radix Complements r = 2, n = 8, X = 1010100, Y = 1000011 Find: Y - X Y 2 s complement of X Sum High digit not zero, do 2 s complement of Sum Place negative sign = = = = = 01000011 + 10101100 11101111 00010001-10001 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 40

Subtraction with Diminished Radix Complements r = 2, n = 8, X = 1010100, Y = 1000011 Find: X - Y X 1 s complement of Y Sum End-around carry Answer = = = = = 01010100 + 10111100 100010000 +1 10001 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 41

Subtraction with Diminished Radix Complements r = 2, n = 8, X = 1010100, Y = 1000011 Find: Y - X Y 1 s complement of X Sum High digit not zero, do 1 s complement of Sum Place negative sign = = = = = 01000011 + 10101011 11101110 00010001-10001 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 42

Signed Binary Numbers Range is (2 (n-1) ) to 2 (n-1) -1 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 43

Arithmetic Addition (2 s s comp) Carry out is discarded Make sure we have enough bits or an overflow will be generated 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 44

Arithmetic Subtraction (2 s s comp) Do the same as addition except perform subtraction Discard the borrow Beneficial since we don t need to make a decision on which operation to do based on the signs Binary adders and subtractors can be combined to obtain more savings in circuit implementation 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 45

Binary Codes Digital systems use signals that have two distinct values and circuit elements that have two stable states Direct analogy among binary signals, binary circuit elements, and binary digits A binary number of n digits may be represented by n binary circuit elements; each a 0 or 1 Digital systems represent and manipulate not only binary numbers but also many other discrete elements of information Any discrete element of information that is distinct among a group of quantities can be represented with a binary code; a pattern of 0 s and 1 s 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 46

Binary Codes Due to technology limitations, codes must be in binary Binary codes merely change the symbols and not the meaning of the elements of information that they represent Most bits of a digital system represent some type of coded information rather than just binary numbers An n-bit binary code is a group of n bits that assumes up to 2 n distinct combinations of 1 s and 0 s, with each combination representing one element of the set that is being coded Four elements can be coded with two bits: 00, 01, 10, 11 Eight elements requires a three bit code Sixteen elements requires a four bit code 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 47

Binary Codes The bit combination of an n-bit code is determined from the count in binary from 0 to 2 n -1 Each element must be assigned a unique binary bit combination No two elements can have the same value or the code assignment will be ambiguous Minimum number of bits required to code 2 n distinct values is n No maximum number of bits that may be used For example, the 10 decimal digits can be coded with 10 bits, and each decimal digit can be assigned a bit combination of nine 0 s and a 1 (one hot) The bit combination 0001000000 represents 6 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 48

Binary Coded Decimal r=bcd Perform computation directly on decimal information Avoid conversion between binary and decimal Can save time on slower systems Each digit takes 4 bits; 6 of 16 states unused 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 49

BCD Addition If the addition of two digits exceeds 9, need to correct by adding 6 This may produce a new digit or add to an existing digit Carry propagation may continue onward to higher significant digits 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 50

Solve: 184 + 576 BCD Addition Carry is sent to next column 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 51

Other Decimal Codes 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 52

Other Decimal Codes BCD8421 code has weights 8, 4, 2, and 1 8x0 + 4x1 + 2x1 + 1x0 = 6 BCD2421 has weights 2, 4, 2, and 1 2x1 + 4x1 + 2x0 + 1x1 = 7 Have duplicate representations: 0100 & 1010 = 4, 0101 & 1011 = 5, etc. Excess-3 adds 3 to BCD8421 Excess-3 and BCD2421 are self complementing so 9 s complement is easily achieved by inverting bits 84-2-1 assigns both positive and negative weights 8x0 + 4x1-2x1-1x0 = 2 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 53

Gray Code Only one bit changes in going from one number to the next ie. 7 (0111) to 8 (1000) in binary requires 4 bit changes whereas 7 to 8 in gray code requires just 1 Traditionally used in applications where many bit changes could have produced errors Analog/asynchronous designs Not an issue today 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 54

American Standard Code for Information Interchange (ASCII) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 55

American Standard Code for Information Interchange (ASCII) 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 56

American Standard Code for Information Interchange (ASCII) ASCII is 7 bits Additional bit made each character 8 bits Bit used for more characters such as Greek letters or graphical symbols This has all been replaced by UNICODE which uses 16 or 32 bits per character Additional bit was also used for error detection using simple parity system: It can only detect 1, 3, 5, or 7 incorrect bits Simple but not used in modern technology 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 57

Binary Storage and Registers Information needs to be stored in binary due to modern technology limitations A group of binary cells is called a register An n-bit register can store up to 2 n possibilities Modern technology groups information into 8-bits or a byte Advancements have transitioned from 1 to 2 to 4 to 8 bytes since it is easy to double up ASCII uses 1 byte UNICODE may use 2 or 4 Floating point may use 4 or 8 or more The amount of bits has to be determined for each application 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 58

Register transfer is a basic operation which moves information from one register to another It may be a direct copy or may be processed before They essentially hold data Example: A keyboard sending data (with odd parity) to a control circuit which stores the information every time a key is pressed Pressed key is shifted 8 bits to the left and stored in memory Register Transfer 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 59

Register Transfer Example: Memory unit holds millions of registers Processing unit takes 2 operands (R1, R2) and adds them and places them sum in (R3) The memory unit cannot perform any processing; it only stores information Transfer information from the memory unit to the processing unit, process it, and store it back The process is not immediate; it takes many steps 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 60

Binary Logic Binary logic deals with variables that take on two discrete values and with operations that assume logical meaning Two values may be called by different names: true and false, yes and no, etc. Use the values 1 and 0 The binary logic is equivalent to Boolean algebra More formal presentation in Chapter 2 Binary logic consists of binary variables and a set of logic operations Variables are: A, B, C, x, y, z, etc. each having two distinct values (0 or 1) Three operations are AND, OR, and NOT 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 61

Definition of Binary Logic AND: Represented by a dot or by the absence of an operator For example, z = x y or z = xy, is read z is equal to x AND y Interpreted to mean that z = 1 if and only if x = 1 and y = 1; otherwise z = 0 OR: Represented by a plus sign For example, z = x + y, is read z is equal to x OR y Interpreted to mean that z = 1 if x = 1 or if y = 1 or if both x = 1 and y = 1; otherwise z = 0 NOT: Represented by a prime after or an overbar or a slash before For example: z = x' or z = x or z = /x, is read z is equal to not x or z is not equal to x Interpreted to mean if x = 1, then z = 0, but if x = 0, then z = 1 Also referred to as the complement operation, since it changes a 1 to 0 and a 0 to 1 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 62

Definition of Binary Logic Binary logic resembles binary arithmetic, and the operations AND and OR have similarities to multiplication and addition, respectively The symbols used for AND and OR are the same as those used for multiplication and addition Binary logic should not be confused with binary arithmetic Arithmetic variable designates a number that may consist of many digits A logic variable is always either 1 or 0 For example: Binary arithmetic: 1 + 1 = 10 Binary logic: 1 + 1 = 1 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 63

Definition of Binary Logic For each combination of the values of x and y, there is a value of z specified by the definition of the logical operation Listed in a compact form called truth tables A table of all possible combinations of the variables, showing the relation between the values that the variables may take and the result of the operation The truth tables for the operations AND, OR, and NOT with variable(s) (x and y) are obtained by listing all possible values that the variables may have when combined in pairs: 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 64

Logic Gates Logic gates are electronic circuits that operate on one or more input signals to produce an output signal Electrical signals exist as analog signals having values over a given continuous range but are interpreted to be either of two recognizable values, 0 or 1 for digital systems Modern day technology uses voltages to determine values; for example: Logic 0 is from 0 V to 1 V Logic 1 is from 2 V to 3 V 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 65

Logic Gates The input terminals of digital circuits accept binary signals within the allowable range and respond at the output terminals with binary signals that fall within the specified range The intermediate region between the allowed regions is crossed only during a state transition Any information for computing or control can be operated on by passing binary signals through various combinations of logic gates 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 66

Logic Gates Graphic symbols of gates shown below Gates are blocks of hardware that produce proper 0 and 1 signals given proper input signals Each gate is made up by a series of transistors Some gates require more transistors and therefore more space Current technology only allows for transistors to be constructed on a single plane 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 67

Logic Gates The input signals x and y in the AND and OR gates may exist in one of four possible states: 00, 10, 11, or 01 These input signals are shown together with the corresponding output signal for each gate Timing diagrams illustrate the idealized response of each gate to the four input signal combinations Horizontal axis represents the time, and the vertical axis shows the signal as it changes between the two possible voltage levels In reality the transitions between logic values occur quickly, but not instantaneously nor are they perfectly square Low level represents logic 0 High level represents logic 1 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 68

Logic Gates AND and OR gates may have more than two inputs The three input AND gate responds with logic 1 output if all three inputs are logic 1; otherwise the output produces logic 0 The four input OR gate responds with logic 1 if any input is logic 1; otherwise the output produces a 0 In practice no more than 3 inputs are used since it slows down the gate Multiple gates are cascaded to generate the same result 2018-2019 Roberto Muscedere Images 2013 Pearson Education Inc. 69