Module1 Notes - Number Systems

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

IT 201 Digital System Design

IT 201 Digital System Design

Introduction

The term digital, is derived from the way computers perform operations, by counting digits.
Today, digital technology is applied in a wide range of areas in addition to computers. Such
applications as television, communications systems, radar, navigation and guidance systems,
military systems, medical instrumentation, industrial process control, and consumer electronics
use digital techniques.

Electronic circuits can be divided into two broad categories, digital and analog. Digital
electronics involves quantities with discrete values, and analog electronics involves quantities
with continuous values.

Digital electronics involves circuits and systems in which there are only two possible states.
These states are represented by two different voltage levels: A HIGH and a LOW. The two-state
number system is called binary, and its two digits are 0 and 1. A binary digit is called a bit.

Module 1
Number Systems:

A number system is a collection of various symbols which are called digits. Different types
of Number Systems are there:

1. Decimal Number System.


The decimal number system is a positional notation numbering system. The decimal number
system has ten digits . In the decimal number system each of the ten digits, 0 through 9,
represents a certain quantity. Each digit is multiplied by an appropriate power of 10 depending
on its position in the number:

For example:
843 = 8 x 10 2 + 4 x 101 + 3 x 100
= 8 x 100 + 4 x 10 + 3 x 1
= 800 + 40 + 3
Faculty: Asst. Prof. Rani Augustine IT Department, TIST
IT 201 Digital System Design

For whole numbers, the rightmost digit position is the one’s position (10 0 = 1). The
numeral in that position indicates how many ones are present in the number. The next
position to the left is ten’s, then hundred’s, thousand’s, and so on. Each digit position has
a weight that is ten times the weight of the position to its right.

In the decimal number system, there are ten possible values that can appear in each
digit position, and so there are ten numerals required to represent the quantity in each
digit position. The decimal numerals are the familiar zero through nine (0, 1, 2, 3, 4, 5,
6, 7, 8, 9).

In a positional notation system, the number base is called the radix. Thus, the base ten
system that we normally use has a radix of 10. The term radix and base can be used
interchangeably. When writing numbers in a radix other than ten, or where the radix
isn’t clear from the context, it is customary to specify the radix using a subscript.

2. Binary Numbers

The binary number system is also a positional notation numbering system, but in this
case, the base is two. Each digit position in a binary number represents a power of two.
So, when we write a binary number, each binary digit is multiplied by an appropriate
power of 2 based on the position in the number:

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

The Weighting Structure of Binary Numbers

For example:
101101 = 1 x 2 5 + 0 x 2 4 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
= 1 x 32 + 0 x 16 + 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1
= 32 + 8 + 4 + 1
= 45

In the binary number system, there are only two possible values that can appear in each
digit position rather than the ten that can appear in a decimal number. Only the numerals
0 and 1 are used in binary numbers. The term ‘bit’ is a contraction of the words ‘binary’
and ‘digit’, and when talking about binary numbers the terms bit and digit can be used
interchangeably. When talking about binary numbers, it is often necessary to talk of the
number of bits used to store or represent the number. This merely describes the number
of binary digits that would be required to write the number. The number in the above
example is a 6 bit number.

The following are some additional examples of binary numbers:


1011012 112 10110 2

Conversion between Decimal and Binary


Converting a number from binary to decimal is quite easy. All that is required is to
find the decimal value of each binary digit position containing a 1 and add them
up.
For example: convert 101102 to decimal.

10110
\ ______________1 x 21 = 2
\________________1 x 22 = 4
\___________________1 x 24 = 16
22
Another convert 110112 to
example: decimal
11011
\ __________1 x 20 = 1
\___________1 x 21 = 2
\______________1 x 23 = 8
\_______________1 x 24 = 16
27
The method for converting a decimal number to binary is one that can be used to convert
from decimal to any number base. It involves using successive division by the radix until
Faculty: Asst. Prof. Rani Augustine IT Department, TIST
IT 201 Digital System Design
the dividend reaches 0. At each division, the remainder provides a digit of the converted
number, starting with the least significant digit.

