Skip to content

Commit 83733e8

Browse files
author
Jesse Hamner
committed
More graphics and examples. Some editing.
1 parent 98f1094 commit 83733e8

11 files changed

+690
-11
lines changed

chapters/appendices.tex

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,11 @@ \section*{Memory}
186186
One type of computer memory, called \emph{static RAM}, uses at least six transistors per bit. The main computer RAM is called dynamic RAM, or DRAM, and uses only one transistor and one capacitor per bit. To store one bit with 6 or more transistors is also more expensive, so SRAM is mostly used for very important memory, like the memory very close to the core of the computer processor. Have a look at Figure \ref{fig:sram}\footnote{Diagram and supporting information adapted from {\color{webblue}\href{https://en.wikipedia.org/wiki/Static_random-access_memory}{Wikipedia}} and {\color{webblue}\href{https://www.entner.net/sites/default/files/diss-entner-final-v1.pdf}{Robert Entner's dissertation}}.},
187187
which is pretty complicated, but if you understand how the two types of transistors are turned on and off, it will make sense. To keep this diagram simple, no resistors are shown. If you look closely at the $Q_1$/$Q_2$ and $Q_3$/$Q_4$ transistors, you can see that they are acting like inverters (that is, each pair makes a NOT gate). When WL (the ``word line") goes high, $Q_5$ and $Q_6$ open up, allowing access to the single bit stored in $BL$ and the inverse of that bit in $\overline{BL}$. Whether the word line is active (that is, whether or not you can write to the memory bit), it is possible to read the value of the bit--making SRAM very fast, because the system does not wait on the word line to activate.
188188

189-
% TODO Replace this section with a complementary NOR gate flip-flop or a JK flip-flop: https://www.electronics-tutorials.ws/sequential/seq_2.html.
190-
% Flip-flop storage using NOR gates is better than this attempt with NOT gates. I've had trouble with the word/line controller circuit resistor values for positive clearing and setting of the gate states.
191189

192190
\begin{figure}[h!]
193191
\begin{center}
194192
\input{./include/sramcell.tex}
195-
\caption{A static ram cell. The bit line ($BL$) on the right is the value of the bit, and the bit line on the left ($\low{BL}$) is the complement (NOT) the value of that bit. With a bit of careful circuitry, it is possible to write using only one of the bit lines, but it is safer to have two inputs (one positive, and one complement) to ensure the gates both change and lock in the value of the bit. }
193+
\caption{A static ram cell. The bit line ($BL$) on the right is the value of the bit, and the bit line on the left ($\low{BL}$) is the complement (NOT) the value of that bit.} % With a bit of careful circuitry, it is possible to write using only one of the bit lines, but it is safer to have two inputs (one positive, and one complement) to ensure the gates both change and lock in the value of the bit.
196194
\label{fig:sram}
197195
\end{center}
198196
\end{figure}
@@ -203,19 +201,61 @@ \section*{Memory}
203201
circuit, and see how it works. As a bonus, you can construct a bit of SRAM with
204202
opposing NOT gates, making it fairly easy to see what is happening.
205203

206-
We are going to make some SRAM using a \emph{flip-flop} circuit, made of NAND gates.
204+
\begin{figure}
205+
\begin{center}
206+
\input{./include/JK-flip-flop.tex}
207+
\caption{A gate-level schematic of one bit of memory, using a JK flip-flop circuit. Note that the two left-most NAND gates have \emph{three} inputs.}
208+
\end{center}
209+
\end{figure}
210+
211+
% JK flip-flop:
212+
% Flip-flop storage using NOR gates is better than my previous attempt using NOT gates.
213+
% I had trouble with the word/line controller circuit resistor values for positive
214+
% clearing and setting of the gate states.
215+
216+
We are going to make some SRAM using a {\color{webblue}\href{https://www.electronics-tutorials.ws/sequential/seq_2.html}{\emph{flip-flop}}} circuit, made of NAND gates.
207217
It uses more transistors, but it's simpler to create and this workshop already
208-
includes plenty of NAND gates for use. Notably, this ``JK Flip-Flip" circuit uses
209-
both two input NAND gates and \emph{three}-input NAND gates. It operates mostly
210-
the same way as a regular ``set/reset (SR) flip-flop''.
218+
includes plenty of NAND gates for use. Notably, this ``JK Flip-Flop" circuit uses
219+
two input NAND gates and also \emph{three}-input NAND gates. 3-input NAND operates mostly
220+
the same way as a regular NAND gate, except that the inputs
221+
also include the value of the Q and not-Q output lines, required to determine the output state of the gate.
222+
Therefore, the set- and reset- functions
223+
only activate when the clock signal is also high (has positive voltage on the line).
224+
This extra feature allows for certainty of reads and writes: it helps
225+
avoid rapid oscillation / instability or lock-ups should a circuit (or a third
226+
grader!) try to both set and reset the
227+
flip-flop at the same time. Furthermore, when powering up a simple SR flip-flop,
228+
there is no inherent guarantee of what the value would be (of course, it's
229+
possible to put a pull-up or pull-down resistor on the signal lines to create
230+
a natural ``base level'' of a set of inputs, though care must be taken to
231+
not accidentally create incompatible base conditions (such as accidentally setting
232+
both set and reset to high).
233+
211234

212235

236+
237+
238+
239+
%---------------------------
213240
\clearpage
241+
\newpage
242+
\section*{Why NAND Gates and NOR Gates are ``Universal"}
243+
%---------------------------
244+
245+
It turns out that it is possible to make \emph{any} gate from NAND gates. The same is true for NOR gates. A very simple example can be seen, where we can create a NOT gate from two NOR gates.
246+
247+
\input{./include/nor-to-or-gate.tex}
214248

215249

250+
%---------------------------
251+
\clearpage
252+
\newpage
216253
\section*{Resistor Chart}
254+
%---------------------------
217255

218-
Resistors are marked with colored bands to make it easy to determine what resistance value they have, and how close each individual part's value is guaranteed to be to that stated value.
256+
Resistors are marked with colored bands to make it easy to determine what
257+
resistance value they have, and how close each individual part's value is
258+
guaranteed to be to that stated value.
219259

220260

221261
\begin{figure}[!ht]

chapters/math.tex

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,36 @@ \subsection*{Representing Numbers in Binary}
235235
}
236236
\end{minipage}
237237

238+
\bigskip
239+
240+
\begin{tabular}{ llll llll llll llll l}
241+
242+
\multicolumn{17}{c}{\textbf{How Computers Count to 2,020}}\\[\sep]
243+
244+
\grr \hline\\[\negsep]
245+
% 2020: 0111 1110 0100
246+
\grr $2^{15}$ & $2^{14}$ & $2^{13}$ & $2^{12}$ & $2^{11}$ & $2^{10}$ & $2^9$ & $2^8$ &
247+
$2^7$ & $2^6$ & $2^5$ & $2^4$ & $2^3$ & $2^2$ & $2^1$ & $2^0$ & \\
248+
\hline\\[\negsep]
249+
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & zero \\
250+
\grr
251+
0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 1 & 2019 \\
252+
0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 2020 \\
253+
\grr
254+
%\\[\sep]
255+
\hline
256+
257+
\end{tabular}
238258

239259
\bigskip
240260

241261
\begin{tabular}{ llll llll llll llll l}
242262

243263
\multicolumn{17}{c}{\textbf{How Computers Count to 65,535}}\\[\sep]
244264

245-
\hline\\[\negsep]
265+
\grr \hline\\[\negsep]
246266

247-
$2^{15}$ & $2^{14}$ & $2^{13}$ & $2^{12}$ & $2^{11}$ & $2^{10}$ & $2^9$ & $2^8$ &
267+
\grr $2^{15}$ & $2^{14}$ & $2^{13}$ & $2^{12}$ & $2^{11}$ & $2^{10}$ & $2^9$ & $2^8$ &
248268
$2^7$ & $2^6$ & $2^5$ & $2^4$ & $2^3$ & $2^2$ & $2^1$ & $2^0$ & \\
249269
\hline\\[\negsep]
250270
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & zero \\

computertheoryforkids.pdf

-2.2 KB
Binary file not shown.

computertheoryforkids.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
% Numerous macros in here:
3939
\input{macros.tex}
40+
\input{flipflopconditions.tex}
4041

4142
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4243
\begin{document}

drawings/1-bit_full-adder.svg

Lines changed: 232 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)