0% found this document useful (0 votes)
18 views

NUMBER SYSTEM _DIGITAL FUNDAMENTAL AND COMPUTER ARCHITECTURE

Uploaded by

s.poorni04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

NUMBER SYSTEM _DIGITAL FUNDAMENTAL AND COMPUTER ARCHITECTURE

Uploaded by

s.poorni04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 90

DIGITAL FUNDAMENTAL AND

COMPUTER ARCHITECTURE

Prepared by

Poornima S
UNIT 1 NUMBER SYSTEM
Basics of Number system. Decimal, Binary, Octal and
Hexadecimal. Binary addition, subtraction, Multiplication,
Division – Conversions-Floating point representation,
Complements: 1’s complement and 2s complement addition and
subtraction

2
NUMBER SYSTEM

 A number system of base or radix r , is a system that uses different symbols


for representing r different digits.
 It can have different base values like:
Binary (base-32)
Octal (base-8)
Decimal (base 10)
Hexadecimal (base 16)
 Here the base number represents the number of digits used in that
3
BINARY NUMBER SYSTEM

 The prefix “bi-” stands for 2


 The binary number system is a Base 2 number system.
 Each place value in a binary number is a power of 2.
 It carries only two digits, either 0 and 1.
 Each digit is known as a BIT
 A binary number consists of sequence of bits ,each of which is
either 0 or 1.
4
 A four-bits collection (1101) is known as a
NIBBLE
 Collection of eight bits (11001010) is known as a
BYTE.
 A combination of sixteen bits is known as
WORD
 A combination of thirty two bits is known as
DOUBLE WORD
 The Binary Point separates Integer and Fraction
points. 5
DECIMAL NUMBER SYSTEM

 The prefix “deci” stands for 10


 Decimal number system has only ten (10) digits from 0 to 9.
 Every number(value) is represented with 0,1,2,3,4,5,6, 7,8 and 9 in this
number system.
 The base of decimal number system is 10
 Each place value in a decimal number is a power of 10 100, 101,102,103…
etc for the integer part and 10-1,10-2,10-3……etc for fractional part.
 Representation of units tens,hundreds,thousands etc are called weights.
6
OCTAL NUMBER SYSTEM

 Octal number system has only eight (8) digits from 0 to 7.


 Every number (value) is represented with 0,1,2,3,4,5,6 and 7 in this
number system.
 The base of octal number system is 8.

7
Decimal Binary(22+21+20) Octal

0 000 0

1 001 1

2 010 2

3 011 3

4 100 4

5 101 5

6 110 6

7 111 7

8
HEXADECIMAL NUMBER SYSTEM

 A Hexadecimal number system has sixteen (16) alphanumeric


values from 0 to 9 and A to F.
 Every number (value) represents with 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B,
C, D, E and F in this number system.
 The base of hexadecimal number system is 16
 0 – 9 , A is 10, B is 11, C is 12, D is 13, E is 14,F is 15.

9
10
11
NUMBER SYSTEM CONVERSIONS
 There are many methods or techniques which can be used to
convert numbers from one base to another.

12
DECIMAL CONVERSION
 Convert decimal numbers to binary

To convert a decimal number to binary, divide the decimal number by 2


repeatedly and collect the remainders from bottom to top

LSB

MSB

13
The remainders have to be arranged in the reverse order
the first remainder becomes the Least Significant Bit (LSB)
the last remainder becomes the Most Significant Bit (MSB).

14
Floating Point Conversion

The whole number part is divided repeatedly by 2


The fractional part is Multiplied repeatedly by 2

15
 Convert decimal numbers to Octal
To convert a decimal number to octal, we have to divide the
decimal number by 8 repeatedly and collect the remainders from
bottom to top (i.e) MSD to LSD.

LSD

MSD

16
Floating Point Conversion
The whole number part is divided repeatedly by 8
The fractional part is Multiplied repeatedly by 8

