Chap 1. Digital Computers and Information

Similar documents
Logic and Computer Design Fundamentals. Chapter 1 Digital Computers and Information

Digital Systems and Binary Numbers

ECE 20B, Winter Purpose of Course. Introduction to Electrical Engineering, II. Administration

EEM 232 Digital System I

DIGITAL SYSTEM DESIGN

Digital Systems and Binary Numbers

Korea University of Technology and Education

CS 121 Digital Logic Design. Chapter 1. Teacher Assistant. Hadeel Al-Ateeq

Logic Circuits I ECE 1411 Thursday 4:45pm-7:20pm. Nathan Pihlstrom.

Lecture (02) Operations on numbering systems

3.1. Unit 3. Binary Representation

Digital Fundamentals

MACHINE LEVEL REPRESENTATION OF DATA

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

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Numbering systems. Dr Abu Arqoub

Review of Number Systems

Chapter 1. Digital Systems and Binary Numbers

Positional Number System

Binary Systems and Codes

Chapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.

Number Systems Base r

CHAPTER TWO. Data Representation ( M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURE THIRD EDITION ) IN THIS CHAPTER

BINARY SYSTEM. Binary system is used in digital systems because it is:

EE 109 Unit 2. Binary Representation Systems

D I G I T A L C I R C U I T S E E

CHW 261: Logic Design

Unit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation

Computer Organization

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

Electronic Data and Instructions

Digital Fundamentals

UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES

Lecture (03) Binary Codes Registers and Logic Gates

Computer Sc. & IT. Digital Logic. Computer Sciencee & Information Technology. 20 Rank under AIR 100. Postal Correspondence

EE 109 Unit 2. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

Digital Fundamentals

Number System. Introduction. Decimal Numbers

LOGIC DESIGN. Dr. Mahmoud Abo_elfetouh

Digital Systems and Binary Numbers

Chapter 2 Number Systems and Codes Dr. Xu

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

EE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

Chapter 1 Review of Number Systems

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Lecture (01) Introduction Number Systems and Conversion (1)

UNIT 7A Data Representation: Numbers and Text. Digital Data

Introduction to Numbering Systems

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

Microcomputers. Outline. Number Systems and Digital Logic Review

Digital Logic Lecture 2 Number Systems

CS/EE 260. Digital Computers Organization and Logical Design

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

Fundamentals of Programming (C)

CHAPTER 2 (b) : AND CODES

Data Representation and Binary Arithmetic. Lecture 2

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

MC1601 Computer Organization

CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS

Number Systems CHAPTER Positional Number Systems

Lecture 2: Number Systems

NUMBER SYSTEMS AND CODES

The type of all data used in a C++ program must be specified

Binary Codes. Dr. Mudathir A. Fagiri

MYcsvtu Notes DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes

SE311: Design of Digital Systems

Chapter 2. Data Representation in Computer Systems

Number System (Different Ways To Say How Many) Fall 2016

Lecture 1: What is a computer?

CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY COMPUTER ARCHITECURE- III YEAR EEE-6 TH SEMESTER 16 MARKS QUESTION BANK UNIT-1

CHAPTER 2 Data Representation in Computer Systems

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2


Chapter 2 Bits, Data Types, and Operations

Computer Organization

Fundamentals of Programming

Final Labs and Tutors

in this web service Cambridge University Press

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Agenda EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 1: Introduction. Go over the syllabus 3/31/2010

User. Application program. Interfaces. Operating system. Hardware

CHAPTER 2 Data Representation in Computer Systems

Chapter 2 Bits, Data Types, and Operations

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

Number Systems. Dr. Tarek A. Tutunji Philadelphia University, Jordan

Chapter 1. Data Storage Pearson Addison-Wesley. All rights reserved

Computer Logical Organization Tutorial

Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras

Goals for this Week. CSC 2400: Computer Systems. Bits, Bytes and Data Types. Binary number system. Finite representations of binary integers

umber Systems bit nibble byte word binary decimal

Electronics Engineering ECE / E & T

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

CMPS 10 Introduction to Computer Science Lecture Notes

The type of all data used in a C (or C++) program must be specified

Transcription:

