SlideShare a Scribd company logo
1 of 95
NUMBER SYSTEMS
Decimal
Binary
Octal
Hexadecimal
MODULE 1
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA 1
2
Number systems
COMMON NUMBER
SYSTEMS
System Base Symbols
Used by
humans?
Used in
computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
Hexa-
decimal
16 0, 1, … 9,
A, B, … F
No No
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
3
Number systems
QUANTITIES/COUNTING (1
OF 2)
Decimal Binary Octal
Hexa-
decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
Decimal Binary Octal
Hexa-
decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
4
Number systems
QUANTITIES/COUNTING (2
OF 2)
Decimal Binary Octal
Hexa-
decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
5
Number systems
CONVERSION AMONG
BASES
The possibilities:
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
6
Number systems
QUICK EXAMPLE
2510 = 110012 = 318 = 1916
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
7
Number systems
DECIMAL TO DECIMAL
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
8
Number systems
12510 => 5 x 100 = 5
2 x 101 = 20
1 x 102 = 100
125
Base
Weight
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
1 2 5
0
1
2 Position
Weights
100
101
102
9
Number systems
BINARY TO DECIMAL
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
10
Number systems
BINARY TO DECIMAL
Technique
Multiply each bit by 2n, where n is the “weight” of
the bit
The weight is the position of the bit, starting from 0
on the right
Add the results
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
11
Number systems
EXAMPLE
1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310
Bit “0”
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
12
Number systems
OCTAL TO DECIMAL
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
13
Number systems
OCTAL TO DECIMAL
Technique
Multiply each bit by 8n, where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the
right
Add the results
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
14
Number systems
EXAMPLE
7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
15
Number systems
HEXADECIMAL TO DECIMAL
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
16
Number systems
HEXADECIMAL TO DECIMAL
Technique
Multiply each bit by 16n, where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the
right
Add the results
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
17
Number systems
EXAMPLE
ABC16 => C x 160 = 12 x 1 = 12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
18
Number systems
DECIMAL TO BINARY
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
19
Number systems
DECIMAL TO BINARY
Technique
Divide by two, keep track of the remainder
First remainder is bit 0 (LSB, least-significant bit)
Second remainder is bit 1
Etc.
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
EXAMPLE
12510 = ?2
2 125
62 1
2
31 0
2
15 1
2
7 1
2
3 1
2
1 1
2
0 1
12510 = 11111012
21
Number systems
OCTAL TO BINARY
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
22
Number systems
OCTAL TO BINARY
Technique
Convert each octal digit to a 3-bit equivalent binary
representation
EXAMPLE
7058 = ?2 7 0 5
111 000 101
7058 = 1110001012
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
23
Number systems
HEXADECIMAL TO BINARY
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
24
Number systems
HEXADECIMAL TO BINARY
Technique
Convert each hexadecimal digit to a 4-bit equivalent binary
representation
EXAMPLE
10AF16 = ?2
1 0 A F
0001 0000 1010 1111
10AF16 = 00010000101011112
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
25
Number systems
DECIMAL TO OCTAL
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
26
Number systems
DECIMAL TO OCTAL
Technique
 Divide by 8
 Keep track of the remainder
EXAMPLE
123410 = ?8
8 1234
154 2
8
19 2
8
2 3
8
0 2
123410 = 23228
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
27
Number systems
DECIMAL TO HEXADECIMAL
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
28
Number systems
DECIMAL TO HEXADECIMAL
Technique
 Divide by 16
 Keep track of the remainder
123410 = ?16
123410 = 4D216
16 1234
77 2
16
4 13 = D
16
0 4
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
29
Number systems
BINARY TO OCTAL
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
30
Number systems
BINARY TO OCTAL
Technique
Group bits in threes, starting on right
Convert to octal digits
10110101112 = ?8
1 011 010 111
1 3 2 7
10110101112 = 13278
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
31
Number systems
BINARY TO HEXADECIMAL
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
32
Number systems
BINARY TO HEXADECIMAL
Technique
 Group bits in fours, starting on right
 Convert to hexadecimal digits
10101110112 = ?16
10 1011 1011
2 B B
10101110112 = 2BB16
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
33
Number systems
OCTAL TO HEXADECIMAL
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
34
Number systems
OCTAL TO HEXADECIMAL
Technique
 Use binary as an intermediary
