WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin...

20
WEEK 4 DISCUSSION CSE 140

Transcript of WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin...

Page 1: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

WEEK 4 DISCUSSIONCSE 140

Page 2: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

Topics for TodayEncoder

Demultiplexer

Adder

Subtractor

Comparator

Shifters

Multiplier

ALU

Page 3: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

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

Page 4: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

Demultiplexers

Page 5: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

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 ?

Page 6: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

Adder

Page 7: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

Ripple Carry Adder

If Each Full Adder has a delay of 5 ms , what is the delay of the above circuit ?

20ms

Page 8: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

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

Page 9: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

C1 = G0 + P0.C0

Page 10: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

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.

Page 11: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

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

Page 12: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

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

Page 13: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

Comparator

A’B -> A < B

AB’ -> A > B

(AB’ + A’B)’ -> A = B

What do the outputs in the above case signify ?

Page 14: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

Multiplier

Page 15: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

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

Page 16: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

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

Page 17: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

What is the output of the above sequence of Shifters ?

Arithmetic Shifter111011111101

Rotator111011110111101111

Logical Shifter010111001011000101

000101

Page 18: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

ALU

Page 19: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

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

Page 20: WEEK 4 DISCUSSION CSE 140 - University of California ...WEEK 4 DISCUSSION CSE 140 Author admin Created Date 10/24/2015 7:59:04 PM ...

Division7 / 3

-3 = 1100 + 1 = 1101

111 (Carry)01111101 0100 Quotient = 1

100 (Carry)010011010001 Quotient = 2

0001 < 0011 => Quotient = 2 ; Remainder = 1