convert 3710 to
An example of the process: binary
37 / 2 = 18 remainder 1 (least significant digit)
18 / 2 = 9 remainder 0
9/ 2 = 4 remainder 1
4/ 2 = 2 remainder 0
2/ 2 = 1 remainder 0
1/ 2 = 0 remainder 1 (most significant digit)
The resulting binary number is: 100101

convert 9310 to
Another example: binary
93 / 2 = 46 remainder 1 (least significant digit)
46 / 2 = 23 remainder 0
23 / 2 = 11 remainder 1
11 / 2 =5 remainder 1
5 /2 =2 remainder 1
2 /2 =1 remainder 0
1 /2 =0 remainder 1 (most significant digit)

The resulting binary number is: 1011101

Exercises
1. Convert the following binary numbers to decimal

a. 1001012 = ----10:
2
Exponents 2 5 24 23 22 21 0

Place Values 32 16 8 4 2 1
Bits 1 0 0 1 0 1
Value 32 + 4 + 1 = 37
Ans= 3710

b. 1111010002 = ____10:
2
Exponents 28 27 26 25 2 4 2 3 22 21 0

Place Values 256 128 64 32 16 8 4 2 1


Bits 1 1 1 1 0 1 0 0 0
Value 256 + 128 + 64 + 32 + 8 = 488

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

Ans: 48810
c. 100011102 = 14210:

d. 101101012 = 18110:
Exponents 27 26 25 2 4 2 3 22 21 1
Place Values 128 64 32 16 8 4 2 1
Bits 1 0 1 1 0 1 0 1
Value 128 + 32 + 16 + 4 + 1 = 181
2. Convert the decimal numbers to their binary equivalents:

(a) 256

Solution:

256

Since the given number 256 appears in the first row, we put 1 in the slot below 256 and fill all
the other slots to the right of this slot with zeros.

Thus, 25610 = 100000000 2

(b) 77

Solution:

77

The given number is less than 128 but greater than 64. We therefore put 1 in the slot
corresponding to 64 in the first row. Next, we subtract 64 from 77 and get 13 as remainder.

This remainder is less than 16 and greater than 8. So we put 1 in the slot corresponding to 8 and
subtract 8 from 13. This gives 13 - 8 = 5. This remainder is greater than 4 and less than 8.

Hence we put 1 in the slot corresponding to 4 and subtracting 4 from 5 we get 1. Now, 1 is
present in the right hand most slot of the first row. We, therefore, put 1 in the corresponding slot
and fill all other slots with zeros.

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design
Thus, 7710 = 10011012.
2. Convert 0.675 10 to its binary equivalent.

Solution:

Subtract .5 from the given number to get .675 - .5 = .175 and place 1 in the slot corresponding to
.5 of the first row.

Now the number .175 is less than .25 and greater than .125. So, we put 1 in the slot
corresponding to the number .125 of the first row and subtract .125 from .175 to get .175 - .125 =
.05. The remainder .05 is less than .0625 but greater than .03125.

Hence we put 1 in the slot corresponding to 0.3125 and the subtraction given .05 - .03125 =
.01875 and continue the process. The other slots are then filled with zeros.

Thus, .675 10 = (.10101…)2


3.. Convert 421510 to its binary equivalent

Solution:

Therefore, 421510 =1000001110111 2

Convert the following decimal numbers to their binary equivalents:

(a) 0.375

Solution:
Faculty: Asst. Prof. Rani Augustine IT Department, TIST
IT 201 Digital System Design

Decimal Numbers to Binary Number Conversion Table


Multiplication Integer Fraction
0.375 × 2 = 0.75 0 .75
0.75 × 2 = 1.5 1 .5
.5 × 2 = 1.0 1 0

Therefore, 0.375 10 = 0.0112


b) 0.435

Solution:

Decimal Numbers to Binary Number Conversion Table


Multiplication Integer Fraction
0.435 × 2 = 0.87 0 .87
0.87 × 2 = 1.74 1 .74
.74 × 2 = 1.48 1 .48
.48 × 2 = 0.96 0 .96
.96 × 2 = 1.92 1 .92

Therefore, 0.435 10 = (0.01101…)2

