\documentclass[11pt]{article}
\usepackage{handout2e}
\input{macros}
\input{epsf}
\usepackage[dvips]{graphicx}
\usepackage{epsfig}
\begin{document}

\input{courseMacros}
\thispagestyle{empty}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1.8ex}

\newcommand{\load}{\mbox{{\it lod }}}
\newcommand{\add}{\mbox{{\it add }}}
\newcommand{\ngt}{\mbox{{\it neg }}}
\newcommand{\jump}{\mbox{{\it jiz }}}

\head{1722}{Freshman Honors Seminar}{Winter 2003}{4 March 2003}{7}

\begin{center}
\Large{\bf Design of a Simple Processor}
\end{center}

Our design will proceed in steps. 

\begin{enumerate}
\item 
We lay out the registers (giving names to the input bits, output bits,
and registers for convenience).
\item
We design the circuits for extracting the next instruction and
incrementing the PC.
\item
We design the circuits for implementing the add, negate, load, and
jump-if-zero operations.
\item
We design the circuit that determines the input and the set bits for
the data registers and the PC based on the above circuits.
\item
In each of the above circuits, we clearly label the inputs and
outputs.  These circuits can be put together by matching the
appropriate labeled inputs and outputs.
\end{enumerate}

\BfPara{Registers} 
Here is a layout of the registers.  Note that the set bit for PC is
always 1 and the set bit of program registers is always 0.  So the PC
changes at every clock cycle and the program registers never change.
The set bits for the data registers will be determined by the
instruction.

\begin{figure}[h]
\begin{center}
\epsfig{file=registers.eps,width=0.7\textwidth}
\end{center}
\end{figure}

\newpage

\BfPara{Extracting the instruction and incrementing the PC} The
following are the circuits for extracting the next instruction using
the PC, and calculating the increment of PC.  Note that whether the PC
will be actually incremented (or set to something else) will be
determined by the instruction, as we will see shortly.

\begin{figure}[h]
\begin{center}
\epsfig{file=instruction.eps,width=0.7\textwidth}
\end{center}
\end{figure}

\newpage

\BfPara{The add instruction}
Here is the circuit for implementing the add instruction.  

\begin{figure}[h]
\begin{center}
\epsfig{file=execute_add.eps,width=\textwidth}
\end{center}
\end{figure}

\newpage

\BfPara{The negate instruction}
Here is the circuit for implementing the negate instruction.  

\begin{figure}[h]
\begin{center}
\epsfig{file=execute_negate.eps,width=\textwidth}
\end{center}
\end{figure}


\newpage

\BfPara{The load instruction}
Here is the circuit for implementing the load instruction.  

\begin{figure}[h]
\begin{center}
\epsfig{file=execute_load.eps,width=0.6\textwidth} 

\end{center}
\end{figure}

\newpage

\BfPara{The jump-if-zero instruction}
Here is the circuit for implementing the jump-if-zero instruction.  

\begin{figure}[h]
\begin{center}
\epsfig{file=execute_jump.eps,width=\textwidth}
\end{center}
\end{figure}

\newpage

\BfPara{Storing the new values into the data registers and PC}
The values computed by the add, negate, load, and jump-if-zero
circuits give us potential values that need to be stored in the data
registers.  Whether the registers need to be updated and what their
new values will be is determined by the particular instruction type.
The following circuit pushes in the correct value into the registers.
It also determines the correct value of the PC.  The inputs to the
program registers are the same as their outputs (since they are not
allowed to change).

\begin{figure}[h]
\begin{center}
\epsfig{file=input_registers.eps,width=\textwidth}
\end{center}
\end{figure}

\newpage
\end{document}
