\documentclass[12pt,a4paper]{article}

\usepackage{amstext}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{stmaryrd}
\usepackage{enumerate}
\usepackage{alltt}
\usepackage[latin1]{inputenc}
\usepackage{cancel}
\usepackage{fancyhdr}
\usepackage{listings}
%\usepackage{gastex}
\usepackage{pstricks}
\usepackage{pst-node}
%\usepackage{ngerman}
\usepackage{wasysym}

\title{\textsc{Embedded Systems \\ \large Assignment 7}}
\author{\shortstack[c]{Jan Hendrik Dithmar\\ \scriptsize 2031259} \and \shortstack[c]{Pascal Gwosdek\\ \scriptsize 2505221}}
\date{}

\pagestyle{fancy}

\lhead{Assignment 7}
\chead{}
\rhead{Dithmar (2031259), Gwosdek (2505221)}
\lfoot{Embedded Systems}
\cfoot{Page \thepage}
\rfoot{SS 2007}

\begin{document}

\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\newcommand{\exercise}[1]{\subsection{#1}}
\renewcommand{\theenumi}{\textbf{\alph{enumi}}}

\newcommand{\AND}{\ensuremath{\wedge}}
\newcommand{\OR}{\ensuremath{\vee}}
\newcommand{\SetR}{\ensuremath{\mathbb{R}}}
\newcommand{\SetN}{\ensuremath{\mathbb{N}}}
\newcommand{\SetC}{\ensuremath{\mathbb{C}}}
\newcommand{\SetZ}{\ensuremath{\mathbb{Z}}}
\newcommand{\SetQ}{\ensuremath{\mathbb{Q}}}
\newcommand{\SetB}{\ensuremath{\mathbb{B}}}
\newcommand{\QED}{\ensuremath{\hspace*{\fill}\square}}
\newcommand{\FLASH}{\ensuremath{\hspace*{\fill}\lightning}}
\newcommand{\OnotO}{\ensuremath{\mathcal{O}}}
\newcommand{\bild}[2]{
	\begin{figure}[htpb]
		\centering
			\includegraphics[#1]{#2}\\[0.2cm]
	\end{figure}
	}

\newcommand{\m}[1]{\begin{pmatrix}#1\end{pmatrix}}
\newcommand{\+}{\phantom{-}}
\newcommand{\f}{\frac}

\maketitle

\thispagestyle{empty}

\newpage
\setcounter{page}{1}
\setcounter{section}{7}

\exercise{Markov processes}
\begin{enumerate}
\item The probability $s_2(A)$ is calculated like this:
$$s_2(A) = 0.2 \cdot 0.2 + 0.8 \cdot 0.6 = 0.04 + 0.48 = 0.52$$
\item
\begin{eqnarray*}
s_{lim}(A) & = & s_{lim}(A) \cdot 0.2 + s_{lim}(B) \cdot 0.6 \\
\Leftrightarrow 0.8 s_{lim}(A) & = & 0.6 s_{lim}(B) \\
\Rightarrow s_{lim}(A) & = & 0.75 s_{lim}(B) \\[0.5cm]
s_{lim}(A) + s_{lim}(B) & = & 1 \\
\Rightarrow s_{lim}(A) + \frac{1}{0.75} s_{lim}(A) & = & 1 \\
\Leftrightarrow \frac{1.75}{0.75} s_{lim}(A) & = & 1 \\
s_{lim}(A) & = & \frac{0.75}{1.75} \\
s_{lim}(A) & = & \frac{3}{7} \\[0.3cm]
\Rightarrow s_{lim}(B) & = & \frac{4}{7}
\end{eqnarray*}
\item $s_{lim}(A)$ depends on $s_{lim}(B)$. We saw that in the previous part. Furthermore we also know from the previous part that $s_{lim}(A) + s_{lim}(B) = 1$. These two facts suffice to calculate the probabilities without knowing the initial probabilities.
\end{enumerate}

\exercise{A/D conversion}
\begin{itemize}
\item $x = 2.25 V \to 0101_2$
\begin{center}
\begin{tabular}{c|c|c}
Comparison $c$ & $x </\geqslant c$? & Output \\
\hline
$3.00 V$ & $<$ & 0 \\
$2.00 V$ & $\geqslant$ & 1 \\
$2.50 V$ & $<$ & 0 \\
$2.25 V$ & $\geqslant$ & 1
\end{tabular}
\end{center}
\newpage
\item $x = 3.75 V \to 1011_2$
\begin{center}
\begin{tabular}{c|c|c}
Comparison $c$ & $x </\geqslant c$? & Output \\
\hline
$3.00 V$ & $\geqslant$ & 1 \\
$4.00 V$ & $<$ & 0 \\
$3.50 V$ & $\geqslant$ & 1 \\
$3.75 V$ & $\geqslant$ & 1
\end{tabular}
\end{center}
\item $x = 1.80 V \to 0011_2$
\begin{center}
\begin{tabular}{c|c|c}
Comparison $c$ & $x </\geqslant c$? & Output \\
\hline
$3.00 V$ & $<$ & 0 \\
$2.00 V$ & $<$ & 0 \\
$1.50 V$ & $\geqslant$ & 1 \\
$1.75 V$ & $\geqslant$ & 1
\end{tabular}
\end{center}
\end{itemize}

\exercise{Digital circuits}
\begin{enumerate}
\item One possible instantiation is the following:
\begin{itemize}
\item $a=0$
\item $b=0$
\item $c=1$
\item $d=0$
\item $e=1$
\item $f=1$
\end{itemize}
\item
\begin{itemize}
\item $\neg x$:
\begin{center}
\includegraphics[width=0.3\textwidth]{problem3b1.eps}
\end{center}
\newpage
\item $x \OR y$:
\begin{center}
\includegraphics[width=0.3\textwidth]{problem3b2.eps}
\end{center}
\end{itemize}
\end{enumerate}

\exercise{D/A conversion}
\begin{enumerate}
\item
\begin{itemize}
\item Assume $\vec{x} = 00...0$. $\Rightarrow U = 0 = U_{min} \quad (\forall R')$ \checkmark
\item Assume $\vec{x} = 11...1$.
\begin{eqnarray*}
-V & = & R' \cdot I \\
& = & \frac{V_{ref}}{128R} \cdot R' \cdot (128 + 64 + 32 + 16 + 8 + 4 + 2 + 1) \\
& = & 5V \cdot R' \cdot \frac{255}{128R} \stackrel{!}{=} 10V \\
\Leftrightarrow R' \cdot \frac{255}{128R} & = & 2 \\
\Leftrightarrow R' & = & \frac{256}{255}R \\
& = & \left(1 + \frac{1}{255}\right) k\Omega \\
& \approx & 1.003922 k \Omega
\end{eqnarray*}
\end{itemize}
\item
\begin{itemize}
\item Case $\vec{x} = 011...1$:
\begin{eqnarray*}
I_1 & = & \frac{V_{ref}}{128R} \cdot 127 \\
& = & \frac{127}{128} \cdot \frac{5V}{k\Omega} \\
& = & 4.9609375 mA
\end{eqnarray*}
\item Case $\vec{x} = 100...0$:
\begin{eqnarray*}
I_2 & = & V_{ref} \cdot \frac{128}{128} \cdot \frac{1}{R} \\
& = & 5 mA
\end{eqnarray*}
\end{itemize}
\item
\begin{eqnarray*}
I_{01...1} & < & I_{10...0} \\
\Leftrightarrow \frac{V_{ref}}{\hat{R}_{01...1}} & < & \frac{V_{ref}}{\hat{R}_{10...0}} \\
\stackrel{\hat{R}_i > 0 \; \forall i}{\Longrightarrow} \hat{R}_{10...0} & < & \hat{R}_{01...1} \\[0.5cm]
\mbox{Let now be } R(x7)' & = & R(x7) \cdot d \\[0.5cm]
\Leftrightarrow R \cdot d & < & \left(\frac{1}{128R} + \frac{1}{64R} + \frac{1}{32R} + \frac{1}{16R} + \frac{1}{8R} + \frac{1}{4R} + \frac{1}{2R}\right)^{-1} \\
\Leftrightarrow R \cdot d & < & \frac{128R}{127} \\
\Leftrightarrow d & < & \frac{128}{127} \approx 1.007874
\end{eqnarray*}
$\Rightarrow$ $R(x7)$ may increasingly deviate by at most $7.7874 \permil$, i.e. must necessarily be smaller than $1.007874 k\Omega$.
\end{enumerate}

\exercise{SDL/Flexray}
Please have a look at the handwritten solution which is attached.

\end{document}