Fox mixed number, we will have to separate the number into its integral and fractional parts and
find the binary equivalent of each part independently.

Finally, we add the two parts to get the binary equivalent of the given number.

3. Convert (56.75)10 to its binary equivalent.

Solution:

At first we find the binary equivalent of 56.

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

Therefore, 5610 = 1110002

The binary equivalent of 0.75 is obtained below:

Decimal Numbers to Binary Number Conversion Table

Multiplication Integer Fraction

0.75 × 2 = 1.5 1 .5

0.5 × 2 = 1.0 1 0

Therefore, 0.7510 = 0.112

Hence 56.7510 = 111000.112

3. Hexadecimal Numbers
In addition to binary, another number base that is commonly used in digital systems is
base 16. This number system is called hexadecimal, and each digit position represents a
power of 16. For any number base greater than ten, a problem occurs because there are
more than ten symbols needed to represent the numerals for that number base. It is
customary in these cases to use the ten decimal numerals followed by the letters of the
alphabet beginning with A to provide the needed numerals. Since the hexadecimal
system is base 16, there are sixteen numerals required. The following are the
hexadecimal numerals:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

The following are some examples of hexadecimal numbers:


1016 4716 3FA16 A03F16
Faculty: Asst. Prof. Rani Augustine IT Department, TIST
IT 201 Digital System Design

The reason for the common use of hexadecimal numbers is the relationship between the
numbers 2 and 16. Sixteen is a power of 2 (16 = 2 4). Because of this relationship, four
digits in a binary number can be represented with a single hexadecimal digit. This makes
conversion between binary and hexadecimal numbers very easy, and hexadecimal can be
used to write large binary numbers with much fewer digits. When working with large
digital systems, such as computers, it is common to find binary numbers with 8, 16 and
even 32 digits. Writing a 16 or 32 bit binary number would be quite tedious and error
prone. By using hexadecimal, the numbers can be written with fewer digits.

Conversion between Hexadecimal and Binary

To convert a binary number to hexadecimal, divide it into groups of four digits starting
with the rightmost digit. If the number of digits isn’t a multiple of 4, prefix the number
with 0’s so that each group contains 4 digits. For each four digit group, convert the 4 bit
binary number into an equivalent hexadecimal digit. (See the Binary, BCD, and
Hexadecimal Number Tables at the end of this document for the correspondence between
4 bit binary patterns and hexadecimal digits)

For example: Convert the binary number 10110101 to a hexadecimal number

Divide into groups for 4 digits 1011 0101


Convert each group to hex digit B 5
B516
Another example: Convert the binary number 0110101110001100 to hexadecimal

Divide into groups of 4 digits 0110 1011 1000 1100


Convert each group to hex digit 6 B 8 C
6B8C16
To convert a hexadecimal number to a binary number, convert each hexadecimal
digit into a group of 4 binary digits.

Example: Convert the hex number 374F into binary

3 7 4 F
Convert the hex digits to binary 0011 0111 0100 1111
00110111010011112
There are several ways in common use to specify that a given number is in hexadecimal
representation rather than some other radix. In most programming languages, this method
isn’t really feasible, so there are several conventions used depending on the language. In
the C and C++ languages, hexadecimal constants are represented with a ‘0x’ preceding
the number, as in: 0x317F, or 0x1234, or 0xAF. The letter ‘h’ is then suffixed onto the
number to inform the assembler that it is a hexadecimal constant. In Intel style assembler
format: 371Fh and 0FABCh are valid hexadecimal constants.

4. OCTAL NUMBERS

Like the hexadecimal number system, the octal number system provides a convenient way to
express binary numbers and codes. The octal number system is composed of eight digits, which
are 0, 1, 2, 3, 4, 5, 6, 7
To count above 7, begin another column and start over:

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design
10, 11, 12, 13, 14, 15, 16, 17, 20, 21, . . .
Counting in octal is similar to counting in decimal, except that the digits 8 and 9 are not used. To
distinguish octal numbers from decimal numbers or hexadecimal numbers, we will use the
subscript 8 to indicate an octal number. For instance, 158 in octal is equivalent to 13 in decimal
and D in hexadecimal.

