Chapter 11Chapter 11
CODES, CONVERTERS, COMPARATORS, AND LOGIC
OPERATION PROCESSING
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 2
Lesson 4
Logic Operations AND, OR, XOR and TEST Between two words
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 3
Outline• OR Logic operation between two
words• AND Logic operation between two
words• XOR Logic operation between two
words• Test Logic operation between two
words
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 4
OR Operation Y = A .OR .B• OR between two word of four bits:• Y0’ = A0 + B0; • Y1’ = A1 + B1; • Y2’ = A2 + B2; • Y3’ = A3 + B3; • ZF = Y0’.Y1’.Y2’.Y3’ [If bit wise OR
results in ZF = 1 when all input as well as output bits = 0s, then ZF sets to 1.]
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 5
OR Array based for OR Operation
A3
B3
Y3
A2
B2
Y2
A1
B1
Y0
A0B0
A OR B = 0or Zero Flag
Y1
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 6
Example
• 10101010• 01010101• Bit wise OR ‘operation gives all bits Y0’ to
Y7’ = 1. Result is 11111111 and ZF = 0.(ZF = 1 means at least one bit = 1 in A or B does not exist. All bits in A and B are 0s.)
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 7
Outline• OR Logic operation between two
words• AND Logic operation between two
words• XOR Logic operation between two
words• Test Logic operation between two
words
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 8
AND Operation Y = A.AND.B• AND between two word of four bits:• Y0’ = A0 . B0; • Y1’ = A1 . B1; • Y2’ = A2 . B2; • Y3’ = A3 . B3; • ZF = Y0’+Y1’+Y2’+Y3’ [If bit wise AND
results in all output bits when each word has different bit at each bit places, results = 0s, then ZF sets to 1.It means A is 1’s complement of B. ]
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 9
AND Array based for AND Operation
A3
B3
Y3
A2
B2
Y2
A1
B1
Y0
A0B0
A AND B = 0or Zero Flag= 1
Y1
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 10
Example
• 10101010• 01010101• Bit wise AND ‘operation gives all bits Y0’
to Y7’ = 0s. Result is 00000000 and ZF = 1(A is 1’s complement of B)
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 11
Outline• OR Logic operation between two
words• AND Logic operation between two
words• XOR Logic operation between two
words• Test Logic operation between two
words
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 12
XOR Operation• AND between two word of four bits:• Y0’ = A0 + B0; • Y1’ = A1 + B1; • Y2’ = A2 + B2; • Y3’ = A3 + B3; • ZF = Y0’ .Y1’.Y2’.Y3’ [If bit wise XOR
results in all output bits = 0s, then ZF sets to 1. Bits of A and B are matching]
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 13
XOR Array based for XOR Operation
A3
B3
Y3
A2
B2
Y2
A1
B1
Y0
A0B0
A XOR B = 0or ZeroFlag
Y1
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 14
Example
• 10101010• 01010101• Bit wise XOR ‘operation gives all bits Y0’
to Y7’ = 1. Result is 11111111 and ZF = 0
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 15
Outline• OR Logic operation between two
words• AND Logic operation between two
words• XOR Logic operation between two
words• Test Logic operation between two
words
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 16
Test means hypothetical AND Operation Y = A.AND.B
• AND between two word of four bits:• Y0’ = A0 . B0; • Y1’ = A1 . B1; • Y2’ = A2 . B2; • Y3’ = A3 . B3; • Y= Y0’.Y1’.Y2’.Y3’ [Y = 1 means If
all bits of A and B are 1s. ]
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 17
AND Array based for test Operation whether all bits of A and B are 1
A3
B3
YA2
B2
A1
B1
Y0
A0B0
A AND B = 0or Zero Flag= 1
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 18
Summary
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 19
Result of OR, AND, XOR and Test operations is after logic operations on each bit of two words.
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 20
End of Lesson 4
Logic Operations AND, OR, XOR and TEST Between
two words
Ch11L4-"Digital Principles and Design", Raj Kamal, Pearson Education, 2006 21
THANK YOU
Top Related