Added the start of a second chapter for the ISA itself.

This commit is contained in:
2024-07-15 23:57:27 -05:00
parent 70849bb698
commit 51c79d74aa
3 changed files with 24 additions and 4 deletions
+13 -4
View File
@@ -1,17 +1,26 @@
\chapter{Overview} \chapter{Overview}
This is an attempt to distill what I know about how computers work into some kind of emulator / simulator. I'm curious to see if what I know at the moment is enough to allow me to emulate a general purpose computer. A computer that will be big-endian, using 8-bit bytes for its char type. The memory is a 32 bit linear address space allowing for a maximum of 2\textsuperscript{32} bytes to be addressable. This is an attempt to distill what I know about how computers work into some kind of emulator / simulator. I'm curious to see if what I know at the moment is enough to allow me to emulate a general purpose computer. A computer that will be big-endian, using 8-bit bytes for its char type. The memory is a 32 bit linear address space allowing for a maximum of 2\textsuperscript{32} bytes to be addressable.
\section{Registers} \section{Registers}
Eight 32-bit general purpose registers are available for holding operands and memory addresses along with a Flags Register. The Flags Register is a 32-bit register allowing for 32 flags. Currently there are only arithmetic flags which are Overflow (OF), Underflow (UF), and a Zero Flag (ZF). The overflow flag is set if there is a carry. A base pointer register contains a 32 bit address that points to the start of the current stack frame, which is the first opcode of the stack frame. Therefore the first argument would be addressed as such: mov r1, bp - sizeof(void *). Finally we have the Program Counter which contains a 32 bit address that contains the next instruction to execute. Eight 32-bit general purpose registers are available for holding operands and memory addresses along with a Flags Register. The Flags Register is a 32-bit register allowing for 32 flags. Currently there are only arithmetic flags which are Overflow (OF), Underflow (UF), and a Zero Flag (ZF). The overflow flag is set if there is a carry. A base pointer register contains a 32 bit address that points to the start of the current stack frame, which is the first opcode of the stack frame. Therefore the first argument would be addressed as such:
\begin{verbatim}
mov r1, bp - sizeof(void *)
\end{verbatim}
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] \tikzstyle{blockRow} = [rectangle, minimum width=10cm, minimum height=0.5cm, text centered, draw=black]
%Note: tikzset might be better to use instead of tikzstyle. %Note: tikzset might be better to use instead of tikzstyle.
\tikzset{
Rect/.style = {rectangle, fill=red!10!white}
}
\begin{figure}[!htb] \begin{figure}[!htb]
\centering %\centering
\begin{tikzpicture} \begin{tikzpicture}
\node at (0, 0) {31}; \node at (1 ,0) {31};
%\node [Rect] at (0, 2) {test};
%\node at (0, ) %\node at (0, )
\foreach \pos in {1,...,8} { \foreach \pos in {1,...,8} {
%\node at (0, \pos + 1) [blockRow] (\pos) {\pos}; %\node at (0, \pos + 1) [blockRow] (\pos) {\pos};
\node at (0, \pos) [blockRow] {r\pos}; \node at (0, \pos - 1) [blockRow] {r\pos};
;} ;}
%\node [blockRow] (start) {r1}; %\node [blockRow] (start) {r1};
%\node (r2) [blockRow] [below=of start] {r2}; %\node (r2) [blockRow] [below=of start] {r2};
+10
View File
@@ -0,0 +1,10 @@
\chapter{Instruction Set Architecture}
\section{Encoding}
\def\minY{0} \def\maxY{0.5}
\def\minX{-7} \def\maxX{7}
\begin{tikzpicture}
\draw (\minX, \minY) -- (\maxX, \minY);
\draw (\minX, \minY) -- (\minX, \maxY) node[above] {31}; %{$y$}; Note the $'s, those make something math stylized.
\draw (\maxX, \minY) -- (\maxX, \maxY) node[above]{0};
\end{tikzpicture}
+1
View File
@@ -13,6 +13,7 @@
\tableofcontents \tableofcontents
\include{chapter 1} \include{chapter 1}
\include{chapter 2}
\end{document} \end{document}