10768 = ?16
1 0 7 6
001 000 111 110
2 3 E
10768 = 23E16
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
35
Number systems
HEXADECIMAL TO OCTAL
Hexadecimal
Decimal Octal
Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
36
Number systems
HEXADECIMAL TO OCTAL
Technique
Use binary as an intermediary
1F0C16 = ?8
1 F 0 C
0001 1111 0000 1100
1 7 4 1 4
1F0C16 = 174148
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
37
Number systems
EXERCISE
Decimal Binary Octal
Hexa-
decimal
33
1110101
703
1AF
Skip answer Answer
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
38
Number systems
EXERCISE – CONVERT …
Decimal Binary Octal
Hexa-
decimal
33 100001 41 21
117 1110101 165 75
451 111000011 703 1C3
431 110101111 657 1AF
Answer
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
39
FRACTIONS
Decimal to decimal
3.14 => 4 x 10-2 = 0.04
1 x 10-1 = 0.1
3 x 100 = 3
3.14
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
40
FRACTIONS
Binary to decimal
10.1011 => 1 x 2-4 = 0.0625
1 x 2-3 = 0.125
0 x 2-2 = 0.0
1 x 2-1 = 0.5
0 x 20 = 0.0
1 x 21 = 2.0
2.6875
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
41
FRACTIONS
Decimal to binary
3.14579
.14579
x 2
0.29158
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
1.33056
etc.
11.001001...
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
42
EXERCISE
Decimal Binary Octal
Hexa-
decimal
29.8
101.1101
3.07
C.82
Skip answer Answer
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
43
Number systems
EXERCISE
Decimal Binary Octal
Hexa-
decimal
29.8 11101.110011… 35.63… 1D.CC…
5.8125 101.1101 5.64 5.D
3.109375 11.000111 3.07 3.1C
12.5078125 1100.10000010 14.404 C.82
Answer
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
BINARY NUMBER SYSTEM
1’s and 2’s compliment
Signed number
representation
Binary arithmetic
Binary subtraction
MODULE 1
44
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
BINARY ADDITION (1 OF 2)
Two 1-bit values
A B A + B
0 0 0
0 1 1
1 0 1
1 1 10
“two”
Number systems 40
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
46
Number systems
BINARY ADDITION (2 OF 2)
Two n-bit values
Add individual bits
Propagate carries
E.g.,
10101 21
+ 11001 + 25
101110 46
1
1
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
47
Binary Subtraction
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
48
Number systems
Binary Subtraction
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
49
Number systems
Binary Multiplication Binary Division
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
50
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
51
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
52
Number systems
REPRESENTING SIGNED (POSITIVE AND
NEGATIVE) NUMBERS
Ex. 4-bit signed magnitude
1 bit for sign
3 bits for magnitude
1111
0111
7
1110
0110
6
1101
0101
5
1100
0100
4
1011
0011
3
1010
0010
2
1001
0001
1
1000
0000
0
N
N 