Chap 1. Digital Computers and Information Spring 004 Overview Digital Systems and Computer Systems Information Representation Number Systems [binary, octal and hexadecimal] Arithmetic Operations Base Conversion Decimal Codes [BCD (binary coded decimal), parity] Gray Codes Alphanumeric Codes Digital System 3 Types of Digital Systems 4 Takes a set of discrete information inputs and discrete internal information (system state) and generates a set of discrete information outputs. No state present Combinational Logic System Output = Function(Input) Discrete Inputs Discrete Information Processing System System State Discrete Outputs State present State updated at discrete times => Synchronous Sequential System State updated at any time =>Asynchronous Sequential System State = Function (State, Input) Output = Function (State) or Function (State, Input) Digital System Example: 5 Signal Examples Over Time 6 Count Up Reset A Digital Counter (e. g., odometer): 0 0 1 3 5 6 4 Inputs: Count Up, Reset Outputs: Visual Display State: "Value" of stored digits Synchronous or Asynchronous? Time Analog Digital Asynchronous Synchronous Continuous in value & time Discrete in value & continuous in time Discrete in value & time

1.1 Digital Computers 7 1.1 Digital Computers 8 Digital Computers information age a prominent and growing role in modern society 'generality' follow a sequence of instruction, called a program, that operates on given data perform a variety of information-processing tasks Signals electrical signals such as voltages and currents two discrete values High (output) 4.5~5.5 (input) 3.0~5.5 Low (output) -0.5~1.0 (input) -0.5~.0 High & Low (H & L), True & False, 1 & 0 Binary Number System Digital computer the best-known example of a digital system manipulate discrete elements of information a binary digit is called a bit information is represented in group of bits use various coding techniques (ex) 10 decimal digits, 6 letters of the alphabets,... Signal Example Physical Quantity: Voltage 9 Binary Values: Other Physical Quantities 10 HIGH LOW OUTPUT 5.0 4.0 3.0.0 1.0 0.0 Volts INPUT HIGH Threshold Region LOW What are other physical quantities represent 0 and 1? CPU Voltage Disk CD Magnetic Field Direction Surface Pits/Light Dynamic RAM Electrical Charge 1.1 Digital Computers 11 1.1 Digital Computers 1 Computer Structure Inputs: Keyboard, mouse, modem, microphone Figure 1-: Block Diagram of a Digital Computer Outputs: CRT, LCD, modem, speakers Basic Structure memory unit: stores programs, input, output, data processor unit: performs arithmetic and other data-processing operations, as specified by the program control unit: supervises the flow of information between units (CPU = control unit + data path) input device: key board output device: CRT, LCD More FPU (floating-point unit) MMU (memory management unit) (Memory: MMU + internal cache + external cache + RAM) (See Text p.)

1. Number Systems 13 1. Number Systems 14 decimal number (base 10 or radix 10) 74.5 = 7 x 10 + x 10 1 + 4 x 10 0 + 5 x 10-1 In general, A n A n-1...a 1 A 0.A -1 A -...A -m+1 A -m Each A i coefficient is (0, 1,, 3, 4, 5, 6, 7, 8, 9) base r or radix r expressed with a power series in r A n r n +A n-1 r n-1 +... + A 1 r 1 +A 0 r 0 +A -1 r -1 +A - r - +. + A -m+1 r -m+1 +A -m r -m expresses in positional notation A n A n-1...a 1 A 0.A -1 A -...A -m+1 A -m. is called radix point A n is the most significant digit (msd) A -m is the least significant digit (lsd) enclose coefficients in parentheses and place a subscript (31.4) 5 = 3 x 5 + 1 x 5 1 + x 5 0 + 4 x 5-1 = 75 + 5 + + 0.8 = (8.8) 10 in computer work, binary, octal, and hexadecimal is popular Binary Numbers base with two digits: 0 & 1 (11010) = 1x 4 + 1x 3 + 0x + 1x 1 + 1x 0 = (6) 10 digits in a binary numbers are called bits powers of two are listed in Table 1-1. Number Systems Representation 15 Number Systems Examples 16 Positive radix, positional number systems A number with radix r is represented by a string of digits: A n - 1 A n - A 1 A 0. A - 1 A - A - m + 1 A - m in which 0 A i < r and. is the radix point. The string of digits represents the power series: (Number) r = i = n - 1 j = - 1 ( i)( ) j Ai r + i = 0 j = - m (Integer Portion) + (Fraction Portion) A j r Radix (Base) Digits 0 1 3 Powers of 4 Radix 5-1 - -3-4 -5 General r 0 => r - 1 r 0 r 1 r r 3 r 4 r 5 r -1 r - r -3 r -4 r -5 Decimal 10 0 => 9 1 10 100 1000 10,000 100,000 0.1 0.01 0.001 0.0001 0.00001 Binary 0 => 1 1 4 8 16 3 0.5 0.5 0.15 0.065 0.0315 Special Powers of 17 1. Number Systems 18 10 (104) is Kilo, denoted "K" 0 (1,048,576) is Mega, denoted "M" 30 (1,073, 741,84)is Giga, denoted "G" Table 1-1: Powers of Two 10 = 104 referred to as K (Kilo); 0 as M (Mega); 30 as G (Giga)

