% Author Info
\def\thetitle{HW5 Logic Circuits}
\def\theclass{CS105}
\def\university{University of Massachusetts Boston}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% You can ignore all this stuff for now
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[12pt,letterpaper]{article}

\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage{setspace}
\usepackage{Tabbing}
\usepackage{lastpage}
\usepackage{extramarks}
\usepackage{chngpage}
\usepackage{soul,color}
\usepackage{graphicx,float,wrapfig}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}
\usepackage{url}
\usepackage{scalefnt}
%Tikz
\usepackage{tikz}
\usetikzlibrary{trees,snakes}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{matrix}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{chains,positioning,scopes}

\usepackage{circuitikz}

\usepackage{multicol}


\setlength{\parskip}{0pt} % 1ex plus 0.5ex minus 0.2ex}
\setlength{\parindent}{0pt}

% Increase to 2.0 for double spacing.
\linespread{1}

% Header & Footers
% LaTeX has very generous margins, by default.
% I've shrunk the margins, considerably.
\usepackage[hmargin=2cm,vmargin=3.5cm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\thetitle}
\chead{}
\rhead{\theclass}
\lfoot{}
\cfoot{}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}

\begin{document}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% You work below this part
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% $\lnot \Box$
% 
% $\diamondsuit$
% 
% $\bigcirc$

Name:
\vspace{30pt}

1. Convert the following logic circuit into a boolean expression and compute
the truth tables.


\begin{center}
\vspace{30pt}
\begin{circuitikz} 


\node (a) at (0,0) {$a$};
\node (b) at (0,-1) {$b$};
\node (c) at (0,-2) {$c$};
%\node (c) at (0,-3) {$d$};


\draw
(3,-0.5) node[and port] (and1) {}
(3,-2.5) node[or port] (and2) {}
(5,-2) node[xnor port] (xor) {}
(and1.out) -- (xor.in 1)
(and2.out) -- (xor.in 2);

\draw (a) -- (and1.in 1);
\draw (b) -- (and1.in 2);

\draw (a) -- (and2.in 1);
\draw (c) -- (and2.in 2);
\end{circuitikz}

\vspace{200pt}


\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|}

\hspace{50pt} & \hspace{50pt} & \hspace{50pt} & \hspace{50pt} & \hspace{50pt} & \hspace{50pt} & \hspace{50pt} \\
\hline
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
\end{tabular}
\end{center}












\newpage 

2. Write the boolean expression for the following circuit. Find at
least one set of inputs that is true.


\begin{center}
\vspace{30pt}
\begin{circuitikz} 


\node (a) at (0,0) {$a$};
\node (b) at (0,-1) {$b$};
\node (c) at (0,-2) {$c$};
\node (d) at (0,-3) {$d$};


\draw
(3,-0.5) node[nor port] (nor) {}
(3,-2.5) node[and port] (and) {}
(5,-2) node[xor port] (xor) {}
(7,-1) node[or port] (or) {}

(and1.out) -- (xor.in 1)
(and2.out) -- (xor.in 2);

\draw (a) -- (nor.in 1);
\draw (b) -- (nor.in 2);

\draw (a) -- (and.in 1);
\draw (c) -- (or.in 1);

\draw (d) -- (and.in 2);
\draw (d) -- (and.in 2);

\draw (xor.out) -- (or.in 2);

\end{circuitikz}
\end{center}









\newpage
3. Draw the circuit and truth table for the following boolean expression

$$(\lnot(a | b) \& (c \oplus b) \& (a | c ))$$





\vspace{300pt}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|}

\hspace{50pt} & \hspace{50pt} & \hspace{50pt} & \hspace{50pt} & \hspace{50pt} & \hspace{50pt} & \hspace{50pt} \\
\hline
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
& & & & & & \\
\hline
\end{tabular}
\end{center}



\end{document}