\section{Encoding}

% -----------------------------------------------------------------
\begin{slide}{}

   \subsection{Overview}

   Signals propagate over a physical medium.
   \begin{sitem}
      \item Digital signals
      \item Analog signals
   \end{sitem}

   \bigskip
   Data can be either digital or analog; we're interested in digital data.

   \bigskip
   Problem: Encode the binary data that the source node wants to send
   to the destination node into the signal that propogates over

   \pichere{node_link_1.eps,height=1.5in}

\end{slide}

% -----------------------------------------------------------------
\begin{slide}{}

   \subsection{Non-Return to Zero (NRZ)}

   \pichere{nrz.eps,height=0.75in}

   \bigskip
   Problem: Consecutive 1s or 0s
   \begin{sitem}
      \item Low signal (0) may be interpretted as no signal
      \item High signal (1) leads to baseline wander
      \item Unable to recover clock
   \end{sitem}
\end{slide}

% -----------------------------------------------------------------
\begin{slide}{}

   \subsection{NRZI and Manchester}

   \begin{sitem} 
      \item Non-return to Zero Inverted (NRZI): Make a transition
       from the current signal to encode a one, and stay at the
       current signal to encode a zero; solves the problem of 
       consecutive ones.

      \bigskip\bigskip
      \item Manchester: Transmits the XOR of the NRZ encoded data and
       the clock; only 50\% efficient.
   \end{sitem}

   \pichere{encode_all.eps,height=2in}

\end{slide}

% -----------------------------------------------------------------
\begin{slide}{}

   \subsection{4B/5B}

   Idea: Every 4 bits of data is encoded in a 5-bit code, with the 5-bit
   codes selected to have no more than one leading 0 and no more than two
   trailing 0 (i.e., never get more than three consecutive 0s). Resulting
   5-bit codes are then transmitted using the NRZI encoding. Achieves 80\% 
   efficiency.

\begin{center}
\begin{tabular}{|l|l|} 
\hline
4-bit Data & 5-bit Code \\
\hline
0000 & 11110\\
0001 & 01001\\
0010 & 10100\\
0011 & 10101\\
0100 & 01010\\
0101 & 01011\\
0110 & 01110\\
0111 & 01111\\
1000 & 10010\\
1001 & 10011\\
1010 & 10110\\
1011 & 10111\\
1100 & 11010\\
1101 & 11011\\
1110 & 11100\\
1111 & 11101\\
\hline
\end{tabular}
\end{center}
\end{slide}

