17ec681f3Smrg<?xml version="1.0" encoding="UTF-8"?>
27ec681f3Smrg<!--
37ec681f3SmrgCopyright © 2020 Google, Inc.
47ec681f3Smrg
57ec681f3SmrgPermission is hereby granted, free of charge, to any person obtaining a
67ec681f3Smrgcopy of this software and associated documentation files (the "Software"),
77ec681f3Smrgto deal in the Software without restriction, including without limitation
87ec681f3Smrgthe rights to use, copy, modify, merge, publish, distribute, sublicense,
97ec681f3Smrgand/or sell copies of the Software, and to permit persons to whom the
107ec681f3SmrgSoftware is furnished to do so, subject to the following conditions:
117ec681f3Smrg
127ec681f3SmrgThe above copyright notice and this permission notice (including the next
137ec681f3Smrgparagraph) shall be included in all copies or substantial portions of the
147ec681f3SmrgSoftware.
157ec681f3Smrg
167ec681f3SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
177ec681f3SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
187ec681f3SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
197ec681f3SmrgTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
207ec681f3SmrgLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
217ec681f3SmrgOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
227ec681f3SmrgSOFTWARE.
237ec681f3Smrg -->
247ec681f3Smrg
257ec681f3Smrg<!--
267ec681f3SmrgThe basic idea is to define a hierarchy of encodings, where various
277ec681f3Smrgranges of bits can be either:
287ec681f3Smrg
297ec681f3Smrg* patterns to match to select a sub-encoding (0, 1, x (dontcare))
307ec681f3Smrg* instruction parameters (ie. dst register, type, etc)
317ec681f3Smrg* range of bits that delegates to another hierarchy (ie. src reg
327ec681f3Smrg  encoding which has multiple sub-encodings depending on gpr/const/
337ec681f3Smrg  relative)
347ec681f3Smrg
357ec681f3SmrgThe root of the encoding hierarchy defines the size.  By the concrete
367ec681f3Smrgleaf nodes of an encoding hierarchy all bits should be accounted for
377ec681f3Smrg(ie. either defined fields or as 0/1/x).
387ec681f3Smrg
397ec681f3SmrgTODO:
407ec681f3Smrg* add optional min/max gen fields for cases where same binary maps
417ec681f3Smrg  to different instructions and/or encodings on later gens
427ec681f3Smrg* schema
437ec681f3Smrg -->
447ec681f3Smrg
457ec681f3Smrg
467ec681f3Smrg<isa>
477ec681f3Smrg
487ec681f3Smrg<import file="ir3-common.xml"/>
497ec681f3Smrg
507ec681f3Smrg<bitset name="#instruction" size="64">
517ec681f3Smrg	<doc>
527ec681f3Smrg		Encoding of an ir3 instruction.  All instructions are 64b.
537ec681f3Smrg	</doc>
547ec681f3Smrg	<gen min="300"/>
557ec681f3Smrg	<encode type="struct ir3_instruction *" case-prefix="OPC_">
567ec681f3Smrg		<!--
577ec681f3Smrg			Define mapping from encode src to individual fields,
587ec681f3Smrg			which are common across all instruction categories
597ec681f3Smrg			at the root instruction level
607ec681f3Smrg
617ec681f3Smrg			Not all of these apply to all instructions, but we
627ec681f3Smrg			can define mappings here for anything that is used
637ec681f3Smrg			in more than one instruction category.  For things
647ec681f3Smrg			that are specific to a single instruction category,
657ec681f3Smrg			mappings should be defined at that level instead.
667ec681f3Smrg		 -->
677ec681f3Smrg		<map name="DST">src->dsts[0]</map>
687ec681f3Smrg		<map name="SRC1">src->srcs[0]</map>
697ec681f3Smrg		<map name="SRC2">src->srcs[1]</map>
707ec681f3Smrg		<map name="SRC3">src->srcs[2]</map>
717ec681f3Smrg		<map name="REPEAT">src->repeat</map>
727ec681f3Smrg		<map name="SS">!!(src->flags &amp; IR3_INSTR_SS)</map>
737ec681f3Smrg		<map name="JP">!!(src->flags &amp; IR3_INSTR_JP)</map>
747ec681f3Smrg		<map name="SY">!!(src->flags &amp; IR3_INSTR_SY)</map>
757ec681f3Smrg		<map name="UL">!!(src->flags &amp; IR3_INSTR_UL)</map>
767ec681f3Smrg		<map name="EQ">0</map>  <!-- We don't use this (yet) -->
777ec681f3Smrg		<map name="SAT">!!(src->flags &amp; IR3_INSTR_SAT)</map>
787ec681f3Smrg	</encode>
797ec681f3Smrg</bitset>
807ec681f3Smrg
817ec681f3Smrg<import file="ir3-cat0.xml"/>
827ec681f3Smrg<import file="ir3-cat1.xml"/>
837ec681f3Smrg<import file="ir3-cat2.xml"/>
847ec681f3Smrg<import file="ir3-cat3.xml"/>
857ec681f3Smrg<import file="ir3-cat4.xml"/>
867ec681f3Smrg<import file="ir3-cat5.xml"/>
877ec681f3Smrg<import file="ir3-cat6.xml"/>
887ec681f3Smrg<import file="ir3-cat7.xml"/>
897ec681f3Smrg
907ec681f3Smrg</isa>
91