DECIM
AL
SIGN BIT
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
53
Number systems
Ex 1. Find the sign/mag representation of -
610
Step1: find binary representation using 8 bits
610 = 000001102
Step2: if the number is a negative number flip
left most bit
10000110
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
54
Number systems
Ex 2. Find the signmag representation of -3610
Step 1: find binary representation using 8 bits
3610 = 001001002
Step 2: if the number is a negative number flip left
most bit
10100100
So: -3610 = 101001002 (in 8-bit sign/magnitude
form) LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
55
Number systems
Ex 3. Find the signmag representation of 7010
Step 1: find binary representation using 8 bits
7010 = 010001102
Step 2: if the number is a negative number flip left
most bit
01000110 (no flipping, since it is +ve)
So: 7010 = 010001102 (in 8-bit sign/magnitude
form) LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
56
Number systems
What is this signmag number?
100000002
The machine will think of it as - 0 , which is a non
valid value.
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
57
Number systems
TWO’S COMPLEMENT
REPRESENTATION
Ex. Find the two’s complement representation
of –610
Step1: find binary representation in 8 bits
610 = 000001102
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
58
Number systems
Step 2: Complement the entire positive number, and then add
one
00000110
(complemented) -> 11111001
(add one) -> + 1
11111010
So: -610 = 111110102 (in 2's complement form)
TWO’S COMPLEMENT
REPRESENTATION
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
59
Number systems
Alternative method for step 2
Scan binary representation from right
too left, find first one bit, from low-order
(right) end, and complement the remaining
pattern to the left.
00000110
(left complemented) --> 11111010
TWO’S COMPLEMENT
REPRESENTATION
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
60
Number systems
Ex 2: Find the Two’s Complement of -7610
Step 1: Find the 8 bit binary representation of the positive value.
7610 = 010011002
Step 2:
Find first one bit, from low-order (right) end, and complement the pattern to the left.
01001100
(left complemented) -> 10110100
So: -7610 = 101101002 (in 2's complement form, using any of above methods)
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
61
Number systems
Ex 3: Find the Two’s Complement of 7210
Step 1: Find the 8 bit binary representation of the
positive value.
7210 = 010010002
Step 2:
Since number is positive do
nothing.
So: 7210 = 010010002 (in 2's complement form,
using any of above methods)
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
62
Number systems
Binary subtraction using 2’s
compliment
To subtract +7 from +3, we add the code for -7, 1001, to that of +3,
0011:
0011 (+3)
+1001 (-7)
1100 (-4)
The result, 1100, is the code for -4, the result of
subtracting +7 from +3.
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
BINARY CODES
Grey Code
BCD Code
Excess -3 Code
Parity and Hamming Code
ASCII Code
MODULE 1
63
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
64
Number systems
BCD
The BCD is simply the 4 bit
representation of the decimal digit.
For multiple digit base 10 numbers,
each symbol is represented by its
BCD digit
What happened to 6 digits not used?
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
65
Would it be easy for you if you can replace
a decimal number with an individual
binary code?
Such as 00011001 = 1910
The 8421 code is a type of BCD to do
that.
BCD code provides an excellent interface
to binary systems:
Keypad inputs
Digital readouts
Number systems
BCD
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
66
ex1: dec-to-BCD
(a) 35
(b) 98
(c) 170
(d) 2469
ex2: BCD-to-dec
(a) 10000110
(b) 001101010001
(c) 1001010001110000
Decimal
Digit
0 1 2 3 4 5 6 7 8 9
BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
Let’s crack these…
Note: 1010, 1011, 1100, 1101, 1110, and 1111 are INVALID CODE!
BCD
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
67
Number systems
BCD OPERATION
Consider the following BCD operation
Decimal: Add 4 + 1
Covert to binary 0 1 0 0
And 0 0 0 1
Getting 0 1 0 1
Which is still a BCD representation of a
decimal digit
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
68
Number systems
A second example
 3 0 0 1 1
 +3 0 0 1 1
Getting 6 or 0 1 1 0
And in range and a BCD digit
representation
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
69
Number systems
AND NOW
Consider 5 + 5
5 0 1 0 1
+5 0 1 0 1
giving 1 0 1 0 which is binary 10 but not a BCD
digit!
What to do?
Try adding 6 !!
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
70
Number systems
ADDING 6
Had 1010 and want to add 6 or 0110
 so 1 0 1 0
 plus 6 0 1 1 0
Giving 1 0 0 0 0
Or a carry out to the next binary digit, or if the
binary in BCD, the next BCD digit.
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
71
Number systems
ANOTHER CARRY EXAMPLE
Add 7 + 6
 have 7 0 1 1 1
 plus 6 0 1 1 0
Giving 1 1 0 1 and again out of range
Adding 6 0 1 1 0
Giving 1 0 0 1 1 so a 1 carries out to the next BCD
digit
FINAL BCD answer 0001 0011 or 1310
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
72
Number systems
MULTIBIT BCD
Add the BCD for 417 to 195
Would expect to get 612
BCD setup - start with Least Significant Digit
 0 1 0 0 0 0 0 1 0 1 1 1
 0 0 0 1 1 0 0 1 0 1 0 1
 1 1 0 0
Adding 6 0 1 1 0
Gives 1 0 0 1 0
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
73
Number systems
CONTINUING MULTIBIT
Had a carry to the 2nd BCD digit position
 1
 0 1 0 0 0 0 0 1 done
 0 0 0 1 1 0 0 1 0 0 1 0
 1 0 1 1
Again must add 6 0 1 1 0
Giving 1 0 0 0 1
And another carry
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
74
Number systems
STILL CONTINUING MULTIBIT
Had a carry to the 3rd BCD digit position
 1
 0 1 0 0 done done
 0 0 0 1 0 0 0 1 0 0 1 0
 0 1 1 0
And answer is 0110 0001 0010 or the BCD for the base
10 number 612
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
75
Number systems
GRAY CODES
Gray code. The reflected binary code
(RBC), also known as Gray code after
Frank Gray, is a binary numeral system
where two successive values differ in
only one bit (binary digit). The reflected
binary code was originally designed to
prevent spurious output from
electromechanical switches.
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
76
The Gray code is unweighted and is not an
arithmetic code.
There are no specific weights assigned to the bit
positions.
Important: the Gray code exhibits only a
single bit change from one code word to the
next in sequence.
Number systems
GRAY CODES
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
77
GRAY CODES
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
78
Number systems
Binary-to-Gray code conversion
The MSB in the Gray code is the same as corresponding
MSB in the binary number.
Going from left to right, add each adjacent pair of
binary code bits to get the next Gray code bit. Discard
carries.
ex: convert 101102 to Gray code
1 + 0 + 1 + 1 + 0 binary
1 1 1 0 1 Gray
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
79
Number systems
Gray-to-Binary Conversion
The MSB in the binary code is the same as the
corresponding bit in the Gray code.
Add each binary code bit generated to the Gray code bit in
the next adjacent position. Discard carries.
ex: convert the Gray code word 11011 to binary
1 1 0 1 1 Gray
+ + + +
1 0 0 1 0 Binary
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
80
Number systems
The Excess-3 (XS-3) BCD code does not use the principle of positional
weights into consideration while converting the decimal numbers to
4-bit BCD system. Therefore, we can say that this code is a non-
weighted BCD code.
The function of XS-3 code is to transform the decimal numbers into
their corresponding 4-bit BCD code.
In this code, the decimal number is transformed to the 4-bit BCD code
by first adding 3 to all the digits of the number and then converting
the excess digits, so obtained, into their corresponding 8421 BCD
code. Therefore, we can say that the XS-3 code is strongly related with
8421 BCD code in its functioning.
The Excess-3 (XS-3) Code
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
81
Number systems
Decimal digits Excess-3 BCD code
0 0011
1 0100
2 0101
3 0110
4 0111
5 1000
6 1001
7 1010
8 1011
9 1100
The Excess-3 (XS-3) Code
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
82
Number systems
ASCII CODES
ASCII stands for American Standard Code for
Information Interchange
The code uses 7 bits to encode 128 unique characters
It has the word length 7 and codes decimal digits, the characters
of the latin alphabet as well as special character. From the 128
possible binary words are 32 pseudo-words and/or control
characters.
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
83
Number systems
ASCII CODES
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
84
Number systems
ERROR DETECTION / CORRECTING CODES
Why might we need Error
detection/correction?
Even & Odd Parity
 Error detection
Hamming code
 Used for error detection & error correction
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
85
Number systems
PARITY BITS
ASCII – 7 bit code (hex 00 to 7F)
Could use “8th” bit for parity bit:
X1011010
 Even parity: make total number of “1” bits is even
01011010
Odd parity: make total number of “1” bits odd
11011010
If a parity bit is added to a bit stream, then there is a basis to check
for bit(s) being corrupted.
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
86
Number systems
Suppose you receive a binary bit word
“0101” and you know you are using an odd
parity.
Is the binary word errored?
The answer is yes:
 There are 2 1-bit, which is an even number
 We are using an odd parity
 So there must have an error.
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
87
Number systems
A single bit is appended to each data chunk
makes the number of 1 bits even/odd
Example: even parity
(1)1000000
(0)1111101
(1)1001001
Example: odd parity
(0)1000000
(1)1111101
(0)1001001
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
88
Number systems
Suppose you are using an odd parity.
What should the binary word “1010” look
like after you add the parity bit?
Answer:
There is an even number of 1-bits.
 So we need to add another 1-bit
Our new word will look like “10101”.
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
89
Number systems
Hamming Code (7,4) [1 bit error correction]
A Hamming code is a linear error-correcting code named after its
inventor, Richard Hamming. Hamming codes can detect up to two bit
errors, and correct single-bit errors. This method of error correction is best
suited for situations in which randomly occurring errors are likely, not for
errors that come in bursts.
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
90
Number systems
1 2 3 4 5 6 7
P1 P2 D3 P4 D5 D6 D7
The format of a Hamming code is:
•Here 1,2,4 are the parity bits and 3,5,6,7 are the
Information/Data bits
LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
91
Example: Encode the data bits 1101 into a 7-bit even parity Hamming code.
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
92
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
93
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
94
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
95
Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA

More Related Content

Similar to 1.Module 1.pptx

Ee2 chapter1 number_system
Ee2 chapter1 number_systemEe2 chapter1 number_system
Ee2 chapter1 number_systemCK Yang
 
digital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointdigital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointRai University
 
Mca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed pointMca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed pointRai University
 
Microprocessor Week 4-5 MCS-51 Arithmetic operation
Microprocessor Week 4-5 MCS-51 Arithmetic operationMicroprocessor Week 4-5 MCS-51 Arithmetic operation
Microprocessor Week 4-5 MCS-51 Arithmetic operationArkhom Jodtang
 
Combinational Circuits Design in Digital System Design.pptx
Combinational Circuits Design in Digital System Design.pptxCombinational Circuits Design in Digital System Design.pptx
Combinational Circuits Design in Digital System Design.pptxMrRRThirrunavukkaras
 
DESIGN OF LOW POWER MULTIPLIER
DESIGN OF LOW POWER MULTIPLIERDESIGN OF LOW POWER MULTIPLIER
DESIGN OF LOW POWER MULTIPLIERIRJET Journal
 
03_NumberSystems.pdf
03_NumberSystems.pdf03_NumberSystems.pdf
03_NumberSystems.pdfvijayapraba1
 
Certificate in Digital System Design - Edukite
Certificate in Digital System Design - EdukiteCertificate in Digital System Design - Edukite
Certificate in Digital System Design - EdukiteEduKite
 
Number system de (2131004) - 160920107003
Number system    de (2131004) - 160920107003Number system    de (2131004) - 160920107003
Number system de (2131004) - 160920107003Prashant odhavani
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptxAliaaTarek5
 
B.sc cs-ii -u-1.1 digital logic circuits, digital component floting and fixed...
B.sc cs-ii -u-1.1 digital logic circuits, digital component floting and fixed...B.sc cs-ii -u-1.1 digital logic circuits, digital component floting and fixed...
B.sc cs-ii -u-1.1 digital logic circuits, digital component floting and fixed...Rai University
 
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...Rai University
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptskatiarrahaman
 
Quine mccluskey method
Quine mccluskey methodQuine mccluskey method
Quine mccluskey methodKanmani R
 

Similar to 1.Module 1.pptx (20)

microprocessor
microprocessormicroprocessor
microprocessor
 
Ee2 chapter1 number_system
Ee2 chapter1 number_systemEe2 chapter1 number_system
Ee2 chapter1 number_system
 
digital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointdigital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed point
 
Mca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed pointMca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed point
 
Microprocessor Week 4-5 MCS-51 Arithmetic operation
Microprocessor Week 4-5 MCS-51 Arithmetic operationMicroprocessor Week 4-5 MCS-51 Arithmetic operation
Microprocessor Week 4-5 MCS-51 Arithmetic operation
 
Combinational Circuits Design in Digital System Design.pptx
Combinational Circuits Design in Digital System Design.pptxCombinational Circuits Design in Digital System Design.pptx
Combinational Circuits Design in Digital System Design.pptx
 
DESIGN OF LOW POWER MULTIPLIER
DESIGN OF LOW POWER MULTIPLIERDESIGN OF LOW POWER MULTIPLIER
DESIGN OF LOW POWER MULTIPLIER
 
number system 1.pptx
number system 1.pptxnumber system 1.pptx
number system 1.pptx
 
03_NumberSystems.pdf
03_NumberSystems.pdf03_NumberSystems.pdf
03_NumberSystems.pdf
 
[ASM] Lab1
[ASM] Lab1[ASM] Lab1
[ASM] Lab1
 
Number Systems.pptx
Number Systems.pptxNumber Systems.pptx
Number Systems.pptx
 
Certificate in Digital System Design - Edukite
Certificate in Digital System Design - EdukiteCertificate in Digital System Design - Edukite
Certificate in Digital System Design - Edukite
 
Number system de (2131004) - 160920107003
Number system    de (2131004) - 160920107003Number system    de (2131004) - 160920107003
Number system de (2131004) - 160920107003
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptx
 
B.sc cs-ii -u-1.1 digital logic circuits, digital component floting and fixed...
B.sc cs-ii -u-1.1 digital logic circuits, digital component floting and fixed...B.sc cs-ii -u-1.1 digital logic circuits, digital component floting and fixed...
B.sc cs-ii -u-1.1 digital logic circuits, digital component floting and fixed...
 
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...
 
02-binary.pptx
02-binary.pptx02-binary.pptx
02-binary.pptx
 
Dpsd lecture-notes
Dpsd lecture-notesDpsd lecture-notes
Dpsd lecture-notes
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.ppt
 
Quine mccluskey method
Quine mccluskey methodQuine mccluskey method
Quine mccluskey method
 

Recently uploaded

HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 

Recently uploaded (20)

HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 

1.Module 1.pptx

  • 1. NUMBER SYSTEMS Decimal Binary Octal Hexadecimal MODULE 1 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA 1
  • 2. 2 Number systems COMMON NUMBER SYSTEMS System Base Symbols Used by humans? Used in computers? Decimal 10 0, 1, … 9 Yes No Binary 2 0, 1 No Yes Octal 8 0, 1, … 7 No No Hexa- decimal 16 0, 1, … 9, A, B, … F No No LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 3. 3 Number systems QUANTITIES/COUNTING (1 OF 2) Decimal Binary Octal Hexa- decimal 0 0 0 0 1 1 1 1 2 10 2 2 3 11 3 3 4 100 4 4 5 101 5 5 6 110 6 6 7 111 7 7 Decimal Binary Octal Hexa- decimal 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 4. 4 Number systems QUANTITIES/COUNTING (2 OF 2) Decimal Binary Octal Hexa- decimal 16 10000 20 10 17 10001 21 11 18 10010 22 12 19 10011 23 13 20 10100 24 14 21 10101 25 15 22 10110 26 16 23 10111 27 17 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 5. 5 Number systems CONVERSION AMONG BASES The possibilities: Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 6. 6 Number systems QUICK EXAMPLE 2510 = 110012 = 318 = 1916 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 7. 7 Number systems DECIMAL TO DECIMAL Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 8. 8 Number systems 12510 => 5 x 100 = 5 2 x 101 = 20 1 x 102 = 100 125 Base Weight LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA 1 2 5 0 1 2 Position Weights 100 101 102
  • 9. 9 Number systems BINARY TO DECIMAL Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 10. 10 Number systems BINARY TO DECIMAL Technique Multiply each bit by 2n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 11. 11 Number systems EXAMPLE 1010112 => 1 x 20 = 1 1 x 21 = 2 0 x 22 = 0 1 x 23 = 8 0 x 24 = 0 1 x 25 = 32 4310 Bit “0” LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 12. 12 Number systems OCTAL TO DECIMAL Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 13. 13 Number systems OCTAL TO DECIMAL Technique Multiply each bit by 8n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 14. 14 Number systems EXAMPLE 7248 => 4 x 80 = 4 2 x 81 = 16 7 x 82 = 448 46810 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 15. 15 Number systems HEXADECIMAL TO DECIMAL Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 16. 16 Number systems HEXADECIMAL TO DECIMAL Technique Multiply each bit by 16n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 17. 17 Number systems EXAMPLE ABC16 => C x 160 = 12 x 1 = 12 B x 161 = 11 x 16 = 176 A x 162 = 10 x 256 = 2560 274810 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 18. 18 Number systems DECIMAL TO BINARY Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 19. 19 Number systems DECIMAL TO BINARY Technique Divide by two, keep track of the remainder First remainder is bit 0 (LSB, least-significant bit) Second remainder is bit 1 Etc. LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 20. EXAMPLE 12510 = ?2 2 125 62 1 2 31 0 2 15 1 2 7 1 2 3 1 2 1 1 2 0 1 12510 = 11111012
  • 21. 21 Number systems OCTAL TO BINARY Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 22. 22 Number systems OCTAL TO BINARY Technique Convert each octal digit to a 3-bit equivalent binary representation EXAMPLE 7058 = ?2 7 0 5 111 000 101 7058 = 1110001012 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 23. 23 Number systems HEXADECIMAL TO BINARY Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 24. 24 Number systems HEXADECIMAL TO BINARY Technique Convert each hexadecimal digit to a 4-bit equivalent binary representation EXAMPLE 10AF16 = ?2 1 0 A F 0001 0000 1010 1111 10AF16 = 00010000101011112 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 25. 25 Number systems DECIMAL TO OCTAL Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 26. 26 Number systems DECIMAL TO OCTAL Technique  Divide by 8  Keep track of the remainder EXAMPLE 123410 = ?8 8 1234 154 2 8 19 2 8 2 3 8 0 2 123410 = 23228 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 27. 27 Number systems DECIMAL TO HEXADECIMAL Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 28. 28 Number systems DECIMAL TO HEXADECIMAL Technique  Divide by 16  Keep track of the remainder 123410 = ?16 123410 = 4D216 16 1234 77 2 16 4 13 = D 16 0 4 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 29. 29 Number systems BINARY TO OCTAL Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 30. 30 Number systems BINARY TO OCTAL Technique Group bits in threes, starting on right Convert to octal digits 10110101112 = ?8 1 011 010 111 1 3 2 7 10110101112 = 13278 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 31. 31 Number systems BINARY TO HEXADECIMAL Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 32. 32 Number systems BINARY TO HEXADECIMAL Technique  Group bits in fours, starting on right  Convert to hexadecimal digits 10101110112 = ?16 10 1011 1011 2 B B 10101110112 = 2BB16 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 33. 33 Number systems OCTAL TO HEXADECIMAL Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 34. 34 Number systems OCTAL TO HEXADECIMAL Technique  Use binary as an intermediary 10768 = ?16 1 0 7 6 001 000 111 110 2 3 E 10768 = 23E16 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 35. 35 Number systems HEXADECIMAL TO OCTAL Hexadecimal Decimal Octal Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 36. 36 Number systems HEXADECIMAL TO OCTAL Technique Use binary as an intermediary 1F0C16 = ?8 1 F 0 C 0001 1111 0000 1100 1 7 4 1 4 1F0C16 = 174148 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 37. 37 Number systems EXERCISE Decimal Binary Octal Hexa- decimal 33 1110101 703 1AF Skip answer Answer LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 38. 38 Number systems EXERCISE – CONVERT … Decimal Binary Octal Hexa- decimal 33 100001 41 21 117 1110101 165 75 451 111000011 703 1C3 431 110101111 657 1AF Answer LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 39. 39 FRACTIONS Decimal to decimal 3.14 => 4 x 10-2 = 0.04 1 x 10-1 = 0.1 3 x 100 = 3 3.14 Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 40. 40 FRACTIONS Binary to decimal 10.1011 => 1 x 2-4 = 0.0625 1 x 2-3 = 0.125 0 x 2-2 = 0.0 1 x 2-1 = 0.5 0 x 20 = 0.0 1 x 21 = 2.0 2.6875 Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 41. 41 FRACTIONS Decimal to binary 3.14579 .14579 x 2 0.29158 x 2 0.58316 x 2 1.16632 x 2 0.33264 x 2 0.66528 x 2 1.33056 etc. 11.001001... Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 42. 42 EXERCISE Decimal Binary Octal Hexa- decimal 29.8 101.1101 3.07 C.82 Skip answer Answer Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 43. 43 Number systems EXERCISE Decimal Binary Octal Hexa- decimal 29.8 11101.110011… 35.63… 1D.CC… 5.8125 101.1101 5.64 5.D 3.109375 11.000111 3.07 3.1C 12.5078125 1100.10000010 14.404 C.82 Answer LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 44. BINARY NUMBER SYSTEM 1’s and 2’s compliment Signed number representation Binary arithmetic Binary subtraction MODULE 1 44 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 45. BINARY ADDITION (1 OF 2) Two 1-bit values A B A + B 0 0 0 0 1 1 1 0 1 1 1 10 “two” Number systems 40 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 46. 46 Number systems BINARY ADDITION (2 OF 2) Two n-bit values Add individual bits Propagate carries E.g., 10101 21 + 11001 + 25 101110 46 1 1 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 47. 47 Binary Subtraction Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 48. 48 Number systems Binary Subtraction LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 49. 49 Number systems Binary Multiplication Binary Division LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 50. 50 Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 51. 51 Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 52. 52 Number systems REPRESENTING SIGNED (POSITIVE AND NEGATIVE) NUMBERS Ex. 4-bit signed magnitude 1 bit for sign 3 bits for magnitude 1111 0111 7 1110 0110 6 1101 0101 5 1100 0100 4 1011 0011 3 1010 0010 2 1001 0001 1 1000 0000 0 N N   DECIM AL SIGN BIT LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 53. 53 Number systems Ex 1. Find the sign/mag representation of - 610 Step1: find binary representation using 8 bits 610 = 000001102 Step2: if the number is a negative number flip left most bit 10000110 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 54. 54 Number systems Ex 2. Find the signmag representation of -3610 Step 1: find binary representation using 8 bits 3610 = 001001002 Step 2: if the number is a negative number flip left most bit 10100100 So: -3610 = 101001002 (in 8-bit sign/magnitude form) LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 55. 55 Number systems Ex 3. Find the signmag representation of 7010 Step 1: find binary representation using 8 bits 7010 = 010001102 Step 2: if the number is a negative number flip left most bit 01000110 (no flipping, since it is +ve) So: 7010 = 010001102 (in 8-bit sign/magnitude form) LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 56. 56 Number systems What is this signmag number? 100000002 The machine will think of it as - 0 , which is a non valid value. LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 57. 57 Number systems TWO’S COMPLEMENT REPRESENTATION Ex. Find the two’s complement representation of –610 Step1: find binary representation in 8 bits 610 = 000001102 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 58. 58 Number systems Step 2: Complement the entire positive number, and then add one 00000110 (complemented) -> 11111001 (add one) -> + 1 11111010 So: -610 = 111110102 (in 2's complement form) TWO’S COMPLEMENT REPRESENTATION LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 59. 59 Number systems Alternative method for step 2 Scan binary representation from right too left, find first one bit, from low-order (right) end, and complement the remaining pattern to the left. 00000110 (left complemented) --> 11111010 TWO’S COMPLEMENT REPRESENTATION LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 60. 60 Number systems Ex 2: Find the Two’s Complement of -7610 Step 1: Find the 8 bit binary representation of the positive value. 7610 = 010011002 Step 2: Find first one bit, from low-order (right) end, and complement the pattern to the left. 01001100 (left complemented) -> 10110100 So: -7610 = 101101002 (in 2's complement form, using any of above methods) LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 61. 61 Number systems Ex 3: Find the Two’s Complement of 7210 Step 1: Find the 8 bit binary representation of the positive value. 7210 = 010010002 Step 2: Since number is positive do nothing. So: 7210 = 010010002 (in 2's complement form, using any of above methods) LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 62. 62 Number systems Binary subtraction using 2’s compliment To subtract +7 from +3, we add the code for -7, 1001, to that of +3, 0011: 0011 (+3) +1001 (-7) 1100 (-4) The result, 1100, is the code for -4, the result of subtracting +7 from +3. LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 63. BINARY CODES Grey Code BCD Code Excess -3 Code Parity and Hamming Code ASCII Code MODULE 1 63 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 64. 64 Number systems BCD The BCD is simply the 4 bit representation of the decimal digit. For multiple digit base 10 numbers, each symbol is represented by its BCD digit What happened to 6 digits not used? LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 65. 65 Would it be easy for you if you can replace a decimal number with an individual binary code? Such as 00011001 = 1910 The 8421 code is a type of BCD to do that. BCD code provides an excellent interface to binary systems: Keypad inputs Digital readouts Number systems BCD LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 66. 66 ex1: dec-to-BCD (a) 35 (b) 98 (c) 170 (d) 2469 ex2: BCD-to-dec (a) 10000110 (b) 001101010001 (c) 1001010001110000 Decimal Digit 0 1 2 3 4 5 6 7 8 9 BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 Let’s crack these… Note: 1010, 1011, 1100, 1101, 1110, and 1111 are INVALID CODE! BCD Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 67. 67 Number systems BCD OPERATION Consider the following BCD operation Decimal: Add 4 + 1 Covert to binary 0 1 0 0 And 0 0 0 1 Getting 0 1 0 1 Which is still a BCD representation of a decimal digit LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 68. 68 Number systems A second example  3 0 0 1 1  +3 0 0 1 1 Getting 6 or 0 1 1 0 And in range and a BCD digit representation LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 69. 69 Number systems AND NOW Consider 5 + 5 5 0 1 0 1 +5 0 1 0 1 giving 1 0 1 0 which is binary 10 but not a BCD digit! What to do? Try adding 6 !! LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 70. 70 Number systems ADDING 6 Had 1010 and want to add 6 or 0110  so 1 0 1 0  plus 6 0 1 1 0 Giving 1 0 0 0 0 Or a carry out to the next binary digit, or if the binary in BCD, the next BCD digit. LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 71. 71 Number systems ANOTHER CARRY EXAMPLE Add 7 + 6  have 7 0 1 1 1  plus 6 0 1 1 0 Giving 1 1 0 1 and again out of range Adding 6 0 1 1 0 Giving 1 0 0 1 1 so a 1 carries out to the next BCD digit FINAL BCD answer 0001 0011 or 1310 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 72. 72 Number systems MULTIBIT BCD Add the BCD for 417 to 195 Would expect to get 612 BCD setup - start with Least Significant Digit  0 1 0 0 0 0 0 1 0 1 1 1  0 0 0 1 1 0 0 1 0 1 0 1  1 1 0 0 Adding 6 0 1 1 0 Gives 1 0 0 1 0 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 73. 73 Number systems CONTINUING MULTIBIT Had a carry to the 2nd BCD digit position  1  0 1 0 0 0 0 0 1 done  0 0 0 1 1 0 0 1 0 0 1 0  1 0 1 1 Again must add 6 0 1 1 0 Giving 1 0 0 0 1 And another carry LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 74. 74 Number systems STILL CONTINUING MULTIBIT Had a carry to the 3rd BCD digit position  1  0 1 0 0 done done  0 0 0 1 0 0 0 1 0 0 1 0  0 1 1 0 And answer is 0110 0001 0010 or the BCD for the base 10 number 612 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 75. 75 Number systems GRAY CODES Gray code. The reflected binary code (RBC), also known as Gray code after Frank Gray, is a binary numeral system where two successive values differ in only one bit (binary digit). The reflected binary code was originally designed to prevent spurious output from electromechanical switches. LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 76. 76 The Gray code is unweighted and is not an arithmetic code. There are no specific weights assigned to the bit positions. Important: the Gray code exhibits only a single bit change from one code word to the next in sequence. Number systems GRAY CODES LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 77. 77 GRAY CODES Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 78. 78 Number systems Binary-to-Gray code conversion The MSB in the Gray code is the same as corresponding MSB in the binary number. Going from left to right, add each adjacent pair of binary code bits to get the next Gray code bit. Discard carries. ex: convert 101102 to Gray code 1 + 0 + 1 + 1 + 0 binary 1 1 1 0 1 Gray LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 79. 79 Number systems Gray-to-Binary Conversion The MSB in the binary code is the same as the corresponding bit in the Gray code. Add each binary code bit generated to the Gray code bit in the next adjacent position. Discard carries. ex: convert the Gray code word 11011 to binary 1 1 0 1 1 Gray + + + + 1 0 0 1 0 Binary LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 80. 80 Number systems The Excess-3 (XS-3) BCD code does not use the principle of positional weights into consideration while converting the decimal numbers to 4-bit BCD system. Therefore, we can say that this code is a non- weighted BCD code. The function of XS-3 code is to transform the decimal numbers into their corresponding 4-bit BCD code. In this code, the decimal number is transformed to the 4-bit BCD code by first adding 3 to all the digits of the number and then converting the excess digits, so obtained, into their corresponding 8421 BCD code. Therefore, we can say that the XS-3 code is strongly related with 8421 BCD code in its functioning. The Excess-3 (XS-3) Code LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 81. 81 Number systems Decimal digits Excess-3 BCD code 0 0011 1 0100 2 0101 3 0110 4 0111 5 1000 6 1001 7 1010 8 1011 9 1100 The Excess-3 (XS-3) Code LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 82. 82 Number systems ASCII CODES ASCII stands for American Standard Code for Information Interchange The code uses 7 bits to encode 128 unique characters It has the word length 7 and codes decimal digits, the characters of the latin alphabet as well as special character. From the 128 possible binary words are 32 pseudo-words and/or control characters. LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 83. 83 Number systems ASCII CODES LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 84. 84 Number systems ERROR DETECTION / CORRECTING CODES Why might we need Error detection/correction? Even & Odd Parity  Error detection Hamming code  Used for error detection & error correction LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 85. 85 Number systems PARITY BITS ASCII – 7 bit code (hex 00 to 7F) Could use “8th” bit for parity bit: X1011010  Even parity: make total number of “1” bits is even 01011010 Odd parity: make total number of “1” bits odd 11011010 If a parity bit is added to a bit stream, then there is a basis to check for bit(s) being corrupted. LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 86. 86 Number systems Suppose you receive a binary bit word “0101” and you know you are using an odd parity. Is the binary word errored? The answer is yes:  There are 2 1-bit, which is an even number  We are using an odd parity  So there must have an error. LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 87. 87 Number systems A single bit is appended to each data chunk makes the number of 1 bits even/odd Example: even parity (1)1000000 (0)1111101 (1)1001001 Example: odd parity (0)1000000 (1)1111101 (0)1001001 LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 88. 88 Number systems Suppose you are using an odd parity. What should the binary word “1010” look like after you add the parity bit? Answer: There is an even number of 1-bits.  So we need to add another 1-bit Our new word will look like “10101”. LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 89. 89 Number systems Hamming Code (7,4) [1 bit error correction] A Hamming code is a linear error-correcting code named after its inventor, Richard Hamming. Hamming codes can detect up to two bit errors, and correct single-bit errors. This method of error correction is best suited for situations in which randomly occurring errors are likely, not for errors that come in bursts. LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 90. 90 Number systems 1 2 3 4 5 6 7 P1 P2 D3 P4 D5 D6 D7 The format of a Hamming code is: •Here 1,2,4 are the parity bits and 3,5,6,7 are the Information/Data bits LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 91. 91 Example: Encode the data bits 1101 into a 7-bit even parity Hamming code. Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 92. 92 Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 93. 93 Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 94. 94 Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA
  • 95. 95 Number systems LOGIC SYSTEM DESIGN||MODULE 1||DR. BIBIN VINCENT||ASSOCIATE PROFESSOR||KMEA