1. Number Systems 19 1. Number Systems 0 conversion of decimal to binary Octal and Hexadecimal Number successively subtracts powers of two from the decimal number octal number - base 8 (0, 1,..., 6, 7) (17.4) 8 = 1x8 + x8 1 + 7x8 0 + 4x8-1 = (87.5 ) 10 (65) 10 = (? ) hexadecimal number - base 16 (0,1,...,9,A,B,C,D,E,F) 65-51 = 113 51 = 9 (B65F) 16 = 11x16 3 + 6x16 + 5x16 1 + 15x16 0 = (46687) 10 113-64 = 49 64 = 6 49-3 = 17 3 = 5 1 octal digit = 3 binary digits 17-16 = 1 16 = 4 1 hexa digit = 4 binary digits 1-1 = 0 1 = 0 conversion (65) 10 = 9 + 6 + 5 + 4 + 0 = (1001110001) (0010 1100 0110 1011. 1111 0000 0110) = (C6B.F06) 16 (3A6.C) 16 = 0011 1010 0110. 1100 = (1110100110.11) Numbers in Different Bases 1 Number Ranges Computers Decimal (Base 10) Binary (Base ) Octal (Base 8) 00 00000 00 00 01 00001 01 01 0 00010 0 0 03 00011 03 03 04 00100 04 04 05 00101 05 05 06 00110 06 06 07 00111 07 07 08 01000 10 08 09 01001 11 09 10 01010 1 0A 11 01011 13 0B 1 01100 14 0C 13 01101 15 0D 14 01110 16 0E 15 01111 17 0F 16 10000 0 10 Hexadecimal (Base 16) 8, 16, 3, 64 bits 16-bit unsigned integers (537) 10 = (0000001000011001) Range: 0 ( 16 1 ), i.e. 0 (65535) 10 16-bit unsigned fractions (0.375) 10 = (.0110000000000000) Range : 0 ( 16 1)/ 16, i.e. 0 (0.999984741) 10 1.3 Arithmetic Operations 3 1.3 Arithmetic Operations 4 addition, subtraction, and multiplication same as for decimal numbers Conversion from Decimal to Other Base (Ex1.3) (153) 10 = (? ) 8 (1) 5 9 F 5 9 15... augend E 4 6 14 4 6... addend 1 3 E 5 19 14 1 1 3 E 5 153/8 = 19 + 1/8... 1 19/8 = + 3/8... 3 /8 = 0 + /8... (153) 10 = (31) 8 (Ex1.) (76)8 x (45)8 (Octal) (Octal) (Decimal) (Octal) 7 6 5 x = 10 = 8 + = 1 4 5 5 x 6 + 1 = 31 = 4 + 7 = 37 4 6 7 5 x 7 + 3 = 38 = 3 + 6 = 46 3 7 1 0 4 x = 8 = 8 + 0 = 10 4 3 7 7 4 x 6 + 1 = 5 = 4 + 1 = 31 4 x 7 + 3 = 31 = 4 + 7 = 37 (Ex1.5) (0.6875) 10 = (? ) 0.6875 x = 1.375... 1 0.375 x = 0.75... 0 0.75 x = 1.5... 1 0.5 x = 1.0... 1 (0.6875) 10 = (0.1011)