Octal-to-Decimal Conversion
Since the octal number system has a base of eight, each successive digit position is an increasing
power of eight, beginning in the right-most column with 8°. The evaluation of an octal number in
terms of its decimal equivalent is accomplished by multiplying each digit by its weight and
summing the products, as illustrated here for 2374 8.

Decimal-to-Octal Conversion
A method of converting a decimal number to an octal number is the repeated division-by- 8
method, which is similar to the method used in the conversion of decimal numbers to binary
or to hexadecimal. To show how it works, let's convert the decimal number 359 to octal. Each
successive division by 8 yields a remainder that becomes a digit in the equivalent octal number.
The first remainder generated is the least significant digit (LSD).

Octal-to-Binary Conversion
Because each octal digit can be represented by a 3-bit binary number, it is very easy to convert
from octal to binary. Each octal digit is represented by three bits as shown in Table

To convert an octal number to a binary number, simply replace each octal digit with the
appropriate three bits.

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

Binary-to-Octal Conversion
Conversion of a binary number to an octal number is the reverse of the octal-to-binary
conversion. The procedure is as follows: Start with the right-most group of three bits and,
moving from right to left, convert each 3-bit group to the equivalent octal digit. If there are not
three bits available for the left-most group, add either one or two zeros to make a complete
group. These leading zeros do not affect the value of the binary number.

Conversion of binary numbers to octal or hexa-decimal numbers and vice


versa:

Conversion Table
Decimal Binary Octal 3-bit String Hexa-decimal 4-bit String

0 0 0 000 0 0000

1 1 1 001 1 0001

2 10 2 010 2 0010

3 11 3 011 3 0011

4 100 4 100 4 0100

5 101 5 101 5 0101

6 110 6 110 6 0110

7 111 7 111 7 0111

8 1000 10 - 8 1000

9 1001 11 - 9 1001

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

10 1010 12 - A 1010

11 1011 13 - B 1011

12 1100 14 - C 1100

13 1101 15 - D 1101

14 1110 16 - E 1110

15 1111 17 - F 1111

1. Convert the following to octal numbers:

(a) 11101011102

Solution:

001110101110

= 001 110 101 110

= 16568

Hence the required octal equivalent is 1656.

(b) 111101.011012

Solution:

111101.0110102

= 75.328

Hence the required octal equivalent is 75.32.

2. Convert the following to their binary equivalents:

(a) 15738

Solution:

15738

= 001 101 111 011

= 11011110112

Hence the required binary number is 1101111011.

(b) 64.1758

Solution:

64.1758

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

= 110 100 . 001 111 101

= 110100.0011111012

Hence the required binary number is 110100.001111101.


3. Convert the following to hexa-decimal numbers:

(a) 11111011012

Solution:

001111101101

= 0011 1110 1101

= 3ED16

Therefore, 11 1110 11012 = 3ED16

(b) 11110.010112

Solution:

11110.010112

= 0001 1110 . 0101 1000

= 1E.5816

Therefore, 11110.010112 = 1E.5816

4. Convert the following to binary equivalents:

(a) A74816

Solution:

A74816

= 1010 0111 0100 1000

= 10100111010010002

Hence the required binary equivalent is 1010011101001000.

(b) BA2.23C16

Solution:

BA2.23C16

= 1011 1010 0010 . 0010 0011 11002

= 101110100010.0010001111

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design
Hence the required binary equivalent is 101110100010 . 0010001111.

5. Convert 15738 to hexa-decimal

Solution:

15738

= 001101111011

= 0011 0111 1011 37B16

Hence 15738 = 37B16

6. Convert A74816 to octal equivalents.

Solution:

A74816

= 1010 0111 0100 1000

= 001 010 011 101 001 000

= 1235108

Therefore, A74816 = 1235108

7. Convert the following to decimal numbers:

(a) 7258

Solution:

7258 = 111010101

= 256 + 128 + 64 + 16 + 4 + 1

= 46910

Therefore, 7258 = 46910

(b) D9F16

Solution:

D9F16

= 1101 1001 1111

= 110110011111

= 2048 + 1024 + 256 + 128 + 16 + 8 + 4 + 2 + 1

