1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.

Slides:



Advertisements
Similar presentations
2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Advertisements

Chapter 2: Data Representation
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
Chapter 2 : Number System
CHAPTER 2 Number Systems, Operations, and Codes
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Introduction to Programming with Java, for Beginners
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
The Binary Number System
Mantıksal Tasarım – BBM231 M. Önder Efe
Number Systems Lecture 02.
Binary Number Systems.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
Binary Representation and Computer Arithmetic
Introduction to Computing Systems from bits & gates to C & beyond Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation.
Dr. Bernard Chen Ph.D. University of Central Arkansas
Data Representation in Computers
Data Representation Number Systems.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Simple Data Type Representation and conversion of numbers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
Computer Math CPS120: Data Representation. Representing Data The computer knows the type of data stored in a particular location from the context in which.
IT253: Computer Organization
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
Data Representation and Computer Arithmetic
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
NUMBER SYSTEM AND COMPUTER CODES Chapter 2. Prelude Fingers, sticks, and other things for counting were not enough! Counting large numbers Count in groups.
Number Systems Spring Semester 2013Programming and Data Structure1.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Number Systems and Codes. CS2100 Number Systems and Codes 2 NUMBER SYSTEMS & CODES Information Representations Number Systems Base Conversion Negative.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
Number systems, Operations, and Codes
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
1 Representation of Data within the Computer Oct., 1999(Revised 2001 Oct)
Computer Math CPS120: Lecture 3. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits have 0 or.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
Data Representation, Number Systems and Base Conversions
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
MECH1500 Chapter 3.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Computer Math CPS120 Introduction to Computer Science Lecture 7.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Some basic concepts underlying computer archi­tecture
Number Systems & Binary Arithmetic
Programming and Data Structure
Data Representation.
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Number Representation
3.1 Denary, Binary and Hexadecimal Number Systems
Number Systems and Binary Arithmetic
CHAPTER 1 : INTRODUCTION
Chapter 3 Data Representation
Chapter 2 Bits, Data Types & Operations Integer Representation
Data Representation Data Types Complements Fixed Point Representation
Numbering System TODAY AND TOMORROW 11th Edition
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
Presentation transcript:

1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems

2 Objectives n Describe the different methods of data representations; n Describe the characteristics of number representation; n Convert a number in any numbering base to other bases; n Perform binary arithmetic;

3 Objectives (Cont’d) n State the methods of complements in representing negative numbers; and n Perform binary subtraction using complement representations.

4 References n Richard S. Sandige, “Modern Digital Design,” Mcgraw-Hill Publishing Company. n Theodore F. Bogart Jr., “Introduction to Digital Circuits,” McGraw-Hill Publishing Company.

5 References (Cont’d) n Thomas C. Bartee, “Digital Computer Fundamentals,” sixth edition, McGraw-Hill Publishing Company.

6 Data Representations n Values in digital systems consist of only 0 and 1. n A combination containing a single 0 or 1 is called a bit (Binary digit). n In general, n bits can be used to distinguish amongst 2 n distinct entities.

7 Data Representations n Computers use strings of bits to represent numbers, letters, punctuation marks, and any other useful pieces of information.

8 Alphanumeric Codes n An alphanumeric code is the assignment of letters and other characters to bit combinations. n These include letters, digits and special symbols. n ASCII: American Standard Code for Information Interchange.

9 Alphanumeric Codes n 7-bit to represent 128 different symbols including upper-case and lower-case letters, digits and special symbols, printable and non-printable. n 8-bit extension uses the eighth bit to add error-detecting capability (parity check) for transferring codes between computers.

10 Alphanumeric Codes n EBCDIC: Extended Binary Coded Decimal Interchange Code. 8-bit IBM code.

11 Numbers n In principal, represented in binary numbering system. n variations, such as integers, floating point numbers, negative numbers, etc.

12 Characteristics of Number representation n Binary numbering system; some characteristics being the same as decimal n A numeric value is represented by a series of symbols. n five thousand two hundred and thirty two represented by Positional significance exists.

13 Example n =5       =

14 Positional Significance n N b =S i S i S 2 S 1 S 0. S -1 S -2 S S -k =S i b i + S i-1 b i S 2 b 2 + S 1 b 1 + S 0 b 0 + S -1 b -1 + S -2 b -2 + S -3 b S -k b -k (Exp. 1.) n The Least Significant Digit (LSD), S -k, and the Most Significant Digit (MSD), S i.

