You are on page 1of 70

EE0023

LOGIC CIRCUITS AND SWITCHING THEORY


LESSON #1

Number Systems

Number Systems
• Identify the different number systems used in logic
circuits
• Perform conversion of one number system into
another

Number Systems
Number system is numerical language used to represent
digits in ordered sets of symbols governed by different
mathematical rules.
Base/ Radix – number of digits in ordered set

(W.F)r

W= integer part
F = fractional part
. = radix point
r = radix
Number is a group of digits in ordered set.

cj coefficient of r
rj = radix raise to j
i = number of integer digits
f = number of fractional digits
Four number system

▪ Decimal (10)
▪ Binary (2)
▪ Octal (8)
▪ Hexadecimal (16)
▪ ............
• Number system with radix or base equals to 2
• Bits is the term use to define the unit which came from
binary digit
• Represented by logic 1 or 0
• Electrical signal can be interpreted as high voltage for
logic 1 and low voltage for logic 0
Computers work only on two states
• On
• Off
Basic memory elements hold only two states
• Zero / One
Thus a number system with two elements {0,1}
A binary digit – bit !
B = log2N
B is the no. of bits in which you can present one of N
probable events
eg. Determine the number of bits in which you can
represent 26 letters in the alphabet. Compare with dits.
Coding efficiency
Ub=(4.7/5)x100%=94%
Ud= (log26)/2 * 100% = 71 %
In digital circuits, there are specified values of logic 1
being specified as high level with corresponding
minimum and maximum value and logic 0 as low level
with corresponding minimum and maximum value.

The specified range don’t have overlapping values.


Source: Communication System by Simon Haykin
1439 = 1 x 103 + 4 x 102 + 3 x 101 + 9 x 100

Thousands Hundreds Tens Ones

Radix = 10
Base r to Base 10:
(W.F)r to (W.F)10
Pointers
Write WFr in polynomial and simplify using decimal
operation ( multiply and add)
eg.
(11.01)2 = 1x21 + 1x20 + 0x2-1 + 1x2-2 =
(11)8 = 1x81 + 1x80 =
(A1)16 = Ax161 + 1x160 =
Base 10 to Base r:
(W.F)10 to (W.F)r
Pointers
Separate integer part from fractional part.
For integer part, divide the integer part by base r until
you reach zero quotient. Then the last remainder will be
the MSB while the first one will be the LSB.
For fractional part, multiply the decimal number by base
r giving integer and fractional part. Continue
multiplication until you reach zero product for the
fractional part and read the first integer up to the last
integer as the desired number.
eg.
(13.75)10 =
• Sum of Weights Method
• Write the binary numbers in the weights of power of 2
and cross out the weights above zero then add the
remaining weights.
Octal: 3bits 000-111 0 to 7
Hexadecimal: 4bits 0000-1111 0 to F
1101 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
=1x8+1x4+0x2+1x1
=8+4+0+1

(1101)2 = (13)10

1, 2, 4, 8, 16, 32, 64, 128, 256, 512, ….


Group 3 bits in 4,2,1 weights then convert to each group
into octal equivalent.
Group 4 bits in 8,4,2,1 weights then convert each group
into hexadecimal equivalent.
2 13 1 LSB
2 6 0
2 3 1
2 1 1 MSB
0

(13)10 = (1101)2
Each digit represent 3 bits .
Each digit represent 4 bits.
137 = 1 x 82 + 3 x 81 + 7 x 80
= 1 x 64 + 3 x 8 + 7 x 1
= 64 + 24 + 7

(137)8 = (95)10

Digits used in Octal number system – 0 to 7


8 95 7 LSP
8 11 3
8 1 1
0 MSP

(95)10 = (137)8
BAD = 11 x 162 + 10 x 161 + 13 x 160
= 11 x 256 + 10 x 16 + 13 x 1
= 2816 + 160 + 13

(BAD)16 = (2989)10

A = 10, B = 11, C = 12, D = 13, E = 14, F = 15


16 2989 13 LSP
16 186 10
16 11 11
0 MSP

(2989)10 = (BAD)16
Convert to decimal first then decimal to non decimal.
Ease of use and conversion
Three bits make one octal digit
111 010 110 101
7 2 6 5 => 7265 in octal

Four bits make one hexadecimal digit


4 bits = nibble
1110 1011 0101
E B 5 => EB5 in hex
Binary 2 Decimal 10
Tertiary 3 Undenary 11
Quartenary 4 duodenary 12
Quintary 5 Tredenary 13
Senary 6 Quartuodinary 14
Septary 7 Quindenary 15
Octal8 Hexadecimal 16
Nonary 9 Vicenary 20
Sexagesimal 60
Three representations:
• Signed magnitude
• 1’s complement
• 2’s complement
• Make MSB represent sign
• Positive = 0
• Negative = 1
• E.g. for a 3 bit set
• “-2”
• MSB as in sign magnitude
• Complement all the other bits
• Given a positive number complement all bits to get
negative equivalent
• E.g. for a 3 bit set
• “-2”
• 1’s complement plus one
• E.g. for a 3 bit set
• “-2”
No matter which scheme is
used we get an even set of
numbers but we need one
less (odd: as we have a
unique zero)
Logic function and subtraction operation in computer
can be represented using 1 and 2’s complement in order
to handle negative number.
1. Radix Complement (r’s complement)
i
r -N
i = number of integer digits
r = radix
N = number
Eg. 2’s and 10’s complement
Determine the 10’s complement of (67789)10
Solution:
r = 10
i=5
N = 67789
Answer: 105-67789 =
2. Diminished Radix Complement (r-1’s complement)
i f
r -r -N
i = number of integer digits
f = number of fractional digits
r = radix
N = number
Eg. 1’s and 9’s complement
Determine the 9’s complement of (67789)10
Solution:
r = 10
i =5
f=0
N = 67789
Answer: 105- 100 - 67789 =
• Addition / subtraction
• Unsigned
• Signed
• Using negative numbers
Augend 0 0 1 1
+
Addend 0 1 0 1
________________
Sum 0 1 1 0
Carry 0 0 0 1
Minuend 0 0 1 1
-
Subtrahend 0 1 0 1
________________
Difference 0 1 1 0
Borrow 0 1 0 0
Multiplicand 0 0 1 1
X
Multiplier 0 1 0 1
________________
Product 0 0 0 1
Use long division method.
• Use a negative number representation scheme