= 348710

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

BINARY ARITHMETIC
Binary addition
Binary addition is performed in the same manner as decimal addition.

The rules of binary addition are as follows:

0+0=0

0+1=1

1+0=1

1 + 1 = 0 with a carry-over of 1

Find the sum of the following


numbers:

i) 10101 and 11011

Solution:

10101 and 11011

1111 Carry overs

10101

11011

110000

ii) 11001 and 111

Solution:

11001 and 111

1111 Carry overs

11001

111

100000

iii) 10101.101 and 1101.011


Faculty: Asst. Prof. Rani Augustine IT Department, TIST
IT 201 Digital System Design

Solution:

10101.101 and 1101.011

11 11 11 Carry overs

10101.101

1101.011

100011.000

iv) 111.0111 and 10011.001

Solution:

111.0111 and 10011.001

111 11 Carry overs

111.0111

10011.001

11010.1001
Binary subtraction
The rules of binary subtraction are as
follows:

0-0=0

1-0=1

1-1=0

0 - 1 = 1 with a borrow of 1

Subtract the following numbers:

i) 101 from 1001


Solution:
101 from 1001

1 Borrow

1001

101

100

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

ii) 111 from 1000

Solution:

111 from 1000

1 Borrow

1000

111

0001

iii) 1010101.10 from 1111011.11

Solution:

1010101.10 from 1111011.11

1 Borrow

1111011.11

1010101.10

100110.01

iv) 11010.101 from 101100.011

Solution:

11010.101 from 101100.011

1 1 1 Borrow

101100.011

11010.101

10001.110

Binary Multiplication

The rules of binary multiplication are given by the following table:

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

× 1 0
1 1 0
0 0 0

Multiply:

(i) 10111 by 1101

10111

1101

10111 ← First partial product

10111

1110011 ← First intermediate sum

10111

100101011 ← Final sum.

Hence the required product is 100101011.

(ii) 11011.101 by 101.111

11011.101

101.111

11011.101

110111.01 ← First partial product

1010010 111 ← First intermediate sum

1101110 1

11000001 011 ← Second intermediate sum

11011101

110011110 011 ← Third intermediate sum

11011101

10100010010 011

Hence the required result is 10100010.010011

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

Binary Division

Evaluate:

(i) 11001 ÷ 101

Solution:

101) 11001 (101


101
101
101

Hence the quotient is 101

(ii) 11101.01 ÷ 1100

Solution:

1100) 11101.01 (10.0111


1100
10101
1100
0010
1100
1100
1100

Hence the quotient is 10.0111

(iii) 10110.1 ÷ 1101

Solution:

1101) 10110.1 (1.101


1101
10011
1101
11000
1101
1011

Thus the quotient is 1.101 upto 3 places of binary point and the remainder is
1.011.

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

(iv) 101.11 ÷ 111

Solution:

111) 101.11 (0.11


11 1
10 01
1 11
10

Thus the quotient is 0.11 upto 2 places of binary point and the remainder is
0.1.

1s AND 2' S COMPLEMENTS OF BINARY NUMBERS (Used for representing negative


numbers)- Important University Question.

? Compare 1’s and 2’s complement methods of representations[KTU April 2018- 4 marks]

The 1’s complement and the 2’s complement of a binary number are important because they
permit the representation of negative numbers. The method of 2’s complement arithmetic is
commonly used in computers to handle negative numbers.

Finding the 1's Complement

The 1’s complement of a binary number is found by changing all 1s to 0s and all 0s to 1s as
shown below:

Finding the 2’s Complement


The 2’s complement of a binary number is found by adding 1 to the LSB of the 1’s complement.
2’s complement = ( l ’s complement) + 1
Find the 2’s complement of 10110010.
Solution : 10110010 Binary number
01001101 l ’s complement
Faculty: Asst. Prof. Rani Augustine IT Department, TIST
IT 201 Digital System Design
Add 1
01001110 - 2's complement
? Determine the 2’s complement of 11001011.
Ans: 00110101

An alternative method of finding the 2’s complement of a binary number is as follows


