-
Notifications
You must be signed in to change notification settings - Fork 0
/
session_3.tex
192 lines (144 loc) · 4.08 KB
/
session_3.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
\documentclass[11pt]{tudbeamer}
\usetheme{Luebeck}
\usepackage[utf8]{inputenc}
\usepackage{gensymb}
\usepackage{default}
\usepackage{ngerman}
\usepackage{float}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{color}
% insert frame number
\expandafter\def\expandafter\insertshorttitle\expandafter{%
\insertshorttitle\hfill%
\insertframenumber\,/\,\inserttotalframenumber}
% Metadata
\title{Rechnerarchitektur 2016}
\subtitle{Session 3}
\author{Fredo Erxleben}
\begin{document}
\maketitle
\begin{frame}{Organisational}
Next Monday is a holiday.\\
Please do 3.11 - 3.16 at home or go to the exercises on
\begin{tabular}{lcc}
Tuesday, &1st slot, &APB E023\\
Thursday, &1st slot, &APB E010\\
Friday, &1st slot, &APB E006\\
\end{tabular}
\end{frame}
\begin{frame}{Today}
\begin{itemize}
\item Basic arithmetic operations on IEEE 754 floating point numbers\dots
\item Basic arithmetic operations on fixed-point numbers\dots
\item \dots and their properties and caveats
\end{itemize}
\end{frame}
\section{Exercise 1}
\section{Exercise 2}
\section{Exercise 3}
\begin{frame}[allowframebreaks]{Exercise 3.5}
Addition and Subtraction:\\
\begin{itemize}
\item Equalize exponents (only the difference of the exponents is relevant)
\item Add / subtract mantissas as usual
\item Normalize if required
\end{itemize}
\framebreak
Multiplication and Division: \\
$\rightarrow$ Blackboard
\end{frame}
\begin{frame}{Exercise 3.6}
Use denormalized form:
$$Z = (-1)^v \cdot 0.f\, \cdot \, 2^{1-B}$$
\end{frame}
\begin{frame}[allowframebreaks]{Exercise 3.7}
Consider the addition of two n-bit numbers which results in a (n+1)-bit number:\\
\vspace{1em}
\begin{center}
\begin{tabular}{lrl}
& &$a_{n-1} \cdots a_0$ \\
+ & &$b_{n-1} \cdots b_0$ \\
\hline
(+carry) &$c_n$ &$c_{n-1} \cdots c_0$ \\
\hline
= &$s_n$ &$s_{n-1} \cdots s_0$ \\
\end{tabular}
\end{center}
Where $c_i$ is the incoming carry for digit $i$ and $c_{i+1}$ is the outgoing carry of digit $i$. \\
$c_0$ is 0 if not indicated otherwise.
\begin{block}{Basic idea}
Observe the carry bits that go into and come out of the n-th digit of the result.
\end{block}
\framebreak
Depending on $a_{n-1}$, $b_{n-1}$ and $c_{n-1}$ you then can reliably determine the value of $c_n$.
\begin{center}
\begin{tabular}{cc|c}
$a_{n-1}$ & $b_{n-1}$ & $c_n$ \\
\hline
0 & 0 & 0 \\
0 & 1 & $c_{n-1}$ \\
1 & 0 & $c_{n-1}$ \\
1 & 1 & 1 \\
\end{tabular}
\end{center}
This allows the conclusions that \dots
\begin{block}{If $a_{n-1} \neq b_{n-1}$:}
$c_n = c_{n-1} \Rightarrow$ incoming and outgoing carry of the last digit are equal, different sign bits of the summands generate \emph{no} overflow.
\end{block}
\framebreak
\begin{block}{If $a_{n-1} = b_{n-1} = 0$:}
The outgoing carry $c_{n_{predicted}}$ should always be 0.\\
If an incoming $c_{n-1} = 1 \neq c_{n_{predicted}}$ forces $c_n$ to become 1, an overflow has happened.
\end{block}
Example:
\begin{center}
\begin{tabular}{lrl}
& &$01$ \\
+ & &$01$ \\
\hline
(+ carry)& $0$ &$1-$ \\
\hline
= &$0$ &$10$ \\
\end{tabular}
\end{center}
\framebreak
\begin{block}{If $a_{n-1} = b_{n-1} = 1$:}
The outgoing carry $c_{n_{predicted}}$ should always be 1.\\
If an incoming $c_{n-1} = 0 \neq c_{n_{predicted}}$ forces $c_n$ to become 0, an overflow has happened.
\end{block}
Example:
\begin{center}
\begin{tabular}{lrl}
& &$10$ \\
+ & &$10$ \\
\hline
(+ carry)& $1$ &$0-$ \\
\hline
= &$1$ &$00$ \\
\end{tabular}
\end{center}
\end{frame}
\begin{frame}{Exercise 3.8 - 3.10}
3.8 $\rightarrow$ Blackboard, Homework\\
3.9 $\rightarrow$ Homework\\
3.10 $\rightarrow$ Blackboard
\end{frame}
\section{Wrapping up}
\begin{frame}{Last slide (finally)}
Homework:
\begin{itemize}
\item Finish exercise 3.8
\item Exercise 3.9
\item Exercise 3.11 to 3.16
\end{itemize}
\vspace{1em}
Next session we talk about
\begin{itemize}
\item Boolean logic
\item Basic boolean circuit elements
\end{itemize}
\vspace{1em}
\textbf{Also:} Question time!
\end{frame}
\end{document}