Magnitude Comparator Lecture L6.4 Section 6.1.

Slides:



Advertisements
Similar presentations
Logic Gates.
Advertisements

Digital Circuits. Review – Getting the truth table The first step in designing a digital circuit usually is to get the truth table. That is, for every.
Modulo-N Counters Module M10.4 Section 7.2.
Encoders Module M9.3 Section 6.3. Encoders Priority Encoders TTL Encoders.
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Logic Circuits Design presented by Amr Al-Awamry
Demultiplexers Module M6.4 Section 6.4. Demultiplexers YIN 1 x 4 DeMUX d0d1 Y0 Y1 Y2 Y3 Y0 Y1 Y2 Y3 d1d0 0 0 YIN YIN YIN
Verilog Modules for Common Digital Functions
7-Segment Displays Lecture L6.1 Section 6.3. Turning on an LED.
Comparators Combinational Design.
ECE 3110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices XOR, Parity Circuits, Comparators.
ReturnNext A circuit that compares two binary words and indicates whether they are equal is called a comparator. Some comparators interpret their input.
Binary-to-BCD Converter Lecture L6.2 Section 6.5 pp
Lecture. Outline Bits Gates Combinatorial Logic Spice Hands-On Stuff.
Multiplexers Lecture L6.4 Section 6.4.
CS 151 Digital Systems Design Lecture 15 Magnitude Comparators and Multiplexers.
Subtractors Module M8.2 Section 6.2. Subtractors Half Subtractor Full Subtractor Adder/Subtractor - 1 Adder/Subtractor - 2.
Digital Electronics Dan Simon Cleveland State University ESC 120 Revised December 30, 2010.
Equality Detector Lecture L6.1 Section 6.1. Equality Detector XNOR X Y Z Z = !(X $ Y) X Y Z
Shifter Lecture L7.4 Group HW #4 Section 10.3.
Arithmetic Logic Unit (ALU) Lecture L7.5 Section 7.5.
Multiplexers Module M6.1 Section 6.4. Multiplexers A 4-to-1 MUX TTL Multiplexer A 2-to-1 MUX.
2’s Complement 4-Bit Saturator
Adders Lecture L7.1 Section 6.2 Section 10.4 (pp )
Shifters Lecture L7.4 Section 7.4. MODULE shift TITLE 'shifter' DECLARATIONS " INPUT PINS " D3..D0 PIN 11,7,6,5; D = [D3..D0]; s2..s0 PIN 3,2,1; S.
Decoders Module M9.1 Section 6.3. Decoders TTL Decoders.
Section 2.6 Question 1. Section 2.6 Answer 1 Section 2.6 Question 2.
Equality Detector Lecture L6.3 Section 6.1. Equality Detector XNOR X Y Z Z = !(X $ Y) X Y Z
Combinational Comparators
1 Carry-Ripple Adder Using full-adder instead of half-adder for first bit, we can include a “carry in” bit in the addition –Will be useful later when we.
Multiplexers Lecture L6.6v Section 6.2. Multiplexers A Digital Switch A 2-to-1 MUX A 4-to-1 MUX A Quad 2-to-1 MUX The Verilog if…else Statement TTL Multiplexer.
ENGIN112 L12: Circuit Analysis Procedure September 29, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 12 Circuit Analysis Procedure.
1 Comparators: Procedures Discussion D9.2 Example 22.
CS 210.  How do we represent data in a computer? ◦ Easy to recognize two conditions:  1. Presence of a voltage – we’ll call this state “1”  2. Absence.
Circuit, State Diagram, State Table
Digital Electronics.
Digital Electronics Understanding truth tables. AND gate How many lines did a 2-input AND gate truth table have? ABZ (output) Answer:4.
Digital Electronics Truth tables for several gates Aberdeen Grammar School.
Digital Systems I EEC 180A Lecture 4 Bevan M. Baas.
Digital Electronics Lecture 6 Combinational Logic Circuit Design.
Exclusive OR Gate. Logically, the exclusive OR (XOR) operation can be seen as either of the following operations:exclusive OR (XOR) 1. A AND NOT B OR.
Combination of logic gates  Logic gates can be combined to produce more complex functions.  They can also be combined to substitute one type of gate.
Abdullah Said Alkalbani University of Buraimi
4.6 Model Direct Variation
UNIT 8 COMBINATIONAL CIRCUIT DESIGN AND SIMULATION USING GATES
Comparators Combinational Design. Comparators Equality and Magnitude Comparators –CSE 171 (Designed using CUPL) TTL Comparators Comparator Networks Cascading.
ECE 2110: Introduction to Digital Systems
Logic Gates Practical Objective: to develop an understanding of logic circuits and truth tables.
ECE 2110: Introduction to Digital Systems
Magnitude Comparator Module M5.2 Section 6.1.
Logic Gates.
Logic Gates Benchmark Companies Inc PO Box Aurora CO
Exclusive OR Gate.
Reference: Chapter 3 Moris Mano 4th Edition
KS4 Electricity – Electronic systems
KS4 Electricity – Electronic systems
Logic Design Review – 2 Basic Combinational Circuits
Schematics 201 Lecture Topic: Electrical Symbols
Behavioral/RTL Description (HDL)
Logic Gates.
Logic Gates.
KS4 Electricity – Electronic systems
Gates Type AND denoted by X.Y OR denoted by X + Y NOR denoted by X + Y
Logic Gates.
Digital Logic Experiment
Magnitude Comparator Lecture L6.2 Section 6.1.
Single bit comparator Single bit comparator 4/10/2007 DSD,USIT,GGSIPU
Department of Electronics
Digital Circuits.
ACOE101: Freshman Computer Engineering Fall 2018
Presentation transcript:

Magnitude Comparator Lecture L6.4 Section 6.1

4-Bit Equality Detector A_EQ_B B[3..0]

Magnitude Comparator A_LT_B A[3..0] Magnitude Detector A_EQ_B B[3..0] A_GT_B

Magnitude Comparator How can we find A_GT_B? How many rows would a truth table have? 28 = 256!

Magnitude Comparator Find A_GT_B Because A3 > B3 i.e. A3 & !B3 = 1 If A = 1001 and B = 0111 is A > B? Why? Therefore, one term in the logic equation for A_GT_B is A3 & !B3

Magnitude Comparator A_GT_B = A3 & !B3 # ….. Because A3 = B3 and # ….. Because A3 = B3 and A2 > B2 i.e. C3 = 1 and A2 & !B2 = 1 If A = 1101 and B = 1011 is A > B? Why? Therefore, the next term in the logic equation for A_GT_B is C3 & A2 & !B2

Magnitude Comparator A_GT_B = A3 & !B3 # C3 & A2 & !B2 # ….. # ….. Because A3 = B3 and A2 = B2 and A1 > B1 i.e. C3 = 1 and C2 = 1 and A1 & !B1 = 1 If A = 1010 and B = 1001 is A > B? Why? Therefore, the next term in the logic equation for A_GT_B is C3 & C2 & A1 & !B1

Magnitude Comparator A_GT_B = A3 & !B3 # C3 & A2 & !B2 # C3 & C2 & A1 & !B1 # ….. Because A3 = B3 and A2 = B2 and A1 = B1 and A0 > B0 i.e. C3 = 1 and C2 = 1 and C1 = 1 and A0 & !B0 = 1 If A = 1011 and B = 1010 is A > B? Why? Therefore, the last term in the logic equation for A_GT_B is C3 & C2 & C1 & A0 & !B0

Magnitude Comparator A_GT_B = A3 & !B3 # C3 & A2 & !B2 # C3 & C2 & A1 & !B1 # C3 & C2 & C1 & A0 & !B0

Magnitude Comparator Find A_LT_B A_LT_B = !A3 & B3 # C3 & !A2 & B2 # C3 & C2 & !A1 & B1 # C3 & C2 & C1 & !A0 & B0

ABEL Program MODULE magcomp4 TITLE '4-BIT COMPARATOR, R. Haskell, 9/21/02‘ DECLARATIONS " INPUT PINS " A3..A0 PIN 11, 7, 6, 5; A = [A3..A0]; B3..B0 PIN 4, 3, 2, 1; B = [B3..B0]; " OUTPUT PINS " A_EQ_B PIN 36; A_LT_B PIN 35; A_GT_B PIN 37; C3..C0 NODE; C = [C3..C0];

