16.8 SQUARE ROOT

A basic square-rooter deduced from Algorithm 16.7 is shown in Figure 16.10. If e1 is even, the square-rooter input is

image

and if e1 is odd

image

In both cases s′ can be represented as a (2.p + 5)-digit integer. The square-root algorithms (Chapter 7) generate Q and R such that

image

so that Q2s′ and (Q + 1)2 > s′. Observe that Q is a (p + 3)-digit integer and R a (p + 4)-digit integer; then, according to (16.33),

image

so that (Q.B−(p + 2))2s′.B−2.(p + 2) and (Q.B−(p + 2) + B−(p + 2))2 > s′.B−2.(p + 2).

Thus Q.B−(p + 2) is the square root of either s1 (16.31) or s1/B (16.32), with a precision of p + 2 fractional digits. The sticky digit is equal to 1 if R > 0 and to 0 if R = 0. The final approximation of the exact result is

image

image

Figure 16.10 Square-rooter.

Get Synthesis of Arithmetic Circuits: FPGA, ASIC and Embedded Systems now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.