1. Start at the right with the LSB and write the bits as they are up to and including
the first 1.
2. Take the 1’s complements of the remaining bits.

1. Determine the 1’s complement of each binary number:

(a) 00011010 ( b ) 11110111 (c) 10001101

2. Determine the 2' s complement of each binary number:

(a) 00010110 (b) 11111100 (c) 10010001

SIGNED NUMBERS

Explain how to represent negative numbers in digital system? [KTU- Jan 2018]

Digital systems, such as the computer, must be able to handle both positive and negative
numbers. A signed binary number consists of both sign and magnitude information. The
sign indicates whether a number is positive or negative, and the magnitude is the value
of the number. There are three forms in which signed integer (whole) numbers can be
represented in binary: sign-magnitude, l’s complement, and 2’s complement.

The Sign Bit


The left-most bit in a signed binary number is the sign bit, which tells you whether the number
is positive or negative.
A 0 sign bit indicates a positive number, and a 1 sign bit indicates a negative number
Sign-Magnitude Form
When a signed binary number is represented in sign-magnitude, the left-most bit is the
sign bit and the remaining bits are the magnitude bits.
For example, the decimal number +25 is expressed as an 8-bit signed binary number using the
sign-magnitude form as

The decimal number -25 is expressed as


10011001
Notice that the only difference between +25 and — 25 is the sign bit because the magnitude
bits are in true binary for both positive and negative numbers.
Faculty: Asst. Prof. Rani Augustine IT Department, TIST
IT 201 Digital System Design
In the sign-magnitude form, a negative number has the same magnitude bits as
the corresponding positive number but the sign bit is a 1 rather than a zero.
1’s Complement Form
Positive numbers in 1’s complement form are represented the same way as the positive sign
magnitude numbers. Negative numbers, however, are the l ’s complements of the corresponding
positive numbers. For example, using eight bits, the decimal number -25 is expressed as the 1 ’s
complement of +25 (00011001) as 11100110
In the l’s complement form, a negative number is the l’s complement of the
corresponding positive number.
2's Complement Form
Positive numbers in 2’s complement form are represented the same way as in the sign magnitude
and l’s complement forms. Negative numbers are the 2’s complements of the corresponding
positive numbers. Again, using eight bits, let’s take decimal number -25 and express it as the 2’s
complement of +25 (00011001).
11100111
In the 2’s complement form, a negative number is the 2’s complement of the
corresponding positive number.

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

Floating-Point Numbers

To represent very large integer (whole) numbers, many bits are required. There is also a
problem when numbers with both integer and fractional parts, such as 23.5618, need to be
represented. The floating-point number system, based on scientific notation, is capable of
representing very large and very small numbers without an increase in the number of bits
and also for representing numbers that have both integer and fractional components.
A floating-point number (also known as a real number) consists of two parts plus a
sign. The mantissa is the part of a floating-point number that represents the magnitude of the
number. The exponent is the part of a floating-point number that represents the number
of places that the decimal point (or binary point) is to be moved.
Let’s consider a decimal number which, in integer form, is 241,506,800. The mantissa is
.2415068 and the exponent is 9. When the integer is expressed as a floating point number, it is
normalized by moving the decimal point to the left of all the digits so that the mantissa is a
fractional number and the exponent is the power of ten. The floating point number is written as
0.2415068 x 109
Single-Precision Floating-Point Binary Numbers In the standard format for a single precision
binary number, the sign bit (S) is the left-most bit, the exponent (E) includes the next eight bits,
and the mantissa or fractional part (F) includes the remaining 23 bits

To illustrate how a binary number is expressed in floating-point format, let’s use


1011010010001 as an example. First, it can be expressed as 1 plus a fractional binary number
by moving the binary point 12 places to the left and then multiplying by the appropriate
power of two.
Faculty: Asst. Prof. Rani Augustine IT Department, TIST
IT 201 Digital System Design
1011010010001 = 1.011010010001 x 212

ARITHMETIC OPERATIONS WITH SIGNED NUMBERS


