1bf215546Sopenharmony_ci<?xml version="1.0" encoding="UTF-8"?>
2bf215546Sopenharmony_ci<!--
3bf215546Sopenharmony_ciCopyright © 2020 Google, Inc.
4bf215546Sopenharmony_ci
5bf215546Sopenharmony_ciPermission is hereby granted, free of charge, to any person obtaining a
6bf215546Sopenharmony_cicopy of this software and associated documentation files (the "Software"),
7bf215546Sopenharmony_cito deal in the Software without restriction, including without limitation
8bf215546Sopenharmony_cithe rights to use, copy, modify, merge, publish, distribute, sublicense,
9bf215546Sopenharmony_ciand/or sell copies of the Software, and to permit persons to whom the
10bf215546Sopenharmony_ciSoftware is furnished to do so, subject to the following conditions:
11bf215546Sopenharmony_ci
12bf215546Sopenharmony_ciThe above copyright notice and this permission notice (including the next
13bf215546Sopenharmony_ciparagraph) shall be included in all copies or substantial portions of the
14bf215546Sopenharmony_ciSoftware.
15bf215546Sopenharmony_ci
16bf215546Sopenharmony_ciTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17bf215546Sopenharmony_ciIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18bf215546Sopenharmony_ciFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19bf215546Sopenharmony_ciTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20bf215546Sopenharmony_ciLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21bf215546Sopenharmony_ciOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22bf215546Sopenharmony_ciSOFTWARE.
23bf215546Sopenharmony_ci -->
24bf215546Sopenharmony_ci
25bf215546Sopenharmony_ci<isa>
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ci<!--
28bf215546Sopenharmony_ci	Cat0 Instructions:
29bf215546Sopenharmony_ci -->
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci<bitset name="#instruction-cat0" extends="#instruction">
32bf215546Sopenharmony_ci	<!--
33bf215546Sopenharmony_ci		TODO immed size is 16b for a3xx, 20b for a4xx, 32b for a5xx+.. should we
34bf215546Sopenharmony_ci		try to express this?  Also, not all cat0 take an immed, so maybe push
35bf215546Sopenharmony_ci		this further down the hierarchy?
36bf215546Sopenharmony_ci	 -->
37bf215546Sopenharmony_ci	<field name="IMMED" low="0" high="31" type="branch"/>
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ci	<field name="REPEAT" low="40" high="42" type="#rptN"/>
40bf215546Sopenharmony_ci	<pattern pos="43">x</pattern>
41bf215546Sopenharmony_ci	<field name="SS" pos="44" type="bool" display="(ss)"/>
42bf215546Sopenharmony_ci	<field name="EQ" pos="48" type="bool" display="(eq)"/>
43bf215546Sopenharmony_ci	<field name="JP" pos="59" type="bool" display="(jp)"/>
44bf215546Sopenharmony_ci	<field name="SY" pos="60" type="bool" display="(sy)"/>
45bf215546Sopenharmony_ci	<pattern low="61" high="63">000</pattern>  <!-- cat0 -->
46bf215546Sopenharmony_ci	<encode>
47bf215546Sopenharmony_ci		<map name="IMMED">src->cat0.immed</map>
48bf215546Sopenharmony_ci		<map name="COMP1">src->cat0.comp1</map>
49bf215546Sopenharmony_ci		<map name="COMP2">src->cat0.comp2</map>
50bf215546Sopenharmony_ci		<map name="INV1">src->cat0.inv1</map>
51bf215546Sopenharmony_ci		<map name="INV2">src->cat0.inv2</map>
52bf215546Sopenharmony_ci	</encode>
53bf215546Sopenharmony_ci</bitset>
54bf215546Sopenharmony_ci
55bf215546Sopenharmony_ci
56bf215546Sopenharmony_ci<bitset name="#instruction-cat0-0src" extends="#instruction-cat0">
57bf215546Sopenharmony_ci	<display>
58bf215546Sopenharmony_ci		{SY}{SS}{EQ}{JP}{REPEAT}{NAME}
59bf215546Sopenharmony_ci	</display>
60bf215546Sopenharmony_ci	<pattern low="32" high="36">00000</pattern>
61bf215546Sopenharmony_ci	<pattern low="37" high="39">000</pattern>  <!-- BRTYPE -->
62bf215546Sopenharmony_ci	<pattern low="45" high="47">000</pattern>  <!-- src1 -->
63bf215546Sopenharmony_ci	<pattern low="52" high="54">000</pattern>  <!-- src0 -->
64bf215546Sopenharmony_ci</bitset>
65bf215546Sopenharmony_ci
66bf215546Sopenharmony_ci<bitset name="nop" extends="#instruction-cat0-0src">
67bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
68bf215546Sopenharmony_ci	<pattern low="55" high="58">0000</pattern> <!-- OPC -->
69bf215546Sopenharmony_ci</bitset>
70bf215546Sopenharmony_ci
71bf215546Sopenharmony_ci<bitset name="end" extends="#instruction-cat0-0src">
72bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
73bf215546Sopenharmony_ci	<pattern low="55" high="58">0110</pattern> <!-- OPC -->
74bf215546Sopenharmony_ci</bitset>
75bf215546Sopenharmony_ci
76bf215546Sopenharmony_ci<bitset name="ret" extends="#instruction-cat0-0src">
77bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
78bf215546Sopenharmony_ci	<pattern low="55" high="58">0100</pattern> <!-- OPC -->
79bf215546Sopenharmony_ci</bitset>
80bf215546Sopenharmony_ci
81bf215546Sopenharmony_ci<bitset name="emit" extends="#instruction-cat0-0src">
82bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
83bf215546Sopenharmony_ci	<pattern low="55" high="58">0111</pattern> <!-- OPC -->
84bf215546Sopenharmony_ci</bitset>
85bf215546Sopenharmony_ci
86bf215546Sopenharmony_ci<bitset name="cut" extends="#instruction-cat0-0src">
87bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
88bf215546Sopenharmony_ci	<pattern low="55" high="58">1000</pattern> <!-- OPC -->
89bf215546Sopenharmony_ci</bitset>
90bf215546Sopenharmony_ci
91bf215546Sopenharmony_ci<bitset name="chmask" extends="#instruction-cat0-0src">
92bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
93bf215546Sopenharmony_ci	<pattern low="55" high="58">1001</pattern> <!-- OPC -->
94bf215546Sopenharmony_ci</bitset>
95bf215546Sopenharmony_ci
96bf215546Sopenharmony_ci<bitset name="chsh" extends="#instruction-cat0-0src">
97bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
98bf215546Sopenharmony_ci	<pattern low="55" high="58">1010</pattern> <!-- OPC -->
99bf215546Sopenharmony_ci</bitset>
100bf215546Sopenharmony_ci
101bf215546Sopenharmony_ci<bitset name="flow_rev" extends="#instruction-cat0-0src">
102bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
103bf215546Sopenharmony_ci	<pattern low="55" high="58">1011</pattern> <!-- OPC -->
104bf215546Sopenharmony_ci</bitset>
105bf215546Sopenharmony_ci
106bf215546Sopenharmony_ci<bitset name="shpe" extends="#instruction-cat0-0src">
107bf215546Sopenharmony_ci	<doc>SHader Prologue End</doc>
108bf215546Sopenharmony_ci	<pattern low="49" high="51">xx1</pattern>  <!-- OPC_HI -->
109bf215546Sopenharmony_ci	<pattern low="55" high="58">1000</pattern> <!-- OPC -->
110bf215546Sopenharmony_ci</bitset>
111bf215546Sopenharmony_ci
112bf215546Sopenharmony_ci<bitset name="prede" extends="#instruction-cat0-0src">
113bf215546Sopenharmony_ci	<pattern low="49" high="51">xx1</pattern>  <!-- OPC_HI -->
114bf215546Sopenharmony_ci	<pattern low="55" high="58">1111</pattern> <!-- OPC -->
115bf215546Sopenharmony_ci</bitset>
116bf215546Sopenharmony_ci
117bf215546Sopenharmony_ci
118bf215546Sopenharmony_ci<bitset name="#instruction-cat0-1src" extends="#instruction-cat0">
119bf215546Sopenharmony_ci	<display>
120bf215546Sopenharmony_ci		{SY}{SS}{EQ}{JP}{NAME} {INV1}p0.{COMP1}
121bf215546Sopenharmony_ci	</display>
122bf215546Sopenharmony_ci	<pattern low="32" high="36">00000</pattern>
123bf215546Sopenharmony_ci	<pattern low="37" high="39">000</pattern>  <!-- BRTYPE -->
124bf215546Sopenharmony_ci	<pattern low="45" high="47">000</pattern>  <!-- src1 -->
125bf215546Sopenharmony_ci	<field name="INV1" pos="52" type="bool" display="!">
126bf215546Sopenharmony_ci		<doc>Invert source condition</doc>
127bf215546Sopenharmony_ci	</field>
128bf215546Sopenharmony_ci	<field name="COMP1" low="53" high="54" type="#swiz">
129bf215546Sopenharmony_ci		<doc>Predicate register (p0.c) component for source</doc>
130bf215546Sopenharmony_ci	</field>
131bf215546Sopenharmony_ci</bitset>
132bf215546Sopenharmony_ci
133bf215546Sopenharmony_ci<bitset name="kill" extends="#instruction-cat0-1src">
134bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
135bf215546Sopenharmony_ci	<pattern low="55" high="58">0101</pattern> <!-- OPC -->
136bf215546Sopenharmony_ci</bitset>
137bf215546Sopenharmony_ci
138bf215546Sopenharmony_ci<bitset name="predt" extends="#instruction-cat0-1src">
139bf215546Sopenharmony_ci	<pattern low="49" high="51">xx1</pattern>  <!-- OPC_HI -->
140bf215546Sopenharmony_ci	<pattern low="55" high="58">1101</pattern> <!-- OPC -->
141bf215546Sopenharmony_ci</bitset>
142bf215546Sopenharmony_ci
143bf215546Sopenharmony_ci<bitset name="predf" extends="#instruction-cat0-1src">
144bf215546Sopenharmony_ci	<pattern low="49" high="51">xx1</pattern>  <!-- OPC_HI -->
145bf215546Sopenharmony_ci	<pattern low="55" high="58">1110</pattern> <!-- OPC -->
146bf215546Sopenharmony_ci</bitset>
147bf215546Sopenharmony_ci
148bf215546Sopenharmony_ci
149bf215546Sopenharmony_ci<bitset name="#instruction-cat0-immed" extends="#instruction-cat0">
150bf215546Sopenharmony_ci	<display>
151bf215546Sopenharmony_ci		{SY}{SS}{JP}{NAME} #{IMMED}
152bf215546Sopenharmony_ci	</display>
153bf215546Sopenharmony_ci	<pattern low="32" high="36">xxxxx</pattern> <!-- INDEX -->
154bf215546Sopenharmony_ci	<pattern low="37" high="39">xxx</pattern>  <!-- BRTYPE -->
155bf215546Sopenharmony_ci	<pattern low="45" high="47">xxx</pattern>  <!-- src1 -->
156bf215546Sopenharmony_ci	<pattern low="52" high="54">xxx</pattern>  <!-- src0 -->
157bf215546Sopenharmony_ci</bitset>
158bf215546Sopenharmony_ci
159bf215546Sopenharmony_ci<bitset name="jump" extends="#instruction-cat0-immed">
160bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
161bf215546Sopenharmony_ci	<pattern low="55" high="58">0010</pattern> <!-- OPC -->
162bf215546Sopenharmony_ci</bitset>
163bf215546Sopenharmony_ci
164bf215546Sopenharmony_ci<bitset name="call" extends="#instruction-cat0-immed">
165bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
166bf215546Sopenharmony_ci	<pattern low="55" high="58">0011</pattern> <!-- OPC -->
167bf215546Sopenharmony_ci</bitset>
168bf215546Sopenharmony_ci
169bf215546Sopenharmony_ci<bitset name="bkt" extends="#instruction-cat0-immed">
170bf215546Sopenharmony_ci	<pattern low="49" high="51">xx1</pattern>  <!-- OPC_HI -->
171bf215546Sopenharmony_ci	<pattern low="55" high="58">0000</pattern> <!-- OPC -->
172bf215546Sopenharmony_ci</bitset>
173bf215546Sopenharmony_ci
174bf215546Sopenharmony_ci<bitset name="getlast" extends="#instruction-cat0">
175bf215546Sopenharmony_ci	<doc>
176bf215546Sopenharmony_ci		Perform a jump for all fibers in the first cluster with any active
177bf215546Sopenharmony_ci		fibers, except for the last fiber in the cluster.
178bf215546Sopenharmony_ci		While there is a separate field for CLUSTER_SIZE its value does
179bf215546Sopenharmony_ci		not change the behaviour in any observable way, it behaves as if
180bf215546Sopenharmony_ci		CLUSTER_SIZE is always 8.
181bf215546Sopenharmony_ci	</doc>
182bf215546Sopenharmony_ci
183bf215546Sopenharmony_ci	<gen min="600"/>
184bf215546Sopenharmony_ci
185bf215546Sopenharmony_ci	<display>
186bf215546Sopenharmony_ci		{SY}{SS}{JP}{NAME}.w{CLUSTER_SIZE} #{IMMED}
187bf215546Sopenharmony_ci	</display>
188bf215546Sopenharmony_ci	<derived name="CLUSTER_SIZE" type="uint">
189bf215546Sopenharmony_ci		<expr>
190bf215546Sopenharmony_ci			2ULL &lt;&lt; {W}
191bf215546Sopenharmony_ci		</expr>
192bf215546Sopenharmony_ci	</derived>
193bf215546Sopenharmony_ci	<pattern low="32" high="36">xxxxx</pattern> <!-- INDEX -->
194bf215546Sopenharmony_ci	<pattern low="37" high="39">xxx</pattern>  <!-- BRTYPE -->
195bf215546Sopenharmony_ci	<pattern low="45" high="47">xxx</pattern>  <!-- src1 -->
196bf215546Sopenharmony_ci	<pattern low="49" high="51">xx1</pattern>  <!-- OPC_HI -->
197bf215546Sopenharmony_ci	<pattern low="55" high="58">0100</pattern> <!-- OPC -->
198bf215546Sopenharmony_ci
199bf215546Sopenharmony_ci	<field name="W" low="52" high="54" type="uint"/>
200bf215546Sopenharmony_ci
201bf215546Sopenharmony_ci	<encode>
202bf215546Sopenharmony_ci		<map name="W">util_logbase2(8) - 1</map>
203bf215546Sopenharmony_ci	</encode>
204bf215546Sopenharmony_ci</bitset>
205bf215546Sopenharmony_ci
206bf215546Sopenharmony_ci<bitset name="getone" extends="#instruction-cat0-immed">
207bf215546Sopenharmony_ci	<pattern low="49" high="51">xx1</pattern>  <!-- OPC_HI -->
208bf215546Sopenharmony_ci	<pattern low="55" high="58">0101</pattern> <!-- OPC -->
209bf215546Sopenharmony_ci</bitset>
210bf215546Sopenharmony_ci
211bf215546Sopenharmony_ci<bitset name="shps" extends="#instruction-cat0-immed">
212bf215546Sopenharmony_ci	<doc>SHader Prologue Start</doc>
213bf215546Sopenharmony_ci	<pattern low="49" high="51">xx1</pattern>  <!-- OPC_HI -->
214bf215546Sopenharmony_ci	<pattern low="55" high="58">0111</pattern> <!-- OPC -->
215bf215546Sopenharmony_ci</bitset>
216bf215546Sopenharmony_ci
217bf215546Sopenharmony_ci<bitset name="#instruction-cat0-branch" extends="#instruction-cat0">
218bf215546Sopenharmony_ci	<pattern low="49" high="51">xx0</pattern>  <!-- OPC_HI -->
219bf215546Sopenharmony_ci	<pattern low="55" high="58">0001</pattern> <!-- OPC -->
220bf215546Sopenharmony_ci</bitset>
221bf215546Sopenharmony_ci
222bf215546Sopenharmony_ci<bitset name="brac" extends="#instruction-cat0-branch">
223bf215546Sopenharmony_ci	<display>
224bf215546Sopenharmony_ci		{SY}{SS}{EQ}{JP}{NAME}.{INDEX} #{IMMED}
225bf215546Sopenharmony_ci	</display>
226bf215546Sopenharmony_ci	<field name="INDEX" low="32" high="36" type="uint"/>
227bf215546Sopenharmony_ci	<pattern low="37" high="39">011</pattern>  <!-- BRTYPE -->
228bf215546Sopenharmony_ci	<pattern low="45" high="47">xxx</pattern>  <!-- src1 -->
229bf215546Sopenharmony_ci	<pattern low="52" high="54">xxx</pattern>  <!-- src0 -->
230bf215546Sopenharmony_ci	<encode>
231bf215546Sopenharmony_ci		<map name="INDEX">src->cat0.idx</map>
232bf215546Sopenharmony_ci	</encode>
233bf215546Sopenharmony_ci</bitset>
234bf215546Sopenharmony_ci
235bf215546Sopenharmony_ci<bitset name="brax" extends="#instruction-cat0-branch">
236bf215546Sopenharmony_ci	<pattern low="32" high="36">xxxxx</pattern>
237bf215546Sopenharmony_ci	<pattern low="37" high="39">110</pattern>  <!-- BRTYPE -->
238bf215546Sopenharmony_ci	<pattern low="45" high="47">xxx</pattern>  <!-- src1 -->
239bf215546Sopenharmony_ci	<pattern low="52" high="54">xxx</pattern>  <!-- src0 -->
240bf215546Sopenharmony_ci</bitset>
241bf215546Sopenharmony_ci
242bf215546Sopenharmony_ci<bitset name="#instruction-cat0-branch-1src" extends="#instruction-cat0-branch">
243bf215546Sopenharmony_ci	<display>
244bf215546Sopenharmony_ci		{SY}{SS}{EQ}{JP}{NAME} {INV1}p0.{COMP1}, #{IMMED}
245bf215546Sopenharmony_ci	</display>
246bf215546Sopenharmony_ci	<pattern low="32" high="36">xxxxx</pattern>
247bf215546Sopenharmony_ci	<pattern low="45" high="47">xxx</pattern>  <!-- src1 -->
248bf215546Sopenharmony_ci	<field name="INV1" pos="52" type="bool" display="!">
249bf215546Sopenharmony_ci		<doc>Invert source condition</doc>
250bf215546Sopenharmony_ci	</field>
251bf215546Sopenharmony_ci	<field name="COMP1" low="53" high="54" type="#swiz">
252bf215546Sopenharmony_ci		<doc>Predicate register (p0.c) component for source</doc>
253bf215546Sopenharmony_ci	</field>
254bf215546Sopenharmony_ci</bitset>
255bf215546Sopenharmony_ci
256bf215546Sopenharmony_ci<bitset name="br" extends="#instruction-cat0-branch-1src">
257bf215546Sopenharmony_ci	<pattern low="37" high="39">000</pattern>  <!-- BRTYPE -->
258bf215546Sopenharmony_ci</bitset>
259bf215546Sopenharmony_ci
260bf215546Sopenharmony_ci<bitset name="bany" extends="#instruction-cat0-branch-1src">
261bf215546Sopenharmony_ci	<pattern low="37" high="39">100</pattern>  <!-- BRTYPE -->
262bf215546Sopenharmony_ci</bitset>
263bf215546Sopenharmony_ci
264bf215546Sopenharmony_ci<bitset name="ball" extends="#instruction-cat0-branch-1src">
265bf215546Sopenharmony_ci	<pattern low="37" high="39">101</pattern>  <!-- BRTYPE -->
266bf215546Sopenharmony_ci</bitset>
267bf215546Sopenharmony_ci
268bf215546Sopenharmony_ci<bitset name="#instruction-cat0-branch-2src" extends="#instruction-cat0-branch">
269bf215546Sopenharmony_ci	<display>
270bf215546Sopenharmony_ci		{SY}{SS}{EQ}{JP}{NAME} {INV1}p0.{COMP1}, {INV2}p0.{COMP2}, #{IMMED}
271bf215546Sopenharmony_ci	</display>
272bf215546Sopenharmony_ci	<pattern low="32" high="36">xxxxx</pattern>
273bf215546Sopenharmony_ci	<!-- src1: -->
274bf215546Sopenharmony_ci	<field name="INV2" pos="45" type="bool" display="!">
275bf215546Sopenharmony_ci		<doc>Invert source 2 condition</doc>
276bf215546Sopenharmony_ci	</field>
277bf215546Sopenharmony_ci	<field name="COMP2" low="46" high="47" type="#swiz">
278bf215546Sopenharmony_ci		<doc>Predicate register (p0.c) component for source 2</doc>
279bf215546Sopenharmony_ci	</field>
280bf215546Sopenharmony_ci	<!-- src0: -->
281bf215546Sopenharmony_ci	<field name="INV1" pos="52" type="bool" display="!">
282bf215546Sopenharmony_ci		<doc>Invert source 1 condition</doc>
283bf215546Sopenharmony_ci	</field>
284bf215546Sopenharmony_ci	<field name="COMP1" low="53" high="54" type="#swiz">
285bf215546Sopenharmony_ci		<doc>Predicate register (p0.c) component for source 1</doc>
286bf215546Sopenharmony_ci	</field>
287bf215546Sopenharmony_ci</bitset>
288bf215546Sopenharmony_ci
289bf215546Sopenharmony_ci<bitset name="brao" extends="#instruction-cat0-branch-2src">
290bf215546Sopenharmony_ci	<pattern low="37" high="39">001</pattern>  <!-- BRTYPE -->
291bf215546Sopenharmony_ci</bitset>
292bf215546Sopenharmony_ci
293bf215546Sopenharmony_ci<bitset name="braa" extends="#instruction-cat0-branch-2src">
294bf215546Sopenharmony_ci	<pattern low="37" high="39">010</pattern>  <!-- BRTYPE -->
295bf215546Sopenharmony_ci</bitset>
296bf215546Sopenharmony_ci
297bf215546Sopenharmony_ci<!-- TODO rest of cat0 -->
298bf215546Sopenharmony_ci
299bf215546Sopenharmony_ci</isa>