17
 Convert decimal numbers to Hexadecimal
To convert a decimal number to Hexadecimal,divide the decimal
number by 16 repeatedly and collect the remainders from bottom to top (i.e)
MSD to LSD
(910)10=(38E)16
LSD
14

MSD

18
Floating Point Conversion
The whole number part is divided repeatedly by 16
The fractional part is Multiplied repeatedly by 16

19
BINARY CONVERSION
 Binary to Decimal

Formula
n = bnq + bn-1qn-2 +………+ b2q2 +b1q1 +b0q0 + b-1q-1 + b-2q-2

Where,
•n is Decimal Equivalent
•b is the Digit
•q is the Base Value

Convert (11100)2 = (?)10

Resultant Decimal number = 0+0+4+8+16 = 28 (11100)2 = (28)10


20
Convert (111)2 to Decimal.

We have (111)2 in binary


⇒ 1 ⨯ 22 + 1 ⨯ 21 + 1 ⨯ 20
=4+2+1=7

Convert (10110)2 to Decimal.

We have (10110)2 in Binary


1 ⨯ 24 + 0 ⨯ 23 + 1 ⨯ 22 + 1 ⨯ 21 + 0 ⨯ 20
= 16 + 4 + 2 = 22

21
 Binary to Octal

1.Binary to Decimal then Decimal to Octal

2.Direct Method for Binary to Octal Conversion

22
Binary to Decimal Then Decimal to Octal

(1111)2 = (______)8

1. First convert (1111)2 into its decimal

(1111)2 = 23 × 1 + 22 × 1 + 21 × 1 + 20 × 1 = (15)10

2. convert (15)10 decimal into octal by division by 8 method

(15)10 = (1111)2

(1111)2 = (17)8

23
Direct Method for Binary to Octal Conversion

1. Take the given binary number and form the group of three bits

2. Replace the group of three bits with its OCTAL equivalent.

24
Note:
 before the radix point (.)- Start forming the group from the LSB bit

 after the radix point, start forming the group of three bits from the
immediate bit after the radix point(.)

 While forming the group, number of bits is less than 3 and bit is before
the radix point, then, add 0s before the fewer bits

 While forming the group the number of bits is less than 3 and bit is after
the radix point, then, add 0s after the fewer bits.

25
Convert (111010. 1001)2 = (____)8

26
 Binary to Hexadecimal Conversion

1.Binary to Decimal then Decimal to Hexadecimal


2.Direct Method for Binary to hexadecimal Conversion

27
28
Binary to Decimal Then Decimal to Hexadecimal
(1110)2 = (_______)16

1. First convert (1110)2 into decimal

(1110)2 = 23 × 1 + 22 × 1 + 21 × 1 + 20 × 0 = 8 + 4 + 2 + 0 = (14)10

2. Then, convert (14)10 into hexadecimal

(14)10 = (E)16

29
Direct Method for Binary to Hexadecimal Conversion

1. Take the given binary number and form the group of four bits

2. Replace the group of four bits with its HEXADECIMAL equivalent.

Example

1110 1111

(1110 1111)2 = (EF)16


30
Note:
 before the radix point (.)- Start forming the group from the LSB bit

 after the radix point, start forming the group of four bits from the
immediate bit after the radix point(.)

 While forming the group, number of bits is less than 4 and bit is before
the radix point, then, add 0s before the fewer bits

 While forming the group the number of bits is less than 4 and bit is after
the radix point, then, add 0s after the fewer bits.

31
Example: (11101111.111001)2 = (EF.E4)16

32
OCTAL CONVERSION
Octal to decimal

multiply each digit by its place value


and add the products.
(125)8 = (1 × 82) + (2 × 81) + (5 × 80)
= (1 × 64) + (2 × 8) + (5 × 1)
= 64 + 16 + 5
= (85)10

33
FLOATING POINT REPRESENTATION

We multiply each digit by its place value


