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<!--
26bf215546Sopenharmony_ciThe basic idea is to define a hierarchy of encodings, where various
27bf215546Sopenharmony_ciranges of bits can be either:
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ci* patterns to match to select a sub-encoding (0, 1, x (dontcare))
30bf215546Sopenharmony_ci* instruction parameters (ie. dst register, type, etc)
31bf215546Sopenharmony_ci* range of bits that delegates to another hierarchy (ie. src reg
32bf215546Sopenharmony_ci  encoding which has multiple sub-encodings depending on gpr/const/
33bf215546Sopenharmony_ci  relative)
34bf215546Sopenharmony_ci
35bf215546Sopenharmony_ciThe root of the encoding hierarchy defines the size.  By the concrete
36bf215546Sopenharmony_cileaf nodes of an encoding hierarchy all bits should be accounted for
37bf215546Sopenharmony_ci(ie. either defined fields or as 0/1/x).
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ciTODO:
40bf215546Sopenharmony_ci* add optional min/max gen fields for cases where same binary maps
41bf215546Sopenharmony_ci  to different instructions and/or encodings on later gens
42bf215546Sopenharmony_ci* schema
43bf215546Sopenharmony_ci -->
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_ci<isa>
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_ci<import file="ir3-common.xml"/>
49bf215546Sopenharmony_ci
50bf215546Sopenharmony_ci<bitset name="#instruction" size="64">
51bf215546Sopenharmony_ci	<doc>
52bf215546Sopenharmony_ci		Encoding of an ir3 instruction.  All instructions are 64b.
53bf215546Sopenharmony_ci	</doc>
54bf215546Sopenharmony_ci	<gen min="300"/>
55bf215546Sopenharmony_ci	<encode type="struct ir3_instruction *" case-prefix="OPC_">
56bf215546Sopenharmony_ci		<!--
57bf215546Sopenharmony_ci			Define mapping from encode src to individual fields,
58bf215546Sopenharmony_ci			which are common across all instruction categories
59bf215546Sopenharmony_ci			at the root instruction level
60bf215546Sopenharmony_ci
61bf215546Sopenharmony_ci			Not all of these apply to all instructions, but we
62bf215546Sopenharmony_ci			can define mappings here for anything that is used
63bf215546Sopenharmony_ci			in more than one instruction category.  For things
64bf215546Sopenharmony_ci			that are specific to a single instruction category,
65bf215546Sopenharmony_ci			mappings should be defined at that level instead.
66bf215546Sopenharmony_ci		 -->
67bf215546Sopenharmony_ci		<map name="DST">src->dsts[0]</map>
68bf215546Sopenharmony_ci		<map name="SRC1">src->srcs[0]</map>
69bf215546Sopenharmony_ci		<map name="SRC2">src->srcs[1]</map>
70bf215546Sopenharmony_ci		<map name="SRC3">src->srcs[2]</map>
71bf215546Sopenharmony_ci		<map name="REPEAT">src->repeat</map>
72bf215546Sopenharmony_ci		<map name="SS">!!(src->flags &amp; IR3_INSTR_SS)</map>
73bf215546Sopenharmony_ci		<map name="JP">!!(src->flags &amp; IR3_INSTR_JP)</map>
74bf215546Sopenharmony_ci		<map name="SY">!!(src->flags &amp; IR3_INSTR_SY)</map>
75bf215546Sopenharmony_ci		<map name="UL">!!(src->flags &amp; IR3_INSTR_UL)</map>
76bf215546Sopenharmony_ci		<map name="EQ">0</map>  <!-- We don't use this (yet) -->
77bf215546Sopenharmony_ci		<map name="SAT">!!(src->flags &amp; IR3_INSTR_SAT)</map>
78bf215546Sopenharmony_ci	</encode>
79bf215546Sopenharmony_ci</bitset>
80bf215546Sopenharmony_ci
81bf215546Sopenharmony_ci<import file="ir3-cat0.xml"/>
82bf215546Sopenharmony_ci<import file="ir3-cat1.xml"/>
83bf215546Sopenharmony_ci<import file="ir3-cat2.xml"/>
84bf215546Sopenharmony_ci<import file="ir3-cat3.xml"/>
85bf215546Sopenharmony_ci<import file="ir3-cat4.xml"/>
86bf215546Sopenharmony_ci<import file="ir3-cat5.xml"/>
87bf215546Sopenharmony_ci<import file="ir3-cat6.xml"/>
88bf215546Sopenharmony_ci<import file="ir3-cat7.xml"/>
89bf215546Sopenharmony_ci
90bf215546Sopenharmony_ci</isa>
91