06.03.2017 Views

Mathematics for Computer Science

e9ck2Ar

e9ck2Ar

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

“mcs” — 2017/3/3 — 11:21 — page 71 — #79<br />

3.7. References 71<br />

and n C 2 binary outputs<br />

c p n ; : : : ; p 1 ; p 0 :<br />

If a n : : : a 1 a 0 are taken to be the .n C 1/-bit representation of an integer k then<br />

cp n : : : p 1 p 0 is supposed to be the .n C 2/-bit binary representation of k C 1.<br />

So a 1-bit add1-module just has input a 0 and outputs c; p 0 where<br />

p 0 WWD a 0 XOR 1; .or more simply, p 0 WWD NOT.a 0 //;<br />

c WWD a 0 :<br />

In the ripple-carry design, a double-size half-adder with 2.n C 1/ inputs takes<br />

twice as long to produce its output values as an .n C 1/-input ripple-carry circuit.<br />

With parallel-design add1-modules, a double-size add1-module produces its output<br />

values nearly as fast as a single-size add1-modules. To see how this works, suppose<br />

the inputs of the double-size module are<br />

a 2nC1 ; : : : ; a 1 ; a 0<br />

and the outputs are<br />

c; p 2nC1 ; : : : ; p 1 ; p 0 :<br />

We will build the double-size add1-module by having two single-size add1-modules<br />

work in parallel. The setup is illustrated in Figure 3.1.<br />

Namely, the first single-size add1-module handles the first n C 1 inputs. The inputs<br />

to this module are the low-order nC1 input bits a n ; : : : ; a 1 ; a 0 , and its outputs<br />

will serve as the first n C 1 outputs p n ; : : : ; p 1 ; p 0 of the double-size module. Let<br />

c .1/ be the remaining carry output from this module.<br />

The inputs to the second single-size module are the higher-order n C 1 input bits<br />

a 2nC1 ; : : : ; a nC2 ; a nC1 . Call its first n C 1 outputs r n ; : : : ; r 1 ; r 0 and let c .2/ be its<br />

carry.<br />

(a) Write a <strong>for</strong>mula <strong>for</strong> the carry c of the double-size add1-module solely in terms<br />

of carries c .1/ and c .2/ of the single-size add1-modules.<br />

(b) Complete the specification of the double-size add1-module by writing propositional<br />

<strong>for</strong>mulas <strong>for</strong> the remaining outputs p nCi <strong>for</strong> 1 i n C 1. The <strong>for</strong>mula<br />

<strong>for</strong> p nCi should only involve the variables a nCi , r i 1 and c .1/ .<br />

(c) Explain how to build an .nC1/-bit parallel-design half-adder from an .nC1/-<br />

bit add1-module by writing a propositional <strong>for</strong>mula <strong>for</strong> the half-adder output s i<br />

using only the variables a i , p i and b.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!