Binary Arithmetic 5 Single Bit Binary Addition with Carry 6 Single Bit Addition with Carry Multiple Bit Addition Single Bit Subtraction with Borrow Multiple Bit Subtraction Multiplication Given two binary digits (X,Y), a carry in (Z) we get the following sum (S) and carry (C): Carry in (Z) of 0: Z 0 0 0 0 X 0 0 1 1 + Y + 0 + 1 + 0 + 1 C S 0 0 0 1 0 1 1 0 BCD Addition Carry in (Z) of 1: Z 1 1 1 1 X 0 0 1 1 + Y + 0 + 1 + 0 + 1 C S 0 1 1 0 1 0 1 1 Multiple Bit Binary Addition 7 Single Bit Binary Subtraction with Borrow 8 Extending this to two multiple bit examples: Carries 0 0 Augend 01100 10110 Addend +10001 +10111 Sum Note: The 0 is the default Carry-In to the least significant bit. Given two binary digits (X,Y), a borrow in (Z) we get the following difference (S) and borrow (B): Borrow in (Z) of 0: Borrow in (Z) of 1: Z 0 0 0 0 X 0 0 1 1 -Y -0-1 -0-1 BS 0 0 1 1 0 1 0 0 Z 1 1 1 1 X 0 0 1 1 -Y -0-1 -0-1 BS 11 1 0 0 0 1 1 Multiple Bit Binary Subtraction 9 Binary Multiplication 30 Extending this to two multiple bit examples: The binary multiplication table is simple: Borrows 0 0 Minuend 10110 10110 Subtrahend - 10010-10011 Difference Notes: The 0 is a Borrow-In to the least significant bit. If the Subtrahend > the Minuend, interchange and append a to the result. 0 0 = 0 1 0 = 0 0 1 = 0 1 1 = 1 Extending multiplication to multiple digits: Multiplicand 1011 Multiplier x 101 Partial Products 1011 0000-1011 - - Product 110111

Non-numeric numeric Binary Codes 31 Number of Bits Required 3 Given n binary digits (called bits), a binary code is a mapping from a set of represented elements to a subset of the n binary numbers. Example: A binary code for the seven colors of the rainbow Code 100 is not used Color Red Orange Yellow Green Blue Indigo Violet Binary Number 000 001 010 011 101 110 111 Given M elements to be represented by a binary code, the minimum number of bits, n, needed, satisfies the following relationships: n > M > (n 1) n = log M where x, called the ceiling function, is the integer greater than or equal to x. Example: How many bits are required to represent decimal digits with a binary code? Number of Elements Represented 33 Binary Codes for Decimal Digits 34 Given n digits in radix r, there are r n distinct elements that can be represented. But, you can represent m elements, m < r n Examples: You can represent 4 elements in radix r = with n = digits: (00, 01, 10, 11). You can represent 4 elements in radix r = with n = 4 digits: (0001, 0010, 0100, 1000). This second code is called a "one hot" code. There are over 8,000 ways that you can chose 10 elements from the 16 binary numbers of 4 bits. A few are useful: Decimal 8,4,,1 Excess3 8,4,-,-1 Gray 0 0000 0011 0000 0000 1 0001 0100 0111 0100 0010 0101 0110 0101 3 0011 0110 0101 0111 4 0100 0111 0100 0110 5 0101 1000 1011 0010 6 0110 1001 1010 0011 7 0111 1010 1001 0001 8 1000 1011 1000 1001 9 1001 1100 1111 1000 1.4 Decimal Codes 35 1.4 Decimal Codes 36 decimal number system (people are accustomed to) (vs) binary number system (natural for computer) 10 decimal digits 4-bit binary code (6 are unassigned) numerous different binary codes ways convert decimal numbers to binary perform all arithmetic calculation in binary and then convert the binary results back to decimal perform the arithmetic operations with decimal numbers when they are stored in coded form BCD (Binary-Coded Decimal) 0 0000 5 0101 1 0001 6 0110 0010 7 0111 3 0011 8 1000 4 0100 9 1001 n-bit binary code a group of n bits up to n distinct combinations of 1's & 0's -bit binary code: 00, 01, 10, 11 (185) 10 = (0001 1000 0101) BCD = (101110001) BCD numbers are decimal numbers, not binary numbers

