Number Systems

18
Lecture 4 Number Systems Lecturer: Sumaira Hussain

Transcript of Number Systems

Page 1: Number Systems

Lecture 4Number Systems

Lecturer: Sumaira Hussain

Page 2: Number Systems

von Neumann Model

• Every computer today is based on the von Neumann Model.

• It is based on 3 ideas:1. Four subsystems2. Stored Program Concept3. Sequential Execution of Instructions

Page 3: Number Systems

• Four subsystems:1. Memory – the storage area of programs and data.2. ALU – arithmetic/logic operations take place3. Control Unit – control Memory, ALU, and I/O4. I/O – accept input data/send output data

Page 4: Number Systems

Input/Output Subsystem• The definition is very broad;

it includes the secondary storage devices.• Disk – stores data and programs for processing

Page 5: Number Systems

Stored Program Concept

• The von Neumann model states thatthe program must be stored in memory.

• The memory of modern computershosts both– a program– its corresponding data

Page 6: Number Systems

Sequential Execution of Instructions

• A program is made of a finite number of instructions.

• The control unit – fetches one instruction from memory– interpret it– execute it

• The instructions are executed one after another.

Page 7: Number Systems

Storing Data

• Store data in the form of an electrical signal, specially its presence or absence.

• This implies that a computer can store data in one of two states.

• Binary number system

Page 8: Number Systems

Data organization• Although data should be stored only in one form (a

binary pattern) inside a computer,data outside a computer can take many forms.

• Data come in different forms:– Numbers– Text– Images– Audio– Video

Page 9: Number Systems

Requirements of von Neumann model

1. The programs must be stored in memory.

2. The programs must be a sequence of instructions.

Page 10: Number Systems

Number System

"A set of values used to represent different quantities is known as Number System".

The digital computer represents all kinds of data and information in binary numbers. It includes audio, graphics, video, text and numbers. The total number of digits used in a number system is called its base or radix. The base is written after the number as subscript such as 51210.

Page 11: Number Systems

Types of Number System

• Decimal number system• Binary number system• Octal number system• Hexadecimal number system

Page 12: Number Systems

Decimal Number System

The Decimal Number System consists of ten digits from 0 to 9. These digits can be used to represent any numeric value. The base of decimal number system is 10.

The decimal number system is used in general.

Page 13: Number Systems

Binary Number System

Digital computer represents all kinds of data and information in the binary system. Binary Number System consists of two digits 0 and 1. Its base is 2. Each digit or bit in binary number system can be 0 or 1

Page 14: Number Systems

Octal Number System

Octal Number System consists of eight digits from 0 to 7. The base of octal system is 8. Octal number system is used as a shorthand representation of long binary numbers.

Page 15: Number Systems

Hexadecimal Number System

The Hexadecimal Number System consists of 16 digits from 0 to 9 and A to F. The alphabets A to F represent decimal numbers from 10 to 15. The base of this number system is 16. This number system provides shortcut method to represent long binary numbers.

Page 16: Number Systems

CONVERTING NUMBERS FROM ONE BASE INTO ANOTHER

• Binary to DecimalMultiplication by the power of 2

• Decimal to BinaryRepeated division by 2

Page 17: Number Systems

• Decimal to OctalDivision by 8 and storing remainder

• Octal to Decimal Multiplication by the power of 8

• Binary to Octalfirst group into set of three digits from right side and then convert into decimal

• Octal to Binarylook up each octal digit to obtain the equivalent group of three binary digitsOctal =345Binary =011100101= 011100101 binary

CONVERTING NUMBERS FROM ONE BASE INTO ANOTHER

Page 18: Number Systems

• Decimal to HexadecimalDivision by 16 and storing remainder

• Hexadecimal to Decimal Multiplication by the power of 16

• Binary to Hexadecimalfirst group into set of four digits from right side. into and then convert into decimal

• Hexadecimal to Binary look up each hexadecimal digit to obtain the equivalent group of four binary digits Hexadecimal =A2DEBinary =1010001011011110

CONVERTING NUMBERS FROM ONE BASE INTO ANOTHER