Mathematics for Computer Science Adding in binary 6.042J/18.062J carry 1 1 1 39 is 100111 Digital Logic 28 is 011100 10 0 0 0 1 1 February 13, 2015 digital.1 February 13, 2015 digital.3 Albert R Meyer Albert R Meyer Binary addition circuit Adding in binary a 1 a 0 a 5 a 4 a 3 a 2 39 is 100111 b 2 b 1 b 0 b 5 b 4 b 3 28 is 011100 sum = 67 is 1000011 c 5 d 2 d 1 d 0 d 5 d 4 d 3 digital.4 digital.5 February 13, 2015 February 13, 2015 Albert R Meyer Albert R Meyer 1
Binary addition circuit Binary addition circuit a 4 a 3 a 2 a 1 a 0 a 5 1 1 0 0 1 1 b 4 b 3 b 2 b 1 b 0 b 4 b 3 b 2 b 1 b 0 b 5 b 5 1 0 0 0 1 1 c 1 c 0 c 4 c 3 c 2 c 5 c 5 1 d 1 d 0 d 1 d 0 d 5 d 4 d 3 d 2 d 5 d 4 d 3 d 2 0 0 1 1 0 0 “ripple carry” February 13, 2015 digital.6 February 13, 2015 digital.7 Albert R Meyer Albert R Meyer half Adder Binary addition circuit a b a 1 a 0 a 5 a 4 a 3 a 2 b 2 b 1 b 0 b 5 b 4 b 3 d :: = a XOR b d :: = a XOR b full full full full full half c :: = a AND b c 2 c 1 c 0 c 5 c 4 c 3 d 2 d 1 d 0 d 5 d 4 d 3 c d “ripple carry” https://en.wikipedia.org/wiki/Adder_(electronics) from digital.8 digital.10 February 13, 2015 February 13, 2015 Albert R Meyer Albert R Meyer 2
full Adder Binary addition circuit s :: = a XOR b a 4 a 3 a 2 a 1 a 0 a 5 d :: = c in XOR s b 4 b 3 b 2 b 1 b 0 b 5 c out ::= (c in AND s) OR (a AND b) d full full full full full half c in c 1 c 0 c 4 c 3 c 2 a c out c 5 half A d 1 d 0 d 5 d 4 d 3 d 2 s half b B “ripple carry” digital.11 February 13, 2015 February 13, 2015 digital.12 Albert R Meyer Albert R Meyer Ripple Carry formulas d 0 :: = a 0 XOR b 0 c 0 :: = a 0 AND b 0 s i :: = a i XOR b i d i :: = c i − 1 XOR s i c i ::= (c i-1 AND s i ) OR (a i AND b i ) digital.13 February 13, 2015 Albert R Meyer 3
MIT OpenCourseWare http://ocw.mit.edu 6.042J / 18.062J Mathematics for Computer Science Spring 20 15 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Recommend
More recommend