30
CSA 1- 1 Computer Systems Architecture Copyright © Genetic Computer School 2008 Lesson 1 Number System

Computer Systems Architecture Copyright © Genetic Computer School 2008 CSA 1- 0 Lesson 1 Number System

Embed Size (px)

Citation preview

CSA 1- 1

Computer Systems Architecture

Copyright © Genetic Computer School 2008

Lesson 1

Number System

CSA 1- 2

Computer Systems Architecture

Copyright © Genetic Computer School 2008

LESSON OVERVIEW Different types of number systems Common bases Place values Conversion of bases Computer calculation Arithmetic of the computer Subtracting using twos complement Coding systems Binary coded decimal Floating-point numbers Numbers in standard form Integers and floating-point arithmetic

CSA 1- 3

Computer Systems Architecture

Copyright © Genetic Computer School 2008

NUMBER SYSTEMS

A number system is the set of symbols used to express quantities as the basis for counting, determining order, comparing amounts, performing calculations, and representing value.

It is the set of characters and mathematical rules that are used to represent a number.

CSA 1- 4

Computer Systems Architecture

Copyright © Genetic Computer School 2008

DIFFERENT TYPES OFNUMBER SYSTEMS

Decimal

Binary

Octal

Hexadecimal

CSA 1- 5

Computer Systems Architecture

Copyright © Genetic Computer School 2008

DECIMAL NUMBER SYSTEM

The decimal or denary number system, base 10, has a radix of 10.

Decimal uses different combinations of 10 symbols to represent any valy (i.e., 0,1,2,3,4,5,6,7,8 and 9)

CSA 1- 6

Computer Systems Architecture

Copyright © Genetic Computer School 2008

BINARY NUMBER SYSTEM

Binary is known as machine language.

Data is stored and manipulated inside the computer in binary.

The binary number system is based on two digits, 0 and 1.

CSA 1- 7

Computer Systems Architecture

Copyright © Genetic Computer School 2008

OCTAL NUMBER SYSTEM

The Octal number system has eight as its base; it uses the symbols 0, 1, 2, 3,4,5,6 and 7 only.

For the values eight and above, need to use two digits.

CSA 1- 8

Computer Systems Architecture

Copyright © Genetic Computer School 2008

HEXADECIMAL NUMBER SYSTEM

The Hexadecimal number has sixteen as its base; using 0,1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F.

A, B, C, D, E and F stand for the “digits” ten, eleven, twelve, thirteen, fourteen and fifteen.

CSA 1- 9

Computer Systems Architecture

Copyright © Genetic Computer School 2008

PLACE VALUE

Place value, positional value depends on the base used.

Example:

The third place from the right

in base 10 has the place value 100

in base 2 has the place value 4

in base 8 has the place value 64

In base 16 has the place value 256

CSA 1- 10

Computer Systems Architecture

Copyright © Genetic Computer School 2008

DECIMAL TO OTHER BASES

Divide the base into the quotient and keep repeating the process until there is a zero quotient. Reading off the remainder

in the reverse order of how you wrote them down gives the answer.

CSA 1- 11

Computer Systems Architecture

Copyright © Genetic Computer School 2008

EXAMPLE (1)

2 ) 132 ) 6 , remainder 12 ) 3 , remainder 02 ) 1 , remainder 1 0 , remainder 1

1310 = 11012

CSA 1- 12

Computer Systems Architecture

Copyright © Genetic Computer School 2008

EXAMPLE (2)

8 ) 2368 ) 29 remainder 48 ) 3 remainder 5

0 remainder 3

23610 = 3548

CSA 1- 13

Computer Systems Architecture

Copyright © Genetic Computer School 2008

EXAMPLE (3)

16 ) 47316 ) 29 remainder 916 ) 1 remainder D

0 remainder 1

47310 = 1D916

CSA 1- 14

Computer Systems Architecture

Copyright © Genetic Computer School 2008

Some decimal fractions cannot be represented exactly as binary fractions.