and add the products.
(52.17)8 = (5 × 81) + (2 × 80) + (1 × 8-1)
+ (7 × 8-2)
=
(5×8) + (2×1) + (1/8)+ 7(1/64​)
34
= 40 + 2 + 0.125​+ 0.109375​
 Octal to Binary

1. Octal to Decimal then Decimal to Binary


2.Direct Method for Octal to Binary Conversion
1. Octal to Decimal then Decimal to Binary
Convert 178 to a binary number.

I. 178 to Decimal

= (1 ×81 + 7 × 80)
= 8 +7
= (15)10
178 = 11112
35
ii. (15) to Binary
2.Direct Method for Octal to Binary Conversion

Convert 178 to a binary number.

 Write each bit of a given number in its binary form

1 7
0011112
001 111

36
 Octal to Hexadecimal

Octal to Decimal then Decimal to Hexadecimal

Convert 178 to a binary number.

I. 178 to Decimal

= (1 ×81 + 7 × 80)
= 8 +7
= (15)10

II. (15)10 to Hexadecimal

1615
0 - 15 F
37
17 F
Octal to Binary then Binary to Hexadecimal

Convert 178 to a binary number.

I. 178 to Binary

1 = > 001
7 => 111
=> 001111
II. (001111)2 to Hexadecimal

 Group into 4 bits


Þ 00001111

0 15
=> ( 15 )16
15 equivalent alphanumeric value is F =>(F) 16
38
HEXADECIMAL CONVERSION
 Hexadecimal to Decimal

Decimal Number = dn-1 × 16r-1+ dn-2 × 16r-2 . . . + d2 × 162 + d1 × 161 + d0 × 160

Where,
• n is the number of digits, and
• r is the placement of the digit (from the right side starting from r = 0), and
• d is the decimal value of the corresponding digit.

39
Convert 6CF16 to decimal.

6CF is the given hexadecimal number. In hexadecimal number system


• 6=6
• C = 12
• F = 15

6CF= (6 × 162) + (12× 161) + (15 × 160)


⇒ 6CF= (6 × 256 + 12 × 16 + 15 × 1)
⇒ 6CF= 1536 + 192 + 15
⇒ 6CF= 1743
Thus, (6CF ) 16 = (1743) 10

40
Convert 31.D216

Thus, (31.D2 ) 16 = (49.8203125) 10


41
 Hexadecimal to Binary

To convert a hexadecimal number to binary, follow these


steps:

1.Break Down the Hexadecimal Number into 4-bit


binary equivalent
2.Concatenate the Binary Equivalents

Example
1. (3A7B)16 in to decimal
3 -> 0011
A -> 1010
7 -> 0111
B -> 1011
2. Combine the binary equivalents: 0011101001111011
42
(3A7B) = (0011101001111011)
 Hexadecimal to Octal
We can convert a hexadecimal number to octal in two steps.
1-HEXADECIMAL TO BINARY
2-BINARY TO OCTAL
Example
Convert (3A)16 = (?)8

1-HEXADECIMAL TO BINARY
write 4 bit binary equivalent of each hexadecimal digit in
the same order.

43
2-BINARY TO OCTAL
Starting from the least significant bit, we partition the binary
number into groups of 3 bits and proceed to the left.

=> (3A)16 = (72)8

44
BINARY ARITMETIC OPERATIONS
• Basic arithmetic operations - addition, subtraction, multiplication, and division.

•Binary Addition

•Rules
Augend Addend sum carry
0 0 0 -
0 1 1 -
1 0 1 -
1 1 0 1

45
Add the binary numbers 11.10 and 01.11

Augend 11.10
Addend 01.11
Carry 11
11.10
+01.11
101.01

46
47
48
•Binary Subtraction

•Rules
Minuend Subtrahend Difference Borrow
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0

49
Subtract the binary numbers 01.11 from 11.10

Minuend 11.10
Subtrahend 01.11

