Unit1 BinaryNumSystem
Unit1 BinaryNumSystem
nd Logic Design
Lecture 1
Adding
01111000
11001001
1 01000001 = 65
00100000
11001110
11101110 – this is the 2’s complement of 18
Note : In this case we get the answer in the 2’s complement form.
Case 4 : addition of two negative numbers
-30 + -20 = -50
2’s complement of 30 = 11100010
2’s complement of 20 = 11101100
Adding the two = 1 11001110
We get the 2’s complement of 50 after ignoring
the carry.
Binary Subtraction
Case 1 : Both positive. Subtracting smaller from larger
positive number
52 – 18 = 34 Same as adding a small negative value to a
large positive number.
Case 2 : positive and small Negative . 48 – (-12) . This is
the same as simple addition of two positive integers.
Case 3 : Positive and large Negative. 12 – (-50). Again
same as simple addition of two positive integers.
Case 4 : Both Negative . -15 – (-68 ) . Same as subtracting
a smaller value from a larger positive value.
Binary Multiplication
1000
x 1001
---------------
1000
0000+
0000++
1000+++
----------------
1001000
Binary Division
1001 - Quotient
Divisor 1000) 1001010 <- Dividend
1000
00010
000101
0001010
1000
0010 - Remainder
• Octal system
– The numbers used is 0, 1, 2, 3, 4, 5, 6 and 7
(127.4)8 = 1*82+2*81+7*80+4*8-1 = (87.5)10
• Hexadecimal system
– The numbers used are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C,
D, E & F
– (B65F)16 =11*163+6*162+5*161+15*160=(46,687)10
Why do we need Octal and
Hexadecimal System ?
• Binary numbers are difficult to work with because
they require three or four times as many digits as
their decimal equivalents.
• When Human Machine interaction is required a
condensed binary system like octal or
hexadecimals are used.
• When humans communicate with each other
about binary numbers , it is easier to represent
them in octal or hexadecimal.
• Thus most computer manuals use either the octal
or hexadecimal system of representation.
Conversions
• Decimal to Binary
• Binary to Decimal
• Octal to Decimal
• Hexadecimal to Decimal
• Decimal to octal
• Octal to Binary
• Decimal to Hexadecimal
• Binary to octal
• Octal to Hexadecimal
• Binary to Hexadecimal
• Hexadecimal to Binary
• Hexadecimal to Octal