Number System
Number System
COURSE OUTLINE:
1. Number systems and codes
Binary, octal and hexadecimal number systems
Conversion from one number system to the other
Binary codes: BCD, gray, excess – 3, 8:4:2:1; 2:4:2:1 etc
Alpha numeric code: ASCII
2. Combinational logic
Logic gates
Boolean algebra
Simplification of Boolean functions
Applications of combinational logic
3. Sequential logic
Flip flops
Counters
Registers
Processor (or)
Control Unit Arithmetic unit
Storage (or)
Memory Unit
Input Output
P a g e 1 | 31 Devices and Devices and Lecturer: Mr. Azinwi Boris
Control Control
Lecture Notes in Digital Electronics Module 1 part One
The memory unit stores programs as well as input, output and intermediate data. The processor unit
performs arithmetic and other data processing tasks as specified by the program.The control unit
supervises the flow of information between various units. The program and data prepared by the user
are transferred into the memory unit by means of an input device such as punch card reader (or) tele
typewriter. An output device, such as printer, receives the result of the computations and the printed
results are presented to the user.
1.2 Number Representation:
It can have different base values like: binary (base-2), octal (base-8), decimal (base 10) and
hexadecimal (base 16),here the base number represents the number of digits used in that numbering
system. As an example, in decimal numbering system the digits used are: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
Therefore the digits for binary are: 0 and 1, the digits for octal are: 0, 1, 2, 3, 4, 5, 6 and 7. For the
hexadecimal numbering system, base 16, the digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
2. Binary numbers
Numbers that contain only two digit 0 and 1 are called Binary Numbers. Each 0 or 1 is called a Bit,
from binary digit. A binary number of 4 bits is called a Nibble. A binary number of 8 bits is called a
Byte. A binary number of 16 bits is called a Word on some systems, on others a 32-bit number is called
a Word while a 16-bit number is called a Halfword.
Using 2 bit 0 and 1 to form
a binary number of 1 bit, numbers are 0 and 1
a binary number of 2 bit, numbers are 00, 01, 10, 11
a binary number of 3 bit, such numbers are 000, 001, 010, 011, 100, 101, 110, 111
a binary number of 4 bit, such numbers are 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000,
1001, 1010, 1011, 1100,1101,1110,1111
Therefore , using n bits there are 2n binary numbers of n bits
Each digit in a binary number has a value or weight. The LSB has a value of 1. The second from the right
has a value of 2, the next 4 , etc.,
16 8 4 2 1
24 23 22 21 20
The binary equivalent for some decimal numbers are given below.
Decimal 0 1 2 3 4 5 6 7 8 9 10 11
( 1010111)2
MSB
( 1110)2
1st Multiplication Iteration
Multiply 0.625 by 2
0.625 x 2 = 1.25(Product) Fractional part=0.25 Carry=1 (MSB)
(410)8
The octal number of (264)10 is (410)8
1 MSB
LSB (151)
MSB
LSB ( 0.4554)
The octal number of (105.589)10 is (151.4554)8
(1693)10 (69D)16
Convert (1693.0628)10 decimal fraction to hexadecimal fraction (?)16
1693/16 = 105 Reminder (13) D (LSB)
105/16 = 6 Reminder 9
6/16 = 0 Reminder 6 (MSB)
(69D)
Multiply 0.0628 by 16
0.0628 x 16 = 1.0048(Product) Fractional part=0.0048 Carry=1 (MSB)
Multiply 0.0048 by 16
0.0048 x 16 = 0.0768(Product) Fractional part = 0.0768 Carry = 0
Multiply 0.0768 by 16
0.0768 x 16 = 1.2288(Product) Fractional part = 0.2288 Carry = 1
Multiply 0.2288 by 16
0.2288 x 16 = 3.6608(Product) Fractional part = 0.6608 Carry = 3 (LSB)
(.1013)
(1693.0628)10 = (69D.1013)16
101.101
= 1 x 22 + 0 x 21 + 1 x 20 . 1 x 2-1 + 0 x 2-2 + 1 x 2-3
= 5 + 0.5 + 0.125
= 5 . 625
Therefore ( 1 0 1 . 1 0 1 )2 = ( 5.625 )10
= 0. 6154782
Convert 11001100.101 to ( )8
011|001|100. |101|
3 1 4 .5
So the equivalent octal number is 314.5
4. COMPLEMENTS
In digital computers to simplify the subtraction operation and for logical manipulation complements
are used . There are two types of complements for each radix system the radix complement and diminished
radix complement. The first is referred to as the r’s complement and the second as the (r-1)’s complement.
r’s Complement
P a g e 10 | 31 Lecturer: Mr. Azinwi Boris
Lecture Notes in Digital Electronics Module 1 part One
Given a positive number N in base r with an integer part of n digits, the r’s complement of N is
defined as rn-N if N≠0 and 0 if N=0
(r-1)’s Complement
Given a positive number N in base r with an integer part of n digits and a fraction part of m
digits, the (r-1)’s complement of N is defined as rn-r-m-N
The subtraction of two positive numbers (M-N), both of base r, may be done as follows.
The procedure for subtraction with (r-1)’s complement is same as r’s complement except for
end-around carry.
The subtraction of M-N, both positive numbers in base r, may be calculated in the following
manner.
1. Add the minuend M to the (r-1)’s complement of the subtrahend N.
2. Inspect the result obtained in step 1 for an end carry.
If an end-carry occurs, add 1 to the least significant digit (end-around carry)
If an end-carry does not occur, take the (r-1)’s complement of the number
obtained in step 1 and place a negative sign in front.
It is classified into four types they are 1’s complement , 2’s complement , 9’s complement and
10’s complement.
4.1 1’s complement representation: The 1’s complement of a binary number is the number that
results when we change all 1’s to zeros and the zeros to ones.
2’s complement representation:
The 2’s complement is the binary number that results when we add 1 to the 1’s complement.
Problems related to 1’s complement and 2’s complement :
Method:
1. Determine the 1’s complement of the smaller number.
2. Add the 1’s complement to the larger number.
3. Remove the carry and add it to the result.
This is called end -around carry.
3. Answer is in 2’s complement form. To get the answer in true form take the 2’s complement and
assign negative sign to the answer.
1. 9s complement
2. 10s complement
3. 9s complement subtraction
4. 10s complement subtraction
Now first of all let us know what 9's complement is and how it is done. To obtain the 9,s complement
of any number we have to subtract the number with (10n - 1) where n = number of digits in the number, or
in a simpler manner we have to divide each digit of the given decimal number with 9. The table 1. will
explain the 9's complement more easily.
9s
Decimal digit
complement
0 9
1 8
2 7
3 6
4 5
5 4
6 3
7 2
8 1
9 0
Now coming to 10's complement, it is relatively easy to find out the 10's complement after finding
out the 9,s complement of that number. We have to add 1 with the 9,s complement of any number to obtain
the desired 10's complement of that number. Or if we want to find out the 10's complement directly, we can
do it by following the formula, (10 n - number), where n = number of digits in the number. An example is
given below to illustrate the concept of obtaining 10’s complement
A decimal number 456, find 9's complement and 10’s complement of this number
In 9’s complement subtraction when 9’s complement of smaller number number is added to the
larger number carry is generated. It is necessary to add this carry to the result. ( this is called an end around
carry).when larger number is subtracted from the smaller number, there is no carry, and the result is in 9’s
compliment form and negative. This is explained with following examples.
5. SIGNED NUMBERS
Digital systems like 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.
5.1 Representation
There are three forms in which the signed integer (whole numbers) can be represented. They
include,
Note:
Negative numbers, are the 1’s complement of the corresponding positive numbers.
(eg)
(eg)
11100110 +
(eg) 1. Determine the decimal value of this signed binary number expressed in sign –
magnitude. 10010101
Soln:
The seven magnitude bits and their powers of 2 weights are as follows.
1 0010101
↓ 26252423222120
Sign bit
Summing weights where there are 1’s.
→ 16+4+1 = 21
P a g e 22 | 31 Lecturer: Mr. Azinwi Boris
Lecture Notes in Digital Electronics Module 1 part One
(eg) Determine the decimal value of the signed binary number expressed in 1’s complement
11101000
Soln:
The bits and their powers- of- two weights are as follows.
1 1 1 0 1 0 0 0
-27 26 25 24 23 22 21 20
(eg): Determine the decimal values of the signed binary numbers expressed in 2’s complement
from 10101010
Soln:
1 0 1 0 1 0 1 0
-27 26 25 24 23 22 21 20
Summing weights where there are 1’s
-128+32+8+2 = -86
Since 8-bit (1byte) grouping is common in most computers, the illustrations are all 8-
bits. With 8-bits, we can represent 256 different numbers.
With 16-bits (2 bytes), we can represent 65,536 different numbers.
P a g e 24 | 31 Lecturer: Mr. Azinwi Boris
Lecture Notes in Digital Electronics Module 1 part One
The formula for finding the number of different combinations of n-bits is,
Total combinations = 2n
Range of values for n-bit numbers is,
-(2n-1) to + (2n-1 – 1)
Addition
The two numbers in an addition are the addend and the augend
The result is 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.
Subtraction
6. BINARY ARITHMETIC
6.1 BINARY ADDITION
The binary addition table is as follows:
A+B SUM CARRY
0+0 0 0
0+1 1 0
1+0 1 0
1+1 0 1
Illustration 1:
Add (1010)2 and (0011)2
1010 (Augend)
0011 (Addend)
1101 (sum)
Step 2: The carry in the previous is added to the next higher significant bits, i.e. 0+1+1= 0 with a carry 1.
Step 3: The carry in the previous is added to the next higher significant bits, i.e. 1+0+0 =1 with a carry 0.
Step 4: The preceding carry is added to the most significant bit i.e. 0+1+0 = 1 with a carry 0.
Thus the sum is 1101.
0110 (Difference)
101101
101101
000000
Partial Product
000000
101101
000000
Step 1: The LSB of the multiplier is taken. If multiplier bit is 1, the multiplicand is copied as such and if
the multiplier bit is 0 zero is placed in all the bit positions.
Step 2: The next higher significant bit of the multiplier is taken and, the partial product is written with the
shift to the left, as in step 1.
Step 3: step 2 is repeated for all other higher significant bits.
Step 4: The partial product terms are added which gives the actual product of multiplier and the
multiplicand.
111
101
101
101