Engin112-F07-L20-dec-mux

Engin112-F07-L20-dec-mux - Engin112 Lectures 19-21...

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

View Full Document Right Arrow Icon
Maciej Ciesielski Department of Electrical and Computer Engineering 10/19/2007 Engin112 – Lectures 19-21 Comparators, Decoders, MUXes 10/19/2007 Engin 112 - Intro to ECE 2 Recap from last lectures ± Standard arithmetic components (combinational) y Adders/subtractors y Multipliers ± Modeling combinational logic with Verilog HDL Today’s lecture: ± Other arithmetic blocks y Comparators y Decoders y Encoders y Multiplexers (MUX) ± Modular design y Implementing combinational logic with decoders and MUXes
Background image of page 1

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

View Full DocumentRight Arrow Icon
10/19/2007 Engin 112 - Intro to ECE 3 Motivation - ALU Design A B invert ALU = Arithmetic Logic Unit (Add, Sub, And, Or) Cin Result Select 1-bit Full Adder Cout MUX ADD AND OR 10/19/2007 Engin 112 - Intro to ECE 4 Motivation – CPU Design Example of computer program (in assembly language) ld r3, 5 (load r3 Å 5) ld r5, 8 (load r5 Å 8) . . . . cmp r3,r5 (compare r3,r5) jmpn stop ( r3 < r5 ? ) sub r5, r3 (r5 Å r5-r3) stop Memory Registers A B R0 R3 R31 ALU Status: N,Z,V ALU control Decoder 5 32 R5 …… …… …… Result deMUX
Background image of page 2
10/19/2007 Engin 112 - Intro to ECE 5 Magnitude Comparator ± Need to compare two numbers: A and B y A > B ?, A = B ?, A < B ? ± How many truth table entries for n -bit numbers? y 2 2n entries y Impractical for design ± How can we determine that two numbers are equal? y Equal if every digit is equal y A 3 A 2 A 1 A 0 = B 3 B 2 B 1 B 0 iff A 3 = B 3 and A 2 = B 2 and A 1 = B 1 and A 0 =B 0 ± New function: x i indicates if A i = B i y x i = A i B i + A i ’B i (XNOR) y Thus, (A = B) = x 3 x 2 x 1 x 0 ± What about A < B and A > B ? 10/19/2007 Engin 112 - Intro to ECE 6 Magnitude Comparator ± Case 1 : A > B y How can we tell that A > B ? y Look at most significant bit where A and B differ » If A = 1 and B = 0 , then A > B » If not, then A B ± Function (n = 4) : y If difference in first digit: A 3 B 3 y If difference in second digit: x 3 A 2 B 2 » Conditional that A 3 = B 3 ( x 3 =1 if : A 3 =B 3 ) y Similar for all other digits ± Comparison function A > B : y (A > B) = A 3 B 3 ’+ x 3 A 2 B 2 ’+ ±x 3 x 2 A 1 B 1 3 x 2 x 1 A 0 B 0 ± Case 2 : A < B y swap A and B for A < B
Background image of page 3

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

View Full DocumentRight Arrow Icon
10/19/2007 Engin 112 - Intro to ECE 7 Magnitude Comparator Circuit ±
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

Engin112-F07-L20-dec-mux - Engin112 Lectures 19-21...

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

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