Addition
The two numbers in an addition are the addend and the augend. The result is the sum.
There are four cases that can occur when two signed binary numbers are added.
1. Both numbers positive
2. Positive number with magnitude larger than negative number
3. Negative number with magnitude larger than positive number
4. Both numbers negative

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

To subtract two signed numbers, take the 2’s complement of the subtrahend and
add. Discard any final carry bit.

Multiplication
The numbers in a multiplication are the multiplicand, the multiplier, and the product.
These are illustrated in the following decimal multiplication:

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

Division

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design
The numbers in a division are the dividend, the divisor, and the quotient. These are illustrated
in the following standard division format.
The division operation in computers is accomplished using subtraction. Since subtraction
is done with an adder, division can also be accomplished with an adder.

BINARY CODED DECIMAL (BCD)

Binary coded decimal (BCD) is a way to express each of the decimal digits with a binary code.
There are only ten code groups in the BCD system, so it is very easy to convert between decimal
and BCD. Because we like to read and write in decimal, the BCD code provides an excellent
interface to binary systems.

For example: The decimal number 136 would be represented in BCD as follows:

136 = 0001 0011 0110


1 3 6

Conversion of numbers between decimal and BCD is quite simple. To convert from
decimal to BCD, simply write down the four bit binary pattern for each decimal digit. To
convert from BCD to decimal, divide the number into groups of 4 bits and write down the
corresponding decimal digit for each 4 bit group.

There are a couple of variations on the BCD representation, namely packed and
unpacked. An unpacked BCD number has only a single decimal digit stored in each data
byte. In this case, the decimal digit will be in the low four bits and the upper 4 bits of the
byte will be 0. In the packed BCD representation, two decimal digits are placed in each
byte. Generally, the high order bits of the data byte contain the more significant decimal
digit.

An example: The following is a 16 bit number encoded in packed BCD format:


01010110 10010011
This is converted to a decimal number as follows:
0101 0110 1001 0011
5 6 9 3
The value is 5693 decimal

Another example: The same number in unpacked BCD (requires 32 bits)


00000101 00000110 00001001 00000011
5 6 9 3

The use of BCD to represent numbers isn’t as common as binary in most computer
systems, as it is not as space efficient. In packed BCD, only 10 of the 16 possible bit
patterns in each 4 bit unit are used. In unpacked BCD, only 10 of the 256 possible bit
patterns in each byte are used. A 16 bit quantity can represent the range 0-65535 in
binary, 0-9999 in packed BCD and only 0-99 in unpacked BCD.

The 8421 Code

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design
The 8421 code is a type of BCD (binary coded decimal) code. Binary coded decimal
decimal digit. means that each decimal digit, 0 through 9, is represented by a binary code of four
bits.The designation 8421 indicates the binary weights of the four bits (23, 22, 21, 2°). The ease
of conversion between 8421 code numbers and the familiar decimal numbers is the main
advantage of this code. All you have to remember are the ten binary combinations that represent
the ten decimal digits as shown in Table

It is equally easy to determine a decimal number from a BCD number. Start at the rightmost
bit and break the code into groups of four bits. Then write the decimal digit represented
by each 4-bit group.

BCD Addition
BCD is a numerical code and can be used in arithmetic operations. Addition is the most
important operation because the other three operations (subtraction, multiplication, and
division) can be accomplished by the use of addition. Here is how to add two BCD
numbers:
Step 1. Add the two BCD numbers, using the rules for binary addition
Step 2. If a 4-bit sum is equal to or less than 9, it is a valid BCD number.
Step 3. If a 4-bit sum is greater than 9, or if a carry out of the 4-bit group is generated,
it is an invalid result. Add 6 (0110) to the 4-bit sum in order to skip the six invalidstates and
return the code to 8421. If a carry results when 6 is added, simply add the carry to the next 4-bit
group

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

DIGITAL CODES

The Gray Code


The Gray code is unweighted and is not an arithmetic code; that is, there are no specific weights
assigned to the bit positions. The important feature of the Gray code is that it exhibits only a
ingle bit change from one code word to the next in sequence.

Binary-to-Gray Code Conversion