11.10
-01.11
1.11 => Difference

50
51
52
•Binary Multiplication

•Rules

Multiplicand Multiplier Product


0 0 0
0 1 0
1 0 0
1 1 1

It involves forming partial products, shifting each successive


partial product left one place, and then adding all the partial products.

53
Multiply Binary Number 1001 with 101
Multiplicand 1001
Multiplier 101

Þ 1001 X 101
1001
1001S
101101

S -> Shift

54
55
56
•Binary Division

•Rules

57
58
Divide binary number 11010 by 101

Divisor 101
Dividend 11010

Quotient 101
Remainder 1

59
INTEGER REPRESENTATION

Integers are whole numbers or fixed-point numbers with the


radix point fixed after the least-significant bit.
Computers use a fixed number of bits to represent an integer.
The commonly-used bit-lengths for integers are 8-bit, 16-bit,
32-bit or 64-bit.
there are two representation schemes for integers:
1.Unsigned Integers: can represent zero and positive
integers.
2.Signed Integers: can represent zero, positive and negative
60
n-BIT UNSIGNED INTEGERS

unsigned integers can represent zero and positive integers,


but not negative integers.

An n-bit pattern can represent 2^n distinct integers.

An n-bit unsigned integer can represent integers


from 0 to (2^n)-1, as tabulated below:

61
SIGNED INTEGERS

signed integers can represent zero, positive integers, as well

as negative integers. Three representation schemes are

available for signed integers:

1.Sign-Magnitude representation

2.1's Complement representation

3.2's Complement representation


62
SIGN-MAGNITUDE REPRESENTATION

In sign-magnitude representation:

•Most-Significant Bit (MSB) is the sign bit, with value of 0

representing positive integer and 1 representing negative

integer.

•The remaining n-1 bits represents the magnitude (absolute

value) of the integer. The absolute value of the integer is


63
64
The drawbacks of sign-magnitude representation are:

 There are two representations (0000 0000B and 1000 0000B) for the
number zero, which could lead to inefficiency and confusion.
 Positive and negative integers need to be processed separately.
65
1'S COMPLEMENT REPRESENTATION:

 MSB is the sign bit, with value of 0 representing positive integers and 1
representing negative integers.
 The remaining n-1 bits represents the magnitude of the integer, as
follows:
 positive integers, the absolute value of the integer is equal to "the
magnitude of the (n-1)-bit binary pattern".
 negative integers, the absolute value of the integer is equal to "the
