13. BCD ADDITION
• How computer will perform Addition of two
numbers using BCD Code ??
Decimal BCD Decimal BCD
4 0100 4 0100
+ 5 + 0101 + 8 1000
9 = 1001 12 1100
Invalid BCD No.
14. ADDITION WHEN SUM > 9
• If sum becomes Greater than 9:
• ADD 6 (0110) to the Binary Sum
• WHY add 6 ??
• We have 4-bits for BCD.
• n = 4
• Possible Combinations are: 2n = 24 = 16
• Used Combinations = 10 (0,1,..9)
• Unused Combinations = 16 – 10 = 6
16. EXAMPLES
(184 + 576)10 = (?)BCD
• Solve Units, Tens, Hundreds place separately
• Transfer Carry’s to the previous bits
• If sum exceeds 1001, ADD 6 (0110) to it
18. 2421 CODE
• Till decimal value 4 write the code
• Decimal value 5 is the 1’s Complement of Decimal
Value 4
• 6 is the complement of 3
• 7 is the complement of 2
• 8 is the complement of 1
• 9 is the complement of 0
23. GRAY CODE
• Like simple Binary Numbers
• Difference:
• Only 1 bit changes at a time
• ADVANTAGE
• Error Detection and Error Correction
• USES
• Rotating Shaft of an aero plane
26. BINARY TO GRAY CODE• First bit of Gray is same as First bit of Binary
• Compare the MSB of Binary with its next bit.
• If bits compared are same, write gray bit 0
• If bits compared are different, write gray bit1
• Number of bits should be Equal
(1 0 1 1 0 1)2 = (?)Gray
(1 1 1 0 1 1)Gray
27. ERROR DETECTION
• Detection of Errors during transmission
• Binary information is sent through WIRES
• Noise in the Wires can change 0 to 1 and 1 to
0
• A PARITY-BIT is added for error-detection
28. GRAY TO BINARY CODE• Start with MSB
• Binary bits are same as Gray bits up to and including first
1
• If Gray bit is 0, repeat the previous binary bit
• If Gray bit is 1, complement the previous binary bit
(0 0 1 1 1 0 1 1 )Gray = (?)2
(0 0 1 0 1 1 0 1)2
29. PARITY BIT
• An extra bit added to the information
• Added to make the total no. of 1’s in the coded group,
either ODD or EVEN
• Even Parity
• choose parity bit such that # of 1’s is even
• Odd Parity
• choose parity bit such that # of 1’s is odd
30. EXAMPLE
• Data=1000001, even parity=0, odd parity=1
• Data=1010100, even parity=1, odd parity=0
• Only one parity bit is used
31. ALPHANUMERIC CODES
• Upper Case Alphabets (A,B,..,Z)
• Lower Case Alphabets (a,b,..,z)
• Numeric Values (0,1,2…)
• Special Characters (@,$,*,%,#,^,…etc)
32. TYPES OF ALPHANUMERIC
CODES• ASCII (American Standard Code for Information
Interchange)
• 7-bit code
• EBCDIC (Extended BCD Interchange Code)
• 8-bit code
34. BINARY LOGIC
• Describes the Processing of Binary Information
• Is also called Boolean Algebra
• Uses 2 possible values:
• ‘1’ and ‘0’
• ‘yes’ and ‘no’
• ‘true’ and ‘false’
• Can be represented by variables: A, B, C, x, y, z, …
35. LOGICAL OPERATIONS
3 basic logical operations
• AND
• OR
• NOT
• Others can be derived from those (NAND, XOR, etc.)
36. AND Function• Operation:
• Two inputs
• Output = 1 if and only if both inputs are 1
• Symbolized by dot or absence of operator
x·y or xy
• Truth table
• Needs to consider 22 = 4 input combinations
• Graphic symbol
• AND gate
111
001
010
000
zyx
inputs output
37. OR Function
• Two inputs
• Output = 1 if any one or both inputs are 1
• Symbolized by “plus” sign: x + y
• Truth table
• Graphic symbol
• OR gate
x y z
0 0 0
0 1 1
1 0 1
1 1 1
38. NOT Function
• Complement operation
• Single input
• Inverts value of input
• Symbolized by prime x’ or over bar
• Truth table
• Input combinations on the left
• Output of function on the right
• Graphic symbol
• NOT gate
• Little circle indicates inversion
x x'
0 1
1 0
x
input output
39. MULTIPLE INPUTS
• Two inputs might not be enough
• 3-input AND gate:
• 4-input OR gate:
40. ALGEBRAS
• What is an algebra?
• Mathematical system consisting of
• Set of elements
• Set of operators
• Axioms or postulates
• Why is it important?
• Defines rules of “calculations”
• Example: arithmetic on natural numbers
• Set of elements: N = {1,2,3,4,…}
• Operator: +, –, *
• Axioms: associativity, distributivity, closure, identity elements, etc.
• Note: operators with two inputs are called binary
• Does not mean they are restricted to binary numbers!
43. TOPICS
• Boolean algebra
• Algebra axioms, postulates
• Boolean functions
• Algebraic expression
• Boolean Theorems
• Comparison of Boolean functions
• Canonical and standard forms
• sum of minterms
• Duality: DeMorgan’s theorem
• Dual canonical form (product of maxterms)
• Digital logic gates and integrated circuits
44. BOOLEAN ALGEBRA• Axioms and Postulates
1. Value of Variables
Variable x may have two values:
x = 0 or x = 1
2. IDENTITY
(+) OR: 0 + x = x + 0 = x
(.) AND: 1 . x = x . 1 = x
******* ALSO *******
1 + x = 1
0 . x = 0
45. BOOLEAN ALGEBRA3. Commutative Law
OR (+):x + y = y + x
AND(.): x . y = y + x
3. Distributive Law
OR/AND: x + (y . z) = (x + y) . (x + z)
AND/OR: x . (y + z) = (x . y) + (x . z)
3. Complement
OR: x + x’ = 1
AND: x . x’ = 0
• Redundance Law
OR/AND: x + (x’ . y) = x + y (using distributive law)
46. BOOLEAN ALGEBRA –
DE-MORGAN’S THEOREM1. x + y + z + … = x . y . z . …
2. x . y . z . … = x + y + z + …
ABSORPTION LAW
1. x + x . y = x
2. x . (x + y) = x
**** ALSO ****
x + x = x
x . x = x
47. VERIFICATION USING TRUTH
TABLES
• Using Truth Table, Verify Distributive Law:
x . (y + z ) = ( x . y ) + ( x . z )
We have 3 variables:
x , y, z
Possible Combinations: 23 = 8
48. SOLUTION: TRUTH TABLE
x y z y + z x . (y + z) x . y x . z (x . y) + (x . z)
0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1