OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [doc/] [manual/] [isa/] [jump.tex] - Blame information for rev 323

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 hellwig
\section{Control Flow Instructions}
2
 
3
Control flow instruction load immediate values or register values into the \pc and/or load the value of the \pc into a general-purpose register. The \eco supports unconditional {\it jumps}, conditional {\it branches}, indirect jumps, subroutine calls, subroutine returns, and indirect subroutine calls out of the box. More complex control flow schemes can be implemented by combining these instructions.
4
 
5
A control transfer is \definition{conditional} if it only occurs on a certain condition that is computed from general-purpose registers. A control transfer is \definition{unconditional} if it always occurs.
6
 
7
A control transfer is \definition{direct} if the target address is supplied as an immediate value. It is \definition{indirect} if the target address is supplied as a register value.
8
 
9
A control transfer is \definition{absolute} if the value of the \pc is overwritten with a totally new value. It is \definition{relative} if the value of the \pc is modified by adding or subtracting an offset.
10
 
11
Both relative control transfers and instructions that read the current \pc value operate on the value of the \pc {\it after} increasing it by 4 during instruction fetching.
12
 
13
\newcommand{\branchdesc}[4]{
14
\subsection{#1}
15
 
16
The #1 instruction performs a conditional direct jump to a relative immediate sign-extended 16-bit offset counted as words. The condition is evaluated by comparing two 32-bit register operands and is asserted if the first operand is #3 the second operand.
17
 
18
\brformat{#2}
19
 
20
\begin{effectize}
21
\effect if $R_x #4 R_y$ then $PC \leftarrow PC + 4 * signext_{32}(offset)$
22
\end{effectize}
23
 
24
}
25
 
26
\branchdesc{BEQ}{100000}{equal to}{=}
27
\branchdesc{BNE}{100001}{not equal to}{\neq}
28
\branchdesc{BLE}{100010}{less or equal to (by signed comparison)}{\leq_{signed}}
29
\branchdesc{BLEU}{100011}{less or equal to (by unsigned comparison)}{\leq_{unsigned}}
30
\branchdesc{BLT}{100100}{less than (by signed comparison)}{<_{signed}}
31
\branchdesc{BLTU}{100101}{less than (by unsigned comparison)}{<_{unsigned}}
32
\branchdesc{BGE}{100110}{greater or equal to (by signed comparison)}{\geq_{signed}}
33
\branchdesc{BGEU}{100111}{greater or equal to (by unsigned comparison)}{\geq_{unsigned}}
34
\branchdesc{BGT}{101000}{greater than (by signed comparison)}{>_{signed}}
35
\branchdesc{BGTU}{101001}{greater than (by unsigned comparison)}{>_{unsigned}}
36
\subsection{J}
37
 
38
The J instruction performs an unconditional direct jump to a relative immediate sign-extended 26-bit offset counted as words.
39
 
40
\jformat{101010}
41
 
42
\begin{effectize}
43
\effect $PC \leftarrow PC + 4 * signext_{32}(offset)$
44
\end{effectize}
45
 
46
\subsection{JR}
47
 
48
The JR instruction performs an unconditional indirect jump to an absolute offset stored in a general-purpose register. It can be used for simple indirect jumps as well as to return from a subroutine.
49
 
50
\jrformat{101011}
51
 
52
\begin{effectize}
53
\effect $PC \leftarrow R_{dest}$
54
\end{effectize}
55
 
56
\subsection{JAL}
57
 
58
The JAL instruction stores the current \pc value in register \#31, then performs an unconditional direct jump to a relative immediate sign-extended 26-bit offset counted as words. It is primarily used for subroutine calls.
59
 
60
\jformat{101100}
61
 
62
\begin{effectize}
63
\effect $R_{31} \leftarrow PC$
64
\effect $PC \leftarrow PC + 4 * signext_{32}(offset)$
65
\end{effectize}
66
 
67
\subsection{JALR}
68
 
69
The JALR instruction remembers the current \pc value, then performs an unconditional indirect jump to an absolute offset stored in a general-purpose register. The previous PC value is then stored in register \#31. It is primarily used for indirect subroutine calls, such as virtual method invocations in object-oriented programming.
70
 
71
\jrformat{101101}
72
 
73
\begin{effectize}
74
\effect $returnAddress \leftarrow PC$
75
\effect $PC \leftarrow R_{dest}$
76
\effect $R_{31} \leftarrow returnAddress$
77
\end{effectize}
78
 
79
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.