WEEK 4 DISCUSSION CSE 140
WEEK 4 DISCUSSIONCSE 140
Topics for TodayEncoder
Demultiplexer
Adder
Subtractor
Comparator
Shifters
Multiplier
ALU
Encoder
I0 I1 I2 I3 y1 y0
1 0 0 0 0 0
0 1 0 0 0 1
0 0 1 0 1 0
0 0 0 1 1 1What are the equations to represent y0 and y1 ?
y0 = EN.(I1 + I3)Y1 = EN.(I2 + I3)
4 : 2 Encoder
Demultiplexers
I = 1 ; S2 = 0 ; S1 = 1 ; S0 = 0 ===> Y2
I = 0 ; S2 = 1 ; S1 = 1 ; S0 = 0 ===> None
For the following inputs, which output bit has a value of 1 ?
Adder
Ripple Carry Adder
If Each Full Adder has a delay of 5 ms , what is the delay of the above circuit ?
20ms
Carry Lookahead Adder
Sum = Ai xor Bi xor Ci
Ci+1 = Ai Bi + Ai Ci + Bi Ci = Ai Bi + Ci (Ai xor Bi) = Gi + Ci Pi
C1 = G0 + P0.C0
Subtractor43 -23
101011 – 101112 ‘s complement of 010111 => 101000 + 1 = 101001
Adding01011 (Carry) 101011101001
1010100 (If Carry into sign bit is different to carry out , overflow has occurred ) . We drop the negative sign.010100 => 20.
23 -43
10111 - 1010112 ‘s complement of 101011 => 010100 + 1 = 010101
Adding010111 (Carry) 010111010101101100(If Carry into sign bit is different to carry out , overflow has occurred )
To get the answer we need to take 2’s complement of the answer above
101100 => 010011 + 1 = 010100Answer = -20
What does the above circuit represent ?
What happens when S is 0 and when S is 1 ?
S = 0 => A + B , S = 1 => A-B
Adder / Subtractor
Comparator
A’B -> A < B
AB’ -> A > B
(AB’ + A’B)’ -> A = B
What do the outputs in the above case signify ?
Multiplier
Compute 1011 x 1100 using the previous procedure
10111100
0 0 0 00 0 0 0 0
0 0 0 0 0 01 0 1 1 0 0
[1 1 1 1 0 0 0 ] Carry0 1 0 1 1 0 01 0 1 1 0 0 0
1 0 0 0 0 1 0 0
ShiftersLogical Shifter : shifts left / right and fills 0 in the empty spacesLeft Shift : 110 << 1Right Shift 110 >> 1
100011
Arithmetic Shifter : left shift is same as Logical , right shift adds previous MSB to the empty spaces110 << 1110 >> 1
100111
Rotator: rotates all the bits in a circular fashion wither to the left / right110 << 1110 >> 1
101011
What is the output of the above sequence of Shifters ?
Arithmetic Shifter111011111101
Rotator111011110111101111
Logical Shifter010111001011000101
000101
ALU
Write a table indicating the ALU operation for the below circuit for f(2-0). Let ai and bi represent each bit of A and B.
F(2-0) Operation
000 A XOR B
001 A OR B
010 A AND B
011 A+ B
100 A XOR ~B
101 A OR ~B
110 A AND ~B
111 A - B
Division7 / 3
-3 = 1100 + 1 = 1101
111 (Carry)01111101 0100 Quotient = 1
100 (Carry)010011010001 Quotient = 2
0001 < 0011 => Quotient = 2 ; Remainder = 1