From b31c1fbe7620b85e81cac0087c1727e5d1aa537b Mon Sep 17 00:00:00 2001 From: Garritt McCune Date: Thu, 1 Aug 2024 23:22:35 -0500 Subject: [PATCH] Started on a new figure to explain a new instruction layout, no more fixed length encoding, basically. --- chapter 2.tex | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/chapter 2.tex b/chapter 2.tex index e1532db..5c073ef 100644 --- a/chapter 2.tex +++ b/chapter 2.tex @@ -21,6 +21,21 @@ 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} + \begin{tikzpicture} + \draw (-8, 0) -- (-4, 0) node[midway, below=1em] {Opcode}; + \draw (-8, -0.25) -- (-8, 0.25) node[above] {7}; + \draw (-4, -0.25) -- (-4, 0.25) node[above] {0}; + \draw [dashed] (-3.75, 0) -- (0, 0) node[midway, above=1em] {Mode Setting}; + \draw (-3.75, -0.25) node[below] {7} -- (-3.75, 0.25); + \draw (0, -0.25) node[below] {0} -- (0, 0.25); + \end{tikzpicture} + \caption{Encoding} + \label{fig:opencoding} % https://www.overleaf.com/learn/latex/Referencing_Figures + \paragraph{Note} The dotted line showing the \textit{Mode Setting} byte can be optional in some instructions. +\end{figure} + + \begin{figure} \begin{tikzpicture} \draw (\minX, 0) -- (\maxX, 0); @@ -86,6 +101,11 @@ The /r represents a byte that specifies a register. /iX is for the immediate dat \OpcodeTable{01 /r /r}{xor /r, /r}{Register}{Register}{Bit-wise exclusive ORs \textit{Operand 1} and \textit{Operand 2} placing the result into \textit{Operand 1}.} \subsection{NOT} \OpcodeTable{01 /r}{not /r}{Register}{None}{Bit-wise negates \textit{Operand 1} placing the result into \textit{Operand 1}.} +\subsection{SHL} +\OpcodeTable{01 /r /i8}{shl /r, /i8}{Register}{Immediate}{Shifts the bits of \textit{Operand 1} left \textit{Operand 2} times.} +\subsection{SHR} +\OpcodeTable{01 /r /i8}{shr /r, /i8}{Register}{Immediate}{Shifts the bits of \textit{Operand 1} right \textit{Operand 2} times.} + \subsection{NOP} \OpcodeTable{01}{nop}{None}{None}{No operation, increments the Program Counter by one.} %Oh this control flow will be interesting, juggling flags is not something I'm used to. @@ -111,4 +131,6 @@ The /r represents a byte that specifies a register. /iX is for the immediate dat \subsection{CLI} \OpcodeTable{01}{cli}{None}{None}{Clears the interrupt flag preventing the processor from receiving interrupts.} \subsection{ENI} -\OpcodeTable{01}{eni}{None}{None}{Sets the interrupt flag allowing the processor to receive interrupts.} \ No newline at end of file +\OpcodeTable{01}{eni}{None}{None}{Sets the interrupt flag allowing the processor to receive interrupts.} +\subsection{INT} +\OpcodeTable{01 /i8}{int /i8}{Immediate}{None}{Triggers software interrupt number \textit{Operand 1}.} \ No newline at end of file