EECC341 - ShaabanEECC341 - Shaaban#1 Lec # 12 Winter 2001 1-23-2002Combinational Comparators• Comparing two binary inputs A, B each n bits for equality (i.e A = B)is a common operation in computers.• A single output combinational circuit to accomplish this can beconstructed using n 2-input XNOR gates for bit-wise comparison plusone n-input AND gate. The output = 1 if A = B• This can also be done by subtraction (A - B) and checking for a zeroresult using a single n-input NOR gate.• Example: 1-bit comparator: A, B 1-bit each.– The 1-bit comparison requires a single XNOR gateTruth table:A B (A ⊕ B)’0 0 10 1 01 0 01 1 1Output(A ⊕⊕ B)’AB1-bit comparatorOutputEECC341 - ShaabanEECC341 - Shaaban#2 Lec # 12 Winter 2001 1-23-2002Example: 4-bit ComparatorComparatorOutputA3B3Compares A = A3 A2 A1 A0 with B = B3 B2 B1 B0 Output = 1 if A = BA2B2A1B1A0B0EECC341 - ShaabanEECC341 - Shaaban#3 Lec # 12 Winter 2001 1-23-2002Combinational Shift Circuits• An n-bit shift circuit (shifter) has a single n-bit data input A, and asingle n-bit output R and a number of control inputs to determinethe shift amount (0 to n-1).• Possible shift operations include:– Shift left or right:• Arithmetic right shift (the sign bit is shifted in),• logic shift (0 is shifted in)• Rotate left or right.• Example: Original data input A = 11011• Shift left by one : 10110• Logic shift right by one: 01101• Arithmetic shift right by one: 11101• Rotate left by one: 10111• Combinational shift circuits are usually constructed using a numberof levels of multiplexeres.EECC341 - ShaabanEECC341 - Shaaban#4 Lec # 12 Winter 2001 1-23-2002Example: Combinational 8-Bit Right Shifter10Mux select SABDBasic Building Block 2-to-1 Mux101010101010101010101010101010101010101010101010S2 S1 S0A0A1A2A3A4A5A6A7R0R1R2R3R4R5R6R7• Propagation delay: 2 gate delays per level x 3 levels = 6 gate delays• How many Mux levels for 32-bit shifter? Propagation delay?S2 S1 S0shift amount from 0 to 7Connect to: 0 for logicright shiftor to A7for arithmetic right shiftor to A0 - A6for rotate right{Three levels of Muxes
View Full Document