magnitude of the complement (inverse) of the (n-1)-bit binary pattern"
(hence called 1's complement). 66
67
the drawbacks are:

 There are two representations (0000 0000B and 1111 1111B) for zero.
 The positive integers and negative integers need to be processed
separately. 68
2'S COMPLEMENT REPRESENTATION

 MSB is the sign bit, with value of 0 representing positive


integers and 1 representing negative integers.
 The remaining n-1 bits represents the magnitude of the integer, as
follows:
 positive integers, the absolute value of the integer is equal to "the
magnitude of the (n-1)-bit binary pattern".
 negative integers, the absolute value of the integer is equal to "the
magnitude of the complement (inverse) of the (n-1)-bit+ 1 binary
pattern" (hence called 2's complement). 69
70
71
Computers use 2's complement in representing signed
integers. This is because:

1.There is only one representation for the number zero


in 2's complement, instead of two representations in
sign-magnitude and 1's complement.

2.Positive and negative integers can be treated


together in addition and subtraction.

3.Subtraction can be carried out using the "addition


logic".

72
73
• Because of the fixed precision (i.e., fixed number of bits), an
n-bit 2's complement signed integer has a certain range.
• For example, for n=8, the range of 2's complement signed
integers is -128 to +127.
• During addition (and subtraction), it is important to check
whether the result exceeds this range, in other words,
whether overflow or underflow has occurred.

74
75
1's complement

 The 1's complement of a number is found by changing all 1's to 0's and
all 0's to 1's.

76
2's complement

 The 2's complement of binary number is obtained by adding 1 to


the Least Significant Bit (LSB) of 1's complement of the number.

 2's complement = 1's complement + 1

77
FLOATING-POINT NUMBER REPRESENTATION
 The central processing unit (CPU) typically consists of an arithmetic
logic unit (ALU), floating point unit (FLU/FPU), registers, control unit,
and the cache memory.
 The arithmetic logic unit performs integer arithmetic operations such
as addition, subtraction, and logic operations such as AND, OR, XOR,
etc.
 Integers are whole numbers without fractional components. 1, 2, and
3 are integers, while 0.1, 2.2, and 3.0001 all have fractional
components are called floating point numbers. 78
 The floating point unit performs floating point operations.
Floating point numbers have a sign, a mantissa, and an
exponent.
 The Institute of Electrical and Electronics Engineers (IEEE)
developed a standard to represent floating point numbers,
referred to as IEEE 754.
 This standard defines a format for both single (32-bit) and
double (64-bit) precision floating point numbers.
 Decimal floating points are represented by ,
 where M is the signed mantissa and E is the exponent. 79
A floating-point number is typically expressed in the scientific notation

fraction / mantissa / significand (M) 80


 Representation of floating point number is not unique.

For example, the number 55.66 can be represented as


5.566×10^1, 0.5566×10^2, 0.05566×10^3, and so on.

The fractional part can be normalized.

In the normalized form, there is only a single non-zero digit


before the radix point.

For example, decimal number 123.4567 can be normalized


as 1.234567×10^2;

binary number 1010.1011 can be normalized as


1.0101011×2^3. 81
Floating-point numbers suffer from loss of precision when represented with
a fixed number of bits (e.g., 32-bit or 64-bit).

The IEEE 754 standard defines several different precisions.

— Single precision numbers include an 8-bit exponent field and a 23-bit


fraction, for a total of 32 bits.

— Double precision numbers have an 11-bit exponent field and a 52-bit


fraction, for a total of 64 bits.

82
Rule using 1s Complement(UNSIGNED)
Step 1: Given numbers must be in the form X-Y with same digits.
Extra 0 can be added at the beginning to make same digits.
Step 2: Calculate 1's complement of ‘Y’
Step 3: Add result of step 2 with ‘X’
Step 4: If there is extra bit, remove that extra bit and add on its
remaining bit.
If there is no extra bit, find 1's Complement of result in step
3 and add (-)ve sign. 83
Subtract (1010)2 from (1111)2 using 1’s complement method.

Step-1: Find the 1’s complement of 1010.


1’s complement will be 0101.
Step-2: add the vale calculated in step-1 to 1111. This is shown below.
Step -3 & Step-4:

84
Example: Subtract (1010)2 from (1000)2 using 1’s
complement method.

85
2’s Complement - Subtraction
Rule using 2s Complement(UNSIGNED)
Step 1: Given numbers must be in the form X-Y with same digits.
Extra 0 can be added at the beginning to make same digits.
Step 2: Calculate 2’s complement of ‘Y’
Step 3: Add result of step 2 with ‘X’
Step 4: If there is extra bit, remove that and remaining bit will be the
answer.
If there is no extra bit, find 2’s Complement of result in step 3 and
add (-)ve sign. 86
Example: Subtract (1010)2 from (1111)2 using 2’s
complement method.
Solution:
Step-1: 2’s complement of (1010)2 is (0110)2.
Step-2: Add (0110)2 to (1111)2. This is shown below.
Step -3 & Step-4:

87
Subtract (1010)2 from (1000)2 using 2’s complement.
Solution:
Step-1: Find the 2’s complement of (1010)2. It is (0110)2.
Step-2: Add (0110)2 to (1000)2.

88
Binary Addition Using Signed Two’s Complement

89
90

You might also like