09-AdditionMultiplication-annot

09-AdditionMultiplication-annot - Addition and...

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

View Full Document Right Arrow Icon
Addition and multiplication 1 Addition and multiplication Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures focus on addition, subtraction, multiplication and arithmetic-logic units, or ALUs, which are the “heart” of CPUs. ALUs are a good example of many of the issues we’ve seen so far, including Boolean algebra, circuit analysis, data representation, and hierarchical, modular design.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Addition and multiplication 2 Binary addition by hand You can add two binary numbers one column at a time starting from the right, just as you add two decimal numbers. But remember that it’s binary. For example, 1 + 1 = 10 and you have to carry! 1 1 1 0 Carry in 1 0 1 1 Augend + 1 1 1 0 Addend 1 1 0 0 1 Sum The initial carry in is implicitly 0 most significant bit , or MSB least significant bit , or LSB
Background image of page 2
Addition and multiplication 3 Adding two bits We’ll make a hardware adder by copying the human addition algorithm. We start with a half adder , which adds two bits and produces a two-bit result: a sum (the right bit) and a carry out (the left bit). Here are truth tables, equations, circuit and block symbol. X Y C S 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 10 C = XY S = X’ Y + X Y’ = X Y Be careful! Now we’re using + for both arithmetic addition and the logical OR operation.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Addition and multiplication 4 Adding three bits But what we really need to do is add three bits: the augend and addend, and the carry in from the right. 0 + 0 + 0 = 00 0 + 0 + 0 = 01 0 + 1 + 0 = 01 0 + 1 + 1 = 10 1 + 0 + 0 = 01 1 + 0 + 1 = 10 1 + 1 + 0 = 10 1 + 1 + 1 = 11 X Y C in C out S 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 (These are the same functions from the decoder and mux examples.) 1 1 1 0 1 0 1 1 + 1 1 1 0 1 1 0 0 1
Background image of page 4
Addition and multiplication 5 Full adder equations A full adder circuit takes three bits of input, and produces a two-bit output consisting of a sum and a carry out. Using Boolean algebra, we get the equations shown here. XOR operations simplify the equations a bit. We used algebra because you can’t easily derive XORs from K-maps. S = Σ m(1,2,4,7) = X’ Y’ C in + X’ Y C in + X Y’ C in + X Y C in = X’ (Y’ C in + Y C in ’) + X (Y’ C in ’ + Y C in ) = X’ (Y C in ) + X (Y C in )’ = X Y C in C out = Σ m(3,5,6,7) = X’ Y C in + X Y’ C in + X Y C in ’ + X Y C in = (X’ Y + X Y’) C in + XY(C in ’ + C in ) = (X Y) C in + XY X Y C in C out S 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1
Background image of page 5

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

View Full DocumentRight Arrow Icon
Addition and multiplication 6 Full adder circuit These things are called half adders and full adders because you can build a full adder by putting together two half adders! S = X Y C in C out = (X Y) C in + XY
Background image of page 6
Addition and multiplication 7
Background image of page 7

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

View Full DocumentRight Arrow Icon
Addition and multiplication 8 A 4-bit adder Four full adders together make a 4-bit adder.
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 31

09-AdditionMultiplication-annot - Addition and...

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

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