1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
<<<
[#insns-cm_jt,reftext="Jump via table"]
=== cm.jt
Synopsis::
jump via table
Mnemonic::
cm.jt _index_
Encoding (RV32, RV64)::
[wavedrom, , svg]
....
{reg:[
{ bits: 2, name: 0x2, attr: ['C2'] },
{ bits: 8, name: 'index', attr: [] },
{ bits: 3, name: 0x0, attr: [] },
{ bits: 3, name: 0x5, attr: ['FUNCT3'] },
],config:{bits:16}}
....
[NOTE]
For this encoding to decode as _cm.jt_, _index<32_, otherwise it decodes as _cm.jalt_, see <<insns-cm_jalt>>.
[NOTE]
If JVT.mode = 0 (Jump Table Mode) then _cm.jt_ behaves as specified here. If JVT.mode is a reserved value, then _cm.jt_ is also reserved. In the future other defined values of JVT.mode may change the behaviour of _cm.jt_.
Assembly Syntax::
[source,sail]
--
cm.jt index
--
Description::
_cm.jt_ reads an entry from the jump vector table in memory and jumps to the address that was read.
For further information see <<insns-tablejump>>.
Prerequisites::
None
32-bit equivalent::
No direct equivalent encoding exists.
<<<
[#insns-cm_jt-SAIL,reftext="cm.jt SAIL code"]
Operation::
[source,sail]
--
//This is not SAIL, it's pseudo-code. The SAIL hasn't been written yet.
# target_address is temporary internal state, it doesn't represent a real register
# InstMemory is byte indexed
switch(XLEN) {
32: table_address[XLEN-1:0] = JVT.base + (index<<2);
64: table_address[XLEN-1:0] = JVT.base + (index<<3);
}
//fetch from the jump table
target_address[XLEN-1:0] = InstMemory[table_address][XLEN-1:0];
j target_address[XLEN-1:0]&~0x1;
--
include::Zcmt_footer.adoc[]
|