• Reduces subtraction to addition


Negative numbers in 2’s complement

001 ( 1)10
101 (-3)10
110 (-2)10

The carry out of the MSB is lost.


• Maximum value N bits can hold : 2n –1
• When addition result is bigger than the biggest number of
bits can hold.
• Overflow
• When addition result is smaller than the smallest number
the bits can hold.
• Underflow
• Addition of a positive and a negative number cannot give
an overflow or underflow.
011 (+3)10
011 (+3)10
110 (+6)10 ????

1’s complement computer interprets it as –1 !!


(+6)10 = (0110)2 requires four bits !
Two’s complement addition
101 (-3)10
101 (-3)10
Carry 1 010 (-6)10 ????

The computer sees it as +2.


(-6)10 = (1010)2 again requires four bits !
Determine the 2’s and 1’s complement of 100111.
Determine the 2’s and 1’s complement of 100111.

Solution:
2’s complement
r=2 ; 26 – 100111 = 1000000-100111=011001
1’s complement
r=2 and f=0
26 –20 – 100111= 1000000-1-100111 =011000
2’s complement of binary number, invert all its and add
logic 1 to LSB.
100111 will become 011000 then add 1 to become 011001

1’s complement of binary number, invert all bits


100111 will become 011000
1. Make sure that the number of digits of Minuend (M)
and Subtrahend (S) are the same.
2. Get the radix (r’s) or diminished radix (r-1)’s
complement of S then add to M.
3. Take note that if M>S, if end carry occur you have to
disregard it if you are using r’s and the sum from
no.2 procedure will be the difference or add the end
carry if you are using r-1’s
4. Take note that if M<S, the sum from no.2 procedure
will be complemented either (r’s or r-1’s) and place a
negative sign to give the difference.
Perform the indicated operation using 10’s complement
a. 432010-8523210
Solution:
M= 4320
S = 85232
radix = 10
1. Make M=S digits 04320 and 85232
2. Take the 10’s complement of S
105-85,232=14,768
3. Add M+S 10’s complement
04320
+14768
----------------
Sum 19088
4. Check if M>S, No, 04320<85232, place a negative sign
in the sum’s 10’s complement
10’complement of 19088
105-19088 = 80912
Place a (-) sign

Answer:
432010-8523210 = -80,91210
Perform the indicated operation using 2’s complement
a. 11012-11002
Solution:
M= 1101
S = 1100
radix = 2
1. Make M=S digits 1101 and 1100
2. Take the 2’s complement of S
24-1100 =100002-11002 = 0100
3. Add M+S 2’s complement
1101
+0100
----------------
1carry0001
4. Check if M>S, yes, disregard the carry
Answer : 11012-11002 = 00012
Perform the indicated operation using 1’s complement
a. 10012-11002
Solution:
M= 1001
S = 1100
radix = 2
1. Make M=S digits 1001 and 1100
2. Take the 1’s complement of S
24-20 -1100 =100002- 1-11002 = 0011
3. Add M+S 2’s complement
1001
+0011
----------------
1100
4. Check if M>S, No, take the 1’s complement of sum
and place a negative number
Answer : 10012-11002 = -00112
Perform the indicated operation using 9’s complement
a. 543210-1325010
Solution:
M= 5432
S = 13250
radix = 2
1. Make M=S digits 5432 and 13250
2. Take the 9’s complement of S
105-100-13250 =86,749
3. Add M+S 9’s complement
05,432
+86,749
----------------
Sum 92,181
4. Check if M>S, No, 5432<13250, take the 9’s
complement of 92,181 qnd place a negative sign
5. 105-100-92,181= 7,818
Answer : 543210-1325010 = -7,818
Perform the indicated operation using 7’s
complement
a. 368-768
Solution:
M= 36
S = 76
radix = 8
1. Make M=S digits 36 and 76, convert S to decimal
system before proceeding to no.2
768 = 7x81+6x80=6210
2. Take the 7’s complement of S
82-80-6210 = 110 = 18
3. Add M+S 7’s complement in octal
368
+ 18
----------------
Sum 378
4. Check if M>S, No, 36<76, take the 7’s complement of
378 qnd place a negative sign
82-80--31= 3210 convert to base 8

Answer : 368-768 = -408


ASK ANY QUESTION RELATED TO
OUR TOPIC FOR TODAY.

You might also like