From 1b9910e908a29fa5c3921c5503d8a7dd7373a3de Mon Sep 17 00:00:00 2001 From: Garritt McCune Date: Mon, 22 Jul 2024 16:09:00 -0500 Subject: [PATCH] Started to mess around with setting up the figure for the layout of the registers and main memory. --- chapter 1.tex | 33 ++++++++++++++++++--------------- chapter 2.tex | 4 +--- document.tex | 2 ++ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/chapter 1.tex b/chapter 1.tex index 1970ce6..8325e7c 100644 --- a/chapter 1.tex +++ b/chapter 1.tex @@ -8,22 +8,25 @@ Eight 32-bit general purpose registers are available for holding operands and me Finally we have the Program Counter which contains a 32 bit address that points to the next instruction to execute. \tikzstyle{blockRow} = [rectangle, minimum width=10cm, minimum height=0.5cm, text centered, draw=black] -%Note: tikzset might be better to use instead of tikzstyle. -\tikzset{ - Rect/.style = {rectangle, fill=red!10!white} -} -\begin{figure}[!htb] - %\centering - \begin{tikzpicture} - \node at (1 ,0) {31}; - %\node [Rect] at (0, 2) {test}; - %\node at (0, ) +\def\minY{-5} \def\maxY{5} +\def\minX{-5} \def\maxX{5} +\begin{figure}[h] + \centering + \begin{tikzpicture}[node distance=0cm] + \node [draw, fit={(\minX, 0) (0, 0.5)}, label=center:Status Register (Flags)] (flags) {}; + %\draw (\minX,0.5) node[above=1em] {31} rectangle (0, 1) node[midway] {Status Register (Flags)} node[above] (lsb) {0}; + \draw (flags); + \node[above left=of flags] {31}; + \node[above right=of flags] {0}; + + %\draw (\minX,-\pos / 2 - 0.5) rectangle (0, -\pos / 2) node[midway] (register1) {r1}; + \foreach \pos in {1,...,8} { - %\node at (0, \pos + 1) [blockRow] (\pos) {\pos}; - \node at (0, \pos - 1) [blockRow] {r\pos}; - ;} - %\node [blockRow] (start) {r1}; - %\node (r2) [blockRow] [below=of start] {r2}; + \draw (\minX,-\pos / 2 - 0.5) rectangle (0, -\pos / 2) node[midway] (register\pos) {r\pos}; + } + %\draw node[above=of register1] {General Purpose Registers}; + + \draw (\maxX / 2, 1) rectangle (\maxX, \minY) node[midway] {Memory}; \end{tikzpicture} \caption{Register Bit Layout} \end{figure} diff --git a/chapter 2.tex b/chapter 2.tex index 26f8d89..4e26f0a 100644 --- a/chapter 2.tex +++ b/chapter 2.tex @@ -17,13 +17,11 @@ \def\minY{-1.5em} \def\maxY{1.5em} \def\minX{-7} \def\maxX{7} -\usetikzlibrary{decorations.pathreplacing} - \section{Encoding Scheme} All instructions are a fixed width of 32-bits. There are two basic encoding schemes that the object code will take. The most basic layout is shown in Figure \ref{fig:OpShortEncodingFigure} that is used by instructions that take one or zero arguments, where the 16 most significant bits are used to encode the instruction itself. Followed by the 16 least significant bits being used to encode a numeric constant that may be interpreted as a relative address. For instructions that require two arguments the encoding scheme shown in Figure \ref{fig:OpArgEncodingFigure} is used. % Placement info here: https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Figures % Paths: https://tikz.dev/tikz-paths -\begin{figure}[h] +\begin{figure} \begin{tikzpicture} \draw (\minX, 0) -- (\maxX, 0); \draw (\minX, \minY / 2) -- (\minX, \maxY / 2); %{$y$}; Note the $'s, those make something math stylized. diff --git a/document.tex b/document.tex index a14de7c..f4dd25c 100644 --- a/document.tex +++ b/document.tex @@ -2,6 +2,8 @@ \usepackage{tabularx} \usepackage{tikz} \usetikzlibrary{positioning} +\usetikzlibrary{decorations.pathreplacing} +\usetikzlibrary{fit} \usepackage{hyperref} \hypersetup{ linktoc=all