cvw/docs/divsqrt_tex/sqrt2.tex

386 lines
18 KiB
TeX

\documentclass[12pt]{article}
\usepackage{amssymb, amsmath, amsfonts, amsthm, graphicx, tcolorbox}
\usepackage{arydshln}
\parskip = .2in
\parindent = 0in
\pagestyle{empty}
%==========
%==========
\begin{document}
X = 0.0111 0011 1001 (1849/4096)
S = 0.1010 1100 0000 (2752/4096)
{\small
\begin{center}
\begin{tabular}{ccccc}
&$X $&$ 0000.0111\ 0011\ 1001 $& &$S_0={\color{blue}0001}.0000\ 0000\ 0000$\\
&$WS_0=2(X-1) $&$ 1110.1110\ 0111\ 0010 $& &$SM_0={\color{blue}0000}.0000\ 0000\ 0000\phantom{M}$\\
&$WC_0 $&$ 0000.0000\ 0000\ 0000 $& &$K_0=0001.0000\ 0000\ 0000\ $\\
& & & &$C_0=1111.0000\ 0000\ 0000\,$\\
\hdashline\\
Step 1: &$WS_0 $&$ 1110.1110\ 0111\ 0010 $& &\\
&$WC_0 $&$ 0000.0000\ 0000\ 0000 $& &($W_{msbs}=1110\ \text{so}\ s_1=-1$)\\
&$F_1=2S_0-K_1 $&${\color{blue}0001.1}000\ 0000\ 0000$& &$S_1={\color{blue}0000.1}000\ 0000\ 0000$\\
& & & &$SM_1={\color{blue}0000.0}000\ 0000\ 0000\phantom{M}$\\
\cline{2-3}
&$sum $&$ 1111.0110\ 0111\ 0010 $&$\ll1 $&$K_1=0000.1000\ 0000\ 0000\ $\\
&$carry $&$ 0001.0000\ 0000\ 0000 $&$\ll1 $&$C_1=1111.1000\ 0000\ 0000\,$\\
\hdashline\\
Step 2: &$WS_1 $&$ 1110.1100\ 1110\ 0100 $& &\\
&$WC_1 $&$ 0010.0000\ 0000\ 0000 $& &($W_{msbs}=0000\ \text{so}\ s_2=1$)\\
&$F_2=-2S_1-K_2$&${\color{blue}1110.11}00\ 0000\ 0000$& &$S_2={\color{blue}0000.11}00\ 0000\ 0000$\\
& & & &$SM_2={\color{blue}0000.10}00\ 0000\ 0000\phantom{M}$\\
\cline{2-3}
&$sum $&$ 0010.0000\ 1110\ 0100 $&$\ll1 $&$K_2=0000.0100\ 0000\ 0000\ $\\
&$carry $&$ 1101.1000\ 0000\ 0000 $&$\ll1 $&$C_2=1111.1100\ 0000\ 0000\,$\\
\hdashline\\
Step 3: &$WS_2 $&$ 0100.0001\ 1100\ 1000 $& &\\
&$WC_2 $&$ 1011.0000\ 0000\ 0000 $& &($W_{msbs}=1111\ \text{so}\ s_3=0$)\\
&$F_3=0 $&${\color{blue}0000.000}0\ 0000\ 0000$& &$S_3={\color{blue}0000.110}0\ 0000\ 0000$\\
& & & &$SM_3={\color{blue}0000.101}0\ 0000\ 0000\phantom{M}$\\
\cline{2-3}
&$sum $&$ 1111.0001\ 1100\ 1000 $&$\ll1 $&$K_3=0000.0010\ 0000\ 0000\ $\\
&$carry $&$ 0000.0000\ 0000\ 0000 $&$\ll1 $&$C_3=1111.1110\ 0000\ 0000\,$\\
\hdashline\\
Step 4: &$WS_3 $&$ 1110.0011\ 1001\ 0000 $& &\\
&$WC_3 $&$ 0000.0000\ 0000\ 0000 $& &($W_{msbs}=1110\ \text{so}\ s_4=-1$)\\
&$F_4=2S_3-K_4 $&${\color{blue}0001.0111}\ 0000\ 0000$& &$S_4={\color{blue}0000.1011}\ 0000\ 0000$\\
& & & &$SM_4={\color{blue}0000.1010}\ 0000\ 0000\phantom{M}$\\
\cline{2-3}
&$sum $&$ 1111.0100\ 1001\ 0000 $&$\ll1 $&$K_4=0000.0001\ 0000\ 0000\ $\\
&$carry $&$ 0000.0110\ 0000\ 0000 $&$\ll1 $&$C_4=1111.1111\ 0000\ 0000\,$\\
\hdashline\\
Step 5: &$WS_4 $&$ 1110.1001\ 0010\ 0000 $& &\\
&$WC_4 $&$ 0000.1100\ 0000\ 0000 $& &($W_{msbs}=1110\ \text{so}\ s_5=-1$)\\
&$F_5=2S_4-K_5 $&${\color{blue}0001.0101\ 1}000\ 0000$& &$S_5={\color{blue}0000.1010\ 1}000\ 0000$\\
& & & &$SM_5={\color{blue}0000.1010\ 0}000\ 0000\phantom{M}$\\
\cline{2-3}
&$sum $&$ 1111.0000\ 1010\ 0000 $&$\ll1 $&$K_5=0000.0000\ 1000\ 0000\ $\\
&$carry $&$ 0001.1010\ 0000\ 0000 $&$\ll1 $&$C_5=1111.1111\ 1000\ 0000\,$\\
\hdashline\\
Step 6: &$WS_5 $&$ 1110.0001\ 0100\ 0000 $& &\\
&$WC_5 $&$ 0011.0100\ 0000\ 0000 $& &($W_{msbs}=0001\ \text{so}\ s_6=1$)\\
&$F_6=-2S_5-K_6$&${\color{blue}1110.1010\ 11}00\ 0000$& &$S_6={\color{blue}0000.1010\ 11}00\ 0000$\\
& & & &$SM_6={\color{blue}0000.1010\ 10}00\ 0000\phantom{M}$\\
\cline{2-3}
&$sum $&$ 0011.1111\ 1000\ 0000 $&$\ll1 $&$K_6=0000.0000\ 0100\ 0000\ $\\
&$carry $&$ 1100.0000\ 1000\ 0000 $&$\ll1 $&$C_6=1111.1111\ 1100\ 0000\,$\\
& & & &$sum+carry=0$, terminate\\
\hdashline\\
Terminate&Square Root&0.101011
\end{tabular}
\end{center}
}
{\small
\begin{center}
\begin{tabular}{cccc}
\hdashline\\
Step 6: &$WS $&$0111.1111\ 0000\ 00$&\\
&$WC $&$1000.0001\ 0000\ 00$&($W_{msbs}=1111\ \text{so}\ s_6=0$)\\
&$F $&$0000.0000\ 0000\ 00$&$S_6=\mathbf{1.0101\ 10}00\ 00$\\
& & &$SM_6=\mathbf{1.0101\ 01}00\ 00\phantom{M}$\\
\cline{2-3}
&$WS $&$1111.1110\ 0000\ 00$&$\ll1$\\
&$WC $&$0000.0010\ 0000\ 00$&$\ll1$\\
\hdashline\\
Step 7: &$WS $&$1111.1100\ 0000\ 00$&\\
&$WC $&$0000.0100\ 0000\ 00$&($W_{msbs}=1111\ \text{so}\ s_7=0$)\\
&$F $&$0000.0000\ 0000\ 00$&$S_7=\mathbf{1.0101\ 100}0\ 00$\\
& & &$SM_7=\mathbf{1.0101\ 011}0\ 00\phantom{M}$\\
\cline{2-3}
&$WS $&$1111.1000\ 0000\ 00$&$\ll1$\\
&$WC $&$0000.1000\ 0000\ 00$&$\ll1$\\
\hdashline\\
Step 8: &$WS $&$1111.0000\ 0000\ 00$&\\
&$WC $&$0001.0000\ 0000\ 00$&($W_{msbs}=0000\ \text{so}\ s_8=1$)\\
&$F $&$1110.1010\ 0111\ 10$&$S_8=\mathbf{1.0101\ 1001}\ 00$\\
& & &$SM_8=\mathbf{1.0101\ 1000}\ 00\phantom{M}$\\
\cline{2-3}
&$WS $&$0000.1010\ 0111\ 10$&$\ll1$\\
&$WC $&$1110.0000\ 0000\ 00$&$\ll1$\\
\hdashline\\
Step 9: &$WS $&$0001.0100\ 1111\ 00$&\\
&$WC $&$1100.0000\ 0000\ 00$&($W_{msbs}=1101\ \text{so}\ s_9=-1$)\\
&$F $&$0001.0101\ 1000\ 11$&$S_9=\mathbf{1.0101\ 1000\ 1}0$\\
& & &$SM_9=\mathbf{1.0101\ 1000\ 0}0\phantom{M}$\\
\cline{2-3}
&$WS $&$1100.0001\ 0111\ 11$&$\ll1$\\
&$WC $&$0010.1001\ 0000\ 00$&$\ll1$\\
\hdashline\\
Step 10:&$WS $&$1000.0010\ 1111\ 10$&\\
&$WC $&$0101.0010\ 0000\ 00$&($W_{msbs}=1101\ \text{so}\ s_{10}=-1$)\\
&$F $&$0001.0101\ 1000\ 01$&$S_{10}=\mathbf{1.0101\ 1000\ 01}$\\
& & &$SM_{10}=\mathbf{1.0101\ 1000\ 00}\phantom{M}$\\
\cline{2-3}
&$WS $&$1100.0001\ 0111\ 11$&$\ll1$\\
&$WC $&$0010.0101\ 0000\ 00$&$\ll1$\\
\hdashline\\
Step 11:&$WS $&$1000.0010\ 1111\ 10$&\\
&$WC $&$0100.1010\ 0000\ 00$&($W_{msbs}=1101\ \text{so}\ s_{11}=-1$)\\
&$F $&$0001.0101\ 1000\ 00$&$S_{11}=\mathbf{1.0101\ 1000\ 00}$\\
& & &$SM_{11}=\mathbf{1.0101\ 1000\ 00}\phantom{M}$\\
\cline{2-3}
&$WS $&$1101.1101\ 0111\ 10$&$\ll1$\\
&$WC $&$0000.0101\ 0000\ 00$&$\ll1$\\
\hdashline\\
Step 12:&$WS $&$1101.1000\ 0111\ 10$&\\
&$WC $&$0000.1010\ 0000\ 00$&($W_{msbs}=1101\ \text{so}\ s_{12}=-1$)\\
&$F $&$0001.0101\ 1000\ 00$&$S_{12}=\mathbf{1.0101\ 1000\ 00}$\\
& & &$SM_{12}=\mathbf{1.0101\ 1000\ 00}\phantom{M}$\\
\cline{2-3}
&$WS $&$1100.0111\ 1111\ 10$&$\ll1$\\
&$WC $&$0011.0000\ 0000\ 00$&$\ll1$\\
\end{tabular}
\end{center}
}
{\small
\begin{center}
\begin{tabular}{cccc}
Step 13:&$WS $&$1000.1111\ 1111\ 00$&\\
&$WC $&$0110.0000\ 0000\ 00$&($W_{msbs}=1110\ \text{so}\ s_{13}=-1$)\\
&$F $&$0001.0101\ 1000\ 00$&$S_{13}=\mathbf{1.0101\ 1000\ 00}$\\
& & &$SM_{13}=\mathbf{1.0101\ 1000\ 00}\phantom{M}$\\
\cline{2-3}
&$WS $&$1111.1010\ 0111\ 10$&$\ll1$\\
&$WC $&$0000.1011\ 0000\ 00$&$\ll1$\\
\end{tabular}
\end{center}
}
\vfill
\eject
{\small
\begin{center}
\begin{tabular}{ccccc}
&$X $&$ 0000.1100\ 0000 $& &$S_0={\color{blue}0001}.0000\ 0000\ 00$\\
&$WS=X-1 $&$ 1111.1100\ 0000 $& &$SM_0={\color{blue}0000}.0000\ 0000\ 00\phantom{M}$\\
&$WC $&$ 0000.0000\ 0000 $& &$K_0=0000.0100\ 0000\ 00\ $\\
& & & &$C_0=1111.1100\ 0000\ 00\,$\\
\hdashline\\
Step 1: &$WS $&$ 1111.1100\ 0000 $& &\\
&$WC $&$ 0000.0000\ 0000 $& &($W_{msbs}=1111\ \text{so}\ s_1=0$)\\
&$F_1=0 $&${\color{blue}0000.00}00\ 0000$& &$S_1={\color{blue}0001.0}000\ 0000\ 00$\\
& & & &$SM_1={\color{blue}0000.1}000\ 0000\ 00\phantom{M}$\\
\cline{2-3}
&$WS $&$ 1111.1100\ 0000 $&$\ll1 $&$K_1=0000.0010\ 0000\ 00\ $\\
&$WC $&$ 0000.0000\ 0000 $&$\ll1 $&$C_1=1111.1110\ 0000\ 00\,$\\
\hdashline\\
Step 2: &$WS $&$ 1111.1000\ 0000 $& &\\
&$WC $&$ 0000.0000\ 0000 $& &($W_{msbs}=1111\ \text{so}\ s_2=0$)\\
&$F_2=0 $&${\color{blue}0000.000}0\ 0000$& &$S_2={\color{blue}0001.00}00\ 0000\ 00$\\
& & & &$SM_2={\color{blue}0000.11}00\ 0000\ 00\phantom{M}$\\
\cline{2-3}
&$WS $&$ 1111.1000\ 0000 $&$\ll1 $&$K_2=0000.0001\ 0000\ 00\ $\\
&$WC $&$ 0000.0000\ 0000 $&$\ll1 $&$C_2=1111.1111\ 0000\ 00\,$\\
\hdashline\\
Step 3: &$WS $&$ 1111.0000\ 0000 $& &\\
&$WC $&$ 0000.0000\ 0000 $& &($W_{msbs}=1111\ \text{so}\ s_3=0$)\\
&$F_3=0 $&${\color{blue}0000.0000}\ 0000$& &$S_3={\color{blue}0001.000}0\ 0000\ 00$\\
& & & &$SM_3={\color{blue}0000.111}0\ 0000\ 00\phantom{M}$\\
\cline{2-3}
&$WS $&$1111.0000\ 0000 $&$\ll1 $&$K_3=0000.0000\ 1000\ 00\ $\\
&$WC $&$0000.0000\ 0000 $&$\ll1 $&$C_3=1111.1111\ 1000\ 00\,$\\
\hdashline\\
Step 4: &$WS $&$1110.0000\ 0000 $& &\\
&$WC $&$0000.0000\ 0000 $& &($W_{msbs}=1110\ \text{so}\ s_4=-1$)\\
&$F_4=S_3-K_3 $&${\color{blue}0000.1111\ 1}000$& &$S_4={\color{blue}0000.1111}\ 0000\ 00$\\
& & & &$SM_4={\color{blue}0000.1110}\ 0000\ 00\phantom{M}$\\
\cline{2-3}
&$WS $&$1110.1111\ 1000 $&$\ll1 $&$K_4=0000.0000\ 0100\ 00\ $\\
&$WC $&$0000.0000\ 0000 $&$\ll1 $&$C_4=1111.1111\ 1100\ 00\,$\\
\hdashline\\
Step 5: &$WS $&$1101.1111\ 0000 $& &\\
&$WC $&$0000.0000\ 0000 $& &($W_{msbs}=1101\ \text{so}\ s_5=-1$)\\
&$F_5=S_4-K_4 $&${\color{blue}0000.1110\ 11}00$& &$S_5={\color{blue}0000.1110\ 1}000\ 00$\\
& & & &$SM_5={\color{blue}0001.1110\ 0}000\ 00\phantom{M}$\\
\cline{2-3}
&$WS $&$1101.0001\ 1100 $&$\ll1 $&$K_5=0000.0000\ 0010\ 00\ $\\
&$WC $&$0001.1100\ 0000 $&$\ll1 $&$C_5=1111.1111\ 1110\ 00\,$\\
Terminate
\end{tabular}
\end{center}
}
\vfill
\eject
X = 0.1010101101(685/1024)
S = 0.1101000110(838/1024)
once R4 sslc gets here i can fill this in
\vfill
\eject
X = 1.1001 (25/16)
S = 1.0100 (20/16)
{\small
\begin{center}
\begin{tabular}{cccc}
Attempt 1:& $X$ is normalized& to $1/2<X<2$&$W_{msbs}$ looks at Q4.0\\
&&&\\
&$X $&$0001.1001$&\\
&$WS=X-1$&$0000.1001$& $s_0=1$\\
&$WC $&$0000.0000$&$S_0=\mathbf{1}.0000,\quad SM_0=\mathbf{0}.0000$ \\
\hdashline\\
Step 1: &$WS $&$0000.1001$&\\
&$WC $&$0000.0000$&($W_{msbs}=0000\ \text{so}\ s_1=1$)\\
&$F $&$1110.1100$&$S_1=\mathbf{1.1}000,\quad SM_1=\mathbf{1.0}000$\\
\cline{2-3}
&$WS $&$1110.0101$&$\ll1$\\
&$WC $&$0001.0000$&$\ll1$\\
\hdashline\\
Step 2: &$WS $&$1100.1010$&\\
&$WC $&$0010.0000$&($W_{msbs}=1110\ \text{so}\ s_2=-1$)\\
&$F $&$0001.0110$&$S_2=\mathbf{1.01}00,\quad SM_2=\mathbf{1.00}00$\\
\cline{2-3}
&$WS $&$1111.1110$&$\ll1$\\
&$WC $&$0000.0010$&$\ll1$\\
\hdashline\\
Step 3: &$WS $&$1111.1100$&\\
&$WC $&$0000.0100$&($W_{msbs}=1111\ \text{so}\ s_3=0$)\\
&$-q_3D $&$0000.0000$&$S_3=\mathbf{1.010}0,\quad SM_3=\mathbf{1.001}0$\\
\cline{2-3}
&$WS $&$1111.1000$&$\ll1$\\
&$WC $&$0000.1000$&$\ll1$\\
\hdashline\\
Step 4: &$WS $&$1111.0000$&\\
&$WC $&$0001.0000$&($W_{msbs}=0000\ \text{so}\ s_4=1$)\\
&$F $&$0000.0000$&$S_4=\mathbf{1.0101},\quad SM_4=\mathbf{1.0100}$\\
Terminate&&&
\end{tabular}
\end{center}
}
{\small
\begin{center}
\begin{tabular}{cccc}
Attempt 2:& $X$ is normalized& to $1/2<X<2$&$W_{msbs}$ looks at Q3.1\\
&&&\\
&$X $&$001.1001$&\\
&$WS=X-1$&$000.1001$& $s_0=1$\\
&$WC $&$000.0000$&$S_0=\mathbf{1}.0000,\quad SM_0=\mathbf{0}.0000$ \\
\hdashline\\
Step 1: &$WS $&$000.1001$&\\
&$WC $&$000.0000$&($W_{msbs}=000.1\ \text{so}\ s_1=1$)\\
&$F $&$110.1000$&$S_1=\mathbf{1.1}000,\quad SM_1=\mathbf{1.0}000$\\
\cline{2-3}
&$WS $&$110.0001$&$\ll1$\\
&$WC $&$001.0000$&$\ll1$\\
\hdashline\\
Step 2: &$WS $&$100.0010$&\\
&$WC $&$010.0000$&($W_{msbs}=110.0\ \text{so}\ s_2=-1$)\\
&$F $&$001.0100$&$S_2=\mathbf{1.01}00,\quad SM_2=\mathbf{1.00}00$\\
\cline{2-3}
&$WS $&$111.0110$&$\ll1$\\
&$WC $&$000.0000$&$\ll1$\\
\hdashline\\
Step 3: &$WS $&$110.1100$&\\
&$WC $&$000.0000$&($W_{msbs}=110.1\ \text{so}\ s_3=-1$)\\
&$-q_3D $&$001.0010$&$S_3=\mathbf{1.001}0,\quad SM_3=\mathbf{1.000}0$\\
\cline{2-3}
&$WS $&$111.1110$&$\ll1$\\
&$WC $&$000.0000$&$\ll1$\\
\hdashline\\
Step 4: &$WS $&$111.1110$&\\
&$WC $&$000.0000$&($W_{msbs}=111.1\ \text{so}\ s_4=0$)\\
&$F $&$000.0000$&$S_4=\mathbf{1.0010},\quad SM_4=\mathbf{1.0001}$\\
Terminate&&&
\end{tabular}
\end{center}
}
{\small
\begin{center}
\begin{tabular}{cccc}
Attempt 3:& $X$ is normalized& to $1<X<4$&$W_{msbs}$ looks at Q4.0\\
&&&\\
&$X $&$0001.1001$&\\
&$WS=X-2$&$1111.1001$& $s_{-1}=10$\\
&$WC $&$0000.0000$&$S_{-1}=\mathbf{1}0.0000,\quad SM_{-1}=\mathbf{0}0.0000$ \\
\hdashline\\
Step 0: &$WS $&$1111.1001$&\\
&$WC $&$0000.0000$&($W_{msbs}=1111\ \text{so}\ s_0=0$)\\
&$F $&$0000.0000$&$S_0=\mathbf{10}.0000,\quad SM_0=\mathbf{01}.0000$\\
\cline{2-3}
&$WS $&$1111.1001$&$\ll1$\\
&$WC $&$0000.0000$&$\ll1$\\
\hdashline\\
Step 1: &$WS $&$1111.0010$&\\
&$WC $&$0000.0000$&($W_{msbs}=1111\ \text{so}\ s_1=0$)\\
&$F $&$0000.0000$&$S_1=\mathbf{10.0}000,\quad SM_1=\mathbf{01.1}000$\\
\cline{2-3}
&$WS $&$1111.0010$&$\ll1$\\
&$WC $&$0000.0000$&$\ll1$\\
\hdashline\\
Step 2: &$WS $&$1110.0100$&\\
&$WC $&$0000.0000$&($W_{msbs}=1110\ \text{so}\ s_2=-1$)\\
&$-q_3D $&$0001.1100$&$S_2=\mathbf{01.01}00,\quad SM_2=\mathbf{01.00}00$\\
\cline{2-3}
&$WS $&$1111.1000$&$\ll1$\\
&$WC $&$0000.1000$&$\ll1$\\
Terminate&&&
\end{tabular}
\end{center}
}
\vfill
\eject
X = 0.011001 (25/64)
S = 0.101000 (40/64)
{\small
\begin{center}
\begin{tabular}{cccc}
Attempt 4:& $X$ is normalized& to $1/4<X<1$&$W_{msbs}$ looks at Q3.1\\
&&&\\
&$X $&$000.0110\ 01$&\\
&$WS=X-1$&$111.0110\ 01$& $s_0=1$\\
&$WC $&$000.0000\ 00$&$S_0=\mathbf{1}.000000,\quad SM_0=\mathbf{0}.000000$ \\
\hdashline\\
Step 1: &$WS $&$111.0110\ 01$&\\
&$WC $&$000.0000\ 00$&($W_{msbs}=111.0\ \text{so}\ s_1=-1$)\\
&$F $&$000.1000\ 00$&$S_1=\mathbf{0.1}00000,\quad SM_1=\mathbf{0.0}00000$\\
\cline{2-3}
&$WS $&$111.1110\ 01$&$\ll1$\\
&$WC $&$000.0000\ 00$&$\ll1$\\
\hdashline\\
Step 2: &$WS $&$111.1100\ 10$&\\
&$WC $&$000.0000\ 00$&($W_{msbs}=111.1\ \text{so}\ s_2=0$)\\
&$F $&$000.0000\ 00$&$S_2=\mathbf{0.10}0000,\quad SM_2=\mathbf{0.01}0000$\\
\cline{2-3}
&$WS $&$111.1100\ 10$&$\ll1$\\
&$WC $&$000.0000\ 00$&$\ll1$\\
\hdashline\\
Step 3: &$WS $&$111.1001\ 00$&\\
&$WC $&$000.0000\ 00$&($W_{msbs}=010.0\ \text{so}\ s_3=1$)\\
&$-q_3D $&$111.0010\ 00$&$S_3=\mathbf{0.111}000,\quad SM_3=\mathbf{0.110}000$\\
\cline{2-3}
&$WS $&$1111.1110$&$\ll1$\\
&$WC $&$0000.0000$&$\ll1$\\
\hdashline\\
Step 4: &$WS $&$1111.1110$&\\
&$WC $&$0000.0000$&($W_{msbs}=111.1\ \text{so}\ s_4=0$)\\
&$F $&$0000.0000$&$S_4=\mathbf{1.0010}00,\quad SM_4=\mathbf{1.0001}00$\\
Terminate&&&
\end{tabular}
\end{center}
}
\end{document}