15 Integers n Represented in binary numbering system n For example, , represents : 1     2 0 = =11 10

16 Integers (Cont ’ d) An integer usually employs 2 bytes, i.e. 16 bits, which can represent a number up to (2 16 – 1) or n Bigger numbers, long integers may occupy 32 bits or 64 bits.

17 Binary Coded Decimal (BCD) n Integer representation. n The decimal digits are stored in terms of their 4-bits binary equivalents n For example: decimal number 9502 would be stored as n Non-positional. n Complicated in arithmetic.

18 Floating point numbers n Used when a number is very large or very small. n A pair of numbers to represent the values. n One is the value scaled to a standard form, the normalized mantissa in fixed-point notation. n The other is a scaling factor, the exponent.

19 Floating point numbers (Cont ’ d) n Scientific notation, i.e. M  b e, where M is the mantissa; b the base and e the exponent. n Example, single-precision floating- point number in IBM 370 or 3000 series: n 1-bit sign indicator, a 7-bit exponent with a base of 16, and a 24-bit mantissa.

20 Floating point numbers (Cont ’ d) n 24 bits correspond to 6-7 decimal digits, we can assume that a number has at least 6 decimal digits of precision. n The exponent of 7 bits gives a range of 0 to 127. Because of an exponential bias, the range is actually -64 to +63, that is, 64 is automatically subtracted from the listed exponent.

21 Floating point numbers (Cont ’ d) n Example: n The leftmost bit is a zero, i.e positive. n The next seven bits, , are exponent equivalent to the decimal number 66 n The final 24 bits indicate the mantissa

22 Floating point numbers (Cont ’ d) n The machine number represents, in decimal: + ( )  = n To ensure uniqueness of representation and obtain all the available precision of the system, M  e -1.

23 Floating point numbers (Cont ’ d) n The smallest positive machine number that can be represented is =  n while the largest is = 

24 Floating point numbers (Cont ’ d) n Numbers less than result in what is called underflow, and are often set to zero. n Numbers greater than result in an overflow condition and cause the computations to halt.

25 Commonly used Numbering Systems n Binary number system (base 2), octal (base 8), and hexadecimal (base 16) number systems. n Computers only deal with binary numbers, the use of the octal and hexadecimal numbers is solely for the convenience of human people.

26 Base numbers n In our daily life, for convenience the base number is always ignored such that means n In computer world, the representation can be a value in other numbering systems. n is different from

27 Base numbers n According to the nature of positional significance, n equals to n equals to n When dealing with numeric values in different systems, the number indicating the base must also be present.

28 Number Conversions n Conversion to decimal numbers n Conversions among binary, octal, and hexadecimal numbers

29 Conversion to decimal numbers n Simply using the polynomial expression stated in Exp. 1.1 n = 1         2 0 = =

30 Conversion to decimal numbers (Cont ’ d) n = 1     8 0 = = n A1D 16 = 10    16 0 = =

31 Conversion from decimal numbers n Given a decimal number, N 10, its equivalent representation in base b is as n S i S i S 2 S 1 S 0 n From Exp. 1.1, we have: N 10 =S i b i + S i-1 b i S 2 b 2 + S 1 b 1 + S 0 b 0

32 Conversion from decimal numbers (Cont ’ d) n Steps : i. Divide the decimal number by the base number and obtain the quotient and the remainder. ii.Take away the remainder and regard the quotient as the new decimal number. iii.Repeat the steps 1 and 2 until the quotient is 0. iv.The equivalent number in base b is obtained by writing the remainder in reverse sequence.

33 Conversion from decimal numbers (Cont ’ d) n To obtain the binary equivalent, use 2 as the base, b, in division. n To find the octal and hexadecimal equivalent numbers, the base number will be 8 and 16 respectively. n In all cases, the remainders will always be less than the base numbers.

34 Conversion from decimal numbers (Cont ’ d) n The equivalent are , 612 8, and 18A 16

35 Conversions among binary, octal, and hexadecimal numbers

36 Conversions from octal or hexadecimal to binary numbers n Each octal digit comprises three binary digits and each hexadecimal digit comprises four binary digits. n Conversion to a binary number from an octal or hexadecimal number is simply replacing all octal or hexadecimal digits by their binary equivalents.