1.4 Decimal Codes 37 Excess 3 Code and 8, 4,, 11 Code 38 BCD Addition Decimal Excess 3 8, 4,, 1 4 0100 4 0100 8 1000 +5 0101 +8 1000 +9 1001 9 1001 1 1100 17 1 0001 +0110 +0110 1 0010 1 0111 0 1 3 4 5 0011 0100 0101 0110 0111 1000 0000 0111 0110 0101 0100 1011 add two BCD numbers as if two binary numbers if sum is greater than or equal to 1010, add 0110 6 7 8 1001 1010 1011 1010 1001 1000 (ex) Text p.19 9 1100 1111 What interesting property is common to these two codes? Error-Detection Codes 39 4-Bit Parity Code Example 40 Redundancy (e.g. extra information), in the form of extra bits, can be incorporated into binary code words to detect and correct errors. A simple form of redundancy is parity, an extra bit appended onto the code word to make the number of 1 s odd or even. Parity can detect all single-bit errors and some multiple-bit errors. A code word has even parity if the number of 1 s in the code word is even. A code word has odd parity if the number of 1 s in the code word is odd. Fill in the even and odd parity bits: Even Parity Odd Parity Message - Parity Message - Parity 000-000 - 001-001 - 010-010 - 011-011 - 100-100 - 101-101 - 110-110 - 111-111 - The codeword "1111" has even parity and the codeword "1110" has odd parity. Both can be used to represent 3-bit data. 1-55 Gray Code 41 Gray Code (Continued) 4 Decimal 8,4,,1 Gray 0 0000 0000 1 0001 0100 0010 0101 3 0011 0111 4 0100 0110 5 0101 0010 6 0110 0011 7 0111 0001 8 1000 1001 9 1001 1000 Does this special Gray code property have any value? An Example: Optical Shaft Encoder 111 000 100 000 B 0 110 B 1 B 001 101 G G 1 G 101 010 111 0 001 011 What special property does the Gray code have in relation to adjacent decimal digits? 100 011 (a) Binary Code for Positions 0 through 7 110 010 (b) Gray Code for Positions 0 through 7

Gray Code (Continued) 43 Gray Code (Continued) 44 How does the shaft encoder work? For the binary code, what codes may be produced if the shaft position lies between codes for 3 and 4 (011 and 100)? Is this a problem? For the Gray code, what codes may be produced if the shaft position lies between codes for 3 and 4 (010 and 110)? Is this a problem? Does the Gray code function correctly for these borderline shaft positions for all cases encountered in octal counting? Warning: Conversion or Coding? 45 1-66 Alphanumeric Codes 46 Do NOT mix up conversion of a decimal number to a binary number with coding a decimal number with a BINARY CODE. 13 10 = 1101 (This is conversion) 13 0001 0011 (This is coding) Data handling of numbers and letters set of elements include 10 digits, 6 letters, special characters 36 ~ 64 letters if only capital letters: need 6 bits 64 ~ 18 letters if upper/lower letters: need 7 bits ASCII Character Code standard binary code is ASCII (Table 1.5) ASCII contain 94 graphic chars(printable) + 34 control chars(nonprinting) Parity Bit ASCII is a 7-bit code + 1 bit => 8-bit (1 byte) \---- used for specific purpose ASCII Character Codes 47 ASCII Properties 48 American Standard Code for Information Interchange (Refer to Table 1-4 in the text) This code is a popular code used to represent information sent as character-based data. It uses 7-bits to represent: 94 Graphic printing characters. 34 Non-printing characters Some non-printing characters are used for text format (e.g. BS = Backspace, CR = carriage return) Other non-printing characters are used for record marking and flow control (e.g. STX and ETX start and end text areas). ASCII has some interesting properties: Digits 0 to 9 span Hexadecimal values 30 16 to 39 16. Upper case A-Z span 41 16 to 5A 16. Lower case a-z span 61 16 to 7A 16. Lower to upper case translation (and vice versa) occurs by flipping bit 6. Delete (DEL) is all bits set, a carryover from when punched paper tape was used to store messages. Punching all holes in a row erased a mistake!

1.5 Alphanumeric Codes 49 Table 1-51 5 ASCII Code 50 parity bit: total number of 1 is even (even parity) total number of 1 is odd (odd parity) (even parity) (odd parity) ASCII A = 1000001 01000001 11000001 ASCII T = 1010100 11010100 01010100 - helpful in detecting errors during the transmission of information Unicode.0 a new standard for 16-bit alphanumeric codes referred to as Unicode/ISO-10646 16 bits provide 65,536 code words, represent the symbols and ideographs of the world's languages 16 bits, implemented in computers by bytes little-endian vs big-endian Table 1-51 5 ASCII Code 51