EE101Lecture15

EE101Lecture15 - Introduction to Digital Logic Lecture 15:...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
© Mark Redekopp, All rights reserved Introduction to Digital Logic Lecture 15: Comparators
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© Mark Redekopp, All rights reserved Comparators Compare two numbers and produce relational conditions A<B, A=B, A>B, A ≤B, and A≥B
Background image of page 2
© Mark Redekopp, All rights reserved The only way one bit, A, can be greater than another bit, B, is if A=1 and B=0 The only way one bit, A, can be less than another bit, B, is if A=0 and B=1 A and B are equal when they are the same A B A=B A<B A>B 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 1 1 1 0 0
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© Mark Redekopp, All rights reserved The only way one bit, A, can be greater than another bit, B, is if A=1 and B=0 The only way one bit, A, can be less than another bit, B, is if A=0 and B=1 A and B are equal when they are the same A B A=B A<B A>B 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 1 1 1 0 0 XNOR A •B A •B A B A=B A B A>B A B A<B
Background image of page 4
© Mark Redekopp, All rights reserved Equality Check XNOR gate outputs 1 when two bits are equal To check whether two 4- bit numbers are equal use 4 XNOR gates to XNOR each pair of bits only if all the pairs are equal, are the 2 numbers equal (i.e. AND the outputs together) A B XNOR 0 0 1 0 1 0 1 0 0 1 1 1 A B A=B A 0 B 0 A 1 B 1 A 2 B 2 A 3 B 3 A 0 =B 0 A=B A 1 =B 1 A 2 =B 2 A 3 =B 3
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© Mark Redekopp, All rights reserved Greater-Than, Less-Than, Equal Find an algorithm to check whether one decimal number is greater than, less than, or equal to another 837 > 756 Start with the MSD, 8 > 7 and you’re done…any number with 8 in the 100’s place is greater than a number with 7 in the 100’s place 621 < 649 Start with the MSD, 6 = 6…you can’t tell yet which is greater or less than so move to the next digit 2 < 4 and you’re done 62x is always less than 64x Algorithm: Start with the MSD and keep comparing digits to the right. Once any digit of A is > or < corresponding digit of B then you know the whole number A > B or A < B, respectively. If all digits are equal then both number are equal.
Background image of page 6
© Mark Redekopp, All rights reserved Greater-Than Consider 2 numbers A (A 3 A 2 A 1 A 0 ) and B (B 3 B 2 B 1 B 0 ) There are 4 cases for when A > B A 3 > B 3 and who cares about the other bits
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 25

EE101Lecture15 - Introduction to Digital Logic Lecture 15:...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online