37 Conversions from octal or hexadecimal to binary numbers n       n 18A A      

38 Conversions from binary to octal or hexadecimal numbers n To group the binary digits into groups of three or four, then replace each group with their octal or hexadecimal equivalent digits. n Grouping must start from the radix point. n Leading zeros can be added if necessary.

39 Conversions from binary to octal or hexadecimal numbers n Leading zero      

40 Conversions from binary to octal or hexadecimal numbers Leading zeros      2 A C B n The equivalents of are and 2ACB 16.

41 Conversions between octal and hexadecimal numbers n No direct method n Through the binary conversions.

42 Binary Arithmetic

43 Binary Arithmetic (Cont ’ d) n The rules are simple. n They are similar to the decimal arithmetic.

44 Binary Arithmetic (Cont ’ d) n Multiplication and division employ the principles of addition and subtraction respectively. n Subtraction can be regarded as addition by adding a negative number. n All arithmetic problems can be solved using the principles of addition provided.

45 Negative numbers n Two ways to represent a negative binary number. u a signed bit to represent the positive or negative sign. u the complemented form of the positive number to represent a negative value.

46 Sign bit representation n Negative number represented by a sign preceding its absolute value, e.g n Similar technique can be employed to represent a negative binary number. n To attach one digit to the binary number to represent the sign. n This binary digit as the sign bit.

47 Sign bit representation (Cont ’ d) n A number with sign bit is called signed number. n Sign bit is always the MSB. n The number is positive if the sign bit is 0 and is negative if the sign bit is 1. n For example, represents , or +5 10, while means , or

48 Sign bit representation (Cont ’ d) n The advantage is simple. n Disadvantages u Duplication in representing zero. u addition to a signed negative number gives an incorrect answer.

49 Sign bit representation (Cont ’ d)

50 Complement representation n The 1’s complement and the 2’s complement. n The most significant bit still represents the sign. n The other digits are not the same.

51 1’s complement n The negative value of an n-digit binary number, N 2, can be represented by its 1’s complement, N' 2 n It is equal to the base number, 2, to the power n minus the number N minus one, or: N' 2 = 2 n - N = (2 n - 1) - N 2

52 1’s complement (Cont ’ d) n (2 n - 1) is the largest value that can be represented by an n-digit number in the binary numbering system n N' 2 can be obtained by subtracting each digit with 1, or by inverting all binary digits.

53 1’s complement (Cont ’ d) n 1's complement number of : n n = 8. N' 2 = ( ) - N 2 = ( ) = =

54 2’s complement n The 2’s complement, N" 2, of an n- digit binary number, N 2, is defined as: N" 2 = 2 n - N 2 = (2 n - 1) - N = N ’ where N ’ 2 is the 1’s complement representation of the number.

55 2’s complement (Cont ’ d) n No duplicate representation for all numbers. N 2 = N’ 2 = N” 2 =N’ 2 + 1= n Since only 8 bits are used, the base complement of zero is zero, too.

56 2’s complement (Cont ’ d) n With 8-bit 2's complement representation, total 256 numbers ( ) to (0 10 ) to ( ).

57 2’s complement (Cont ’ d) n 2's complement number of ’ s complement, N' is N ” = N ’ + 1 = =

58 Subtraction with 2’s complements n Subtraction of two numbers: X 2 - Y 2 =X 2 + (- Y 2 ) In 2 ’ s complement representation: X 2 + (2 n - Y 2 ) = X 2 - Y n n If X > Y, the sum will produce an end carry, 2 n, which can be discarded, and the sum is positive.

59 Subtraction with 2’s complements (Cont ’ d) n If X < Y, the sum is negative and will be 2 n - (Y 2 - X 2 ) which is the 2 ’ s complement of (Y 2 - X 2 ). n (Y 2 - X 2 ) is positive. n The sum is negative with the absolute value being (Y 2 - X 2 ).

60 Subtraction with 2’s complements (Cont ’ d) n Example: = = = (in 2’s complement)

61 Subtraction with 2’s complements (Cont ’ d)

62 Subtraction with 2’s complements (Cont ’ d) n Example: = = = (in 2’s complement)

63 Subtraction with 2’s complements (Cont ’ d)