cvw/docs/divsqrt_tex/div2.tex

124 lines
4.1 KiB
TeX

\documentclass[12pt]{article}
\usepackage{amssymb, amsmath, amsfonts, amsthm, graphicx, tcolorbox}
\usepackage{arydshln}
\parindent = 0in
\pagestyle{empty}
%==========
%==========
\begin{document}
\begin{center}
\begin{tabular}{cccc}
Initialization&$D$&$0001.1010\ 000$&\\
&$-D=\overline{D}+1$&$1110.0101\ 111$&(+ 1 ulp)\\
&&&\\
&$WS_{-1}=X$&$0001.0000\ 010$&\\
&$WC_{-1}$&$0000.0000\ 000$&\\
\hdashline\\
Step 0:&$WS_{-1}$&$0001.0000\ 010$&\\
&$WC_{-1}$&$0000.0000\ 00\mathbf{1}$&($W_{msbs}=0001\ \text{so}\ q_0=1$)\\
&$-q_0D$&$1110.0101\ 111$&\\
\cline{2-3}
&$sum$&$1111.0101\ 100$&$\ll1$\\
&$carry$&$0000.0000\ 110$&$\ll1$\\
\hdashline\\
Step 1:&$WS_0$&$1110.1011\ 000$&\\
&$WC_0$&$0000.0001\ 10\mathbf{0}$&($W_{msbs}=1110\ \text{so}\ q_1=-1$)\\
&$-q_1D$&$0001.1010\ 000$&\\
\cline{2-3}
&$sum$&$1111.0000\ 100$&$\ll1$\\
&$carry$&$0001.0110\ 000$&$\ll1$\\
\hdashline\\
Step 2:&$WS_1$&$1110.0001\ 000$&\\
&$WC_1$&$0010.1100\ 00\mathbf{1}$&($W_{msbs}=0000\ \text{so}\ q_2=1$)\\
&$-q_2D$&$1110.0101\ 111$&\\
\cline{2-3}
&$sum$&$0010.1000\ 110$&$\ll1$\\
&$carry$&$1100.1010\ 010$&$\ll1$\\
\hdashline\\
Step 3:&$WS_2$&$0101.0001\ 100$&\\
&$WC_2$&$1001.0100\ 10\mathbf{0}$&($W_{msbs}=1110\ \text{so}\ q_3=-1$)\\
&$-q_3D$&$0001.1010\ 000$&\\
\cline{2-3}
&$sum$&$1101.1111\ 000$&\\
&$carry$&$0010.0001\ 000$&$sum+carry=0$, terminate.\\
\hdashline\\
Terminate&Quotient&0.101
\end{tabular}
\end{center}
\vfill
\eject
X = 1.0110\ 011 (179/128)
D = 1.0011\ 000 (152/128)
Q = 1.0010\ 1101\ 0
D[1.3] = 1.001, so we use the ``"1.001" column of chart 13.X. This means we select a quotient bit of 2 if the partial remainder is greater than or equal to 3.5, a quotient bit of 1 if the partial is greater or equal to than 1.0, a zero if the partial is greater than or equal to -1.5, -1 if the partial is greater than or equal to -3.75, and a -2 otherwise.
\begin{center}
\begin{tabular}{cccc}
Initialization&$D$&$0001.0011\ 000$&\\
&$2D$&$0010.0110\ 000$&\\
&$-D=\overline{D}+1$&$1110.1100\ 111$&(+ 1 ulp)\\
&$-2D=\overline{2D}+1$&$1101.1001\ 111$&(+ 1 ulp)\\
&&&\\
&$X=WS$&$0001.0110\ 011$&\\
&$WC$&$0000.0000\ 000$&\\
\hdashline\\
Step 4:&$WS$&$0001.0110\ 011$&\\
&$WC$&$0000.0000\ 00\mathbf{1}$&($RW_{msbs}=0001.010\ \text{so}\ q_4=1$)\\
&$-q_7D$&$1110.1100\ 111$&\\
\cline{2-3}
&$WS$&$1111.1010\ 101$&$\ll2$\\
&$WC$&$0000.1000\ 110$&$\ll2$\\
\hdashline\\
Step 3:&$WS$&$1110.1010\ 100$&\\
&$WC$&$0010.0011\ 000$&($RW_{msbs}=0000.110\ \text{so}\ q_3=1$)\\
&$-q_6D$&$0000.0000\ 000$&\\
\cline{2-3}
&$WS$&$1100.1001\ 100$&$\ll2$\\
&$WC$&$0100.0100\ 000$&$\ll2$\\
\hdashline\\
Step 2:&$WS$&$0010.0110\ 000$&\\
&$WC$&$0001.0000\ 00\mathbf{1}$&($RW_{msbs}=0011.010\ \text{so}\ q_2=-1$)\\
&$-q_5D$&$1110.0101\ 111$&\\
\cline{2-3}
\end{tabular}
\end{center}
page 269 306
\vfill
\eject
\large{\bf{
Math for the recurrence relation}}
**going to have to change notation for sure, change the subscripts for steps and might have to get rid of some exponents**
\begin{align*}
w[j+1] &= r^{j+1}\big(x-S[j+1]^2\big)\\
&= r^{j+1}\big(x-(S[j]+s_{j+1}r^{-(j+1)})^2\big)\\
&= r^{j+1}x-r^{j+1}\big(S[j]^2+2S[j]s_{j+1}r^{-(j+1)}+s^2_{j+1}r^{-2(j+1)}\big)\\
&= r^{j+1}\big(x-S[j]^2\big)-\big(2S[j]s_{j+1}+s_{j+1}^2r^{-(j+1)}\big)\\
&= rw[j]-\big(2S[j]s_{j+1}+s_{j+1}^2r^{-(j+1)}\big)\\
&= rw[j]+F[j]
\end{align*}
where
\begin{align*}
F[j]=-\big(2S[j]s_{j+1}+s_{j+1}^2r^{-(j+1)}\big)
\end{align*}
Since there is a term of $S$ in the expression of $F$, we must come up with a way to represent $S$ using only zeros and ones, rather than using the bit set $\{-a,\ldots,a\}$. This is done using on-the-fly conversion just as we did to compute the quotient for the divider. We keep a running copy of $S$, but we also keep the value $SM=S-1$. The logic is still the same for computing $S$ and $SM$ on the next step; see figure 13.15.
Now that $S$ is in a form such that we can use it in a CSA, we need to compute $F$. To do so,
\end{document}