Professional Documents
Culture Documents
Digital Design
Digital Design
i. Divide the decimal number by the base of the target number system that is, to convert
decimal to binary, divide the decimal number with 2 (the base of binary number system),
8 for octal and 16 for hexadecimal.
ii. Note the remainder separately as the first digit from the right. In case of hexadecimal, if
the remainder exceeds 9, convert the remainder into equivalent hexadecimal form. For
e.g., if the remainder is 10 then note the remainder as A.
iii. Continually repeat the process of dividing until the quotient is zero and keep writing the
remainders after each step of division.
iv. Finally, when no more division can occur, write down the remainders in reverse order.
Fractional Part
i. Multiply the fractional part by the value of the new base (i.e. in 45.7310 =0.73 x 2; where
2 is the new base or target base)
ii. Record the integer part if it exits, else record 0.
iii. Repeat step 1 with the result of the previous multiplication and then step 2, until the
fractional part becomes 0. In case of infinite calculations, generally 6 digits are taken.
Example:
Fractional Part
0.75 x 2 = 1.5, Integer part = 1
0.5 x 2 = 1.0, Integer part = 1
The method used for conversion of a binary, octal and hexadecimal number to
decimal number involves each digit of the binary, octal or hexadecimal number to be
multiplied by its weighted position, and then each of the weighted values are added to
get the decimal number. Example:
Binary Number 1 1 0 1 0
Weight of each bit 24 23 22 21 20
Weighted Value 24 * 1 23 * 1 22 * 0 21 * 1 20 * 0
Solved Multiplication 16 8 0 2 0
Example:
Convert 10112 to Decimal number system
1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 = 8 + 0 + 2 + 1 = 1110
Convert 3568 to Decimal number system
3 x 82 + 5 x 81 + 6 x 80 = 192 + 40 + 6 = 23810
c. Converting Between Octal and Hexadecimal
Steps of conversion
i. Convert each octal digit to 3-bit binary form
ii. Combine all the 3-bit binary numbers.
iii. Segregate the binary numbers into 4-bit binary form by starting the first number
from the right bit (LSB) towards the number on the left bit (MSB).
iv. Finally, convert these 4-bit blocks into their respective hexadecimal symbols.
Example:
Given 3568, convert to Hexadecimal number system
38 = 011
58 = 101
68 = 110
Therefore, 3568 = 0 1110 11102 = EE16
d. Arithmetic operations
i. Order of precedence of operators
If you are asked to simplify something like "4 + 2×3", the question that
naturally arises is "Which way do I do this? Because there are two options!" I
could add first:
4 + 2×3 = (4 + 2) × 3 = 6×3 = 18
4 + 2×3 = 4 + (2×3) = 4 + 6 = 10
Which answer is the right one? Arithmetic operations follow the following
order of precedence:
1. Parentheses ()
2. Exponents
3. Multiplication and Division (from left to right)
4. Addition and Subtraction (from left to right)
ii. Binary Addition and Subtraction
Binary addition is much like your normal everyday addition (decimal addition),
except that it carries on a value of 2 instead of a value of 10.
For example: in decimal addition, if you add 8 + 2 you get ten, which you write as
10; in the sum this gives a digit 0 and a carry of 1. Something similar happens in binary
addition when you add 1 and 1; the result is two (as always), but since two is written
as 10 in binary, we get, after summing 1 + 1 in binary, a digit 0 and a carry of 1.
Therefore in binary:
0+0=0 1–1=0
0+1=1 1–0=1
1+0=1 0 – 1 = 1 (borrow 1)
1 + 1 = 10 (which is 0 carry 1) 0–0=0
Examples:
Add 23 and 52 Subtract 23 from 52
1 0111 11 0100
+ 11 0100 - 1 0111
100 1011 1 1101
1 0 1 1.0 1
x 1 1 0.1
101101
000000
101101
1 0 1 1 0 1 __
1 0 0 1 0 0 1.0 0 1
a. 0 b. 01 c. 010
11/1101 11/1101 11/1101
0 0 0
1 11 11
Note:
1/11 = 0 ;since 1<11 11 11
0 00
Note:
11/11 = 1 00
0
Note:
00/11 = 0
d. 0100
11/1101
0
11
11
00
00
01
Note:
00/11 = 0
v. Octal Division
Divide 34438 and 78
Step 2: Divide
4 0 5
7/3 4 4 3
3 4 ; 48 x 78
0 4 ; 04 is less than 8, thus, quotient is 0
0 ; 08 x 78
4 3
4 3 ; 58 x 78
0
e. Represent Signed Numbers
Positive numbers (including zero) are represented as unsigned numbers without the
need to put the + sign in front of them to show that they are positive numbers. However,
when dealing with negative numbers we do use a - sign in front of the number to show
that the number is negative in value and different from a positive unsigned value, and the
same is true with signed binary numbers.
However, in digital circuits there is no provision made to put a plus or even a minus
sign to a number, since digital systems operate with binary numbers that are represented
in terms of “0’s” and “1’s”.
It is important to note that floating-point numbers suffer from loss of precision when
represented with a fixed number of bits (e.g., 32-bit or 64-bit). This is because there
are infinite number of real numbers (even within a small range of says 0.0 to 0.1). On
the other hand, a n-bit binary pattern can represent a finite 2^n distinct numbers.
Hence, not all the real numbers can be represented. The nearest approximation will
be used instead, resulted in loss of accuracy.
It is also important to note that floating number arithmetic is very much less efficient
than integer arithmetic. It could be speed up with a so-called dedicated floating-point
co-processor. Hence, use integers if your application does not require floating-point
numbers.
The most significant bit is the sign bit (S), with 0 for positive numbers and 1 for
negative numbers.
The following 8 bits represent exponent (E).
The remaining 23 bits represents fraction (F).
Normalized Form
Suppose that the 32-bit pattern is 1 1000 0001 011 0000 0000 0000 0000 0000, with:
The sign bit represents the sign of the number, with S=0 for positive and S=1 for
negative number.
Step 5: Sign
In this example with S=1, this is a negative number, thus, -1.37510.
Example 1: Given -5.510, show its single precision floating point data representation
Step 1: Convert decimal in its binary representation (use remainder method and etc.)
5.510 = 101.1
Example 2: Given 52.72510, show its single precision floating point data
representation