ABEL Program (cont.) EQUATIONS C = !(A $ B); A_EQ_B = C0 & C1 & C2 & C3; A_GT_B = A3 & !B3 # C3 & A2 & !B2 # C3 & C2 & A1 & !B1 # C3 & C2 & C1 & A0 & !B0; A_LT_B = !A3 & B3 # C3 & !A2 & B2 # C3 & C2 & !A1 & B1 # C3 & C2 & C1 & !A0 & B0;

ABEL Program (cont.) test_vectors ([A, B] -> [A_EQ_B, A_LT_B, A_GT_B]) [0, 0] -> [1, 0, 0]; [2, 5] -> [0, 1, 0]; [10, 12] -> [0, 1, 0]; [7, 8] -> [0, 1, 0]; [4, 2] -> [0, 0, 1]; [6, 6] -> [1, 0, 0]; [1, 7] -> [0, 1, 0]; [5, 13] -> [0, 1, 0]; [12, 0] -> [0, 0, 1]; [6, 3] -> [0, 0, 1]; [9, 9] -> [1, 0, 0]; [12, 13] -> [0, 1, 0]; [7, 0] -> [0, 0, 1]; [4, 1] -> [0, 0, 1]; [3, 2] -> [0, 0, 1]; [15, 15] -> [1, 0, 0]; END

TTL Comparators 1 2 3 4 5 6 7 9 10 11 12 8 19 20 17 18 15 16 13 14 GND Vcc P>Q P0 Q0 P1 Q1 P2 Q2 P3 Q3 P=Q Q7 P7 Q6 P6 Q5 P5 Q4 P4 74LS682 B3 A<Bin A=Bin A>Bin A>Bout A=Bout A<Bout A3 B2 A2 A1 B1 A0 B0 74LS85

Cascading two 74LS85s

Question Draw a logic circuit for what is in the green box. P_GT_Q P_EQ_Q P_LT_Q 1 2 3 4 5 6 7 9 10 11 12 8 19 20 17 18 15 16 13 14 GND Vcc P>Q P0 Q0 P1 Q1 P2 Q2 P3 Q3 P=Q Q7 P7 Q6 P6 Q5 P5 Q4 P4 74LS682 Draw a logic circuit for what is in the green box.

Answer Outputs: Y = !(P_GT_Q) Z = !(P_EQ_Q) P_GT_Q = !Y NOT GATE P_EQ_Q = !Z NOT GATE P_LT_Q = !(P_GT_Q) & !(P_EQ_Q) = Y & Z AND GATE P_LT_Q = !(P_GT_Q # P_EQ_Q) = !(!Y # !Z) NOR GATE

Comparator Using Behavioral ABEL MODULE comp4bit TITLE '4-BIT COMPARATOR, R. Haskell, 7/29/02' DECLARATIONS " INPUT PINS " A3..A0 PIN 11,7, 6, 5; A = [A3..A0]; B3..B0 PIN 4, 3, 2, 1; B = [B3..B0]; A_EQ_B PIN 36; A_LT_B PIN 35; A_GT_B PIN 37;

Comparator Using Behavioral ABEL EQUATIONS A_EQ_B = (A == B); A_GT_B = (A > B); A_LT_B = !((A == B) # (A > B));

Comparator Using Behavioral ABEL test_vectors ([A, B] -> [A_EQ_B, A_LT_B, A_GT_B]) [0, 0] -> [1, 0, 0]; [2, 5] -> [0, 1, 0]; [10, 12] -> [0, 1, 0]; [7, 8] -> [0, 1, 0]; [4, 2] -> [0, 0, 1]; [6, 6] -> [1, 0, 0]; [1, 7] -> [0, 1, 0]; [5, 13] -> [0, 1, 0]; [12, 0] -> [0, 0, 1]; [6, 3] -> [0, 0, 1]; [9, 9] -> [1, 0, 0]; [12, 13] -> [0, 1, 0]; [7, 0] -> [0, 0, 1]; [4, 1] -> [0, 0, 1]; [3, 2] -> [0, 0, 1]; [15, 15] -> [1, 0, 0]; END