IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE

Slides:



Advertisements
Similar presentations
Chapter 1 Digital Systems and Numbers System
Advertisements

Chapter Chapter Goals Know the different types of numbers Describe positional notation.
1 CSE-221 Digital Logic Design (DLD) Lecture-1: Digital Systems & Number Systems.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
1 Number Systems. 2 Numbers Each number system is associated with a base or radix – The decimal number system is said to be of base or radix 10 A number.
Number Systems and Arithmetic
Number Systems Lecture 02.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Numbering systems.
Numeral Systems Subjects: Numeral System Positional systems Decimal
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
Number Systems. Why binary numbers? Digital systems process information in binary form. That is using 0s and 1s (LOW and HIGH, 0v and 5v). Digital designer.
Number systems & Binary codes MODULE 1 Digital Logic Design Ch1-2 Outline of Chapter 1  1.1 Digital Systems  1.2 Binary Numbers  1.3 Number-base Conversions.
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
Number systems, Operations, and Codes
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.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Number Systems & Operations
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Introduction To Number Systems Binary System M. AL-Towaileb1.
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
CPEN Digital Logic Design Binary Systems Spring 2004 C. Gerousis © Digital Design 3 rd Ed., Mano Prentice Hall.
CSC 331: DIGITAL LOGIC DESIGN COURSE LECTURER: E. Y. BAAGYERE. CONTACT: LECTURE TIME: 15:40 – 17:45 hrs. VENUE: SP-LAB.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
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 Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
Unit 1 Introduction Number Systems and Conversion.
Data Representation COE 308 Computer Architecture
Cosc 2150: Computer Organization
Introduction To Number Systems
Number Systems & Binary Arithmetic
Digital Logic & Design Adil Waheed Lecture 02.
NUMBER SYSTEMS.
Data Representation ICS 233
Data Representation.
Number Systems and Binary Arithmetic
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
Digital Systems and Number Systems
CHAPTER 1 : INTRODUCTION
Data Representation in Computer Systems
Number Systems.
Introduction The term digital is derived from the way computers perform operation, by counting digits. Application of digital technology: television, communication.
COMPUTING FUNDAMENTALS
Number Systems Lab session 1 Xuan Guo.
Chapter 3 Data Representation
Number System conversions
University of Gujrat Department of Computer Science
Data Representation COE 301 Computer Organization
Introduction to IT By: Muhammed s. anwar.
MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
Digital Electronics & Logic Design
Data Representation in Computer Systems
Numbering System TODAY AND TOMORROW 11th Edition
Digital Logic & Design Lecture 02.
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
Digital Systems and Binary Numbers
Chapter Four Data Representation in Computers By Bezawit E.
Data Representation ICS 233
Binary to Decimal Conversion
Introduction To Number Systems
COE 202: Digital Logic Design Number Systems Part 2
CHAPTER 69 NUMBER SYSTEMS AND CODES
Data Representation COE 308 Computer Architecture
Presentation transcript:

IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE Number systems

Introduction There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal. These systems are classified according to the values of the base of the number system. Base is total number of digits in the number system.

Introduction The maximum value of a single digit is always equal to one less than the value of the base. The number systems having base 16, 10, 8 and 2 are called hexadecimal, decimal, octal and binary number systems respectively.

Decimal Number System The decimal number system is a base-10 number system and therefore has 10 different digits. These are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. Each position of the digit represents a specific power of the base (10). We use this number system in our day to day life.

Decimal Number System For example, for decimal number 2785.618, the integer part (i.e. 2785) can be expressed as and fractional part can be expressed as

Binary Number System The binary number system is a base-2 number system with ‘0’ and ‘1’ as the two independent digits. The maximum value of a single digit is 1 (one less than the value of the base) Each position of a digit represents a specific power of base 2. This number system is used in computers.

Binary Number System Example With two symbols for each bit, we have 2n possible combinations of symbols where n is the number of bits.

A bit Nibble Byte Word Binary Number System Stands for binary digit is a single place or position in a binary number. A bit A four bit binary number. Nibble An eight bit (2 nibble) binary number. Byte Is a string of bits whose size (the word length) may be equal to one byte, two bytes, four bytes and more. Word

Binary Number System The rightmost bit, the one that represents the ones place, is called the Least Significant Bit or LSB. The leftmost bit, the one that represents the highest power of two represented by that number, is called the Most Significant Bit or MSB

Octal Number System The octal number system has a base of 8 and therefore has eight distinct digits. All higher-order numbers are expressed as a combination of these on the same pattern as the one followed in the case of the binary and decimal number systems. The independent digits are 0, 1, 2, 3, 4, 5, 6 and 7. Each position of a digit represents a specific power of the base 8.

Octal Number System Since there are only 8 digits, 3 bits are sufficient to represent any octal number in binary. Example