To reduce errors of this type, computers need to store such converted values to a large number of binary places.

The process involves repeatedly multiplying by 2 that part of the decimal fraction to the right of the decimal point, and writing down the whole number part of the product at each stage ( but not involving it in subsequent multiplication ). Reading the whole number parts down from the top gives the binary fraction to as many places as is necessary.

CHANGING DECIMAL FRACTION TO BINARY

CSA 1- 15

Computer Systems Architecture

Copyright © Genetic Computer School 2008

EXAMPLE (4)

CSA 1- 16

Computer Systems Architecture

Copyright © Genetic Computer School 2008

(e.g. 13.746)

Work separately on the whole and fraction parts. Then link the two answers together with a point.

TO CONVERT A MIXED DECIMAL NUMBER

CSA 1- 17

Computer Systems Architecture

Copyright © Genetic Computer School 2008

Multiple each digit with its place value

and then added together.

FROM OTHER BASES TO DECIMAL(Whole Number)

CSA 1- 18

Computer Systems Architecture

Copyright © Genetic Computer School 2008

EXAMPLE (5)

11012 = (1x8)+(1x4)+(0x2)+(1x1)

= 1310

CSA 1- 19

Computer Systems Architecture

Copyright © Genetic Computer School 2008

EXAMPLE (6)

11028 = (1x512) +(1x64) +(0x8) +(2x1)

= 57810

CSA 1- 20

Computer Systems Architecture

Copyright © Genetic Computer School 2008

EXAMPLE (7)

17F16 =(1x256) +(7x16) +(15x1)

= 38310

CSA 1- 21

Computer Systems Architecture

Copyright © Genetic Computer School 2008

1s compliment and 2s compliment used to represent positive and negative number.

Example

1s COMPLEMENT AND 2s COMPLEMENT

CSA 1- 22

Computer Systems Architecture

Copyright © Genetic Computer School 2008

Adding Binary Numbers

CSA 1- 23

Computer Systems Architecture

Copyright © Genetic Computer School 2008

Subtracting Binary NumbersUsing Twos Compliment

CSA 1- 24

Computer Systems Architecture

Copyright © Genetic Computer School 2008

CODING SYSTEMS

Three of the most popular coding systems are: ASCII (American Standard Code for Information Interchange) EBCDIC (Extended Binary Coded Decimal Interchange Code) BCD (Binary Coded Decimal)

CSA 1- 25

Computer Systems Architecture

Copyright © Genetic Computer School 2008

FLOATING POINT NUMBERS

Floating-point numbers allow a far greater range of values - integer, fractional or mixed numbers, - in a single word. Calculations in floating-point arithmetic are slower than those in fixed-length working.

CSA 1- 26

Computer Systems Architecture

Copyright © Genetic Computer School 2008

STANDARD FORM

The number 57429 in standard form is:

5.7429 X 104

where 5.7429 is the mantissa and

4 is the exponent.

CSA 1- 27

Computer Systems Architecture

Copyright © Genetic Computer School 2008

FLOATING POINT ADDITION (1)

(0.1011 x 25) + (0.1001 x 25)

= (0.1011 + 0.1001) x 25

= 1.0100 x 25

= 0.1010 x 26

CSA 1- 28

Computer Systems Architecture

Copyright © Genetic Computer School 2008

FLOATING POINT ADDITION (2)

(0.1001 x 23) + (0.1110 x 25)

= (0.001001 x 25) + 0.1001) x 25

= 1.000001 x 25

= 0.1000 x 26 (after truncation)

CSA 1- 29

Computer Systems Architecture

Copyright © Genetic Computer School 2008

FLOATING POINT MULTIPLICATION

(0.1101 x 26) x (0.1010 x 24)

= 0.1000001 x 210

= 0.1000 x 210 (after truncation)

CSA 1- 30

Computer Systems Architecture

Copyright © Genetic Computer School 2008

FLOATING POINT DIVISION

(0.1011 x 27) ÷ (0.1101 x 24)

= 0.1101 x 23