1 |
22 |
hellwig |
\newenvironment{effectize}{Effect: \begin{itemize}}{\end{itemize}}
|
2 |
|
|
\newcommand{\effect}{\item[]}
|
3 |
|
|
\newenvironment{effectblock}{\begin{itemize}}{\end{itemize}}
|
4 |
|
|
|
5 |
|
|
\newcommand{\regeffect}[1]{\effect $R_r \leftarrow #1$}
|
6 |
|
|
\newcommand{\regeffects}[1]{\begin{effectize}\regeffect{#1}\end{effectize}}
|
7 |
|
|
|
8 |
|
|
\newcommand{\bitregeffect}[1]{\effect $R_{r,i} \leftarrow #1$}
|
9 |
|
|
\newcommand{\bitregeffects}[1]{\begin{effectize}\bitregeffect{#1}\end{effectize}}
|
10 |
|
|
|
11 |
|
|
\newcommand{\priveffect}{\effect if $U_C = 1$ then trigger a \name{Privileged Instruction Fault}}
|
12 |
|
|
|
13 |
|
|
\newcommand{\rrrformat}[1]{
|
14 |
|
|
Format:
|
15 |
|
|
\begin{tabular}{|c|c|c|c|c|c|}
|
16 |
|
|
\hline
|
17 |
|
|
Bits & 31..26 & 25..21 & 20..16 & 15..11 & 10..0\\
|
18 |
|
|
\hline
|
19 |
|
|
Value & #1 & x & y & r & (ignored)\\
|
20 |
|
|
\hline
|
21 |
|
|
\end{tabular}
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
\newcommand{\rriformat}[1]{
|
25 |
|
|
Format:
|
26 |
|
|
\begin{tabular}{|c|c|c|c|c|}
|
27 |
|
|
\hline
|
28 |
|
|
Bits & 31..26 & 25..21 & 20..16 & 15..0\\
|
29 |
|
|
\hline
|
30 |
|
|
Value & #1 & x & r & y\\
|
31 |
|
|
\hline
|
32 |
|
|
\end{tabular}
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
\newcommand{\jformat}[1]{
|
36 |
|
|
Format:
|
37 |
|
|
\begin{tabular}{|c|c|c|}
|
38 |
|
|
\hline
|
39 |
|
|
Bits & 31..26 & 25..0\\
|
40 |
|
|
\hline
|
41 |
|
|
Value & #1 & offset\\
|
42 |
|
|
\hline
|
43 |
|
|
\end{tabular}
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
\newcommand{\jrformat}[1]{
|
47 |
|
|
Format:
|
48 |
|
|
\begin{tabular}{|c|c|c|c|}
|
49 |
|
|
\hline
|
50 |
|
|
Bits & 31..26 & 25..21 & 20..0\\
|
51 |
|
|
\hline
|
52 |
|
|
Value & #1 & dest & (ignored)\\
|
53 |
|
|
\hline
|
54 |
|
|
\end{tabular}
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
\newcommand{\brformat}[1]{
|
58 |
|
|
Format:
|
59 |
|
|
\begin{tabular}{|c|c|c|c|c|}
|
60 |
|
|
\hline
|
61 |
|
|
Bits & 31..26 & 25..21 & 20..16 & 15..0\\
|
62 |
|
|
\hline
|
63 |
|
|
Value & #1 & x & y & offset\\
|
64 |
|
|
\hline
|
65 |
|
|
\end{tabular}
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
\newcommand{\ldstformat}[1]{
|
69 |
|
|
Format:
|
70 |
|
|
\begin{tabular}{|c|c|c|c|c|}
|
71 |
|
|
\hline
|
72 |
|
|
Bits & 31..26 & 25..21 & 20..16 & 15..0\\
|
73 |
|
|
\hline
|
74 |
|
|
Value & #1 & x & r & y\\
|
75 |
|
|
\hline
|
76 |
|
|
\end{tabular}
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
\newcommand{\noargformat}[1]{
|
80 |
|
|
Format:
|
81 |
|
|
\begin{tabular}{|c|c|c|}
|
82 |
|
|
\hline
|
83 |
|
|
Bits & 31..26 & 25..0\\
|
84 |
|
|
\hline
|
85 |
|
|
Value & #1 & (ignored)\\
|
86 |
|
|
\hline
|
87 |
|
|
\end{tabular}
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
\newcommand{\mvspformat}[1]{
|
91 |
|
|
Format:
|
92 |
|
|
\begin{tabular}{|c|c|c|c|c|}
|
93 |
|
|
\hline
|
94 |
|
|
Bits & 31..26 & 25..21 & 20..16 & 15..0\\
|
95 |
|
|
\hline
|
96 |
|
|
Value & #1 & (ignored) & r & z\\
|
97 |
|
|
\hline
|
98 |
|
|
\end{tabular}
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
\chapter{Instruction Set}
|
102 |
|
|
|
103 |
|
|
The instructions of the \eco operate directly on the functional components described in the previous chapter. They can be subdivided into groups of instructions that work in a similar way:
|
104 |
|
|
\begin{itemize}
|
105 |
|
|
\item {\it Computation}: These instructions compute a function of values stored in general-purpose registers or encoded directly into the instruction and store the result in a general-purpose register.
|
106 |
|
|
\item {\it Control Flow}: These instructions affect the \pc in various ways.
|
107 |
|
|
\item {\it Load/Store}: These instructions transfer data from or to RAM locations or peripheral device registers.
|
108 |
|
|
\item {\it System}: Special instructions for \pswx, \mmux, or exception operation.
|
109 |
|
|
\end{itemize}
|
110 |
|
|
|
111 |
|
|
\section{Definitions}
|
112 |
|
|
|
113 |
|
|
Some definitions are useful when explaining the effect of an instruction: An \definition{immediate} value is a value encoded directly into the instruction. A \definition{register value} is a 32-bit value taken from a general-purpose register. The interpretation of such values is up to the instruction.
|
114 |
|
|
|
115 |
|
|
A register value is referred to by an instruction by an immediate value that denotes the register number. If $x$ is a 5-bit immediate value, then $R_x$ shall denote the corresponding register value, and $R_x \leftarrow ...$ shall denote an assignment to this register. Similarly, $S_i$ denotes special purpose register \#i. $R_{i,j}$ and $S_{i,j}$ denote specific bits of a register. As a special rule, an assignment to $R_0$ has no effect since that register is not writeable.
|
116 |
|
|
|
117 |
|
|
\section{General Execution Loop}
|
118 |
|
|
|
119 |
|
|
The \eco executes the following loop to perform its task:
|
120 |
|
|
\begin{itemize}
|
121 |
|
|
\item Remember the current value of the \pc register. If any exception occurs before the instruction is finished, this value is placed in register \#30 such that the current instruction can be restarted.
|
122 |
|
|
\item Load the current instruction from the virtual address stored in the \pcx. If that address is not word-aligned, then an \name{Invalid Address Exception} occurs. Otherwise, if it is a privileged address and the CPU is in user mode, then a \name{Privileged Address Exception} occurs. Otherwise, it is mapped to a physical address by the \mmux, which may trigger a \name{TLB Miss Exception} or a \name{TLB Invalid Exception}. All these exceptions cause the faulting \pc value to be stored in the \name{TLB Bad Address Register}. Note that a \name{TLB Write Exception} cannot occur since the instruction fetch is a read access.
|
123 |
|
|
\item Increase the \pc by 4.
|
124 |
|
|
\item If the opcode in the instruction word does not denote a valid instruction, then an \name{Illegal Instruction Fault} is triggered.
|
125 |
|
|
\item Decode and execute the instruction. Any fault triggered during this step immediately stops execution of the current instruction and transfers control to the fault service routine.
|
126 |
|
|
\item Remember the new value of the \pc register. If any interrupt occurs in the next step, this value is placed in register \#30 such that control can return to the next instruction.
|
127 |
|
|
\item Test for interrupts. If an interrupt is signalled and admitted (\myref{2}{ien}), then control is transferred to the service routine (\myref{2}{accept_exception}).
|
128 |
|
|
\end{itemize}
|
129 |
|
|
|
130 |
|
|
\input{isa/comp}
|
131 |
|
|
\input{isa/jump}
|
132 |
|
|
\input{isa/ldst}
|
133 |
|
|
\input{isa/system}
|