From 5c646a48358cb6f5f02deccaf9b9261982b37f60 Mon Sep 17 00:00:00 2001 From: Garritt McCune Date: Fri, 19 Jul 2024 00:53:29 -0500 Subject: [PATCH] First opcode table setup. --- chapter 2.tex | 23 +++++++++++++++++++++-- document.tex | 13 ++----------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/chapter 2.tex b/chapter 2.tex index 5ecdd7a..818b2c6 100644 --- a/chapter 2.tex +++ b/chapter 2.tex @@ -1,9 +1,23 @@ \chapter{Instruction Set Architecture} -\section{Encoding Schemes} + +\newcommand{\OpcodeTable}[4] { + \begin{tabularx}{\textwidth}{ | X | X | X | X | } + \hline + Opcode Hex & Instruction & Operand 1 & Operand 2 \\ + \hline + #1 & #2 & #3 & #4 \\ + \hline + \end{tabularx} +} + \def\minY{0} \def\maxY{0.5} \def\minX{-7} \def\maxX{7} \usetikzlibrary{decorations.pathreplacing} + +\section{Encoding Schemes} +The /r represents a byte that specifies a register. /iX is for the immediate data type, where \textit{X} defines the width, which are 8, 16, or 32 bits. + \begin{figure}[!htb] \begin{tikzpicture} \draw (\minX, \minY) -- (\maxX, \minY); @@ -28,4 +42,9 @@ \draw [decorate, decoration={brace, amplitude=1em, mirror}] (0, -\maxY) -- (\maxX, -\maxY) node[midway, below=1em] {Near Address (16-bits)}; \end{tikzpicture} \caption{Short Valued Opcodes} -\end{figure} \ No newline at end of file +\end{figure} + +\section{Instructions} +\subsection{Add} +\OpcodeTable{01 /r /r}{add /r, /r}{Register}{Register} +\paragraph{Description} Sums \textit{Operand 1} and \textit{Operand 2} placing the result into \textit{Operand 1}. \ No newline at end of file diff --git a/document.tex b/document.tex index 8bc095d..a14de7c 100644 --- a/document.tex +++ b/document.tex @@ -1,4 +1,5 @@ \documentclass[a4paper,12pt]{book} +\usepackage{tabularx} \usepackage{tikz} \usetikzlibrary{positioning} \usepackage{hyperref} @@ -15,14 +16,4 @@ \include{chapter 1} \include{chapter 2} -\end{document} - -\newcommand{\OpcodeTable}[5] { - \begin{tabular}{ c c c c c } - \hline - Opcode & Bit Pattern & Mnemonic & Operand 1 & Operand 2 \\ - \hline\hline - #1 & #2 & #3 & #4 & #5 \\ - \hline - \end{tabular} -} \ No newline at end of file +\end{document} \ No newline at end of file