Hexadecimal Number System The hexadecimal number system is a base-16 number system this means it has 16 basic digits which are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. The symbols A, B, C, D, E and F represent the decimal number 10, 11, 12, 13, 14 and 15 respectively. Each position of a digit represents a specific power of the base 16.

Hexadecimal Number System Since there are only 16 digits, 4 bits are sufficient to represent any hexadecimal number in binary. Example

Converting a Decimal No. to a No. of Another Base Division Reminder Method Divide the decimal number to be converted by the value of the new base. Record the reminder from step 1 as the rightmost digit of the new base number Divide the quotient of the previous divide by the new base. Record the reminder from step 3 as the next digit of the new base number.

Converting a Decimal No. to a No. of Another Base Division Reminder Method Repeat step 3 and 4 recording reminders from right to left until the quotient become zero in step 3. Note that the last reminder thus obtained will be the most significant digit of the new base number.

Converting a Decimal No. to a No. of Another Base Decimal-to-binary Conversion Conversion of decimal to a binary number can be done by dividing the decimal number by 2 repeatedly, until the quotient of zero is obtained.

Converting a Decimal No. to a No. of Another Base Decimal-to-binary Conversion Example 1.1. Convert 2610 into a binary number

Converting a Decimal No. to a No. of Another Base Decimal-to-octal Conversion Conversion of decimal to a Octal number can be done by dividing the decimal number by 8 repeatedly, until the quotient of zero is obtained.

Converting a Decimal No. to a No. of Another Base Decimal-to-octal Conversion Example 2. Convert 42610 into an octal number.

Converting a Decimal No. to a No. of Another Base Decimal-to-hexadecimal Conversion Conversion of decimal to a Hexadecimal number can be done by dividing the decimal number by 16 repeatedly, until the quotient of zero is obtained.

Converting a Decimal No. to a No. of Another Base Decimal-to-hexadecimal Conversion Example 3. Convert 34810 into a hexadecimal number.

Converting a Decimal No. to a No. of Another Base Method Determine the column (positional) value of each digit Multiply the obtained column values by the digits in the corresponding columns Calculate the sum of these products

Conversion Between Number Systems Binary-to-decimal Conversion Example: Convert 1001.01012 into a decimal number

Conversion Between Number Systems Octal-to-decimal Conversion Example: Convert (137.21)8 into a decimal number

Conversion Between Number Systems Hexadecimal-to-decimal Conversion Example: Convert (1E0.2A)16 into a decimal number

Converting a number of some base to a number of another base Method Convert the original number to a decimal number (base 10) Convert the decimal number to the new base number.

Converting a number of some base to a number of another base Example

Converting a number of some base to a number of another base Example

Shortcut method for converting a binary number to its equivalent octal number Divide the digits into groups of three starting from the right Convert each group of three binary digits to one octal digit using the method of binary to decimal conversion

Shortcut method for converting a binary number to its equivalent octal number Binary–Octal Conversions Example: Convert (1110100.0100111)2 into an equivalent octal number

Shortcut method for converting a octal number to its equivalent Binary number Convert each octal digit to a 3 digit binary number ( the octal digits may be treated as decimal for this conversion). Combine all the resulting binary groups (of 3 digits each) into a single binary number.

Shortcut method for converting a octal number to its equivalent Binary number Example: Convert 47.3218 into an equivalent binary number.

Shortcut method for converting a binary number to its equivalent Hexadecimal number Divide the digits into groups of four starting from the right Convert each group of three binary digits to one hexadecimal digit.

Shortcut method for converting a binary number to its equivalent Hexadecimal number Example: Convert 111011.0112 into an equivalent hexadecimal number.

Shortcut method for converting a Hexadecimal number to its equivalent Binary number Convert the decimal equivalent of each hexadecimal digit to a 4 digit binary number. Combine all the resulting binary groups (of 4 digits each) into a single binary number.

Shortcut method for converting a Hexadecimal number to its equivalent Binary number Example: Convert 9E.AF216 into an equivalent binary number.

Conversion from an Octal to Hexadecimal Number and Vice Versa Method to convert an octal number into a hexadecimal number. First convert the octal number to its binary equivalent. Then form groups of 4 bits, starting from the LSB. Then write the equivalent hexadecimal number for each group of 4 bits.

Conversion from an Octal to Hexadecimal Number and Vice Versa Method to converting a hexadecimal number into an octal number: First convert the hexadecimal number to its binary equivalent. Then form groups of 3 bits, starting from the LSB. Then write the equivalent octal number for each group of 3 bits.

Conversion from an Octal to Hexadecimal Number and Vice Versa Example: Convert the 4.BF85 hexadecimal numbers into equivalent octal

Conversion from an Octal to Hexadecimal Number and Vice Versa Example: Convert (36.532)8 into an equivalent hexadecimal number

Computer Arithmetic