Conversion between binary code and Gray code is
sometimes useful. The following rules explain how to convert from a binary number to a
Gray code word:
1. The most significant bit (left-most) in the Gray code is the same as the corresponding MSB in
the binary number.
2. Going from left to right, add each adjacent pair of binary code bits to get the next
Gray code bit. Discard carries.

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design

ASCII Character Encoding


The name ASCII is an acronym for: American Standard Code for Information
Interchange. It is a character encoding standard developed several decades ago to provide
a standard way for digital machines to encode characters. The ASCII code provides a
mechanism for encoding alphabetic characters, numeric digits, and punctuation marks for
use in representing text and numbers written using the Roman alphabet. As originally
designed, it was a seven bit code. The seven bits allow the representation of 128 unique
characters. All of the alphabet, numeric digits and standard English punctuation marks
are encoded. The ASCII standard was later extended to an eight bit code (which allows
256 unique code patterns) and various additional symbols were added, including
characters with diacritical marks (such as accents) used in European languages, which

Faculty: Asst. Prof. Rani Augustine IT Department, TIST


IT 201 Digital System Design
don’t appear in English. There are also numerous non-standard extensions to ASCII
giving different encoding for the upper 128 character codes than the standard. For
example, The character set encoded into the display card for the original IBM PC had a
non-standard encoding for the upper character set. This is a non-standard extension that is
in very wide spread use, and could be considered a standard in itself.

Some important things to note about ASCII code:


1) The numeric digits, 0-9, are encoded in sequence starting at 30h
2) The upper case alphabetic characters are sequential beginning at 41h
3) The lower case alphabetic characters are sequential beginning at 61h
4) The first 32 characters (codes 0-1Fh) and 7Fh are control characters. They do not
have a standard symbol (glyph) associated with them. They are used for carriage
control, and protocol purposes. They include 0Dh (CR or carriage return), 0Ah
(LF or line feed), 0Ch (FF or form feed), 08h (BS or backspace).
5) Most keyboards generate the control characters by holding down a control key
(CTRL) and simultaneously pressing an alphabetic character key. The control
code will have the same value as the lower five bits of the alphabetic key pressed.
So, for example, the control character 0Dh is carriage return. It can be generated
by pressing CTRL-M. To get the full 32 control characters a few at the upper end
of the range are generated by pressing CTRL and a punctuation key in
combination. For example, the ESC (escape) character is generated by pressing
CTRL-[ (left square bracket).

EBCDIC

Extended Binary Coded Decimal Interchange Code (EBCDIC) is an 8-bit character


encoding used on IBM mainframe and minicomputer operating systems. It originated with
punched cards and the corresponding six-bit encoding that most IBM peripherals used in the late
1950s and early 1960s. The first nibble (four bits) is called the zone and represents the category
of the character, while the last nibble is called the digit and identifies the specific character.

All IBM mainframe peripherals and operating systems still support EBCDIC, although the
operating systems also provide ASCII and Unicode modes to allow translation between different
encodings (EBCDIC and ASCII-based code pages are incompatible with each other). EBCDIC is
used in modern mainframes only to provide backwards compatibility, and has no specific
advantage over ASCII or Unicode. A number of different versions of EBCDIC are used in
different countries. Some East Asian countries use an extended 16-bit version to allow the
display of Chinese, Japanese and Korean characters.

Hexadecimal Digits
0 ...................... 0 0000
1 ...................... 1 0001
Faculty: Asst. Prof. Rani Augustine IT Department, TIST
IT 201 Digital System Design
2 ...................... 2 0010
3 ...................... 3 0011
4 ...................... 4 0100
5 ...................... 5 0101
6 ...................... 6 0110
7 ...................... 7 0111
8 ...................... 8 1000
9 ...................... 9 1001
10 ..................... A 1010
11 ..................... B 1011
12 ..................... C 1100
13 ..................... D 1101
14 ..................... E 1110
15 ...................... F 1111
BCD Digits
0 ................ 0000
1 ................ 0001
2 ................ 0010
3 ................ 0011
4 ................ 0100
5 ................ 0101
6 ................ 0110
7 ................ 0111
8 ................ 1000
9 ................ 1001

Faculty: Asst. Prof. Rani Augustine IT Department, TIST

You might also like