Conditional-Sum Adders and Parallel Prefix Network Adders ECE 645: Lecture 5.
Adders - facultystaff.richmond.edu
Transcript of Adders - facultystaff.richmond.edu
![Page 1: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/1.jpg)
Adders
Lecture 12CS301
![Page 2: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/2.jpg)
Administrative
• Read Appendix C.5, C.7-C.10• Program #1 due 10/24
![Page 3: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/3.jpg)
FP Bias
• Infinity is represented asw exponent is all 1sw significand is all 0s
![Page 4: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/4.jpg)
Review
• MUX
• DeMux
• Decoder
• Encoder
![Page 5: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/5.jpg)
Combinational Logic
• Half-Adderw No carry in A B Sum Carry
Out 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1
A⊕B AB
![Page 6: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/6.jpg)
1-bit Full Adder
• Three inputs:w Aw Bw Cin
• Two outputs:w Sum = (A⊕B) ⊕ Cin
w Cout = AB + (A⊕B) Cin
![Page 7: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/7.jpg)
Combinational Logic
• Full Adder
Note: Cout = (b Cin) + (a Cin) + (a b) + (a b Cin) = (b Cin) + (a Cin) + (a b) = (a b) + (a + b) Cin
![Page 8: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/8.jpg)
Ripple Carry Adder
• Construct n-bit adder with n 1-bit adders
• Delay is problem• Faster alternative:
w Carry-lookahead adder
![Page 9: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/9.jpg)
Designing connections
• Problem: Ripple-carry adder is too sloww Each carry must wait for all previous units
to complete execution• Solution:
![Page 10: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/10.jpg)
Designing connections
• Problem: Ripple-carry adder is too sloww Each carry must wait for all previous units
to complete execution• Solution:
w Quickly get information for carriesw Compute carries in parallel
![Page 11: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/11.jpg)
1b Adder
• Three inputs:w Aw Bw Cin
• Two outputs:w Sum = (A⊕B) ⊕ Cin
w Cout = AB + (A⊕B) Cinw Cout = AB + ACin +
BCin
![Page 12: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/12.jpg)
Carry Look-ahead
We already know:ci+1 = (bi � ci) + (ai � ci) + (ai � bi)
= (ai � bi) + ci � (ai + bi)
![Page 13: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/13.jpg)
Carry Look-ahead
We already know:ci+1 = (bi � ci) + (ai � ci) + (ai � bi)
= (ai � bi) + ci � (ai + bi)
= Gi + Ci � PiLet’s calculate ci+1 without waiting for ci
Generate Propagate
![Page 14: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/14.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
P3 G3 P2 G2 P1 G1 P0 G0
Carry Lookahead Logic C0
C1 = G0 + C0 * P0
C1
![Page 15: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/15.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
P3 G3 P2 G2 P1 G1 P0 G0
Carry Lookahead Logic C0
C1 = G0 + C0 * P0
C1
![Page 16: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/16.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Lookahead Logic C0
C1 = G0 + C0 * P0
P3 G3 P2 G2 P1 G1 P0 G0 C1
![Page 17: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/17.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Lookahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2
![Page 18: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/18.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Lookahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2
![Page 19: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/19.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Lookahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2
![Page 20: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/20.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Lookahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2
![Page 21: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/21.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Look-ahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2
![Page 22: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/22.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Look-ahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1 C3 = G2 + C2 * P2
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2 C3
![Page 23: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/23.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Look-ahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1 C3 = G2 + C2 * P2 = G2 + (G1 + G0 * P1 + C0 * P0 * P1) * P2
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2 C3
![Page 24: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/24.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Look-ahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1 C3 = G2 + C2 * P2 = G2 + (G1 + G0 * P1 + C0 * P0 * P1) * P2 = G2 + G1 * P2 + G0 * P1 * P2 + C0 * P0 * P1 * P2
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2 C3
![Page 25: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/25.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Look-ahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1 C3 = G2 + C2 * P2 = G2 + (G1 + G0 * P1 + C0 * P0 * P1) * P2 = G2 + G1 * P2 + G0 * P1 * P2 + C0 * P0 * P1 * P2
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2 C3
![Page 26: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/26.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Look-ahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1 C3 = G2 + C2 * P2 = G2 + (G1 + G0 * P1 + C0 * P0 * P1) * P2 = G2 + G1 * P2 + G0 * P1 * P2 + C0 * P0 * P1 * P2
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2 C3
![Page 27: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/27.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Look-ahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1 C3 = G2 + C2 * P2 = G2 + (G1 + G0 * P1 + C0 * P0 * P1) * P2 = G2 + G1 * P2 + G0 * P1 * P2 + C0 * P0 * P1 * P2
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2 C3
![Page 28: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/28.jpg)
Carry Look-ahead
1-bit ALU 1-bit ALU 1-bit ALU 1-bit ALU
B[3] B[2] B[1] B[0] A[3] A[2] A[1] A[0]
Carry Look-ahead Logic C0
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1 C3 = G2 + C2 * P2 = G2 + (G1 + G0 * P1 + C0 * P0 * P1) * P2 = G2 + G1 * P2 + G0 * P1 * P2 + C0 * P0 * P1 * P2
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2 C3
![Page 29: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/29.jpg)
Why is it Faster?
![Page 30: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/30.jpg)
![Page 31: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/31.jpg)
Why is it Faster?
• 4th bit waits only for p&g to be calculated, not all of the computations from bits 0-2
• Only three levels of computation
w Gi and Piw ANDw OR
C1 = G0 + C0 * P0 C2 = G1 + C1 * P1 = G1 + ( G0 + C0 * P0 ) * P1 = G1 + G0 * P1 + C0 * P0 * P1 C3 = G2 + C2 * P2 = G2 + (G1 + G0 * P1 + C0 * P0 * P1) * P2 = G2 + G1 * P2 + G0 * P1 * P2 + C0 * P0 * P1 * P2
![Page 32: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/32.jpg)
The Next Step
4-bit ALU 4-bit ALU 4-bit ALU 4-bit ALU
B[12-15] B[8-11] B[4-7] B[0-3] A[12-15] A[8-11] A[4-7] A[0-3]
Carry Look-ahead Logic C0
P3 G3 P2 G2 P1 G1 P0 G0 C1 C2 C3
Now what is the equation for Pi & Gi? They are for the 4-bit ALU, not just one bit!
![Page 33: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/33.jpg)
Basic Memory Cells and Sequential Logic
![Page 34: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/34.jpg)
Sequential Logic and Clocks
• Sequential logic retains state• Clocks specify when that state should
be updated• System using clocks called
synchronous
![Page 35: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/35.jpg)
Clock
• Signal with fixed cycle time (Tcycle)
• Frequency: 1/Tcycle• Tcycle has two parts
delineated by two edgesw Clock highw Clock low
Tcycle
Rising edge
Falling edge
![Page 36: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/36.jpg)
Clocks (cont.)
![Page 37: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/37.jpg)
Memory Elements
• All memory elements store statew Output depends both on inputs and the
value stored inside the memory element• Thus: All logic blocks containing
memory elements contain state and are sequential!
![Page 38: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/38.jpg)
Unclocked Latch
![Page 39: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/39.jpg)
Clocked Latch
![Page 40: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/40.jpg)
D Flip-Flop
• D flip flop stores 1 bit of data• Created from 2 edge triggered D
latches• Only takes in new inputs when clock is
high
![Page 41: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/41.jpg)
Register
• D flip-flop allows us to store 1 bit• Programmers don’t programming in bits, but
w char = 8 bw integer = 32 bw ...
• String n D flip-flops together to store n bits
4b register implement with D flip-flops
b3 b2 b1 b0
![Page 42: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/42.jpg)
Register Files
• Contains set of registers accessed by register numw Input: register
numberw Output: data in
registern entry register file
![Page 43: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/43.jpg)
Register Files
• Componentsw Array of registers built
from flip-flops• Port
w Access pointw Read port
§ register numw Write port
§ register num, clock, data
2 read ports / 1 write port
![Page 44: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/44.jpg)
Register File:Read Ports
![Page 45: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/45.jpg)
Register File:Write Port
![Page 46: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/46.jpg)
Comparator
• Comparator has three output linesw A<Bw A=Bw A>B
![Page 47: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/47.jpg)
Comparator
![Page 48: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/48.jpg)
Comparator
![Page 49: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/49.jpg)
Comparator
![Page 50: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/50.jpg)
We Almost Have All the Pieces
• Inverter, AND, OR• Multiplexor and demultiplexor• Decode and encoder• Comparator• Ripple carry adder and carry lookahead adder
w Half and full adder• Register file
w Registersw D flip flop
![Page 51: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/51.jpg)
Arithmetic Logic Unit
• Circuitry that does arithmetic (+/-) and logical operations (AND/OR)
• MIPS has 32b quantities so ALU needs to handle 32b numbers
• Combine 32 1-b ALUs to create 32b ALU
![Page 52: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/52.jpg)
AND/OR
![Page 53: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/53.jpg)
1b Adder
• Three inputs:w Aw Bw Cin
• Two outputs:w Sum = (A⊕B) ⊕ Cin
w Cout = AB + (A⊕B) Cin
![Page 54: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/54.jpg)
1b ALU
![Page 55: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/55.jpg)
32b ALU
![Page 56: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/56.jpg)
Subtraction
• Add negative version of operand
• Recall to get two’s complement number:w Invert all bitsw Add 1
• In hardwarew Use complements of
all bitsw Set CarryIn for LSB to
1A+(B+1) = A+(-B)=A-B
![Page 57: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/57.jpg)
SLT
if (A < B) C=1 else C=0
• Resulting 32bw 31b set to 0w Least significant bit set
according to operation• Least significant bit
w Sign bit of (a-b)• In hardware,
w Set input for MUX to 0 for 31 MSB (Less)
![Page 58: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/58.jpg)
SLT
• Resulting 32bw 31b set to 0w Least significant bit set
according to operation• Least significant bit
w Sign bit of (a-b)• In hardware,
w Set input for MUX to 0 for 31 MSB
w For LSB, need to grab output of adder of MSB (SET) and set it as input to MUX ALU for MSB
![Page 59: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/59.jpg)
32b ALU w/ SLT
![Page 60: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/60.jpg)
32b ALU w/ SLT
![Page 61: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/61.jpg)
Conditional Branch Instructions
• Branch if 2 registers equal or unequal
• Easiest way:w Test (a-b) == 0
• In hardware,w OR all outputs togetherw InvertZero = (o31+o30+...+o0)
![Page 62: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/62.jpg)
Review: ALU
• AND/OR• Addition/
Subtraction• SLT• Conditional
branches
![Page 63: Adders - facultystaff.richmond.edu](https://reader030.fdocuments.in/reader030/viewer/2022012721/61b385eaa35e973ae53a096f/html5/thumbnails/63.jpg)
What More Do We Need?
• Multiplication• Division