Complement of a Number Binary Number System The 1’s complement of a binary number is obtained by complementing all its bits, i.e. by replacing 0s with 1s and 1s with 0s. For example, the 1’s complement of (10010110)2 is (01101001)2. The 2’s complement of a binary number is obtained by adding ‘1’ to its 1’s complement. The 2’s complement of (10010110)2 is (01101010)2

Complement of a Number Decimal Number System In the decimal number system, we have the 9’s and 10’s complements. The 9’s complement of a given decimal number is obtained by subtracting each digit from 9. For example, the 9’s complement of (2496)10 would be (7503)10 The 10’s complement is obtained by adding ‘1’ to the 9’s complement. The 10’s complement of (2496)10 is (7504)10

Complement of a Number Octal Number System In the octal number system, we have the 7’s and 8’s complements. The 7’s complement of a given octal number is obtained by subtracting each octal digit from 7. For example, the 7’s complement of (562)8 would be (215)8. The 8’s complement is obtained by adding ‘1’ to the 7’s complement. The 8’s complement of (562)8 would be (216)8.

Complement of a Number Hexadecimal Number System The 15’s and 16’s complements are defined with respect to the hexadecimal number system. The 15’s complement is obtained by subtracting each hex digit from 15. For example, the 15’s complement of (3BF)16 would be (C40)16. The 16’s complement is obtained by adding ‘1’ to the 15’s complement. The 16’s complement of (2AE)16 would be (D52)16

Integer Representation In binary number system arbitrary numbers can be represented with just digits 0 and 1, the minus sign and the period the radix. For the purpose of computer storage and processing minus sign and periods are not used. Only binary digits may be used to represent numbers.

Integer Representation Signed magnitude representation The most significant (leftmost) bit in the word is treated as the sign bit. If the sign bit is 0, the number is positive and if the sign bit is 1 the number is negative.

Integer Representation Signed magnitude representation This makes it vital to declare the number of bits that a signed binary number uses. If this information is not given, then the computer or the user looking at a binary number will not know which bit is the MSB. In other words, the leading zeros of a binary value may have been removed making it look like the binary value is negative since it starts with a one.

Integer Representation Signed magnitude representation Since computers don't use an infinite number of bits to represent values, the software must know two things before it can interpret a binary value: the number of bits and the type of binary representation being used.

Binary Arithmetic Information is handled in a computer by electronic or electrical components. Electronic components operate in binary mode (can only indicate two states, on (1) or off (0). Binary number system has only two digits (0 and 1) and is suitable for expressing two possible states.

Binary Arithmetic In binary system, computer circuits only have to handle two binary digits rather than ten decimal digits causing Simpler internal circuit design Less expensive More reliable circuits Arithmetic rules or processes are possible with binary numbers

Binary Arithmetic Examples of few devices that work in binary Mode

Binary Arithmetic Binary Addition The rules of binary addition are given in Table Example: Add the binary numbers: (a) 1010 and 1101 (b) 0110 and 1111 (c) 100111 and 11011 AUGEND ADDEND SUM CARRY RESULT 1 10

Binary Arithmetic Binary Subtraction The rules of binary subtraction are given in Table MINUEND SUBTRAHEND DIFFERENCE BORROW 1

Binary Arithmetic Binary Subtraction Direct method Subtraction 1’s Complement 2’s Complement

Binary Arithmetic The direct method Example 1: Using the direct method to perform the subtraction 1000 – 1001.

Binary Arithmetic The direct method When the minuend is smaller than the subtrahend the result of subtraction is negative and in the direct method the result obtained is in 2’s complement form. So to get back the actual result we have to perform the 2’s complement again on the result thus obtained.

Binary Arithmetic Subtraction Using 1’s Complement Find 1’s complement of the of the number you are subtracting (subtrahend). Add this to the number from which you are taking away (minuend) If a carry is generated, remove the carry, add it to the result, if there is no carry recomplement the sum and attach a negative sign.

Binary Arithmetic Subtraction Using 1’s Complement Example: Subtract (1001)2 from (1101)2 and (1100)2 from (1001)2 using the 1’s complement method.

Binary Arithmetic Subtraction Using 2’s Complement Find 2’s complement of the of the number you are subtracting (subtrahend). Add this to the number from which you are taking away (minuend) If a carry is generated, discard the carry. If there is no carry take the 2’s complement of the number and change the sign.

Binary Arithmetic Subtraction Using 2’s Complement Example: Subtract (1010)2 from (1001)2 using the 1’s complement method.

Binary Arithmetic Binary Multiplication The rules of binary multiplication are given in Table MULTIPLICAD MULTIPLIER RESULT 1

Binary Arithmetic Binary Multiplication Example: Multiply the following binary numbers 0111 and 1101.

Binary Arithmetic Binary Division The rules regarding binary division are listed in Table. DIVIDEND DIVISOR RESULT Not allowed 1

Binary Arithmetic Binary Division Example: Divide the following binary numbers: (a) 11001 and 101

Questions?