Debian Codegraph @

docs/DSP/GameCube_DSP_Users_Manual/GameCube_DSP_Users_Manual.tex

raw
1 \batchmode
2 \makeatother
3 \documentclass[oneside,english,a4paper,10pt,oneside,openany,final]{memoir}
4 \setcounter{secnumdepth}{3}
5 \setcounter{tocdepth}{3}
6
7 \makeatletter
8
9 \usepackage{array} % Setting typefaces on a column-wide basis
10 \usepackage{babel} % Manages language rules
11 \usepackage{bytefield} % Creation of byte overviews
12 \usepackage[a4paper, margin=1in]{geometry} % Page geometry
13 \usepackage{float} % Used for the H specifier in tables
14 \usepackage[T1]{fontenc} % Font encoding
15 \usepackage[latin9]{inputenc} % Input encoding
16 \usepackage{listings} % Code listings
17 \usepackage{longtable} % LaTeX is hilarious and tables by default cannot span more than one page
18 \usepackage{lmodern} % Latin Modern font
19 \usepackage{microtype} % Allow conditional disabling of ligatures
20 \usepackage{multirow} % Multi-row tables
21 \usepackage{parskip} % Handle non-indented paragraphs "properly"
22 \usepackage{upquote} % Use proper quotes in verbatim/listing environments
23 \usepackage[bookmarks=true,
24 bookmarksnumbered=true,
25 colorlinks=true,
26 linkcolor=blue,
27 linktocpage=true,
28 pdfcreator={Duddie},
29 pdftex,
30 pdfpagelabels=true,
31 pdfpagemode=UseOutlines,
32 pdfstartview=FitH,
33 pdfsubject={GameCube DSP User's Manual},
34 pdftitle={GameCube DSP User's Manual},
35 plainpages=false
36 ]{hyperref} % Support document hyperlinking
37
38 % Paragraph settings for main body text
39 \setlength{\parindent}{0pt}
40 \setlength{\parskip}{1ex}
41 \setlength{\partopsep}{0pt}
42
43 % Disable ligatures in the teletype font family
44 \DisableLigatures[-]{family=tt*}
45
46 % Document front page material
47 \title{\textbf{\Huge GameCube DSP User's Manual}}
48 \author{Reverse-engineered and documented by Duddie \\ \href{mailto:[email protected]}{[email protected]}}
49 \date{\today\\v0.1.8}
50
51 % Title formatting commands
52 \newcommand{\OpcodeTitle}[1]{\subsection{#1}\label{instruction:#1}}
53
54 % Formatting/self-documenting commands
55 \newcommand{\Address}[1]{\texttt{#1}}
56 \newcommand{\Code}[1]{\texttt{#1}}
57 \newcommand{\Exception}[1]{\texttt{#1}}
58 \newcommand{\Flag}[1]{\texttt{#1}}
59 \newcommand{\Function}[1]{\texttt{#1}}
60 \newcommand{\InlineExpression}[1]{\texttt{#1}}
61 \newcommand{\Opcode}[1]{\texttt{\nameref{instruction:#1}}}
62 \newcommand{\Register}[1]{\texttt{#1}}
63 \newcommand{\RegisterField}[1]{\texttt{#1}}
64 \newcommand{\Value}[1]{\texttt{#1}}
65 \newcommand{\Variable}[1]{\texttt{#1}}
66
67 % Creates a table displaying the bits given in a register
68 % Useful for avoiding boilerplate
69 %
70 % Accepts an address, register name, description, and bit layout (in that exact order)
71 %
72 \newcommand{\RegisterBitOverview}[4]{
73 \begin{table}[H]
74 \centering
75 \begin{tabular}{|lcr|}
76 \hline
77 \Address{#1} & \Register{#2} & {#3} \\ \hline
78 \multicolumn{3}{|c|}{\texttt{#4}} \\ \hline
79 \end{tabular}
80 \end{table}
81 }
82
83 % Environment for describing the functionality of bits following a \RegisterBitOverview
84 \newenvironment{RegisterBitDescriptions}
85 {
86 \begin{table}[H]
87 \centering
88 \begin{tabular}{|l|l|l|p{10cm}|}
89 \hline
90 \textbf{Bit} & \textbf{Name} & \textbf{R/W} & \textbf{Action} \\ \hline
91 }
92 {
93 \end{tabular}
94 \end{table}
95 }
96
97 % Used within a RegisterBitDescriptions environment to describe a bit or series of bits.
98 \newenvironment{RegisterBitDescription}[4]
99 {
100 #1 & \RegisterField{#2} & \texttt{#3} & #4 \\ \hline
101 }
102 {
103 }
104
105 % Used for describing functions that provide pseudocode
106 \newcommand{\FunctionPseudocode}[3]
107 {
108 \texttt{#1}
109
110 \begin{itemize}
111 \item \textbf{Description}: \\ #2
112 \item \textbf{Operation}: \\ #3
113 \end{itemize}
114 }
115
116 % bitbox helper for monospaced text so all usage sites of the bitbox don't
117 % need to specify \texttt{} over and over.
118 %
119 % First argument is the size of the bitbox (1-based).
120 % Second argument is the text to place within the bitbox.
121 %
122 \newcommand{\monobitbox}[2]{\bitbox{#1}{\texttt{#2}}}
123
124 % Environment for specifying an opcode.
125 \newenvironment{DSPOpcode}[1]
126 {
127 \OpcodeTitle{#1}
128 }
129 {
130 % Each opcode should be followed by a page break to maintain clean separation of opcodes.
131 \pagebreak{}
132 }
133
134 % Defines the formatting for an opcode bytefield.
135 % The given argument specifies how many bits wide
136 % the bytefield should be.
137 %
138 % Note that we perform a subtraction by one, since
139 % we want to make the header range from 0-(N-1) to
140 % match regular bit field listings (i.e. we turn a 1-based
141 % specification of bits into a 0-based one)
142 \newenvironment{DSPOpcodeBytefield}[1]
143 {
144 \begin{center}
145 \begin{bytefield}[endianness=big]{#1}
146 \bitheader{0-{\the\numexpr #1 - 1\relax}} \\
147 }
148 {
149 \end{bytefield}
150 \end{center}
151 }
152
153 % Environment for describing the format of a DSP opcode
154 \lstnewenvironment{DSPOpcodeFormat}
155 {
156 \textbf{Format:}
157 \lstset{basicstyle=\ttfamily}
158 }
159 {
160 }
161
162 % Environment for providing a DSP opcode description
163 \newenvironment{DSPOpcodeDescription}
164 {
165 \textbf{Description:}
166 \begin{description}
167 }
168 {
169 \end{description}
170 }
171
172 % Environment for providing the pseudocode displaying the functional operation of an opcode
173 \lstnewenvironment{DSPOpcodeOperation}
174 {
175 \textbf{Operation:}
176 \lstset{basicstyle=\ttfamily}
177 }
178 {
179 }
180
181 % Environment for describing a note for a DSP opcode
182 \newenvironment{DSPOpcodeNote}
183 {
184 \textbf{Note:}
185 \begin{description}
186 }
187 {
188 \end{description}
189 }
190
191 % Environment for a See Also section per opcode.
192 \newenvironment{DSPOpcodeSeeAlso}
193 {
194 \textbf{See also:}
195 \begin{description}
196 }
197 {
198 \end{description}
199 }
200
201 % Command to show flags.
202 \newcommand{\DSPOpcodeFlags}[8]
203 {
204 \textbf{Flags:}
205 \begin{description}
206 \item \begin{tabular}{|c|c|c|c|c|c|c|c|}
207 \hline
208 OS & LZ & TB & S32 & S & AZ & O & C \\
209 \hline
210 #1 & #2 & #3 & #4 & #5 & #6 & #7 & #8 \\
211 \hline
212 \end{tabular}
213 \end{description}
214 }
215
216 \newcommand{\DSPOpcodeFlagsUnchanged}[0]{\DSPOpcodeFlags{-}{-}{-}{-}{-}{-}{-}{-}}
217
218 \makeatother
219 \begin{document}
220 \maketitle{}
221
222 \pagebreak{}
223 \vspace*{\fill}
224
225 Copyright (c) 2005 Duddie. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''.
226
227 \pagebreak{}
228 \tableofcontents{}
229 \pagebreak{}
230
231 \addcontentsline{toc}{chapter}{Disclaimer}
232 \textbf{\LARGE Disclaimer}
233 \vspace{5mm}
234
235 This documentation is no way endorsed by or affiliated with Nintendo, Nintendo of America or its licenses. GameCube is a trademark of Nintendo of America. Other trademarked names used in this documentation are trademarks of their respective owners.
236
237 This documentation is provided ``AS IS'' and can be wrong, incomplete or in any other way useless.
238
239 This documentation cannot be used for any commercial purposes without prior agreement received from authors.
240
241 The purpose of this documentation is purely academic and it aims at understanding described hardware. It is based on academic reverse engineering of hardware.
242
243 \pagebreak{}
244 \addcontentsline{toc}{chapter}{Version History}
245 \textbf{\LARGE Version History}
246 \vspace{5mm}
247
248 \begin{table}[htb]
249 \centering
250 \begin{tabular}{|p{.5in}|p{.75in}|p{.75in}|p{3.5in}|}
251 \hline
252 \textbf{Version} & \textbf{Date} & \textbf{Author} & \textbf{Change} \\ \hline
253 0.0.1 & 2005.05.08 & Duddie & Initial release \\ \hline
254 0.0.2 & 2005.05.09 & Duddie & Added \Register{\$prod} and \Register{\$config} registers, table of opcodes, disclaimer. \\ \hline
255 0.0.3 & 2005.05.09 & Duddie & Fixed BLOOP and BLOOPI and added description of the loop stack. \\ \hline
256 0.0.4 & 2005.05.12 & Duddie & Added preliminary DSP memory map and opcode syntax. \\ \hline
257 0.0.5 & 2018.04.09 & Lioncache & Converted document over to LaTeX. \\ \hline
258 0.0.6 & 2018.04.13 & BhaaL & Updated register tables, fixed opcode operations \\ \hline
259 0.0.7 & Mid 2020 & Tilka & Fixed typos and register names, and improved readability. \\ \hline
260 0.1.0 & 2021.08.21 & Pokechu22 & Added missing instructions, improved documentation of hardware registers, documented additional behaviors, and improved formatting. \\ \hline
261 0.1.1 & 2022.05.14 & xperia64 & Added tested DSP bootloading transfer size \\ \hline
262 0.1.2 & 2022.05.21 & Pokechu22 & Fixed ``ILLR'' typo in Instruction Memory section \\ \hline
263 0.1.3 & 2022.05.27 & Pokechu22 & Renamed \texttt{CMPAR} instruction to \texttt{CMPAXH} \\ \hline
264 0.1.4 & 2022.06.02 & Pokechu22 & Fixed typos; added sections on 16-bit and 40-bit modes and on main and extended opcode writing to the same register. \\ \hline
265 0.1.5 & 2022.09.29 & vpelletier & Fixed \texttt{BLOOP} and \texttt{BLOOPI} suboperation order \\ \hline
266 0.1.6 & 2022.06.20 & xperia64 & Accelerator documentation updates, fix register typo in ANDC and ORC descriptions \\ \hline
267 0.1.7 & 2025.04.21 & Tilka & Fixed typos and complained about GFDL \\ \hline
268 0.1.8 & 2025.07.27 & Tilka & Fixed some bit pattern inconsistencies in the 'LDAX* opcodes \\ \hline
269 \end{tabular}
270 \end{table}
271
272 \pagebreak{}
273
274 \addcontentsline{toc}{chapter}{GNU Documentation License 1.2}
275
276 GNU Free Documentation License
277
278 Version 1.2, November 2002
279
280 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
281 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
282 Everyone is permitted to copy and distribute verbatim copies
283 of this license document, but changing it is not allowed.
284
285 0. PREAMBLE
286
287 The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
288
289 This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.
290
291 We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
292
293 1. APPLICABILITY AND DEFINITIONS
294
295 This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.
296
297 A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
298
299 A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.
300
301 The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.
302
303 The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.
304
305 A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque".
306
307 Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.
308
309 The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.
310
311 A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition.
312
313 The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.
314
315 2. VERBATIM COPYING
316
317 You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.
318
319 You may also lend copies, under the same conditions stated above, and you may publicly display copies.
320
321 3. COPYING IN QUANTITY
322
323 If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
324
325 If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
326
327 If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
328
329 It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
330
331 4. MODIFICATIONS
332
333 You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
334
335 A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
336 B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.
337 C. State on the Title page the name of the publisher of the Modified Version, as the publisher.
338 D. Preserve all the copyright notices of the Document.
339 E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
340 F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
341 G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.
342 H. Include an unaltered copy of this License.
343 I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
344 J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
345 K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
346 L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
347 M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version.
348 N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section.
349 O. Preserve any Warranty Disclaimers.
350
351 If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.
352
353 You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.
354
355 You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
356
357 The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
358
359 5. COMBINING DOCUMENTS
360
361 You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.
362
363 The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
364
365 In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements."
366
367 6. COLLECTIONS OF DOCUMENTS
368
369 You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
370
371 You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
372
373 7. AGGREGATION WITH INDEPENDENT WORKS
374
375 A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.
376
377 If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.
378
379 8. TRANSLATION
380
381 Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.
382
383 If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.
384
385 9. TERMINATION
386
387 You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
388
389 10. FUTURE REVISIONS OF THIS LICENSE
390
391 The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See https://www.gnu.org/licenses/.
392
393 Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.
394
395 \pagebreak{}
396
397 \chapter{Overview}
398
399 \section{DSP Memory Map}
400
401 The DSP has two address spaces, one for data and one for instructions. The DSP accesses memory in words, so all addresses refer to words. A DSP word is 16 bits in size.
402
403 \subsection{Instruction Memory}
404 Instruction Memory (IMEM) is divided into instruction RAM (IRAM) and instruction ROM (IROM).
405
406 Exception vectors are located at the top of the RAM and occupy the first 16 words, with 2 words available for each exception (enough for a \Opcode{JMP} instruction for each exception).
407
408 There are no DSP instructions that write to IMEM; however, the \Opcode{ILRR} family of instructions can read from it. This is sometimes used for jump tables or indexing into a list of pointers (which may point into either IMEM or DMEM).
409
410 \begin{table}[htb]
411 \centering
412 \begin{tabular}{|l|l|}
413 \hline
414 \begin{tabular}[c]{@{}l@{}}\texttt{0x0000}\\ \\ \\ \\ \\ \\ \\ \\ \texttt{0x0FFF}\end{tabular} & \texttt{IRAM} \\ \hline
415 & \\ \hline
416 \begin{tabular}[c]{@{}l@{}}\texttt{0x8000}\\ \\ \\ \\ \\ \\ \\ \\ \texttt{0x8FFF}\end{tabular} & \texttt{IROM} \\ \hline
417 \end{tabular}
418 \end{table}
419
420 \pagebreak{}
421
422 \subsection{Data Memory}
423 Data Memory (DMEM) is divided into data RAM (DRAM) and resampling coefficient data (COEF). Hardware registers (IFX) are also mapped into this space.
424
425 It is possible to both read and write to DMEM, but coefficient data cannot be written to.
426
427 \begin{table}[htb]
428 \centering
429 \begin{tabular}{|l|l|}
430 \hline
431 \begin{tabular}[c]{@{}l@{}}\texttt{0x0000}\\ \\ \\ \\ \\ \\ \\ \\ \texttt{0x0FFF}\end{tabular} & \texttt{DRAM} \\ \hline
432 & \\ \hline
433 \begin{tabular}[c]{@{}l@{}}\texttt{0x1000}\\ \\ \\ \\ \\ \\ \\ \\ \texttt{0x17FF}\end{tabular} & \texttt{COEF} \\ \hline
434 & \\ \hline
435 \begin{tabular}[c]{@{}l@{}}\texttt{0xFF00}\\ \\ \\ \\\\ \\ \\ \\ \texttt{0xFFFF}\end{tabular} & \texttt{IFX} \\ \hline
436 \end{tabular}
437 \end{table}
438
439 \pagebreak{}
440
441 \section{Initialization}
442
443 The DSP is initialized before it is used. This is done by copying a small program to physical address \Address{0x01000000} (virtual \Address{0x81000000}) in GameCube/Wii main memory, and then writing to \Register{DSP\_CONTROL\_STATUS} at \texttt{0xCC00500A} with the 11th and 0th bits set (SDK titles write \Value{0x08ad}). The 11th bit being set appears to cause data from \Address{0x01000000} to be DMAd to the start of IMEM; a basic hardware test (sending increasingly larger payloads until they fail) indicates 1024 bytes of data (512 DSP words) are transferred. (None of this has been extensively hardware tested, and is instead based on libogc's \Code{\_\_dsp\_bootstrap}.)
444
445 The program that SDK titles send does the following:
446 \begin{enumerate}
447 \item Reads all \Value{0x1000} words of IROM from \Address{0x8000} through \Address{0x8FFF} (using \Opcode{ILRRI})
448 \item Writes zero to all \Value{0x1000} words of DRAM from \Address{0x0000} through \Address{0x0FFF} (using \Opcode{SRRI})
449 \item Reads all \Value{0x0800} words of COEF data from \Address{0x1000} through \Address{0x17FF} (using \Opcode{LRRI})
450 \item Waits for the top bit of \Register{DMBH} to be clear (indicating the CPU is ready to receive mail)
451 \item Writes \Value{0x0054} to \Register{DMBH} and \Value{0x4348} to \Register{DMBL}, sending \Value{0x00543448} (``TCH''?) to the CPU. The CPU does not check for this value, but it does wait for mail to be sent.
452 \end{enumerate}
453
454 It is not clear why this is done, as the values read from IROM and COEF are not used; perhaps it works around a hardware bug where incorrect values are read from ROM initially.
455
456 \pagebreak{}
457
458 \chapter{Registers}
459
460 \section{Register names}
461
462 The DSP has 32 16-bit registers, although their individual purpose and their function differ from register to register.
463
464 \begin{table}[htb]
465 \centering
466 \begin{tabular}{|l|l|l|l|}
467 \hline
468 & & & \\ \hline
469 \Register{\$0} & \Register{\$r00} & \Register{\$ar0} & Addressing register 0 \\ \hline
470 \Register{\$1} & \Register{\$r01} & \Register{\$ar1} & Addressing register 1 \\ \hline
471 \Register{\$2} & \Register{\$r02} & \Register{\$ar2} & Addressing register 2 \\ \hline
472 \Register{\$3} & \Register{\$r03} & \Register{\$ar3} & Addressing register 3 \\ \hline
473 \Register{\$4} & \Register{\$r04} & \Register{\$ix0} & Indexing register 0 \\ \hline
474 \Register{\$5} & \Register{\$r05} & \Register{\$ix1} & Indexing register 1 \\ \hline
475 \Register{\$6} & \Register{\$r06} & \Register{\$ix2} & Indexing register 2 \\ \hline
476 \Register{\$7} & \Register{\$r07} & \Register{\$ix3} & Indexing register 3 \\ \hline
477 \Register{\$8} & \Register{\$r08} & \Register{\$wr0} & Wrapping register 0 \\ \hline
478 \Register{\$9} & \Register{\$r09} & \Register{\$wr1} & Wrapping register 1 \\ \hline
479 \Register{\$10} & \Register{\$r0A} & \Register{\$wr2} & Wrapping register 2 \\ \hline
480 \Register{\$11} & \Register{\$r0B} & \Register{\$wr3} & Wrapping register 3 \\ \hline
481 \Register{\$12} & \Register{\$r0C} & \Register{\$st0} & Call stack register \\ \hline
482 \Register{\$13} & \Register{\$r0D} & \Register{\$st1} & Data stack register \\ \hline
483 \Register{\$14} & \Register{\$r0E} & \Register{\$st2} & Loop address stack register \\ \hline
484 \Register{\$15} & \Register{\$r0F} & \Register{\$st3} & Loop counter register \\ \hline
485 \Register{\$16} & \Register{\$r10} & \Register{\$ac0.h} & 40-bit Accumulator 0 (high) \\ \hline
486 \Register{\$17} & \Register{\$r11} & \Register{\$ac1.h} & 40-bit Accumulator 1 (high) \\ \hline
487 \Register{\$18} & \Register{\$r12} & \Register{\$config} & Config register \\ \hline
488 \Register{\$19} & \Register{\$r13} & \Register{\$sr} & Status register \\ \hline
489 \Register{\$20} & \Register{\$r14} & \Register{\$prod.l} & Product register (low) \\ \hline
490 \Register{\$21} & \Register{\$r15} & \Register{\$prod.m1} & Product register (mid 1) \\ \hline
491 \Register{\$22} & \Register{\$r16} & \Register{\$prod.h} & Product register (high) \\ \hline
492 \Register{\$23} & \Register{\$r17} & \Register{\$prod.m2} & Product register (mid 2) \\ \hline
493 \Register{\$24} & \Register{\$r18} & \Register{\$ax0.l} & 32-bit Accumulator 0 (low) \\ \hline
494 \Register{\$25} & \Register{\$r19} & \Register{\$ax1.l} & 32-bit Accumulator 1 (low) \\ \hline
495 \Register{\$26} & \Register{\$r1A} & \Register{\$ax0.h} & 32-bit Accumulator 0 (high) \\ \hline
496 \Register{\$27} & \Register{\$r1B} & \Register{\$ax1.h} & 32-bit Accumulator 1 (high) \\ \hline
497 \Register{\$28} & \Register{\$r1C} & \Register{\$ac0.l} & 40-bit Accumulator 0 (low) \\ \hline
498 \Register{\$29} & \Register{\$r1D} & \Register{\$ac1.l} & 40-bit Accumulator 1 (low) \\ \hline
499 \Register{\$30} & \Register{\$r1E} & \Register{\$ac0.m} & 40-bit Accumulator 0 (mid) \\ \hline
500 \Register{\$31} & \Register{\$r1F} & \Register{\$ac1.m} & 40-bit Accumulator 1 (mid) \\ \hline
501 \end{tabular}
502 \end{table}
503
504 \section{Accumulators}
505
506 The DSP has two long 40-bit accumulators (\Register{\$acX}) and their short 24-bit forms (\Register{\$acsX}) that reflect the
507 upper part of 40-bit accumulator. There are additional two 32-bit accumulators (\Register{\$axX}).
508
509 The high parts of the 40-bit accumulators (\Register{acX.h}) are sign-extended 8-bit registers. Writes to the upper 8 bits are ignored,
510 and the upper 8 bits read the same as the 7th bit. For instance, \Value{0x007F} reads back as \Value{0x007F}, but \Value{0x0080} reads
511 back as \Value{0xFF80}.
512
513 \subsection{Accumulators \Register{\$acX}}
514
515 40-bit accumulator \Register{\$acX} (\Register{\$acX.hml}) consists of registers:
516
517 \begin{lstlisting}[language=C++]
518 $acX = $acX.h << 32 | $acX.m << 16 | $acX.l
519 \end{lstlisting}
520
521 \subsection{Short accumulators \Register{\$acsX}}
522
523 24-bit accumulator \Register{\$acsX} (\Register{\$acX.hm}) consists of the upper 24 bits of accumulator \Register{\$acX}.
524
525 \begin{lstlisting}[language=C++]
526 $acsX = $acX.h << 16 | $acX.m
527 \end{lstlisting}
528
529 \subsection{Additional accumulators \Register{\$axX}}
530
531 32-bit accumulators \Register{\$axX} (\Register{\$axX.hl}) consist of registers:
532
533 \begin{lstlisting}[language=C++]
534 $axX = $axX.h << 16 | $axX.l
535 \end{lstlisting}
536
537 \subsection{16-bit and 40-bit modes}\label{subsec:SET40}
538
539 Depending on the value of \RegisterField{\$sr.SXM} (bit 14), loading to \Register{\$acX.m} may also update \Register{\$acX.h} and \Register{\$acX.l}, and stores from \Register{\$acX.m} may experience saturation based on \Register{\$acX.h}. Regardless of the value of \RegisterField{\$sr.SXM}, arithmetic operations such as \Opcode{ADDI}, \Opcode{INCM}, \Opcode{MOVR}, and \Opcode{LSRN} will still affect the entire accumulator.
540
541 If \RegisterField{\$sr.SXM} is set to 0, then 16-bit mode (\Opcode{SET16}) is in use. Loads to \Register{\$acX.m} will only change \Register{\$acX.m}, and storing \Register{\$acX.m} will use the value directly contained in \Register{\$acX.m}; the same applies to loads to and stores from \Register{\$acX.h} or \Register{\$acX.l} or any other register.
542
543 If \RegisterField{\$sr.SXM} is set to 1, then 40-bit mode (\Opcode{SET40}) is in use. Loads to \Register{\$acX.m} will set \Register{\$acX.l} to 0 and will sign-extend into \Register{\$acX.h} (setting it to \Value{0xFF} if the sign bit is set (\InlineExpression{\$acX.m \& 0x8000 != 0}), and to 0 otherwise). This means that in 40-bit mode, loads to \Register{\$acX.m} are effectively loads to the whole accumulator \Register{\$acX}. Loads to \Register{\$acX.h} and \Register{\$acX.l} do not have this special behavior; they only modify the specified register (as in 16-bit mode).
544
545 Additionally, if \RegisterField{\$sr.SXM} is set to 1, then moving or storing from \Register{\$acX.m} may instead result in \Value{0x7fff} or \Value{0x8000} being used. This happens if \Register{\$acX.hml} is not the same as sign-extending \Register{\$acX.ml}; \Value{0x7fff} is used if \Register{\$acX} is positive and \Value{0x8000} is used if \Register{\$acX} is negative.
546
547 The conditions for this saturation are the same as the conditions for \RegisterField{\$sr.AS} (bit 4, above s32) to be set when flags are updated. (This does not mean that the saturation happens if and only if \RegisterField{\$sr.AS} is set, as the flags might have been set after an operation on a different register.)
548
549 The following instructions perform sign-extension when writing to \Register{\$acX.m}: \Opcode{ILRR}, \Opcode{ILRRD}, \Opcode{ILRRI}, and \Opcode{ILRRN}; \Opcode{LR}; \Opcode{LRI}; \Opcode{LRIS}; \Opcode{LRR}, \Opcode{LRRD}, \Opcode{LRRI}, and \Opcode{LRRN}; \Opcode{LRS}; \Opcode{MRR}; and \Opcode{'L} and \Opcode{'LN}.
550
551 The following instructions experience saturation when reading from \Register{\$acX.m}: \Opcode{BLOOP}; \Opcode{LOOP}; \Opcode{MRR}; \Opcode{SR}; \Opcode{SRR}, \Opcode{SRRD}, \Opcode{SRRI}, and \Opcode{SRRN}; \Opcode{SRS}; \Opcode{'LS}, \Opcode{'LSM}, \Opcode{'LSM}, and \Opcode{'LSNM}; \Opcode{'MV}; \Opcode{'SL}, \Opcode{'SLM}, \Opcode{'SLN}, and \Opcode{'SLNM}; and \Opcode{'S} and \Opcode{'SN}.
552
553 \pagebreak{}
554
555 \section{Stacks}
556
557 The GameCube DSP contains four stack registers:
558
559 \begin{itemize}
560 \item \Register{\$st0} -- Call stack register
561 \item \Register{\$st1} -- Data stack register
562 \item \Register{\$st2} -- Loop address stack register
563 \item \Register{\$st3} -- Loop counter register
564 \end{itemize}
565
566 Stacks are implemented in hardware and have limited depth. The data stack is limited to four values
567 and the call stack is limited to eight values. The loop stack is limited to four values.
568 Upon underflow or overflow of any of the stack registers exception \Exception{STOVF} is raised.
569
570 The loop stack is used to control execution of repeated blocks of instructions. Whenever there is a value in
571 \Register{\$st2} and the current PC is equal to the value in \Register{\$st2}, then the value in \Register{\$st3} is decremented.
572 If the value is not zero, then the PC is modified by the value from call stack \Register{\$st0}. Otherwise values from the call stack
573 \Register{\$st0} and both loop stacks, \Register{\$st2} and \Register{\$st3}, are popped and execution continues at the next opcode.
574
575 \pagebreak{}
576
577 \section{Config register}
578
579 Serves as a base offset for \Opcode{SRS}, \Opcode{SRSH}, and \Opcode{LRS}. Zelda uCode writes it with \Value{0x0004}, but otherwise it is usually \Value{0x00FF}.
580
581 This is an 8-bit register. Writes to the upper 8 bits are ignored and those bits always read back as 0.
582
583 \pagebreak{}
584
585 \section{Status register}
586
587 Status register \Register{\$sr} reflects flags computed on accumulators after logical or arithmetic operations.
588 Furthermore, it also contains control bits to configure the flow of certain operations.
589
590 \begin{table}[htb]
591 \centering
592 \begin{tabular}{|l|l|l|}
593 \hline
594 \textbf{Bit} & \textbf{Name} & \textbf{Comment} \\ \hline
595 \texttt{15} & \texttt{SU} & Multiplication operands are signed (1 = unsigned) \\ \hline
596 \texttt{14} & \texttt{SXM} & Sign extension mode (1 = 40-bit, see \nameref{subsec:SET40}) \\ \hline
597 \texttt{13} & \texttt{AM} & Product multiply result by 2 (when \texttt{AM = 0}) \\ \hline
598 \texttt{12} & & \\ \hline
599 \texttt{11} & \texttt{EIE} & External interrupt enable \\ \hline
600 \texttt{10} & & \\ \hline
601 \texttt{9} & \texttt{IE} & Interrupt enable \\ \hline
602 \texttt{8} & & Unknown, always reads back as 0 \\ \hline
603 \texttt{7} & \texttt{OS} & Overflow (sticky) \\ \hline
604 \texttt{6} & \texttt{LZ} & Logic zero (used by \Opcode{ANDCF} and \Opcode{ANDF}) \\ \hline
605 \texttt{5} & \texttt{TB} & Top two bits are equal \\ \hline
606 \texttt{4} & \texttt{AS} & Above s32 \\ \hline
607 \texttt{3} & \texttt{S} & Sign \\ \hline
608 \texttt{2} & \texttt{Z} & Arithmetic zero \\ \hline
609 \texttt{1} & \texttt{O} & Overflow \\ \hline
610 \texttt{0} & \texttt{C} & Carry \\ \hline
611 \end{tabular}
612 \end{table}
613
614 \pagebreak{}
615
616 \section{Product register}
617
618 The product register is a register containing the intermediate product of a multiply or multiply and accumulation operation.
619 Its result should never be used for calculation although the register can be read or written.
620 It reflects the state of the internal multiply unit. The product is 40 bits with 1 bit of overflow.
621
622 \begin{lstlisting}[language=C++]
623 $prod = ($prod.h << 32) + (($prod.m1 + $prod.m2) << 16) + $prod.l
624 \end{lstlisting}
625
626 It needs to be noted that \InlineExpression{\$prod.m1 + \$prod.m2} overflow bit (bit 16) will be added to \Register{\$prod.h}.
627
628 Bit \RegisterField{\$sr.AM} affects the result of the multiply unit.
629 If \RegisterField{\$sr.AM} is equal 0 then the result of every multiply operation will be multiplied by two.
630
631 \Register{prod.h} is 8 bits. The upper 8 bits always read back as 0.
632
633 \pagebreak{}
634
635 \chapter{Exceptions}
636
637 \section{Exception processing}
638
639 Exception processing happens by setting the program counter to different exception vectors.
640 At exception time, the exception program counter is stored at call stack \Register{\$st0} and status register \Register{\$sr} is stored at data stack \Register{\$st1}.
641
642 \textbf{Operation:}
643 \begin{lstlisting}[basicstyle=\ttfamily]
644 PUSH_STACK($st0);
645 $st0 = $pc;
646 PUSH_STACK($st1);
647 $st1 = $sr;
648 $pc = exception_nr * 2;
649 \end{lstlisting}
650
651 \pagebreak{}
652
653 \section{Exception vectors}
654
655 Exception vectors are located at address \Address{0x0000} in Instruction RAM.
656
657 \begin{table}[htb]
658 \centering
659 \begin{tabular}{|l|l|l|l|}
660 \hline
661 \textbf{Level} & \textbf{Address} & \textbf{Name} & \textbf{Description} \\ \hline
662 0 & \Address{0x0000} & \texttt{RESET} & \\ \hline
663 1 & \Address{0x0002} & \texttt{STOVF} & Stack under/overflow \\ \hline
664 2 & \Address{0x0004} & & \\ \hline
665 3 & \Address{0x0006} & \texttt{ACRROV} & Accelerator raw read address overflow \\ \hline
666 4 & \Address{0x0008} & \texttt{ACRWOV} & Accelerator raw write address overflow \\ \hline
667 5 & \Address{0x000A} & \texttt{ACSOV} & Accelerator sample read address overflow \\ \hline
668 6 & \Address{0x000C} & & \\ \hline
669 7 & \Address{0x000E} & \texttt{INT} & External interrupt (from CPU) \\ \hline
670 \end{tabular}
671 \end{table}
672
673 \pagebreak{}
674
675 \chapter{Hardware interface}
676
677 \section{Hardware registers}
678
679 Hardware registers (IFX) occupy the address space at \Address{0xFFxx} in the Data Memory space. Each register is 16 bits in width.
680
681 \begin{table}[htb]
682 \centering
683 \begin{tabular}{|l|l|l|}
684 \hline
685 \textbf{Address} & \textbf{Name} & \textbf{Description} \\ \hline
686 \multicolumn{3}{|l|}{\textit{ADPCM Coefficients}} \\ \hline
687 \Address{0xFFA0} & \Register{COEF\_A1\_0} & A1 Coefficient \# 0 \\ \hline
688 \Address{0xFFA1} & \Register{COEF\_A2\_0} & A2 Coefficient \# 0 \\ \hline
689 \multicolumn{3}{|c|}{$\vdots$} \\ \hline
690 \Address{0xFFAE} & \Register{COEF\_A1\_7} & A1 Coefficient \# 7 \\ \hline
691 \Address{0xFFAF} & \Register{COEF\_A2\_7} & A2 Coefficient \# 7 \\ \hline
692 \multicolumn{3}{|l|}{\textit{DMA Interface}} \\ \hline
693 \Address{0xFFC9} & \Register{DSCR} & DMA control \\ \hline
694 \Address{0xFFCB} & \Register{DSBL} & Block length \\ \hline
695 \Address{0xFFCD} & \Register{DSPA} & DSP memory address \\ \hline
696 \Address{0xFFCE} & \Register{DSMAH} & Memory address H \\ \hline
697 \Address{0xFFCF} & \Register{DSMAL} & Memory address L \\ \hline
698 \multicolumn{3}{|l|}{\textit{Accelerator}} \\ \hline
699 \Address{0xFFD1} & \Register{FORMAT} & Accelerator sample format \\ \hline
700 \Address{0xFFD2} & \Register{ACUNK1} & Unknown, usually 3 \\ \hline
701 \Address{0xFFD3} & \Register{ACDRAW} & Accelerator raw data \\ \hline
702 \Address{0xFFD4} & \Register{ACSAH} & Accelerator start address H \\ \hline
703 \Address{0xFFD5} & \Register{ACSAL} & Accelerator start address L \\ \hline
704 \Address{0xFFD6} & \Register{ACEAH} & Accelerator end address H \\ \hline
705 \Address{0xFFD7} & \Register{ACEAL} & Accelerator end address L \\ \hline
706 \Address{0xFFD8} & \Register{ACCAH} & Accelerator current address H \\ \hline
707 \Address{0xFFD9} & \Register{ACCAL} & Accelerator current address L \\ \hline
708 \Address{0xFFDA} & \Register{PRED\_SCALE} & ADPCM predictor and scale \\ \hline
709 \Address{0xFFDB} & \Register{YN1} & ADPCM output history Y[N - 1] \\ \hline
710 \Address{0xFFDC} & \Register{YN2} & ADPCM output history Y[N - 2] \\ \hline
711 \Address{0xFFDD} & \Register{ACDSAMP} & Accelerator processed sample \\ \hline
712 \Address{0xFFDE} & \Register{GAIN} & Gain \\ \hline
713 \Address{0xFFDF} & \Register{ACIN} & Accelerator input \\ \hline
714 \Address{0xFFED} & \Register{AMDM} & ARAM DMA Request Mask \\ \hline
715 \multicolumn{3}{|l|}{\textit{Interrupts}} \\ \hline
716 \Address{0xFFFB} & \Register{DIRQ} & IRQ request \\ \hline
717 \multicolumn{3}{|l|}{\textit{Mailboxes}} \\ \hline
718 \Address{0xFFFC} & \Register{DMBH} & DSP Mailbox H \\ \hline
719 \Address{0xFFFD} & \Register{DMBL} & DSP Mailbox L \\ \hline
720 \Address{0xFFFE} & \Register{CMBH} & CPU Mailbox H \\ \hline
721 \Address{0xFFFF} & \Register{CMBL} & CPU Mailbox L \\ \hline
722 \end{tabular}
723 \end{table}
724
725 \pagebreak{}
726
727 \section{DMA}
728
729 The GameCube DSP is connected to the memory bus through a DMA channel. DMA can be used to transfer data between DSP memory (both instruction and data) and main memory.
730
731 \RegisterBitOverview{0xFFC9}{DSCR}{DMA Control}{---- ---- ---- -tid}
732
733 \begin{RegisterBitDescriptions}
734 \RegisterBitDescription{2}{t}{R}{Transfer currently in progress if set}
735 \RegisterBitDescription{1}{i}{R/W}{\begin{tabular}[c]{@{}l@{}}\Value{1} - DMA to/from IMEM\\ \Value{0} - DMA to/from DMEM\end{tabular}}
736 \RegisterBitDescription{0}{d}{R/W}{\begin{tabular}[c]{@{}l@{}}\Value{1} - DMA to CPU from DSP\\ \Value{0} - DMA from CPU to DSP\end{tabular}}
737 \end{RegisterBitDescriptions}
738
739 \RegisterBitOverview{0xFFCB}{DSBL}{Block length}{dddd dddd dddd dddd}
740
741 \begin{RegisterBitDescriptions}
742 \RegisterBitDescription{15--0}{d}{W}{Length in bytes to transfer. Writing to this register starts a DMA transfer.}
743 \end{RegisterBitDescriptions}
744
745 \RegisterBitOverview{0xFFCD}{DSPA}{DSP Address}{dddd dddd dddd dddd}
746
747 \begin{RegisterBitDescriptions}
748 \RegisterBitDescription{15--0}{d}{R/W}{Bits 15--0 of the DSP memory address}
749 \end{RegisterBitDescriptions}
750
751 \RegisterBitOverview{0xFFCE}{DSMAH}{Memory Address H}{dddd dddd dddd dddd}
752
753 \begin{RegisterBitDescriptions}
754 \RegisterBitDescription{15--0}{d}{R/W}{Bits 31--16 of the main memory address}
755 \end{RegisterBitDescriptions}
756
757 \RegisterBitOverview{0xFFCF}{DSMAL}{Memory Address L}{dddd dddd dddd dddd}
758
759 \begin{RegisterBitDescriptions}
760 \RegisterBitDescription{15--0}{d}{R/W}{Bits 15--0 of the main memory address}
761 \end{RegisterBitDescriptions}
762
763 \pagebreak{}
764
765 \section{Accelerator}
766
767 The accelerator is used to transfer data from accelerator memory (ARAM) to DSP memory. The accelerator area can be marked with \Register{ACSA} (start) and \Register{ACEA} (end) addresses.
768 Current address for the accelerator can be set or read from the \Register{ACCA} register. Accessing accelerator memory is done by reading or writing the \Register{ACDRAW} register for raw data, or reading the \Register{ACDSAMP} register for processed sample data.
769 These registers contain raw or processed sample data from ARAM pointed to by the \Register{ACCA} register.
770 After reading the data, \Register{ACCA} is incremented by one.
771 After \Register{ACCA} grows bigger than the area pointed to by \Register{ACEA}, it gets reset to a value from \Register{ACSA} and an exception is generated. Raw reads generate exception \Exception{ACRROV}, raw writes generate exception \Exception{ACRWOV}, and sample reads generate exception \Exception{ACSOV}.
772
773 \RegisterBitOverview{0xFFD1}{FORMAT}{Accelerator sample format}{---- ---- --gg ddss}
774
775 \begin{RegisterBitDescriptions}
776 \RegisterBitDescription{5--4}{g}{R/W}{\begin{tabular}[c]{@{}l@{}}
777 \Value{0} - PCM gain/coef scaling = 1/2048 \\
778 \Value{1} - PCM gain/coef scaling = 1/1 \\
779 \Value{2} - PCM gain/coef scaling = 1/65536 \\
780 \end{tabular}}
781 \RegisterBitDescription{3--2}{d}{R/W}{\begin{tabular}[c]{@{}l@{}}
782 \Value{0} - ADPCM decoding from ARAM \\
783 \Value{1} - PCM decoding from \Register{ACIN}, \Register{ACCA} doesn't increment \\
784 \Value{2} - PCM decoding from ARAM \\
785 \Value{3} - PCM decoding from \Register{ACIN}, \Register{ACCA} increments \\
786 \end{tabular}}
787 \RegisterBitDescription{1--0}{s}{R/W}{\begin{tabular}[c]{@{}l@{}}
788 \Value{0} - 4-bit \\
789 \Value{1} - 8-bit \\
790 \Value{2} - 16-bit \\
791 \end{tabular}}
792 \end{RegisterBitDescriptions}
793
794 \RegisterBitOverview{0xFFD2}{ACUNK1}{Unknown 1}{dddd dddd dddd dddd}
795
796 \begin{RegisterBitDescriptions}
797 \RegisterBitDescription{15--0}{d}{R/W}{Usually 3}
798 \end{RegisterBitDescriptions}
799
800 \RegisterBitOverview{0xFFD3}{ACDRAW}{Raw ARAM Access}{dddd dddd dddd dddd}
801
802 \begin{RegisterBitDescriptions}
803 \RegisterBitDescription{15--0}{d}{R/W}{Reads from or writes to raw data pointed to by current accelerator address, and then increments the current address. Reads respect the FORMAT size. Writes are always 16-bit and treat the addresses as such. Writes require that the uppermost bit of the current address is set. Reads that overflow the end address throw exception \Exception{ACRROV}. Writes that overflow throw exception \Exception{ACRWOV}.}
804 \end{RegisterBitDescriptions}
805
806 \RegisterBitOverview{0xFFD4}{ACSAH}{Accelerator Start Address H}{dddd dddd dddd dddd}
807
808 \begin{RegisterBitDescriptions}
809 \RegisterBitDescription{15--0}{d}{R/W}{Bits 31--16 of the accelerator start address}
810 \end{RegisterBitDescriptions}
811
812 \RegisterBitOverview{0xFFD5}{ACSAL}{Accelerator Start Address L}{dddd dddd dddd dddd}
813
814 \begin{RegisterBitDescriptions}
815 \RegisterBitDescription{15--0}{d}{R/W}{Bits 15--0 of the accelerator start address}
816 \end{RegisterBitDescriptions}
817
818 \pagebreak{}
819
820 \RegisterBitOverview{0xFFD6}{ACEAH}{Accelerator End Address H}{dddd dddd dddd dddd}
821
822 \begin{RegisterBitDescriptions}
823 \RegisterBitDescription{15--0}{d}{R/W}{Bits 31--16 of the accelerator end address}
824 \end{RegisterBitDescriptions}
825
826 \RegisterBitOverview{0xFFD7}{ACEAL}{Accelerator End Address L}{dddd dddd dddd dddd}
827
828 \begin{RegisterBitDescriptions}
829 \RegisterBitDescription{15--0}{d}{R/W}{Bits 15--0 of the accelerator end address}
830 \end{RegisterBitDescriptions}
831
832 \RegisterBitOverview{0xFFD8}{ACCAH}{Accelerator Current Address H}{dddd dddd dddd dddd}
833
834 \begin{RegisterBitDescriptions}
835 \RegisterBitDescription{15--0}{d}{R/W}{Bits 31--16 of the accelerator current address}
836 \end{RegisterBitDescriptions}
837
838 \RegisterBitOverview{0xFFD9}{ACSAH}{Accelerator Current Address L}{dddd dddd dddd dddd}
839
840 \begin{RegisterBitDescriptions}
841 \RegisterBitDescription{15--0}{d}{R/W}{Bits 15--0 of the accelerator current address}
842 \end{RegisterBitDescriptions}
843
844 \RegisterBitOverview{0xFFDA}{PRED\_SCALE}{ADPCM predictor and scale}{---- ---- -ppp ssss}
845
846 \begin{RegisterBitDescriptions}
847 \RegisterBitDescription{6--4}{d}{R/W}{Used to decide which pair of coefficients to use (\Register{COEF\_A1\_p} and \Register{COEF\_A2\_p}, at $\Address{0xFFA0} + 2p$ and $\Address{0xFFA0} + 2p + 1$)}
848 \RegisterBitDescription{3--0}{s}{R/W}{The scale to use, as $2^s$}
849 \end{RegisterBitDescriptions}
850
851 \pagebreak{}
852
853 \RegisterBitOverview{0xFFDB}{YN1}{ADPCM YN1}{dddd dddd dddd dddd}
854
855 \begin{RegisterBitDescriptions}
856 \RegisterBitDescription{15--0}{d}{R/W}{Last value read by the accelerator, updated to the new value of \Register{ACDSAMP} when \Register{ACDSAMP} is read. Used and updated for all sample formats. Multiplied by the A1 coefficient selected by PRED\_SCALE and scaled per FORMAT.}
857 \end{RegisterBitDescriptions}
858
859 \RegisterBitOverview{0xFFDC}{YN2}{ADPCM YN2}{dddd dddd dddd dddd}
860
861 \begin{RegisterBitDescriptions}
862 \RegisterBitDescription{15--0}{d}{R/W}{Second-last value read by the accelerator, updated to the previous value of \Register{YN1} when \Register{ACDSAMP} is read. Used and updated for all sample formats. Multiplied by the A2 coefficient selected by PRED\_SCALE and scaled per FORMAT. Writing this value starts the accelerator.}
863 \end{RegisterBitDescriptions}
864
865 \RegisterBitOverview{0xFFDD}{ACDSAMP}{Accelerator data}{dddd dddd dddd dddd}
866
867 \begin{RegisterBitDescriptions}
868 \RegisterBitDescription{15--0}{d}{R}{Reads new proccessed sample data from the accelerator. Data is processed per FORMAT. When there is no data left, returns 0.}
869 \end{RegisterBitDescriptions}
870
871 \RegisterBitOverview{0xFFDE}{GAIN}{Gain}{dddd dddd dddd dddd}
872
873 \begin{RegisterBitDescriptions}
874 \RegisterBitDescription{15--0}{d}{R/W}{Applied in PCM FORMATs. Raw sample is multiplied by GAIN, then scaled per the gain scale bits of FORMAT.}
875 \end{RegisterBitDescriptions}
876
877 \RegisterBitOverview{0xFFDF}{ACIN}{Accelerator Input}{dddd dddd dddd dddd}
878
879 \begin{RegisterBitDescriptions}
880 \RegisterBitDescription{15--0}{d}{R/W}{Used as the sample input in place of ARAM reads when FORMAT specifies it.}
881 \end{RegisterBitDescriptions}
882
883 \RegisterBitOverview{0xFFEF}{AMDM}{ARAM DMA Request Mask}{---- ---- ---- ---m}
884
885 \begin{RegisterBitDescriptions}
886 \RegisterBitDescription{0}{m}{R/W}{\begin{tabular}[c]{@{}l@{}}\Value{0} - DMA with ARAM unmasked\\ \Value{1} - masked\end{tabular}}
887 \end{RegisterBitDescriptions}
888
889 \pagebreak{}
890
891 \section{Interrupts}
892
893 The DSP can raise interrupts at the CPU. Interrupts are usually used to signal that a DSP mailbox has been filled with new data.
894
895 \RegisterBitOverview{0xFFFB}{DIRQ}{IRQ Request}{---- ---- ---- ---I}
896
897 \begin{RegisterBitDescriptions}
898 \RegisterBitDescription{0}{I}{W}{\Value{1} - Raise interrupt at CPU}
899 \end{RegisterBitDescriptions}
900
901 \pagebreak{}
902
903 \section{Mailboxes}
904
905 \subsection{DSP Mailbox}
906
907 The DSP mailbox (DMB) is an interface to send 31 bits of information from the DSP to the CPU.
908
909 \RegisterBitOverview{0xFFFC}{DMBH}{DSP Mailbox H}{Mddd dddd dddd dddd}
910
911 \begin{table}[htb]
912 \centering
913 \begin{tabular}{|l|l|l|l|}
914 \hline
915 \textbf{Bit} & \textbf{Name} & \textbf{R/W} & \textbf{Action} \\ \hline
916 \multirow{2}{*}{15} & \multirow{2}{*}{M} & \texttt{R} & \begin{tabular}[c]{@{}l@{}}\Value{1} - Mailbox has not been received by CPU\\ \Value{0} - Mailbox empty\end{tabular} \\ \cline{3-4}
917 & & \texttt{W} & Does not matter. It will be set when DMBL is written to \\ \hline
918 14--0 & \RegisterField{d} & \texttt{W} & Bits 30--16 of mail sent from the DSP to the CPU \\ \hline
919 \end{tabular}
920 \end{table}
921
922 \RegisterBitOverview{0xFFFD}{DMBL}{DSP Mailbox L}{dddd dddd dddd dddd}
923
924 \begin{RegisterBitDescriptions}
925 \RegisterBitDescription{15--0}{d}{W}{
926 Bits 15--0 of mail sent from the DSP to the CPU. Writing to this register by the DSP causes the
927 \RegisterField{DMBH.M} bit to be set, indicating that the mail is ready.
928 }
929 \end{RegisterBitDescriptions}
930
931 \textbf{Operation:}
932
933 Sending mail from the DSP to the CPU can be achieved by writing mail to register \Register{DMBH} and then to register \Register{DMBL} in that order.
934 After writing to \Register{DMBL}, bit \RegisterField{DMBH.M} will be set, signaling that the mail is ready to be received by the CPU.
935 If the DSP needs to receive a response from the CPU, then it usually waits for the \RegisterField{M} bit to be cleared after sending a mail.
936 If the DSP does processing when the CPU receives a mail, then it waits for the \RegisterField{M} bit to be cleared before issuing another mail to the CPU.
937
938 \pagebreak{}
939
940 \subsection{CPU Mailbox}
941
942 The CPU Mailbox (CMB) is a register that allows sending 31 bits of information from the CPU to the DSP.
943
944 \RegisterBitOverview{0xFFFE}{CMBH}{CPU Mailbox H}{Mddd dddd dddd dddd}
945
946 \begin{RegisterBitDescriptions}
947 \RegisterBitDescription{15}{M}{R}{
948 \begin{tabular}[c]{@{}l@{}}
949 \Value{1} - Mailbox contains mail from the CPU\\ \Value{0} - Mailbox empty
950 \end{tabular}
951 }
952 \RegisterBitDescription{14--0}{d}{R}{Bits 30--16 of the mail sent from the CPU}
953 \end{RegisterBitDescriptions}
954
955 \RegisterBitOverview{0xFFFF}{CMBL}{CPU Mailbox L}{dddd dddd dddd dddd}
956
957 \begin{RegisterBitDescriptions}
958 \RegisterBitDescription{15--0}{d}{R}{
959 Bits 15--0 of mail sent from the CPU. Reading of this register by the DSP causes the \RegisterField{CMBH.M}
960 bit to be cleared.
961 }
962 \end{RegisterBitDescriptions}
963
964 \textbf{Operation:}
965
966 From the CPU side, software usually checks the \RegisterField{M} bit of \Register{CMBH}. It takes action only in the case that this bit is \Value{0}.
967 Said action is to write \Register{CMBH} first and then \Register{CMBL}. After writing to \Register{CMBL}, the mail is ready to be received by the DSP.
968
969 From the DSP side, the DSP loops by probing the \RegisterField{M} bit. When this bit is \Value{1}, the DSP reads \Register{CMBH} first and then \Register{CMBL}.
970 After reading \Register{CMBL}, \RegisterField{CMBH.M} will be cleared.
971
972 \pagebreak{}
973
974 \chapter{Opcodes}
975
976 \section{Opcode syntax}
977
978 \vspace{3mm}
979 \textbf{Basic opcode syntax:}
980
981 \begin{lstlisting}[basicstyle=\ttfamily]
982 OPC <opcode parameters>
983 \end{lstlisting}
984
985 \textit{Above syntax is correct for all opcodes.}
986 \vspace{5mm}
987
988 \textbf{\textit{EXAMPLES:}}
989 \begin{lstlisting}[basicstyle=\ttfamily]
990 JMP 0x0300
991 CALL loop
992 HALT
993 \end{lstlisting}
994
995 \vspace{5mm}
996
997 \textbf{Extended syntax:}
998
999 \begin{lstlisting}[basicstyle=\ttfamily]
1000 OPC'EXOPC <opcode parameters> : <extended opcode parameters>
1001 \end{lstlisting}
1002
1003 \textit{Above syntax is correct only for arithmetic opcodes, because those can be extended with additional load/store unit behavior.}
1004 \vspace{5mm}
1005
1006 \textbf{\textit{EXAMPLES:}}
1007 \begin{lstlisting}[basicstyle=\ttfamily]
1008 DECM'L $acs0 : $acl.m, @ar0
1009 NX'MV : $acx1.h, $ac0.l
1010 \end{lstlisting}
1011
1012 \pagebreak{}
1013
1014 \section{Operation --- Used Functions}
1015
1016 Functions used for describing opcode operation.
1017
1018 \begin{description}
1019 \item \Function{PUSH\_STACK(\$stR)}
1020 \begin{description}
1021 \item \textbf{Description:} \\
1022 Pushes value onto given stack referenced by stack register \Register{\$stR}. Operation moves values down in internal stack.
1023
1024 \item \textbf{Operation:} \\
1025 \Code{stack\_stR[stack\_ptr\_stR++] = \$stR;}
1026 \end{description}
1027 \end{description}
1028
1029 \begin{description}
1030 \item \Function{POP\_STACK(\$stR)}
1031 \begin{description}
1032 \item \textbf{Description:} \\
1033 Pops value from stack referenced by stack register \Register{\$stR}. Operation moves values up in internal stack.
1034
1035 \item \textbf{Operation:} \\
1036 \Code{\$stR = stack\_stR[--stack\_ptr\_stR];}
1037 \end{description}
1038 \end{description}
1039
1040 \begin{description}
1041 \item \Function{FLAGS(val)}
1042 \begin{description}
1043 \item\textbf{Description:} \\
1044 Calculates flags depending on given value or result of operation and sets corresponding bits in status register \Register{\$sr}.
1045 \end{description}
1046 \end{description}
1047
1048 \begin{description}
1049 \item \Function{EXECUTE\_OPCODE(new\_pc)}
1050 \begin{description}
1051 \item \textbf{Description:} \\
1052 Executes opcode at the given \Variable{new\_pc} address.
1053 \end{description}
1054 \end{description}
1055
1056 \pagebreak{}
1057
1058 \section{Bit meanings}
1059
1060 Opcode decoding uses special naming for bits and their decimal representations to provide easier understanding of bit fields in the opcode.
1061
1062 \begin{table}[H]
1063 \centering
1064 \begin{tabular}{|l|l|l|}
1065 \hline
1066 \textbf{Binary form} & \textbf{Decimal form} & \textbf{Meaning} \\ \hline
1067 \texttt{d, dd, ddd, dddd} & \texttt{D} & Destination register \\ \hline
1068 \texttt{s, ss, sss, ssss} & \texttt{S} & Source register \\ \hline
1069 \texttt{t, tt, ttt, tttt} & \texttt{T} & Source register \\ \hline
1070 \texttt{r, rr, rrr, rrrr} & \texttt{R} & Register (either source or destination) \\ \hline
1071 \texttt{Aaaaa(a)} & \texttt{A, addrA} & Address in either instruction or data memory \\ \hline
1072 \texttt{xxxx xxxx} & \texttt{X} & Extended opcode \\ \hline
1073 \texttt{mmm(m)} & \texttt{M, addrM} & Address in memory \\ \hline
1074 \texttt{iii(i)} & \texttt{I, Imm} & Immediate value \\ \hline
1075 \texttt{cccc} & \texttt{cc} & Condition (see conditional opcodes) \\ \hline
1076 \end{tabular}
1077 \end{table}
1078
1079 \pagebreak{}
1080
1081 \section{Conditional opcodes}
1082
1083 Conditional opcodes are executed only when the condition described by their encoded conditional field has been met.
1084 The groups of conditional instructions are: \Opcode{CALLcc}, \Opcode{Jcc}, \Opcode{IFcc}, \Opcode{RETcc}, \Opcode{RTIcc}, \Opcode{JRcc}, and \Opcode{CALLRcc}.
1085
1086 \begin{table}[H]
1087 \centering
1088 \begin{tabular}{|l|l|l|l|}
1089 \hline
1090 \textbf{Bits} & \textbf{\texttt{cc}} & \textbf{Name} & \textbf{Evaluated expression} \\ \hline
1091 \texttt{0b0000} & \texttt{GE} & Greater than or equal & \Code{\$sr.O == \$sr.S} \\ \hline
1092 \texttt{0b0001} & \texttt{L} & Less than & \Code{\$sr.O != \$sr.S} \\ \hline
1093 \texttt{0b0010} & \texttt{G} & Greater than & \Code{(\$sr.O == \$sr.S) \&\& (\$sr.Z == 0)} \\ \hline
1094 \texttt{0b0011} & \texttt{LE} & Less than or equal & \Code{(\$sr.O != \$sr.S) || (\$sr.Z != 0)} \\ \hline
1095 \texttt{0b0100} & \texttt{NZ} & Not zero & \Code{\$sr.Z == 0} \\ \hline
1096 \texttt{0b0101} & \texttt{Z} & Zero & \Code{\$sr.Z != 0} \\ \hline
1097 \texttt{0b0110} & \texttt{NC} & Not carry & \Code{\$sr.C == 0} \\ \hline
1098 \texttt{0b0111} & \texttt{C} & Carry & \Code{\$sr.C != 0} \\ \hline
1099 \texttt{0b1000} & \texttt{x8} & Below s32 & \Code{\$sr.AS == 0} \\ \hline
1100 \texttt{0b1001} & \texttt{x9} & Above s32 & \Code{\$sr.AS != 0} \\ \hline
1101 \texttt{0b1010} & \texttt{xA} & & \Code{((\$sr.AS != 0) || (\$sr.TB != 0)) \&\& (\$sr.Z == 0)} \\ \hline
1102 \texttt{0b1011} & \texttt{xB} & & \Code{((\$sr.AS == 0) \&\& (\$sr.TB == 0)) || (\$sr.Z != 0)} \\ \hline
1103 \texttt{0b1100} & \texttt{LNZ} & Not logic zero & \Code{\$sr.LZ == 0} \\ \hline
1104 \texttt{0b1101} & \texttt{LZ} & Logic zero & \Code{\$sr.LZ != 0} \\ \hline
1105 \texttt{0b1110} & \texttt{O} & Overflow & \Code{\$sr.O != 0} \\ \hline
1106 \texttt{0b1111} & & \textless always\textgreater & \\ \hline
1107 \end{tabular}
1108 \end{table}
1109
1110 \textbf{Note:}
1111
1112 There are two pairs of conditions that work similarly: \texttt{Z}/\texttt{NZ} and \texttt{LZ}/\texttt{LNZ}.
1113 \texttt{Z}/\texttt{NZ} pair operates on arithmetic zero flag (arithmetic 0) while \texttt{LZ}/\texttt{LNZ} pair operates on logic zero flag (logic 0).
1114 The logic zero flag is only set by \Opcode{ANDCF} and \Opcode{ANDF}.
1115
1116 \pagebreak{}
1117
1118 \section{Flags}
1119
1120 Most opcodes update flags in the status register (\Register{\$sr}) based on their result. (Extended opcodes do not update flags.)
1121
1122 Overflow (\texttt{O}) occurs when the result has wrapped around. The expression $C = A + B$ has overflown if $A > 0$ and $B > 0$ but $C \le 0$ or if $A < 0$ and $B < 0$ but $C \ge 0$. Any instruction that sets the \texttt{O} flag will also set the \texttt{OS} flag; when the \texttt{O} flag is set, \texttt{OS} is also set, but \texttt{OS} is not cleared when \texttt{O} is cleared.
1123
1124 Carry (\texttt{C}) occurs when an arithmetic carry occurs and should be added to the next most significant word. The expression $C = A + B$ generates a carry if $A > C$. The DSP uses different logic for subtraction: the expression $C = A - B$ generates a carry if $A \ge C$ (so if $B = 0$, a carry is generated for all $A$). This is because the DSP uses a carry flag, not a borrow flag.
1125
1126 Each instruction has a table showing what flags it updates, such as this:
1127
1128 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1129
1130 A ``-'' indicates that the flag retains its previous value, a ``0'' indicates that the flag is set to 0, and a ``X'' indicates that the value of the flag changes depending on what the instruction did.
1131
1132 \pagebreak{}
1133
1134 \section{Alphabetical list of opcodes}
1135
1136 \pagebreak{}
1137
1138 \begin{DSPOpcode}{ABS}
1139 \begin{DSPOpcodeBytefield}{16}
1140 \monobitbox{4}{1010} & \monobitbox{4}{d001} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1141 \end{DSPOpcodeBytefield}
1142
1143 \begin{DSPOpcodeFormat}
1144 ABS $acD
1145 \end{DSPOpcodeFormat}
1146
1147 \begin{DSPOpcodeDescription}
1148 \item Sets \Register{\$acD} to the absolute value of \Register{\$acD}.
1149 \end{DSPOpcodeDescription}
1150
1151 \begin{DSPOpcodeOperation}
1152 IF $acD < 0
1153 $acD = -$acD
1154 ENDIF
1155 FLAGS($acD)
1156 $pc++
1157 \end{DSPOpcodeOperation}
1158
1159 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1160 \end{DSPOpcode}
1161
1162 \begin{DSPOpcode}{ADD}
1163 \begin{DSPOpcodeBytefield}{16}
1164 \monobitbox{4}{0100} & \monobitbox{4}{110d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1165 \end{DSPOpcodeBytefield}
1166
1167 \begin{DSPOpcodeFormat}
1168 ADD $acD, $ac(1-D)
1169 \end{DSPOpcodeFormat}
1170
1171 \begin{DSPOpcodeDescription}
1172 \item Adds accumulator \Register{\$ac(1-D)} to accumulator register \Register{\$acD}.
1173 \end{DSPOpcodeDescription}
1174
1175 \begin{DSPOpcodeOperation}
1176 $acD += $ac(1-D)
1177 FLAGS($acD)
1178 $pc++
1179 \end{DSPOpcodeOperation}
1180
1181 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
1182 \end{DSPOpcode}
1183
1184 \begin{DSPOpcode}{ADDARN}
1185 \begin{DSPOpcodeBytefield}{16}
1186 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{0001} & \monobitbox{4}{ssdd}
1187 \end{DSPOpcodeBytefield}
1188
1189 \begin{DSPOpcodeFormat}
1190 ADDARN $arD, $ixS
1191 \end{DSPOpcodeFormat}
1192
1193 \begin{DSPOpcodeDescription}
1194 \item Adds indexing register \Register{\$ixS} to an addressing register \Register{\$arD}.
1195 \end{DSPOpcodeDescription}
1196
1197 \begin{DSPOpcodeOperation}
1198 $arD += $ixS
1199 $pc++
1200 \end{DSPOpcodeOperation}
1201
1202 \DSPOpcodeFlagsUnchanged
1203 \end{DSPOpcode}
1204
1205 \begin{DSPOpcode}{ADDAX}
1206 \begin{DSPOpcodeBytefield}{16}
1207 \monobitbox{4}{0100} & \monobitbox{4}{10sd} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1208 \end{DSPOpcodeBytefield}
1209
1210 \begin{DSPOpcodeFormat}
1211 ADDAX $acD, $axS
1212 \end{DSPOpcodeFormat}
1213
1214 \begin{DSPOpcodeDescription}
1215 \item Adds secondary accumulator \Register{\$axS} to accumulator register \Register{\$acD}.
1216 \end{DSPOpcodeDescription}
1217
1218 \begin{DSPOpcodeOperation}
1219 $acD += $axS
1220 FLAGS($acD)
1221 $pc++
1222 \end{DSPOpcodeOperation}
1223
1224 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
1225 \end{DSPOpcode}
1226
1227 \begin{DSPOpcode}{ADDAXL}
1228 \begin{DSPOpcodeBytefield}{16}
1229 \monobitbox{4}{0111} & \monobitbox{4}{00sd} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1230 \end{DSPOpcodeBytefield}
1231
1232 \begin{DSPOpcodeFormat}
1233 ADDAXL $acD, $axS.l
1234 \end{DSPOpcodeFormat}
1235
1236 \begin{DSPOpcodeDescription}
1237 \item Adds secondary accumulator \Register{\$axS.l} to accumulator register \Register{\$acD}.
1238 \Register{\$axS.l} is treated as an unsigned value.
1239 \end{DSPOpcodeDescription}
1240
1241 \begin{DSPOpcodeOperation}
1242 $acD += $axS.l
1243 FLAGS($acD)
1244 $pc++
1245 \end{DSPOpcodeOperation}
1246
1247 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
1248 \end{DSPOpcode}
1249
1250 \begin{DSPOpcode}{ADDI}
1251 \begin{DSPOpcodeBytefield}{16}
1252 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{0000} & \monobitbox{4}{0000} \\
1253 \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
1254 \end{DSPOpcodeBytefield}
1255
1256 \begin{DSPOpcodeFormat}
1257 ADDI $acD, #I
1258 \end{DSPOpcodeFormat}
1259
1260 \begin{DSPOpcodeDescription}
1261 \item Adds a 16-bit sign-extended immediate to mid accumulator \Register{\$acD.hm}.
1262 \end{DSPOpcodeDescription}
1263
1264 \begin{DSPOpcodeOperation}
1265 $acD.hm += #I
1266 FLAGS($acD)
1267 $pc += 2
1268 \end{DSPOpcodeOperation}
1269
1270 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
1271 \end{DSPOpcode}
1272
1273 \begin{DSPOpcode}{ADDIS}
1274 \begin{DSPOpcodeBytefield}{16}
1275 \monobitbox{4}{0000} & \monobitbox{4}{010d} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
1276 \end{DSPOpcodeBytefield}
1277
1278 \begin{DSPOpcodeFormat}
1279 ADDIS $acD, #I
1280 \end{DSPOpcodeFormat}
1281
1282 \begin{DSPOpcodeDescription}
1283 \item Adds an 8-bit sign-extended immediate to mid accumulator \Register{\$acD.hm}.
1284 \end{DSPOpcodeDescription}
1285
1286 \begin{DSPOpcodeOperation}
1287 $acD.hm += #I
1288 FLAGS($acD)
1289 $pc++
1290 \end{DSPOpcodeOperation}
1291
1292 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
1293 \end{DSPOpcode}
1294
1295 \begin{DSPOpcode}{ADDP}
1296 \begin{DSPOpcodeBytefield}{16}
1297 \monobitbox{4}{0100} & \monobitbox{4}{111d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1298 \end{DSPOpcodeBytefield}
1299
1300 \begin{DSPOpcodeFormat}
1301 ADDP $acD
1302 \end{DSPOpcodeFormat}
1303
1304 \begin{DSPOpcodeDescription}
1305 \item Adds the product register to the accumulator register.
1306 \end{DSPOpcodeDescription}
1307
1308 \begin{DSPOpcodeOperation}
1309 $acD += $prod
1310 FLAGS($acD)
1311 $pc++
1312 \end{DSPOpcodeOperation}
1313
1314 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
1315 \end{DSPOpcode}
1316
1317 \begin{DSPOpcode}{ADDPAXZ}
1318 \begin{DSPOpcodeBytefield}{16}
1319 \monobitbox{4}{1111} & \monobitbox{4}{10sd} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1320 \end{DSPOpcodeBytefield}
1321
1322 \begin{DSPOpcodeFormat}
1323 ADDPAXZ $acD, $axS
1324 \end{DSPOpcodeFormat}
1325
1326 \begin{DSPOpcodeDescription}
1327 \item Adds secondary accumulator \Register{\$axS} to product register and stores result
1328 in accumulator register. Low 16-bits of \Register{\$acD} (\Register{\$acD.l}) are set to 0.
1329 \end{DSPOpcodeDescription}
1330
1331 \begin{DSPOpcodeOperation}
1332 $acD.hm = $prod.hm + $ax.h
1333 $acD.l = 0
1334 FLAGS($acD)
1335 $pc++
1336 \end{DSPOpcodeOperation}
1337
1338 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
1339 \end{DSPOpcode}
1340
1341 \begin{DSPOpcode}{ADDR}
1342 \begin{DSPOpcodeBytefield}{16}
1343 \monobitbox{4}{0100} & \monobitbox{4}{0ssd} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1344 \end{DSPOpcodeBytefield}
1345
1346 \begin{DSPOpcodeFormat}
1347 ADDR $acD, $(0x18+S)
1348 \end{DSPOpcodeFormat}
1349
1350 \begin{DSPOpcodeDescription}
1351 \item Adds register \Register{\$(0x18+S)} to the accumulator \Register{\$acD} register.
1352 \end{DSPOpcodeDescription}
1353
1354 \begin{DSPOpcodeOperation}
1355 $acD += ($(0x18+S) << 16)
1356 FLAGS($acD)
1357 $pc++
1358 \end{DSPOpcodeOperation}
1359
1360 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
1361 \end{DSPOpcode}
1362
1363 \begin{DSPOpcode}{ANDC}
1364 \begin{DSPOpcodeBytefield}{16}
1365 \monobitbox{4}{0011} & \monobitbox{4}{110d} & \monobitbox{4}{0xxx} & \monobitbox{4}{xxxx}
1366 \end{DSPOpcodeBytefield}
1367
1368 \begin{DSPOpcodeFormat}
1369 ANDC $acD.m, $ac(1-D).m
1370 \end{DSPOpcodeFormat}
1371
1372 \begin{DSPOpcodeDescription}
1373 \item Logic AND middle part of accumulator \Register{\$acD.m} with middle part of accumulator \Register{\$ac(1-D)}.m.
1374 \end{DSPOpcodeDescription}
1375
1376 \begin{DSPOpcodeOperation}
1377 $acD.m &= $ac(1-D).m
1378 FLAGS($acD)
1379 $pc++
1380 \end{DSPOpcodeOperation}
1381
1382 \begin{DSPOpcodeNote}
1383 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
1384 \end{DSPOpcodeNote}
1385
1386 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1387 \end{DSPOpcode}
1388
1389 \begin{DSPOpcode}{ANDCF}
1390 \begin{DSPOpcodeBytefield}{16}
1391 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{1100} & \monobitbox{4}{0000} \\
1392 \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
1393 \end{DSPOpcodeBytefield}
1394
1395 \begin{DSPOpcodeFormat}
1396 ANDCF $acD.m, #I
1397 \end{DSPOpcodeFormat}
1398
1399 \begin{DSPOpcodeDescription}
1400 \item Sets the logic zero (\Flag{LZ}) flag in status register \Register{\$sr} if the result of the logical AND operation
1401 involving the mid part of accumulator \Register{\$acD.m} and the immediate value \Value{I} is equal to immediate value \Value{I}.
1402 If the logical AND operation does not result in a value equal to \Value{I}, then the \Flag{LZ} flag is cleared.
1403 \end{DSPOpcodeDescription}
1404
1405 \begin{DSPOpcodeOperation}
1406 IF ($acD.m & I) == I
1407 $sr.LZ = 1
1408 ELSE
1409 $sr.LZ = 0
1410 ENDIF
1411 $pc += 2
1412 \end{DSPOpcodeOperation}
1413
1414 \DSPOpcodeFlags{-}{X}{-}{-}{-}{-}{-}{-}
1415 \end{DSPOpcode}
1416
1417 \begin{DSPOpcode}{ANDF}
1418 \begin{DSPOpcodeBytefield}{16}
1419 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{1010} & \monobitbox{4}{0000} \\
1420 \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
1421 \end{DSPOpcodeBytefield}
1422
1423 \begin{DSPOpcodeFormat}
1424 ANDF $acD.m, #I
1425 \end{DSPOpcodeFormat}
1426
1427 \begin{DSPOpcodeDescription}
1428 \item Sets the logic zero (\Flag{LZ}) flag in status register \Register{\$sr} if the result of the logic AND operation
1429 involving the mid part of accumulator \Register{\$acD.m} and the immediate value \Value{I} is equal to zero.
1430 If the result is not equal to zero, then the \Flag{LZ} flag is cleared.
1431 \end{DSPOpcodeDescription}
1432
1433 \begin{DSPOpcodeOperation}
1434 IF ($acD.m & I) == 0
1435 $sr.LZ = 1
1436 ELSE
1437 $sr.LZ = 0
1438 ENDIF
1439 $pc += 2
1440 \end{DSPOpcodeOperation}
1441
1442 \DSPOpcodeFlags{-}{X}{-}{-}{-}{-}{-}{-}
1443 \end{DSPOpcode}
1444
1445 \begin{DSPOpcode}{ANDI}
1446 \begin{DSPOpcodeBytefield}{16}
1447 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{0100} & \monobitbox{4}{0000} \\
1448 \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
1449 \end{DSPOpcodeBytefield}
1450
1451 \begin{DSPOpcodeFormat}
1452 ANDI $acD.m, #I
1453 \end{DSPOpcodeFormat}
1454
1455 \begin{DSPOpcodeDescription}
1456 \item Performs a logical AND with the mid part of accumulator \Register{\$acD.m} and the immediate value \Value{I}.
1457 \end{DSPOpcodeDescription}
1458
1459 \begin{DSPOpcodeOperation}
1460 $acD.m &= #I
1461 FLAGS($acD)
1462 $pc += 2
1463 \end{DSPOpcodeOperation}
1464
1465 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1466 \end{DSPOpcode}
1467
1468 \begin{DSPOpcode}{ANDR}
1469 \begin{DSPOpcodeBytefield}{16}
1470 \monobitbox{4}{0011} & \monobitbox{4}{01sd} & \monobitbox{4}{0xxx} & \monobitbox{4}{xxxx}
1471 \end{DSPOpcodeBytefield}
1472
1473 \begin{DSPOpcodeFormat}
1474 ANDR $acD.m, $axS.h
1475 \end{DSPOpcodeFormat}
1476
1477 \begin{DSPOpcodeDescription}
1478 \item Performs a logical AND with the middle part of accumulator \Register{\$acD.m} and the high part of secondary accumulator, \Register{\$axS.h}.
1479 \end{DSPOpcodeDescription}
1480
1481 \begin{DSPOpcodeOperation}
1482 $acD.m &= $axS.h
1483 FLAGS($acD)
1484 $pc++
1485 \end{DSPOpcodeOperation}
1486
1487 \begin{DSPOpcodeNote}
1488 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
1489 \end{DSPOpcodeNote}
1490
1491 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1492 \end{DSPOpcode}
1493
1494 \begin{DSPOpcode}{ASL}
1495 \begin{DSPOpcodeBytefield}{16}
1496 \monobitbox{4}{0001} & \monobitbox{4}{010r} & \monobitbox{4}{10ii} & \monobitbox{4}{iiii}
1497 \end{DSPOpcodeBytefield}
1498
1499 \begin{DSPOpcodeFormat}
1500 ASL $acR, #I
1501 \end{DSPOpcodeFormat}
1502
1503 \begin{DSPOpcodeDescription}
1504 \item Arithmetically left shifts the accumulator \Register{\$acR} by the amount specified by immediate \Value{I}.
1505 \end{DSPOpcodeDescription}
1506
1507 \begin{DSPOpcodeOperation}
1508 $acR <<= I
1509 FLAGS($acR)
1510 $pc++
1511 \end{DSPOpcodeOperation}
1512
1513 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1514 \end{DSPOpcode}
1515
1516 \begin{DSPOpcode}{ASR}
1517 \begin{DSPOpcodeBytefield}{16}
1518 \monobitbox{4}{0001} & \monobitbox{4}{010r} & \monobitbox{4}{11ii} & \monobitbox{4}{iiii}
1519 \end{DSPOpcodeBytefield}
1520
1521 \begin{DSPOpcodeFormat}
1522 ASR $acR, #I
1523 \end{DSPOpcodeFormat}
1524
1525 \begin{DSPOpcodeDescription}
1526 \item Arithmetically right shifts accumulator \Register{\$acR} specified by the value calculated by negating sign-extended bits 0-6.
1527 \end{DSPOpcodeDescription}
1528
1529 \begin{DSPOpcodeOperation}
1530 IF I != 0
1531 $acR >>= (64 - I)
1532 ENDIF
1533 FLAGS($acR)
1534 $pc++
1535 \end{DSPOpcodeOperation}
1536
1537 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1538 \end{DSPOpcode}
1539
1540 \begin{DSPOpcode}{ASRN}
1541 \begin{DSPOpcodeBytefield}{16}
1542 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{1101} & \monobitbox{4}{1011}
1543 \end{DSPOpcodeBytefield}
1544
1545 \begin{DSPOpcodeFormat}
1546 ASRN
1547 \end{DSPOpcodeFormat}
1548
1549 \begin{DSPOpcodeDescription}
1550 \item Arithmetically shifts accumulator \Register{\$ac0} either left or right based on \Register{\$ac1.m}: if bit 6 is set, a right by the amount calculated by negating sign-extended bits 0--5 occurs, while if bit 6 is clear, a left shift occurs by bits 0--5.
1551 \end{DSPOpcodeDescription}
1552
1553 \begin{DSPOpcodeOperation}
1554 IF ($ac1.m & 64)
1555 IF ($ac1.m & 63) != 0
1556 $ac0 >>= (64 - ($ac1.m & 63))
1557 ENDIF
1558 ELSE
1559 $ac0 <<= $ac1.m
1560 ENDIF
1561 FLAGS($ac0)
1562 $pc++
1563 \end{DSPOpcodeOperation}
1564
1565 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1566 \end{DSPOpcode}
1567
1568 \begin{DSPOpcode}{ASRNR}
1569 \begin{DSPOpcodeBytefield}{16}
1570 \monobitbox{4}{0011} & \monobitbox{4}{111d} & \monobitbox{4}{1xxx} & \monobitbox{4}{xxxx}
1571 \end{DSPOpcodeBytefield}
1572
1573 \begin{DSPOpcodeFormat}
1574 ASRNR $acD
1575 \end{DSPOpcodeFormat}
1576
1577 \begin{DSPOpcodeDescription}
1578 \item Arithmetically shifts accumulator \Register{\$acD} either left or right based on \Register{\$ac(1-D).m}: if bit 6 is set, a right by the amount calculated by negating sign-extended bits 0--5 occurs, while if bit 6 is clear, a left shift occurs by bits 0--5.
1579 \end{DSPOpcodeDescription}
1580
1581 \begin{DSPOpcodeOperation}
1582 IF ($ac(1-D).m & 64)
1583 IF ($ac(1-D).m & 63) != 0
1584 $acD >>= (64 - ($ac(1-D).m & 63))
1585 ENDIF
1586 ELSE
1587 $acD <<= $ac(1-D).m
1588 ENDIF
1589 FLAGS($acD)
1590 $pc++
1591 \end{DSPOpcodeOperation}
1592
1593 \begin{DSPOpcodeNote}
1594 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
1595 \end{DSPOpcodeNote}
1596
1597 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1598 \end{DSPOpcode}
1599
1600 \begin{DSPOpcode}{ASRNRX}
1601 \begin{DSPOpcodeBytefield}{16}
1602 \monobitbox{4}{0011} & \monobitbox{4}{10sd} & \monobitbox{4}{1xxx} & \monobitbox{4}{xxxx}
1603 \end{DSPOpcodeBytefield}
1604
1605 \begin{DSPOpcodeFormat}
1606 ASRNRX $acD, $axS.h
1607 \end{DSPOpcodeFormat}
1608
1609 \begin{DSPOpcodeDescription}
1610 \item Arithmetically shifts accumulator \Register{\$acD} either left or right based on \Register{\$axS.h}: if bit 6 is set, a right by the amount calculated by negating sign-extended bits 0--5 occurs, while if bit 6 is clear, a left shift occurs by bits 0--5.
1611 \end{DSPOpcodeDescription}
1612
1613 \begin{DSPOpcodeOperation}
1614 IF ($axS.h & 64)
1615 IF ($axS.h & 63) != 0
1616 $acD >>= (64 - ($axS.h & 63))
1617 ENDIF
1618 ELSE
1619 $acD <<= $axS.h
1620 ENDIF
1621 FLAGS($acD)
1622 $pc++
1623 \end{DSPOpcodeOperation}
1624
1625 \begin{DSPOpcodeNote}
1626 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
1627 \end{DSPOpcodeNote}
1628
1629 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1630 \end{DSPOpcode}
1631
1632 \begin{DSPOpcode}{ASR16}
1633 \begin{DSPOpcodeBytefield}{16}
1634 \monobitbox{4}{1001} & \monobitbox{4}{r001} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1635 \end{DSPOpcodeBytefield}
1636
1637 \begin{DSPOpcodeFormat}
1638 ASR16 $acR
1639 \end{DSPOpcodeFormat}
1640
1641 \begin{DSPOpcodeDescription}
1642 \item Arithmetically right shifts accumulator \Register{\$acR} by 16.
1643 \end{DSPOpcodeDescription}
1644
1645 \begin{DSPOpcodeOperation}
1646 $acR >>= 16
1647 FLAGS($acR)
1648 $pc++
1649 \end{DSPOpcodeOperation}
1650
1651 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1652 \end{DSPOpcode}
1653
1654 \begin{DSPOpcode}{BLOOP}
1655 \begin{DSPOpcodeBytefield}{16}
1656 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{011r} & \monobitbox{4}{rrrr} \\
1657 \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa}
1658 \end{DSPOpcodeBytefield}
1659
1660 \begin{DSPOpcodeFormat}
1661 BLOOP $R, addrA
1662 \end{DSPOpcodeFormat}
1663
1664 \begin{DSPOpcodeDescription}
1665 \item Repeatedly execute a block of code starting at the following opcode until the counter specified by the value from register
1666 \Register{\$R} reaches zero. Block ends at specified address \Address{addrA} inclusive. i.e. opcode at \Address{addrA} is the last
1667 opcode included in loop. Counter is pushed on loop stack \Register{\$st3}, end of block address is pushed on loop stack
1668 \Register{\$st2} and the repeat address is pushed on call stack \Register{\$st0}. Up to 4 nested loops are allowed.
1669 \item When using \Register{\$ac0.m} or \Register{\$ac1.m} as the initial counter value, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
1670 \end{DSPOpcodeDescription}
1671
1672 \begin{DSPOpcodeOperation}
1673 $st0 = $pc + 2
1674 $st2 = addrA
1675 $st3 = $R
1676 $pc += 2
1677
1678 // On real hardware, the below does not happen,
1679 // this opcode only sets stack registers
1680 WHILE ($st3)
1681 DO
1682 EXECUTE_OPCODE($pc)
1683 WHILE($pc != $st2)
1684 $st3--
1685 $pc = $st0
1686 END
1687 $pc = addrA + 1
1688 // Remove values from stack
1689 \end{DSPOpcodeOperation}
1690
1691 \DSPOpcodeFlagsUnchanged
1692 \end{DSPOpcode}
1693
1694 \begin{DSPOpcode}{BLOOPI}
1695 \begin{DSPOpcodeBytefield}{16}
1696 \monobitbox{4}{0001} & \monobitbox{4}{0001} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii} \\
1697 \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa}
1698 \end{DSPOpcodeBytefield}
1699
1700 \begin{DSPOpcodeFormat}
1701 BLOOPI #I, addrA
1702 \end{DSPOpcodeFormat}
1703
1704 \begin{DSPOpcodeDescription}
1705 \item Repeatedly execute a block of code starting at the following opcode until the counter specified by the immediate value \Value{I}
1706 reaches zero. Block ends at specified address \Address{addrA} inclusive. i.e. opcode at \Address{addrA} is the last
1707 opcode included in loop. Counter is pushed on loop stack \Register{\$st3}, end of block address is pushed on loop stack
1708 \Register{\$st2} and the repeat address is pushed on call stack \Register{\$st0}. Up to 4 nested loops are allowed.
1709 \end{DSPOpcodeDescription}
1710
1711 \begin{DSPOpcodeOperation}
1712 $st0 = $pc + 2
1713 $st2 = addrA
1714 $st3 = I
1715 $pc += 2
1716
1717 // On real hardware, the below does not happen,
1718 // this opcode only sets stack registers
1719 WHILE ($st3)
1720 DO
1721 EXECUTE_OPCODE($pc)
1722 WHILE($pc != $st2)
1723 $st3--
1724 $pc = $st0
1725 END
1726 $pc = addrA + 1
1727 // Remove values from stack
1728 \end{DSPOpcodeOperation}
1729
1730 \DSPOpcodeFlagsUnchanged
1731 \end{DSPOpcode}
1732
1733 \begin{DSPOpcode}{CALL}
1734 \begin{DSPOpcodeBytefield}{16}
1735 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{1011} & \monobitbox{4}{1111} \\
1736 \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa}
1737 \end{DSPOpcodeBytefield}
1738
1739 \begin{DSPOpcodeFormat}
1740 CALL addressA
1741 \end{DSPOpcodeFormat}
1742
1743 \begin{DSPOpcodeDescription}
1744 \item Call function. Push program counter of the instruction following ``call'' to call stack \Register{\$st0}.
1745 Set program counter to address represented by the value that follows this \Opcode{CALL} instruction.
1746 \end{DSPOpcodeDescription}
1747
1748 \begin{DSPOpcodeOperation}
1749 // Must skip value that follows "call"
1750 PUSH_STACK($st0)
1751 $st0 = $pc + 2
1752 $pc = addressA
1753 \end{DSPOpcodeOperation}
1754
1755 \DSPOpcodeFlagsUnchanged
1756 \end{DSPOpcode}
1757
1758 \begin{DSPOpcode}{CALLcc}
1759 \begin{DSPOpcodeBytefield}{16}
1760 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{1011} & \monobitbox{4}{cccc} \\
1761 \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa}
1762 \end{DSPOpcodeBytefield}
1763
1764 \begin{DSPOpcodeFormat}
1765 CALLcc addressA
1766 \end{DSPOpcodeFormat}
1767
1768 \begin{DSPOpcodeDescription}
1769 \item Call function if condition \Flag{cc} has been met. Push program counter of the instruction following
1770 ``call'' to call stack \Register{\$st0}. Set program counter to address represented by the value that
1771 follows this \Opcode{CALL} instruction.
1772 \end{DSPOpcodeDescription}
1773
1774 \begin{DSPOpcodeOperation}
1775 // Must skip value that follows "call"
1776 IF (cc)
1777 PUSH_STACK($st0)
1778 $st0 = $pc + 2
1779 $pc = addressA
1780 ELSE
1781 $pc += 2
1782 ENDIF
1783 \end{DSPOpcodeOperation}
1784
1785 \DSPOpcodeFlagsUnchanged
1786 \end{DSPOpcode}
1787
1788 \begin{DSPOpcode}{CALLR}
1789 \begin{DSPOpcodeBytefield}{16}
1790 \monobitbox{4}{0001} & \monobitbox{4}{0111} & \monobitbox{4}{rrr1} & \monobitbox{4}{1111}
1791 \end{DSPOpcodeBytefield}
1792
1793 \begin{DSPOpcodeFormat}
1794 CALLR $R
1795 \end{DSPOpcodeFormat}
1796
1797 \begin{DSPOpcodeDescription}
1798 \item Call function. Push program counter of the instruction following ``call'' to call stack \Register{\$st0}.
1799 Set program counter to register \Register{\$R}.
1800 \end{DSPOpcodeDescription}
1801
1802 \begin{DSPOpcodeOperation}
1803 PUSH_STACK($st0)
1804 $st0 = $pc + 1
1805 $pc = $R
1806 \end{DSPOpcodeOperation}
1807
1808 \DSPOpcodeFlagsUnchanged
1809 \end{DSPOpcode}
1810
1811 \begin{DSPOpcode}{CALLRcc}
1812 \begin{DSPOpcodeBytefield}{16}
1813 \monobitbox{4}{0001} & \monobitbox{4}{0111} & \monobitbox{4}{rrr1} & \monobitbox{4}{cccc}
1814 \end{DSPOpcodeBytefield}
1815
1816 \begin{DSPOpcodeFormat}
1817 CALLRcc $R
1818 \end{DSPOpcodeFormat}
1819
1820 \begin{DSPOpcodeDescription}
1821 \item Call function if condition \Flag{cc} has been met. Push program counter of the instruction following ``call'' to call stack \Register{\$st0}.
1822 Set program counter to register \Register{\$R}.
1823 \end{DSPOpcodeDescription}
1824
1825 \begin{DSPOpcodeOperation}
1826 IF (cc)
1827 PUSH_STACK($st0)
1828 $st0 = $pc + 1
1829 $pc = $R
1830 ELSE
1831 $pc++
1832 ENDIF
1833 \end{DSPOpcodeOperation}
1834
1835 \DSPOpcodeFlagsUnchanged
1836 \end{DSPOpcode}
1837
1838
1839 \begin{DSPOpcode}{CLR15}
1840 \begin{DSPOpcodeBytefield}{16}
1841 \monobitbox{4}{1000} & \monobitbox{4}{1100} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1842 \end{DSPOpcodeBytefield}
1843
1844 \begin{DSPOpcodeFormat}
1845 CLR15
1846 \end{DSPOpcodeFormat}
1847
1848 \begin{DSPOpcodeDescription}
1849 \item Sets \RegisterField{\$sr.SU} (bit 15) to 0, causing multiplication to treat its operands as signed.
1850 \end{DSPOpcodeDescription}
1851
1852 \begin{DSPOpcodeOperation}
1853 $sr &= ~0x8000
1854 $pc++
1855 \end{DSPOpcodeOperation}
1856
1857 \begin{DSPOpcodeSeeAlso}
1858 \item \Opcode{SET15}
1859 \end{DSPOpcodeSeeAlso}
1860
1861 \DSPOpcodeFlagsUnchanged
1862 \end{DSPOpcode}
1863
1864 \begin{DSPOpcode}{CLR}
1865 \begin{DSPOpcodeBytefield}{16}
1866 \monobitbox{4}{1000} & \monobitbox{4}{r001} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1867 \end{DSPOpcodeBytefield}
1868
1869 \begin{DSPOpcodeFormat}
1870 CLR $acR
1871 \end{DSPOpcodeFormat}
1872
1873 \begin{DSPOpcodeDescription}
1874 \item Clears accumulator \Register{\$acR}.
1875 \end{DSPOpcodeDescription}
1876
1877 \begin{DSPOpcodeOperation}
1878 $acR = 0
1879 FLAGS($acR)
1880 $pc++
1881 \end{DSPOpcodeOperation}
1882
1883 \DSPOpcodeFlags{-}{-}{1}{0}{0}{1}{0}{0}
1884 \end{DSPOpcode}
1885
1886 \begin{DSPOpcode}{CLRL}
1887 \begin{DSPOpcodeBytefield}{16}
1888 \monobitbox{4}{1111} & \monobitbox{4}{110r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1889 \end{DSPOpcodeBytefield}
1890
1891 \begin{DSPOpcodeFormat}
1892 CLRL $acR.l
1893 \end{DSPOpcodeFormat}
1894
1895 \begin{DSPOpcodeDescription}
1896 \item Rounds \Register{\$acR} such that \Register{\$acR.l} is 0. This is a round-to-even operation.
1897 \end{DSPOpcodeDescription}
1898
1899 \begin{DSPOpcodeOperation}
1900 IF ($acR & 0x10000) != 0
1901 $acR = ($acR + 0x8000) & ~0xffff
1902 ELSE
1903 $acR = ($acR + 0x7fff) & ~0xffff
1904 ENDIF
1905 FLAGS($acR)
1906 $pc++
1907 \end{DSPOpcodeOperation}
1908
1909 \begin{DSPOpcodeNote}
1910 \item An alternative interpretation is that if \Register{\$acR.m} is odd, then increment \Register{\$acsR} if \Register{\$acR.l} is greater than or equal to \Value{0x8000}; if \Register{\$acR.m} is even, then increment \Register{\$acsR} if \Register{\$acR.l} is greater than or equal to \Value{0x7fff}. Afterwards set \Register{\$acR.l} to 0.
1911 \end{DSPOpcodeNote}
1912
1913 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
1914 \end{DSPOpcode}
1915
1916 \begin{DSPOpcode}{CLRP}
1917 \begin{DSPOpcodeBytefield}{16}
1918 \monobitbox{4}{1000} & \monobitbox{4}{0100} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1919 \end{DSPOpcodeBytefield}
1920
1921 \begin{DSPOpcodeFormat}
1922 CLRP
1923 \end{DSPOpcodeFormat}
1924
1925 \begin{DSPOpcodeDescription}
1926 \item Clears product register \Register{\$prod}.
1927 \end{DSPOpcodeDescription}
1928
1929 \begin{DSPOpcodeOperation}
1930 $prod = 0 // See note below
1931 $pc++
1932 \end{DSPOpcodeOperation}
1933
1934 \begin{DSPOpcodeNote}
1935 \item Actually product register gets cleared by setting registers with following values:
1936 \begin{lstlisting}[basicstyle=\ttfamily]
1937 $prod.l = 0x0000
1938 $prod.m1 = 0xfff0
1939 $prod.h = 0x00ff
1940 $prod.m2 = 0x0010
1941 \end{lstlisting}
1942 \end{DSPOpcodeNote}
1943
1944 \DSPOpcodeFlagsUnchanged
1945 \end{DSPOpcode}
1946
1947 \begin{DSPOpcode}{CMP}
1948 \begin{DSPOpcodeBytefield}{16}
1949 \monobitbox{4}{1000} & \monobitbox{4}{0010} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1950 \end{DSPOpcodeBytefield}
1951
1952 \begin{DSPOpcodeFormat}
1953 CMP
1954 \end{DSPOpcodeFormat}
1955
1956 \begin{DSPOpcodeDescription}
1957 \item Compares accumulator \Register{\$ac0} with accumulator \Register{\$ac1}.
1958 \end{DSPOpcodeDescription}
1959
1960 \begin{DSPOpcodeOperation}
1961 $sr = FLAGS($ac0 - $ac1)
1962 $pc++
1963 \end{DSPOpcodeOperation}
1964
1965 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
1966 \end{DSPOpcode}
1967
1968 \begin{DSPOpcode}{CMPAXH}
1969 \begin{DSPOpcodeBytefield}{16}
1970 \monobitbox{4}{110r} & \monobitbox{4}{s001} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
1971 \end{DSPOpcodeBytefield}
1972
1973 \begin{DSPOpcodeFormat}
1974 CMPAXH $acS, $axR.h
1975 \end{DSPOpcodeFormat}
1976
1977 \begin{DSPOpcodeDescription}
1978 \item Compares accumulator \Register{\$acS} with high part of secondary accumulator \Register{\$axR.h}.
1979 \end{DSPOpcodeDescription}
1980
1981 \begin{DSPOpcodeOperation}
1982 $sr = FLAGS($acS - ($axR.h << 16))
1983 $pc++
1984 \end{DSPOpcodeOperation}
1985
1986 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
1987 \end{DSPOpcode}
1988
1989 \begin{DSPOpcode}{CMPI}
1990 \begin{DSPOpcodeBytefield}{16}
1991 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{1000} & \monobitbox{4}{0000} \\
1992 \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
1993 \end{DSPOpcodeBytefield}
1994
1995 \begin{DSPOpcodeFormat}
1996 CMPI $acD, #I
1997 \end{DSPOpcodeFormat}
1998
1999 \begin{DSPOpcodeDescription}
2000 \item Compares accumulator with immediate. Comparison is performed by subtracting the immediate (16-bit sign-extended)
2001 from mid accumulator \Register{\$acD.hm} and computing flags based on whole accumulator \Register{\$acD}.
2002 \end{DSPOpcodeDescription}
2003
2004 \begin{DSPOpcodeOperation}
2005 FLAGS($acD - (I << 16))
2006 $pc += 2
2007 \end{DSPOpcodeOperation}
2008
2009 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
2010 \end{DSPOpcode}
2011
2012 \begin{DSPOpcode}{CMPIS}
2013 \begin{DSPOpcodeBytefield}{16}
2014 \monobitbox{4}{0000} & \monobitbox{4}{011d} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
2015 \end{DSPOpcodeBytefield}
2016
2017 \begin{DSPOpcodeFormat}
2018 CMPIS $acD, #I
2019 \end{DSPOpcodeFormat}
2020
2021 \begin{DSPOpcodeDescription}
2022 \item Compares accumulator with short immediate. Comparison is performed by subtracting the short immediate (8-bit sign-extended)
2023 from mid accumulator \Register{\$acD.hm} and computing flags based on whole accumulator \Register{\$acD}.
2024 \end{DSPOpcodeDescription}
2025
2026 \begin{DSPOpcodeOperation}
2027 FLAGS($acD - (I << 16))
2028 $pc++
2029 \end{DSPOpcodeOperation}
2030
2031 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
2032 \end{DSPOpcode}
2033
2034 \begin{DSPOpcode}{DAR}
2035 \begin{DSPOpcodeBytefield}{16}
2036 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{01dd}
2037 \end{DSPOpcodeBytefield}
2038
2039 \begin{DSPOpcodeFormat}
2040 DAR $arD
2041 \end{DSPOpcodeFormat}
2042
2043 \begin{DSPOpcodeDescription}
2044 \item Decrement address register \Register{\$arD}.
2045 \end{DSPOpcodeDescription}
2046
2047 \begin{DSPOpcodeOperation}
2048 $arD--
2049 $pc++
2050 \end{DSPOpcodeOperation}
2051
2052 \DSPOpcodeFlagsUnchanged
2053 \end{DSPOpcode}
2054
2055 \begin{DSPOpcode}{DEC}
2056 \begin{DSPOpcodeBytefield}{16}
2057 \monobitbox{4}{0111} & \monobitbox{4}{101d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2058 \end{DSPOpcodeBytefield}
2059
2060 \begin{DSPOpcodeFormat}
2061 DEC $acD
2062 \end{DSPOpcodeFormat}
2063
2064 \begin{DSPOpcodeDescription}
2065 \item Decrements accumulator \Register{\$acD}.
2066 \end{DSPOpcodeDescription}
2067
2068 \begin{DSPOpcodeOperation}
2069 $acD--
2070 FLAGS($acD)
2071 $pc++
2072 \end{DSPOpcodeOperation}
2073
2074 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
2075 \end{DSPOpcode}
2076
2077 \begin{DSPOpcode}{DECM}
2078 \begin{DSPOpcodeBytefield}{16}
2079 \monobitbox{4}{0111} & \monobitbox{4}{100d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2080 \end{DSPOpcodeBytefield}
2081
2082 \begin{DSPOpcodeFormat}
2083 DECM $acsD
2084 \end{DSPOpcodeFormat}
2085
2086 \begin{DSPOpcodeDescription}
2087 \item Decrements 24-bit mid-accumulator \Register{\$acsD}.
2088 \end{DSPOpcodeDescription}
2089
2090 \begin{DSPOpcodeOperation}
2091 $acsD--
2092 FLAGS($acD)
2093 $pc++
2094 \end{DSPOpcodeOperation}
2095
2096 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
2097 \end{DSPOpcode}
2098
2099 \begin{DSPOpcode}{HALT}
2100 \begin{DSPOpcodeBytefield}{16}
2101 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{0001}
2102 \end{DSPOpcodeBytefield}
2103
2104 \begin{DSPOpcodeFormat}
2105 HALT
2106 \end{DSPOpcodeFormat}
2107
2108 \begin{DSPOpcodeDescription}
2109 \item Stops execution of DSP code. Sets bit \RegisterField{DSP\_CR\_HALT} in register \Register{DREG\_CR}.
2110 \end{DSPOpcodeDescription}
2111
2112 \begin{DSPOpcodeOperation}
2113 DREG_CR |= DSP_CR_HALT;
2114 \end{DSPOpcodeOperation}
2115
2116 \DSPOpcodeFlagsUnchanged
2117 \end{DSPOpcode}
2118
2119 \begin{DSPOpcode}{IAR}
2120 \begin{DSPOpcodeBytefield}{16}
2121 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{10dd}
2122 \end{DSPOpcodeBytefield}
2123
2124 \begin{DSPOpcodeFormat}
2125 IAR $arD
2126 \end{DSPOpcodeFormat}
2127
2128 \begin{DSPOpcodeDescription}
2129 \item Increment address register \Register{\$arD}.
2130 \end{DSPOpcodeDescription}
2131
2132 \begin{DSPOpcodeOperation}
2133 $arD++
2134 $pc++
2135 \end{DSPOpcodeOperation}
2136
2137 \DSPOpcodeFlagsUnchanged
2138 \end{DSPOpcode}
2139
2140 \begin{DSPOpcode}{IFcc}
2141 \begin{DSPOpcodeBytefield}{16}
2142 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{0111} & \monobitbox{4}{cccc}
2143 \end{DSPOpcodeBytefield}
2144
2145 \begin{DSPOpcodeFormat}
2146 IFcc
2147 \end{DSPOpcodeFormat}
2148
2149 \begin{DSPOpcodeDescription}
2150 \item Executes the following opcode if the condition described by \Flag{cccc} has been met.
2151 \end{DSPOpcodeDescription}
2152
2153 \begin{DSPOpcodeOperation}
2154 IF (cc)
2155 EXECUTE_OPCODE($pc + 1)
2156 ELSE
2157 $pc += 2
2158 ENDIF
2159 \end{DSPOpcodeOperation}
2160
2161 \DSPOpcodeFlagsUnchanged
2162 \end{DSPOpcode}
2163
2164 \begin{DSPOpcode}{ILRR}
2165 \begin{DSPOpcodeBytefield}{16}
2166 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{0001} & \monobitbox{4}{00ss}
2167 \end{DSPOpcodeBytefield}
2168
2169 \begin{DSPOpcodeFormat}
2170 ILRR $acD.m, @$arS
2171 \end{DSPOpcodeFormat}
2172
2173 \begin{DSPOpcodeDescription}
2174 \item Move value from instruction memory pointed by addressing register \Register{\$arS}
2175 to mid accumulator register \Register{\$acD.m}.
2176 \item Optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2177 \end{DSPOpcodeDescription}
2178
2179 \begin{DSPOpcodeOperation}
2180 $acD.m = MEM[$arS]
2181 $pc++
2182 \end{DSPOpcodeOperation}
2183
2184 \DSPOpcodeFlagsUnchanged
2185 \end{DSPOpcode}
2186
2187 \begin{DSPOpcode}{ILRRD}
2188 \begin{DSPOpcodeBytefield}{16}
2189 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{0001} & \monobitbox{4}{01ss}
2190 \end{DSPOpcodeBytefield}
2191
2192 \begin{DSPOpcodeFormat}
2193 ILRRD $acD.m, @$arS
2194 \end{DSPOpcodeFormat}
2195
2196 \begin{DSPOpcodeDescription}
2197 \item Move value from instruction memory pointed by addressing register \Register{\$arS}
2198 to mid accumulator register \Register{\$acD.m}. Decrement addressing register \Register{\$arS}.
2199 \item Optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2200 \end{DSPOpcodeDescription}
2201
2202 \begin{DSPOpcodeOperation}
2203 $acD.m = MEM[$arS]
2204 $arS--
2205 $pc++
2206 \end{DSPOpcodeOperation}
2207
2208 \DSPOpcodeFlagsUnchanged
2209 \end{DSPOpcode}
2210
2211 \begin{DSPOpcode}{ILRRI}
2212 \begin{DSPOpcodeBytefield}{16}
2213 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{0001} & \monobitbox{4}{10ss}
2214 \end{DSPOpcodeBytefield}
2215
2216 \begin{DSPOpcodeFormat}
2217 ILRRI $acD.m, @$S
2218 \end{DSPOpcodeFormat}
2219
2220 \begin{DSPOpcodeDescription}
2221 \item Move value from instruction memory pointed by addressing register \Register{\$arS} to
2222 mid accumulator register \Register{\$acD.m}. Increment addressing register \Register{\$arS}.
2223 \item Optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2224 \end{DSPOpcodeDescription}
2225
2226 \begin{DSPOpcodeOperation}
2227 $acD.m = MEM[$arS]
2228 $arS++
2229 $pc++
2230 \end{DSPOpcodeOperation}
2231
2232 \DSPOpcodeFlagsUnchanged
2233 \end{DSPOpcode}
2234
2235 \begin{DSPOpcode}{ILRRN}
2236 \begin{DSPOpcodeBytefield}{16}
2237 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{0001} & \monobitbox{4}{11ss}
2238 \end{DSPOpcodeBytefield}
2239
2240 \begin{DSPOpcodeFormat}
2241 ILRRN $acD.m, @$arS
2242 \end{DSPOpcodeFormat}
2243
2244 \begin{DSPOpcodeDescription}
2245 \item Move value from instruction memory pointed by addressing register \Register{\$arS}
2246 to mid accumulator register \Register{\$acD.m}. Add corresponding indexing register
2247 \Register{\$ixS} to addressing register \Register{\$arS}.
2248 \item Optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2249 \end{DSPOpcodeDescription}
2250
2251 \begin{DSPOpcodeOperation}
2252 $acD.m = MEM[$arS]
2253 $arS += $ixS
2254 $pc++
2255 \end{DSPOpcodeOperation}
2256
2257 \DSPOpcodeFlagsUnchanged
2258 \end{DSPOpcode}
2259
2260 \begin{DSPOpcode}{INC}
2261 \begin{DSPOpcodeBytefield}{16}
2262 \monobitbox{4}{0111} & \monobitbox{4}{011d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2263 \end{DSPOpcodeBytefield}
2264
2265 \begin{DSPOpcodeFormat}
2266 INC $acD
2267 \end{DSPOpcodeFormat}
2268
2269 \begin{DSPOpcodeDescription}
2270 \item Increments accumulator \Register{\$acD}.
2271 \end{DSPOpcodeDescription}
2272
2273 \begin{DSPOpcodeOperation}
2274 $acD++
2275 FLAGS($acD)
2276 $pc++
2277 \end{DSPOpcodeOperation}
2278
2279 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
2280 \end{DSPOpcode}
2281
2282 \begin{DSPOpcode}{INCM}
2283 \begin{DSPOpcodeBytefield}{16}
2284 \monobitbox{4}{0111} & \monobitbox{4}{010d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2285 \end{DSPOpcodeBytefield}
2286
2287 \begin{DSPOpcodeFormat}
2288 INCM $acsD
2289 \end{DSPOpcodeFormat}
2290
2291 \begin{DSPOpcodeDescription}
2292 \item Increments 24-bit mid-accumulator \Register{\$acsD}.
2293 \end{DSPOpcodeDescription}
2294
2295 \begin{DSPOpcodeOperation}
2296 $acsD++
2297 FLAGS($acD)
2298 $pc++
2299 \end{DSPOpcodeOperation}
2300
2301 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
2302 \end{DSPOpcode}
2303
2304 \begin{DSPOpcode}{JMP}
2305 \begin{DSPOpcodeBytefield}{16}
2306 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{1001} & \monobitbox{4}{1111} \\
2307 \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa}
2308 \end{DSPOpcodeBytefield}
2309
2310 \begin{DSPOpcodeFormat}
2311 JMP addressA
2312 \end{DSPOpcodeFormat}
2313
2314 \begin{DSPOpcodeDescription}
2315 \item Jumps to \Address{addressA}. Set program counter to the address represented by the
2316 value that follows this \Opcode{JMP} instruction.
2317 \end{DSPOpcodeDescription}
2318
2319 \begin{DSPOpcodeOperation}
2320 $pc = addressA
2321 \end{DSPOpcodeOperation}
2322
2323 \DSPOpcodeFlagsUnchanged
2324 \end{DSPOpcode}
2325
2326 \begin{DSPOpcode}{Jcc}
2327 \begin{DSPOpcodeBytefield}{16}
2328 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{1001} & \monobitbox{4}{cccc} \\
2329 \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa} & \monobitbox{4}{aaaa}
2330 \end{DSPOpcodeBytefield}
2331
2332 \begin{DSPOpcodeFormat}
2333 Jcc addressA
2334 \end{DSPOpcodeFormat}
2335
2336 \begin{DSPOpcodeDescription}
2337 \item Jumps to \Address{addressA} if condition \Flag{cc} has been met. Set program counter to the
2338 address represented by the value that follows this \Opcode{Jcc} instruction.
2339 \end{DSPOpcodeDescription}
2340
2341 \begin{DSPOpcodeOperation}
2342 IF (cc)
2343 $pc = addressA
2344 ELSE
2345 $pc += 2
2346 ENDIF
2347 \end{DSPOpcodeOperation}
2348
2349 \DSPOpcodeFlagsUnchanged
2350 \end{DSPOpcode}
2351
2352 \begin{DSPOpcode}{JMPR}
2353 \begin{DSPOpcodeBytefield}{16}
2354 \monobitbox{4}{0001} & \monobitbox{4}{0111} & \monobitbox{4}{rrr0} & \monobitbox{4}{1111}
2355 \end{DSPOpcodeBytefield}
2356
2357 \begin{DSPOpcodeFormat}
2358 JMPR $R
2359 \end{DSPOpcodeFormat}
2360
2361 \begin{DSPOpcodeDescription}
2362 \item Jump to address; set program counter to a value from register \Register{\$R}.
2363 \end{DSPOpcodeDescription}
2364
2365 \begin{DSPOpcodeOperation}
2366 $pc = $R
2367 \end{DSPOpcodeOperation}
2368
2369 \DSPOpcodeFlagsUnchanged
2370 \end{DSPOpcode}
2371
2372 \begin{DSPOpcode}{JRcc}
2373 \begin{DSPOpcodeBytefield}{16}
2374 \monobitbox{4}{0001} & \monobitbox{4}{0111} & \monobitbox{4}{rrr0} & \monobitbox{4}{cccc}
2375 \end{DSPOpcodeBytefield}
2376
2377 \begin{DSPOpcodeFormat}
2378 JRcc $R
2379 \end{DSPOpcodeFormat}
2380
2381 \begin{DSPOpcodeDescription}
2382 \item Jump to address if condition \Flag{cc} has been met; set program counter to a value from register \Register{\$R}.
2383 \end{DSPOpcodeDescription}
2384
2385 \begin{DSPOpcodeOperation}
2386 IF (cc)
2387 $pc = $R
2388 ELSE
2389 $pc++
2390 ENDIF
2391 \end{DSPOpcodeOperation}
2392
2393 \DSPOpcodeFlagsUnchanged
2394 \end{DSPOpcode}
2395
2396 \begin{DSPOpcode}{LOOP}
2397 \begin{DSPOpcodeBytefield}{16}
2398 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{010r} & \monobitbox{4}{rrrr}
2399 \end{DSPOpcodeBytefield}
2400
2401 \begin{DSPOpcodeFormat}
2402 LOOP $R
2403 \end{DSPOpcodeFormat}
2404
2405 \begin{DSPOpcodeDescription}
2406 \item Repeatedly execute the following opcode until the counter specified by the value from register \Register{\$R} reaches zero.
2407 Each execution decrements the counter. Register \Register{\$R} remains unchanged. If register \Register{\$R} is set to zero at the
2408 beginning of loop then the looped instruction will not get executed.
2409 \item When using \Register{\$ac0.m} or \Register{\$ac1.m} as the initial counter value, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2410 \end{DSPOpcodeDescription}
2411
2412 \begin{DSPOpcodeOperation}
2413 counter = $R
2414 WHILE (counter--)
2415 EXECUTE_OPCODE($pc + 1)
2416 END
2417 $pc += 2
2418 \end{DSPOpcodeOperation}
2419
2420 \DSPOpcodeFlagsUnchanged
2421 \end{DSPOpcode}
2422
2423 \begin{DSPOpcode}{LOOPI}
2424 \begin{DSPOpcodeBytefield}{16}
2425 \monobitbox{4}{0001} & \monobitbox{4}{0000} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
2426 \end{DSPOpcodeBytefield}
2427
2428 \begin{DSPOpcodeFormat}
2429 LOOPI #I
2430 \end{DSPOpcodeFormat}
2431
2432 \begin{DSPOpcodeDescription}
2433 \item Repeatedly execute the following opcode until the counter specified by immediate value \Value{I} reaches zero.
2434 Each execution decrements the counter. If immediate \Value{I} is set to zero at the
2435 beginning of loop then the looped instruction will not get executed.
2436 \end{DSPOpcodeDescription}
2437
2438 \begin{DSPOpcodeOperation}
2439 counter = I
2440 WHILE (counter--)
2441 EXECUTE_OPCODE($pc + 1)
2442 END
2443 $pc += 2
2444 \end{DSPOpcodeOperation}
2445
2446 \DSPOpcodeFlagsUnchanged
2447 \end{DSPOpcode}
2448
2449 \begin{DSPOpcode}{LR}
2450 \begin{DSPOpcodeBytefield}{16}
2451 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{110d} & \monobitbox{4}{dddd} \\
2452 \monobitbox{4}{mmmm} & \monobitbox{4}{mmmm} & \monobitbox{4}{mmmm} & \monobitbox{4}{mmmm}
2453 \end{DSPOpcodeBytefield}
2454
2455 \begin{DSPOpcodeFormat}
2456 LR $D, @M
2457 \end{DSPOpcodeFormat}
2458
2459 \begin{DSPOpcodeDescription}
2460 \item Move value from data memory pointed by address \Address{M} to register \Register{\$D}.
2461 \item When loading to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2462 \end{DSPOpcodeDescription}
2463
2464 \begin{DSPOpcodeOperation}
2465 $D = MEM[M]
2466 $pc += 2
2467 \end{DSPOpcodeOperation}
2468
2469 \DSPOpcodeFlagsUnchanged
2470 \end{DSPOpcode}
2471
2472 \begin{DSPOpcode}{LRI}
2473 \begin{DSPOpcodeBytefield}{16}
2474 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{100d} & \monobitbox{4}{dddd} \\
2475 \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
2476 \end{DSPOpcodeBytefield}
2477
2478 \begin{DSPOpcodeFormat}
2479 LRI $D, #I
2480 \end{DSPOpcodeFormat}
2481
2482 \begin{DSPOpcodeDescription}
2483 \item Load immediate value \Value{I} to register \Register{\$D}.
2484 \item When loading to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2485 \end{DSPOpcodeDescription}
2486
2487 \begin{DSPOpcodeOperation}
2488 $D = I
2489 $pc += 2
2490 \end{DSPOpcodeOperation}
2491
2492 \DSPOpcodeFlagsUnchanged
2493 \end{DSPOpcode}
2494
2495 \begin{DSPOpcode}{LRIS}
2496 \begin{DSPOpcodeBytefield}{16}
2497 \monobitbox{4}{0000} & \monobitbox{4}{1ddd} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
2498 \end{DSPOpcodeBytefield}
2499
2500 \begin{DSPOpcodeFormat}
2501 LRIS $(0x18+D), #I
2502 \end{DSPOpcodeFormat}
2503
2504 \begin{DSPOpcodeDescription}
2505 \item Load immediate value \Value{I} (8-bit sign-extended) to accumulator register \Register{\$(0x18+D)}.
2506 \item When loading to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2507 \end{DSPOpcodeDescription}
2508
2509 \begin{DSPOpcodeOperation}
2510 $(0x18+D) = I
2511 $pc++
2512 \end{DSPOpcodeOperation}
2513
2514 \DSPOpcodeFlagsUnchanged
2515 \end{DSPOpcode}
2516
2517 \begin{DSPOpcode}{LRR}
2518 \begin{DSPOpcodeBytefield}{16}
2519 \monobitbox{4}{0001} & \monobitbox{4}{1000} & \monobitbox{4}{0ssd} & \monobitbox{4}{dddd}
2520 \end{DSPOpcodeBytefield}
2521
2522 \begin{DSPOpcodeFormat}
2523 LRR $D, @$arS
2524 \end{DSPOpcodeFormat}
2525
2526 \begin{DSPOpcodeDescription}
2527 \item Move value from data memory pointed by addressing register \Register{\$arS} to register \Register{\$D}.
2528 \item When loading to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2529 \end{DSPOpcodeDescription}
2530
2531 \begin{DSPOpcodeOperation}
2532 $D = MEM[$arS]
2533 $pc++
2534 \end{DSPOpcodeOperation}
2535
2536 \DSPOpcodeFlagsUnchanged
2537 \end{DSPOpcode}
2538
2539 \begin{DSPOpcode}{LRRD}
2540 \begin{DSPOpcodeBytefield}{16}
2541 \monobitbox{4}{0001} & \monobitbox{4}{1000} & \monobitbox{4}{1ssd} & \monobitbox{4}{dddd}
2542 \end{DSPOpcodeBytefield}
2543
2544 \begin{DSPOpcodeFormat}
2545 LRRD $D, @$arS
2546 \end{DSPOpcodeFormat}
2547
2548 \begin{DSPOpcodeDescription}
2549 \item Move value from data memory pointed by addressing register \Register{\$arS} to register \Register{\$D}.
2550 Decrements register \Register{\$arS}.
2551 \item When loading to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2552 \end{DSPOpcodeDescription}
2553
2554 \begin{DSPOpcodeOperation}
2555 $D = MEM[$arS]
2556 $arS--
2557 $pc++
2558 \end{DSPOpcodeOperation}
2559
2560 \DSPOpcodeFlagsUnchanged
2561 \end{DSPOpcode}
2562
2563 \begin{DSPOpcode}{LRRI}
2564 \begin{DSPOpcodeBytefield}{16}
2565 \monobitbox{4}{0001} & \monobitbox{4}{1001} & \monobitbox{4}{0ssd} & \monobitbox{4}{dddd}
2566 \end{DSPOpcodeBytefield}
2567
2568 \begin{DSPOpcodeFormat}
2569 LRRI $D, @$arS
2570 \end{DSPOpcodeFormat}
2571
2572 \begin{DSPOpcodeDescription}
2573 \item Move value from data memory pointed by addressing register \Register{\$arS} to register \Register{\$D}.
2574 Increments register \Register{\$arS}.
2575 \item When loading to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2576 \end{DSPOpcodeDescription}
2577
2578 \begin{DSPOpcodeOperation}
2579 $D = MEM[$arS]
2580 $arS++
2581 $pc++
2582 \end{DSPOpcodeOperation}
2583
2584 \DSPOpcodeFlagsUnchanged
2585 \end{DSPOpcode}
2586
2587 \begin{DSPOpcode}{LRRN}
2588 \begin{DSPOpcodeBytefield}{16}
2589 \monobitbox{4}{0001} & \monobitbox{4}{1001} & \monobitbox{4}{1ssd} & \monobitbox{4}{dddd}
2590 \end{DSPOpcodeBytefield}
2591
2592 \begin{DSPOpcodeFormat}
2593 LRRN $D, @$arS
2594 \end{DSPOpcodeFormat}
2595
2596 \begin{DSPOpcodeDescription}
2597 \item Move value from data memory pointed by addressing register \Register{\$arS} to register \Register{\$D}.
2598 Add indexing register \Register{\$ixS} to register \Register{\$arS}.
2599 \item When loading to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2600 \end{DSPOpcodeDescription}
2601
2602 \begin{DSPOpcodeOperation}
2603 $D = MEM[$arS]
2604 $arS += $ixS
2605 $pc++
2606 \end{DSPOpcodeOperation}
2607
2608 \DSPOpcodeFlagsUnchanged
2609 \end{DSPOpcode}
2610
2611 \begin{DSPOpcode}{LRS}
2612 \begin{DSPOpcodeBytefield}{16}
2613 \monobitbox{4}{0010} & \monobitbox{4}{0ddd} & \monobitbox{4}{mmmm} & \monobitbox{4}{mmmm}
2614 \end{DSPOpcodeBytefield}
2615
2616 \begin{DSPOpcodeFormat}
2617 LRS $(0x18+D), @M
2618 \end{DSPOpcodeFormat}
2619
2620 \begin{DSPOpcodeDescription}
2621 \item Move value from data memory pointed by address \Address{(\$cr << 8) | M} to register \Register{\$(0x18+D)}.
2622 \item When loading to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
2623 \end{DSPOpcodeDescription}
2624
2625 \begin{DSPOpcodeOperation}
2626 $(0x18+D) = MEM[($cr << 8) | M]
2627 $pc++
2628 \end{DSPOpcodeOperation}
2629
2630 \begin{DSPOpcodeNote}
2631 \item \Opcode{LRS} can use \Register{\$axD}, but cannot use \Register{\$acD.h}, while \Opcode{SRS} and \Opcode{SRSH} only work on \Register{\$acS}.
2632 \end{DSPOpcodeNote}
2633
2634 \DSPOpcodeFlagsUnchanged
2635 \end{DSPOpcode}
2636
2637 \begin{DSPOpcode}{LSL}
2638 \begin{DSPOpcodeBytefield}{16}
2639 \monobitbox{4}{0001} & \monobitbox{4}{010r} & \monobitbox{4}{00ii} & \monobitbox{4}{iiii}
2640 \end{DSPOpcodeBytefield}
2641
2642 \begin{DSPOpcodeFormat}
2643 LSL $acR, #I
2644 \end{DSPOpcodeFormat}
2645
2646 \begin{DSPOpcodeDescription}
2647 \item Logically left shifts accumulator \Register{\$acR} by the amount specified by value \Value{I}.
2648 \end{DSPOpcodeDescription}
2649
2650 \begin{DSPOpcodeOperation}
2651 $acR <<= I
2652 FLAGS($acR)
2653 $pc++
2654 \end{DSPOpcodeOperation}
2655
2656 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
2657 \end{DSPOpcode}
2658
2659 \begin{DSPOpcode}{LSL16}
2660 \begin{DSPOpcodeBytefield}{16}
2661 \monobitbox{4}{1111} & \monobitbox{4}{000r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2662 \end{DSPOpcodeBytefield}
2663
2664 \begin{DSPOpcodeFormat}
2665 LSL16 $acR
2666 \end{DSPOpcodeFormat}
2667
2668 \begin{DSPOpcodeDescription}
2669 \item Logically left shifts accumulator \Register{\$acR} by 16.
2670 \end{DSPOpcodeDescription}
2671
2672 \begin{DSPOpcodeOperation}
2673 $acR <<= 16
2674 FLAGS($acR)
2675 $pc++
2676 \end{DSPOpcodeOperation}
2677
2678 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
2679 \end{DSPOpcode}
2680
2681 \begin{DSPOpcode}{LSR}
2682 \begin{DSPOpcodeBytefield}{16}
2683 \monobitbox{4}{0001} & \monobitbox{4}{010r} & \monobitbox{4}{01ii} & \monobitbox{4}{iiii}
2684 \end{DSPOpcodeBytefield}
2685
2686 \begin{DSPOpcodeFormat}
2687 LSR $acR, #I
2688 \end{DSPOpcodeFormat}
2689
2690 \begin{DSPOpcodeDescription}
2691 \item Logically right shifts accumulator \Register{\$acR} by the amount calculated by negating sign-extended bits 0--6.
2692 \end{DSPOpcodeDescription}
2693
2694 \begin{DSPOpcodeOperation}
2695 IF I != 0
2696 $acR >>= (64 - I)
2697 ENDIF
2698 FLAGS($acR)
2699 $pc++
2700 \end{DSPOpcodeOperation}
2701
2702 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
2703 \end{DSPOpcode}
2704
2705 \begin{DSPOpcode}{LSRN}
2706 \begin{DSPOpcodeBytefield}{16}
2707 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{1100} & \monobitbox{4}{1010}
2708 \end{DSPOpcodeBytefield}
2709
2710 \begin{DSPOpcodeFormat}
2711 LSRN
2712 \end{DSPOpcodeFormat}
2713
2714 \begin{DSPOpcodeDescription}
2715 \item Logically shifts accumulator \Register{\$ac0} either left or right based on \Register{\$ac1.m}: if bit 6 is set, a right by the amount calculated by negating sign-extended bits 0--5 occurs, while if bit 6 is clear, a left shift occurs by bits 0--5.
2716 \end{DSPOpcodeDescription}
2717
2718 \begin{DSPOpcodeOperation}
2719 IF ($ac1.m & 64)
2720 IF ($ac1.m & 63) != 0
2721 $ac0 >>= (64 - ($ac1.m & 63))
2722 ENDIF
2723 ELSE
2724 $ac0 <<= $ac1.m
2725 ENDIF
2726 FLAGS($ac0)
2727 $pc++
2728 \end{DSPOpcodeOperation}
2729
2730 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
2731 \end{DSPOpcode}
2732
2733 \begin{DSPOpcode}{LSRNR}
2734 \begin{DSPOpcodeBytefield}{16}
2735 \monobitbox{4}{0011} & \monobitbox{4}{110d} & \monobitbox{4}{1xxx} & \monobitbox{4}{xxxx}
2736 \end{DSPOpcodeBytefield}
2737
2738 \begin{DSPOpcodeFormat}
2739 LSRNR $acD
2740 \end{DSPOpcodeFormat}
2741
2742 \begin{DSPOpcodeDescription}
2743 \item Logically shifts accumulator \Register{\$acD} either left or right based on \Register{\$ac(1-D).m}: if bit 6 is set, a right by the amount calculated by negating sign-extended bits 0--5 occurs, while if bit 6 is clear, a left shift occurs by bits 0--5.
2744 \end{DSPOpcodeDescription}
2745
2746 \begin{DSPOpcodeOperation}
2747 IF ($ac(1-D).m & 64)
2748 IF ($ac(1-D).m & 63) != 0
2749 $acD >>= (64 - ($ac(1-D).m & 63))
2750 ENDIF
2751 ELSE
2752 $acD <<= $ac(1-D).m
2753 ENDIF
2754 FLAGS($acD)
2755 $pc++
2756 \end{DSPOpcodeOperation}
2757
2758 \begin{DSPOpcodeNote}
2759 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
2760 \end{DSPOpcodeNote}
2761
2762 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
2763 \end{DSPOpcode}
2764
2765 \begin{DSPOpcode}{LSRNRX}
2766 \begin{DSPOpcodeBytefield}{16}
2767 \monobitbox{4}{0011} & \monobitbox{4}{01sd} & \monobitbox{4}{1xxx} & \monobitbox{4}{xxxx}
2768 \end{DSPOpcodeBytefield}
2769
2770 \begin{DSPOpcodeFormat}
2771 LSRNRX $acD, $axS.h
2772 \end{DSPOpcodeFormat}
2773
2774 \begin{DSPOpcodeDescription}
2775 \item Logically shifts accumulator \Register{\$acD} either left or right based on \Register{\$axS.h}: if bit 6 is set, a right by the amount calculated by negating sign-extended bits 0--5 occurs, while if bit 6 is clear, a left shift occurs by bits 0--5.
2776 \end{DSPOpcodeDescription}
2777
2778 \begin{DSPOpcodeOperation}
2779 IF ($axS.h & 64)
2780 IF ($axS.h & 63) != 0
2781 $acD >>= (64 - ($axS.h & 63))
2782 ENDIF
2783 ELSE
2784 $acD <<= $axS.h
2785 ENDIF
2786 FLAGS($acD)
2787 $pc++
2788 \end{DSPOpcodeOperation}
2789
2790 \begin{DSPOpcodeNote}
2791 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
2792 \end{DSPOpcodeNote}
2793
2794 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
2795 \end{DSPOpcode}
2796
2797 \begin{DSPOpcode}{LSR16}
2798 \begin{DSPOpcodeBytefield}{16}
2799 \monobitbox{4}{1111} & \monobitbox{4}{010r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2800 \end{DSPOpcodeBytefield}
2801
2802 \begin{DSPOpcodeFormat}
2803 LSR16 $acR
2804 \end{DSPOpcodeFormat}
2805
2806 \begin{DSPOpcodeDescription}
2807 \item Logically right shifts accumulator \Register{\$acR} by 16.
2808 \end{DSPOpcodeDescription}
2809
2810 \begin{DSPOpcodeOperation}
2811 $acR >>= 16
2812 FLAGS($acR)
2813 $pc++
2814 \end{DSPOpcodeOperation}
2815
2816 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
2817 \end{DSPOpcode}
2818
2819 \begin{DSPOpcode}{M0}
2820 \begin{DSPOpcodeBytefield}{16}
2821 \monobitbox{4}{1000} & \monobitbox{4}{1011} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2822 \end{DSPOpcodeBytefield}
2823
2824 \begin{DSPOpcodeFormat}
2825 M0
2826 \end{DSPOpcodeFormat}
2827
2828 \begin{DSPOpcodeDescription}
2829 \item Sets \RegisterField{\$sr.AM} (bit 13) to 1, \textbf{disabling} the functionality that doubles the result of every multiply operation.
2830 \end{DSPOpcodeDescription}
2831
2832 \begin{DSPOpcodeOperation}
2833 $sr |= 0x2000
2834 $pc++
2835 \end{DSPOpcodeOperation}
2836
2837 \begin{DSPOpcodeSeeAlso}
2838 \item \Opcode{M2}
2839 \end{DSPOpcodeSeeAlso}
2840
2841 \DSPOpcodeFlagsUnchanged
2842 \end{DSPOpcode}
2843
2844 \begin{DSPOpcode}{M2}
2845 \begin{DSPOpcodeBytefield}{16}
2846 \monobitbox{4}{1000} & \monobitbox{4}{1010} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2847 \end{DSPOpcodeBytefield}
2848
2849 \begin{DSPOpcodeFormat}
2850 M2
2851 \end{DSPOpcodeFormat}
2852
2853 \begin{DSPOpcodeDescription}
2854 \item Sets \RegisterField{\$sr.AM} (bit 13) to 0, \textbf{enabling} the functionality that doubles the result of every multiply operation.
2855 \end{DSPOpcodeDescription}
2856
2857 \begin{DSPOpcodeOperation}
2858 $sr &= ~0x2000
2859 $pc++
2860 \end{DSPOpcodeOperation}
2861
2862 \begin{DSPOpcodeSeeAlso}
2863 \item \Opcode{M0}
2864 \end{DSPOpcodeSeeAlso}
2865
2866 \DSPOpcodeFlagsUnchanged
2867 \end{DSPOpcode}
2868
2869 \begin{DSPOpcode}{MADD}
2870 \begin{DSPOpcodeBytefield}{16}
2871 \monobitbox{4}{1111} & \monobitbox{4}{001s} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2872 \end{DSPOpcodeBytefield}
2873
2874 \begin{DSPOpcodeFormat}
2875 MADD $axS.l, $axS.h
2876 \end{DSPOpcodeFormat}
2877
2878 \begin{DSPOpcodeDescription}
2879 \item Multiply low part \Register{\$axS.l} of secondary accumulator \Register{\$axS} by high part \Register{\$axS.h} of secondary
2880 accumulator \Register{\$axS} (treat them both as signed) and add result to product register.
2881 \end{DSPOpcodeDescription}
2882
2883 \begin{DSPOpcodeOperation}
2884 $prod += $axS.l * $axS.h
2885 $pc++
2886 \end{DSPOpcodeOperation}
2887
2888 \begin{DSPOpcodeSeeAlso}
2889 \item \RegisterField{\$sr.AM} bit affects multiply result.
2890 \end{DSPOpcodeSeeAlso}
2891
2892 \DSPOpcodeFlagsUnchanged
2893 \end{DSPOpcode}
2894
2895 \begin{DSPOpcode}{MADDC}
2896 \begin{DSPOpcodeBytefield}{16}
2897 \monobitbox{4}{1110} & \monobitbox{4}{10st} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2898 \end{DSPOpcodeBytefield}
2899
2900 \begin{DSPOpcodeFormat}
2901 MADDC $acS.m, $axT.h
2902 \end{DSPOpcodeFormat}
2903
2904 \begin{DSPOpcodeDescription}
2905 \item Multiply middle part of accumulator \Register{\$acS.m} by high part of secondary accumulator
2906 \Register{\$axT.h} (treat them both as signed) and add result to product register.
2907 \end{DSPOpcodeDescription}
2908
2909 \begin{DSPOpcodeOperation}
2910 $prod += $acS.m * $axT.h
2911 $pc++
2912 \end{DSPOpcodeOperation}
2913
2914 \begin{DSPOpcodeSeeAlso}
2915 \item \RegisterField{\$sr.AM} bit affects multiply result.
2916 \end{DSPOpcodeSeeAlso}
2917
2918 \DSPOpcodeFlagsUnchanged
2919 \end{DSPOpcode}
2920
2921 \begin{DSPOpcode}{MADDX}
2922 \begin{DSPOpcodeBytefield}{16}
2923 \monobitbox{4}{1110} & \monobitbox{4}{00st} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2924 \end{DSPOpcodeBytefield}
2925
2926 \begin{DSPOpcodeFormat}
2927 MADDX $(0x18+S*2), $(0x19+T*2)
2928 \end{DSPOpcodeFormat}
2929
2930 \begin{DSPOpcodeDescription}
2931 \item Multiply one part of secondary accumulator \Register{\$ax0} (selected by \Value{S}) by one part of
2932 secondary accumulator \Register{\$ax1} (selected by \Value{T}) (treat them both as signed) and add result to product register.
2933 \end{DSPOpcodeDescription}
2934
2935 \begin{DSPOpcodeOperation}
2936 $prod += $(0x18+S*2) * $(0x19+T*2)
2937 $pc++
2938 \end{DSPOpcodeOperation}
2939
2940 \begin{DSPOpcodeSeeAlso}
2941 \item \RegisterField{\$sr.AM} bit affects multiply result.
2942 \end{DSPOpcodeSeeAlso}
2943
2944 \DSPOpcodeFlagsUnchanged
2945 \end{DSPOpcode}
2946
2947 \begin{DSPOpcode}{MOV}
2948 \begin{DSPOpcodeBytefield}{16}
2949 \monobitbox{4}{0110} & \monobitbox{4}{110d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2950 \end{DSPOpcodeBytefield}
2951
2952 \begin{DSPOpcodeFormat}
2953 MOV $acD, $ac(1-D)
2954 \end{DSPOpcodeFormat}
2955
2956 \begin{DSPOpcodeDescription}
2957 \item Moves accumulator \Register{\$ac(1-D)} to accumulator \Register{\$acD}.
2958 \end{DSPOpcodeDescription}
2959
2960 \begin{DSPOpcodeOperation}
2961 $acD = $ac(1-D)
2962 FLAGS($acD)
2963 $pc++
2964 \end{DSPOpcodeOperation}
2965
2966 \DSPOpcodeFlags{-}{-}{X}{0}{X}{X}{0}{0}
2967 \end{DSPOpcode}
2968
2969 \begin{DSPOpcode}{MOVAX}
2970 \begin{DSPOpcodeBytefield}{16}
2971 \monobitbox{4}{0110} & \monobitbox{4}{10sd} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2972 \end{DSPOpcodeBytefield}
2973
2974 \begin{DSPOpcodeFormat}
2975 MOVAX $acD, $axS
2976 \end{DSPOpcodeFormat}
2977
2978 \begin{DSPOpcodeDescription}
2979 \item Moves secondary accumulator \Register{\$axS} to accumulator \Register{\$acD}.
2980 \end{DSPOpcodeDescription}
2981
2982 \begin{DSPOpcodeOperation}
2983 $acD = $axS
2984 FLAGS($acD)
2985 $pc++
2986 \end{DSPOpcodeOperation}
2987
2988 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
2989 \end{DSPOpcode}
2990
2991 \begin{DSPOpcode}{MOVNP}
2992 \begin{DSPOpcodeBytefield}{16}
2993 \monobitbox{4}{0111} & \monobitbox{4}{111d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
2994 \end{DSPOpcodeBytefield}
2995
2996 \begin{DSPOpcodeFormat}
2997 MOVNP $acD
2998 \end{DSPOpcodeFormat}
2999
3000 \begin{DSPOpcodeDescription}
3001 \item Moves negated multiply product from the \Register{\$prod} register to the accumulator register \Register{\$acD}.
3002 \end{DSPOpcodeDescription}
3003
3004 \begin{DSPOpcodeOperation}
3005 $acD = -$prod
3006 FLAGS($acD)
3007 $pc++
3008 \end{DSPOpcodeOperation}
3009
3010 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3011 \end{DSPOpcode}
3012
3013 \begin{DSPOpcode}{MOVP}
3014 \begin{DSPOpcodeBytefield}{16}
3015 \monobitbox{4}{0110} & \monobitbox{4}{111d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3016 \end{DSPOpcodeBytefield}
3017
3018 \begin{DSPOpcodeFormat}
3019 MOVP $acD
3020 \end{DSPOpcodeFormat}
3021
3022 \begin{DSPOpcodeDescription}
3023 \item Moves multiply product from the \Register{\$prod} register to the accumulator register \Register{\$acD}.
3024 \end{DSPOpcodeDescription}
3025
3026 \begin{DSPOpcodeOperation}
3027 $acD = $prod
3028 FLAGS($acD)
3029 $pc++
3030 \end{DSPOpcodeOperation}
3031
3032 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3033 \end{DSPOpcode}
3034
3035 \begin{DSPOpcode}{MOVPZ}
3036 \begin{DSPOpcodeBytefield}{16}
3037 \monobitbox{4}{1111} & \monobitbox{4}{111d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3038 \end{DSPOpcodeBytefield}
3039
3040 \begin{DSPOpcodeFormat}
3041 MOVPZ $acD
3042 \end{DSPOpcodeFormat}
3043
3044 \begin{DSPOpcodeDescription}
3045 \item Moves multiply product from the \Register{\$prod} register to the accumulator \Register{\$acD} and sets \Register{\$acD.l} to 0.
3046 \end{DSPOpcodeDescription}
3047
3048 \begin{DSPOpcodeOperation}
3049 $acD.hm = $prod.hm
3050 $acD.l = 0
3051 FLAGS($acD)
3052 $pc++
3053 \end{DSPOpcodeOperation}
3054
3055 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3056 \end{DSPOpcode}
3057
3058 \begin{DSPOpcode}{MOVR}
3059 \begin{DSPOpcodeBytefield}{16}
3060 \monobitbox{4}{0110} & \monobitbox{4}{0ssd} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3061 \end{DSPOpcodeBytefield}
3062
3063 \begin{DSPOpcodeFormat}
3064 MOVR $acD, $(0x18+S)
3065 \end{DSPOpcodeFormat}
3066
3067 \begin{DSPOpcodeDescription}
3068 \item Moves register \Register{\$(0x18+S)} (sign-extended) to middle accumulator \Register{\$acD.hm}. Sets \Register{\$acD.l} to 0.
3069 \end{DSPOpcodeDescription}
3070
3071 \begin{DSPOpcodeOperation}
3072 $acD.hm = $(0x18+S)
3073 $acD.l = 0
3074 FLAGS($acD)
3075 $pc++
3076 \end{DSPOpcodeOperation}
3077
3078 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
3079 \end{DSPOpcode}
3080
3081 \begin{DSPOpcode}{MRR}
3082 \begin{DSPOpcodeBytefield}{16}
3083 \monobitbox{4}{0001} & \monobitbox{4}{11dd} & \monobitbox{4}{ddds} & \monobitbox{4}{ssss}
3084 \end{DSPOpcodeBytefield}
3085
3086 \begin{DSPOpcodeFormat}
3087 MRR $D, $S
3088 \end{DSPOpcodeFormat}
3089
3090 \begin{DSPOpcodeDescription}
3091 \item Move value from register \Register{\$S} to register \Register{\$D}.
3092 \item When moving to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
3093 \item When moving from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
3094 \end{DSPOpcodeDescription}
3095
3096 \begin{DSPOpcodeOperation}
3097 $D = $S
3098 $pc++
3099 \end{DSPOpcodeOperation}
3100
3101 \DSPOpcodeFlagsUnchanged
3102 \end{DSPOpcode}
3103
3104 \begin{DSPOpcode}{MSUB}
3105 \begin{DSPOpcodeBytefield}{16}
3106 \monobitbox{4}{1111} & \monobitbox{4}{011s} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3107 \end{DSPOpcodeBytefield}
3108
3109 \begin{DSPOpcodeFormat}
3110 MSUB $axS.l, $axS.h
3111 \end{DSPOpcodeFormat}
3112
3113 \begin{DSPOpcodeDescription}
3114 \item Multiply low part \Register{\$axS.l} of secondary accumulator \Register{\$axS} by high part \Register{\$axS.h}
3115 of secondary accumulator \Register{\$axS} (treat them both as signed) and
3116 subtract result from product register.
3117 \end{DSPOpcodeDescription}
3118
3119 \begin{DSPOpcodeOperation}
3120 $prod -= $axS.l * $axS.h
3121 $pc++
3122 \end{DSPOpcodeOperation}
3123
3124 \begin{DSPOpcodeSeeAlso}
3125 \item \RegisterField{\$sr.AM} bit affects multiply result.
3126 \end{DSPOpcodeSeeAlso}
3127
3128 \DSPOpcodeFlagsUnchanged
3129 \end{DSPOpcode}
3130
3131 \begin{DSPOpcode}{MSUBC}
3132 \begin{DSPOpcodeBytefield}{16}
3133 \monobitbox{4}{1110} & \monobitbox{4}{11st} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3134 \end{DSPOpcodeBytefield}
3135
3136 \begin{DSPOpcodeFormat}
3137 MSUBC $acS.m, $axT.h
3138 \end{DSPOpcodeFormat}
3139
3140 \begin{DSPOpcodeDescription}
3141 \item Multiply middle part of accumulator \Register{\$acS.m} by high part of secondary accumulator
3142 \Register{\$axT.h} (treat them both as signed) and subtract result from product register.
3143 \end{DSPOpcodeDescription}
3144
3145 \begin{DSPOpcodeOperation}
3146 $prod -= $acS.m * $axT.h
3147 $pc++
3148 \end{DSPOpcodeOperation}
3149
3150 \begin{DSPOpcodeSeeAlso}
3151 \item \RegisterField{\$sr.AM} bit affects multiply result.
3152 \end{DSPOpcodeSeeAlso}
3153
3154 \DSPOpcodeFlagsUnchanged
3155 \end{DSPOpcode}
3156
3157 \begin{DSPOpcode}{MSUBX}
3158 \begin{DSPOpcodeBytefield}{16}
3159 \monobitbox{4}{1110} & \monobitbox{4}{01st} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3160 \end{DSPOpcodeBytefield}
3161
3162 \begin{DSPOpcodeFormat}
3163 MSUBX $(0x18+S*2), $(0x19+T*2)
3164 \end{DSPOpcodeFormat}
3165
3166 \begin{DSPOpcodeDescription}
3167 \item Multiply one part of secondary accumulator \Register{\$ax0} (selected by \Value{S}) by one part of secondary accumulator
3168 \Register{\$ax1} (selected by \Value{T}) (treat them both as signed) and subtract result from product register.
3169 \end{DSPOpcodeDescription}
3170
3171 \begin{DSPOpcodeOperation}
3172 $prod -= $(0x18+S*2) * $(0x19+T*2)
3173 $pc++
3174 \end{DSPOpcodeOperation}
3175
3176 \begin{DSPOpcodeSeeAlso}
3177 \item \RegisterField{\$sr.AM} bit affects multiply result.
3178 \end{DSPOpcodeSeeAlso}
3179
3180 \DSPOpcodeFlagsUnchanged
3181 \end{DSPOpcode}
3182
3183 \begin{DSPOpcode}{MUL}
3184 \begin{DSPOpcodeBytefield}{16}
3185 \monobitbox{4}{1001} & \monobitbox{4}{s000} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3186 \end{DSPOpcodeBytefield}
3187
3188 \begin{DSPOpcodeFormat}
3189 MUL $axS.l, $axS.h
3190 \end{DSPOpcodeFormat}
3191
3192 \begin{DSPOpcodeDescription}
3193 \item Multiply low part \Register{\$axS.l} of secondary accumulator \Register{\$axS} by high part \Register{\$axS.h}
3194 of secondary accumulator \Register{\$axS} (treat them both as signed).
3195 \end{DSPOpcodeDescription}
3196
3197 \begin{DSPOpcodeOperation}
3198 $prod = $axS.l * $axS.h
3199 $pc++
3200 \end{DSPOpcodeOperation}
3201
3202 \begin{DSPOpcodeSeeAlso}
3203 \item \RegisterField{\$sr.AM} bit affects multiply result.
3204 \end{DSPOpcodeSeeAlso}
3205
3206 \DSPOpcodeFlagsUnchanged
3207 \end{DSPOpcode}
3208
3209 \begin{DSPOpcode}{MULAC}
3210 \begin{DSPOpcodeBytefield}{16}
3211 \monobitbox{4}{1001} & \monobitbox{4}{s10r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3212 \end{DSPOpcodeBytefield}
3213
3214 \begin{DSPOpcodeFormat}
3215 MULAC $axS.l, $axS.h, $acR
3216 \end{DSPOpcodeFormat}
3217
3218 \begin{DSPOpcodeDescription}
3219 \item Add product register to accumulator register \Register{\$acR}. Multiply low part \Register{\$axS.l} of
3220 secondary accumulator \Register{\$axS} by high part \Register{\$axS.h} of secondary accumulator
3221 \Register{\$axS} (treat them both as signed).
3222 \end{DSPOpcodeDescription}
3223
3224 \begin{DSPOpcodeOperation}
3225 $acR += $prod
3226 $prod = $axS.l * $axS.h
3227 $pc++
3228 \end{DSPOpcodeOperation}
3229
3230 \begin{DSPOpcodeSeeAlso}
3231 \item \RegisterField{\$sr.AM} bit affects multiply result.
3232 \end{DSPOpcodeSeeAlso}
3233
3234 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3235 \end{DSPOpcode}
3236
3237 \begin{DSPOpcode}{MULAXH}
3238 \begin{DSPOpcodeBytefield}{16}
3239 \monobitbox{4}{1000} & \monobitbox{4}{0011} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3240 \end{DSPOpcodeBytefield}
3241
3242 \begin{DSPOpcodeFormat}
3243 MULAXH
3244 \end{DSPOpcodeFormat}
3245
3246 \begin{DSPOpcodeDescription}
3247 \item Multiplies \Register{\$ax0.h} by itself.
3248 \end{DSPOpcodeDescription}
3249
3250 \begin{DSPOpcodeOperation}
3251 $prod = $ax0.h * $ax0.h
3252 $pc++
3253 \end{DSPOpcodeOperation}
3254
3255 \begin{DSPOpcodeSeeAlso}
3256 \item \RegisterField{\$sr.AM} bit affects multiply result.
3257 \end{DSPOpcodeSeeAlso}
3258
3259 \DSPOpcodeFlagsUnchanged
3260 \end{DSPOpcode}
3261
3262 \begin{DSPOpcode}{MULC}
3263 \begin{DSPOpcodeBytefield}{16}
3264 \monobitbox{4}{110s} & \monobitbox{4}{t000} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3265 \end{DSPOpcodeBytefield}
3266
3267 \begin{DSPOpcodeFormat}
3268 MULC $acS.m, $axT.h
3269 \end{DSPOpcodeFormat}
3270
3271 \begin{DSPOpcodeDescription}
3272 \item Multiply mid part of accumulator register \Register{\$acS.m} by high part \Register{\$axS.h}
3273 of secondary accumulator \Register{\$axS} (treat them both as signed).
3274 \end{DSPOpcodeDescription}
3275
3276 \begin{DSPOpcodeOperation}
3277 $prod = $acS.m * $axS.h
3278 $pc++
3279 \end{DSPOpcodeOperation}
3280
3281 \begin{DSPOpcodeSeeAlso}
3282 \item \RegisterField{\$sr.AM} bit affects multiply result.
3283 \end{DSPOpcodeSeeAlso}
3284
3285 \DSPOpcodeFlagsUnchanged
3286 \end{DSPOpcode}
3287
3288 \begin{DSPOpcode}{MULCAC}
3289 \begin{DSPOpcodeBytefield}{16}
3290 \monobitbox{4}{110s} & \monobitbox{4}{t10r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3291 \end{DSPOpcodeBytefield}
3292
3293 \begin{DSPOpcodeFormat}
3294 MULCAC $acS.m, $axT.h, $acR
3295 \end{DSPOpcodeFormat}
3296
3297 \begin{DSPOpcodeDescription}
3298 \item Multiply mid part of accumulator register \Register{\$acS.m} by high part \Register{\$axS.h} of
3299 secondary accumulator \Register{\$axS} (treat them both as signed).
3300 Add product register before multiplication to accumulator \Register{\$acR}.
3301 \end{DSPOpcodeDescription}
3302
3303 \begin{DSPOpcodeOperation}
3304 temp = $prod
3305 $prod = $acS.m * $axS.h
3306 $acR += temp
3307 $pc++
3308 \end{DSPOpcodeOperation}
3309
3310 \begin{DSPOpcodeSeeAlso}
3311 \item \RegisterField{\$sr.AM} bit affects multiply result.
3312 \end{DSPOpcodeSeeAlso}
3313
3314 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3315 \end{DSPOpcode}
3316
3317 \begin{DSPOpcode}{MULCMV}
3318 \begin{DSPOpcodeBytefield}{16}
3319 \monobitbox{4}{110s} & \monobitbox{4}{t11r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3320 \end{DSPOpcodeBytefield}
3321
3322 \begin{DSPOpcodeFormat}
3323 MULCMV $acS.m, $axT.h, $acR
3324 \end{DSPOpcodeFormat}
3325
3326 \begin{DSPOpcodeDescription}
3327 \item Multiply mid part of accumulator register \Register{\$acS.m} by high part \Register{\$axT.h} of
3328 secondary accumulator \Register{\$axT} (treat them both as signed).
3329 Move product register before multiplication to accumulator \Register{\$acR}.
3330 \end{DSPOpcodeDescription}
3331
3332 \begin{DSPOpcodeOperation}
3333 temp = $prod
3334 $prod = $acS.m * $axT.h
3335 $acR = temp
3336 $pc++
3337 \end{DSPOpcodeOperation}
3338
3339 \begin{DSPOpcodeSeeAlso}
3340 \item \RegisterField{\$sr.AM} bit affects multiply result.
3341 \end{DSPOpcodeSeeAlso}
3342
3343 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3344 \end{DSPOpcode}
3345
3346 \begin{DSPOpcode}{MULCMVZ}
3347 \begin{DSPOpcodeBytefield}{16}
3348 \monobitbox{4}{110s} & \monobitbox{4}{t01r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3349 \end{DSPOpcodeBytefield}
3350
3351 \begin{DSPOpcodeFormat}
3352 MULCMVZ $acS.m, $axT.h, $acR
3353 \end{DSPOpcodeFormat}
3354
3355 \begin{DSPOpcodeDescription}
3356 \item Multiply mid part of accumulator register \Register{\$acS.m} by high part \Register{\$aTS.h} of
3357 secondary accumulator \Register{\$axT} (treat them both as signed).
3358 Move product register before multiplication to accumulator \Register{\$acR}.
3359 Set low part of accumulator \Register{\$acR.l} to zero.
3360 \end{DSPOpcodeDescription}
3361
3362 \begin{DSPOpcodeOperation}
3363 temp = $prod
3364 $prod = $acS.m * $axT.h
3365 $acR.hm = temp.hm
3366 $acR.l = 0
3367 $pc++
3368 \end{DSPOpcodeOperation}
3369
3370 \begin{DSPOpcodeSeeAlso}
3371 \item \RegisterField{\$sr.AM} bit affects multiply result.
3372 \end{DSPOpcodeSeeAlso}
3373
3374 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3375 \end{DSPOpcode}
3376
3377 \begin{DSPOpcode}{MULMV}
3378 \begin{DSPOpcodeBytefield}{16}
3379 \monobitbox{4}{1001} & \monobitbox{4}{s11r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3380 \end{DSPOpcodeBytefield}
3381
3382 \begin{DSPOpcodeFormat}
3383 MULMV $axS.l, $axS.h, $acR
3384 \end{DSPOpcodeFormat}
3385
3386 \begin{DSPOpcodeDescription}
3387 \item Move product register to accumulator register \Register{\$acR}.
3388 Multiply low part \Register{\$axS.l} of secondary accumulator Register{\$axS} by high part
3389 \Register{\$axS.h} of secondary accumulator \Register{\$axS} (treat them both as signed).
3390 \end{DSPOpcodeDescription}
3391
3392 \begin{DSPOpcodeOperation}
3393 $acR = $prod
3394 $prod = $axS.l * $axS.h
3395 $pc++
3396 \end{DSPOpcodeOperation}
3397
3398 \begin{DSPOpcodeSeeAlso}
3399 \item \RegisterField{\$sr.AM} bit affects multiply result.
3400 \end{DSPOpcodeSeeAlso}
3401
3402 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3403 \end{DSPOpcode}
3404
3405 \begin{DSPOpcode}{MULMVZ}
3406 \begin{DSPOpcodeBytefield}{16}
3407 \monobitbox{4}{1001} & \monobitbox{4}{s01r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3408 \end{DSPOpcodeBytefield}
3409
3410 \begin{DSPOpcodeFormat}
3411 MULMVZ $axS.l, $axS.h, $acR
3412 \end{DSPOpcodeFormat}
3413
3414 \begin{DSPOpcodeDescription}
3415 \item Move product register to accumulator register \Register{\$acR} and clear low
3416 part of accumulator register \Register{\$acR.l}. Multiply low part \Register{\$axS.l} of
3417 secondary accumulator \Register{\$axS} by high part \Register{\$axS.h} of secondary accumulator
3418 \Register{\$axS} (treat them both as signed).
3419 \end{DSPOpcodeDescription}
3420
3421 \begin{DSPOpcodeOperation}
3422 $acR.hm = $prod.hm
3423 $acR.l = 0
3424 $prod = $axS.l * $axS.h
3425 $pc++
3426 \end{DSPOpcodeOperation}
3427
3428 \begin{DSPOpcodeSeeAlso}
3429 \item \RegisterField{\$sr.AM} bit affects multiply result.
3430 \end{DSPOpcodeSeeAlso}
3431
3432 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3433 \end{DSPOpcode}
3434
3435 \begin{DSPOpcode}{MULX}
3436 \begin{DSPOpcodeBytefield}{16}
3437 \monobitbox{4}{101s} & \monobitbox{4}{t000} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3438 \end{DSPOpcodeBytefield}
3439
3440 \begin{DSPOpcodeFormat}
3441 MULX $ax0.S, $ax1.T
3442 \end{DSPOpcodeFormat}
3443
3444 \begin{DSPOpcodeDescription}
3445 \item Multiply one part \Register{\$ax0} by one part \Register{\$ax1} (treat them both as signed).
3446 Part is selected by \Value{S} and \Value{T} bits. Zero selects low part, one selects high part.
3447 \end{DSPOpcodeDescription}
3448
3449 \begin{DSPOpcodeOperation}
3450 $prod = (S == 0) ? $ax0.l : ax0.h * (T == 0) ? $ax1.l : $ax1.h
3451 $pc++
3452 \end{DSPOpcodeOperation}
3453
3454 \begin{DSPOpcodeSeeAlso}
3455 \item \RegisterField{\$sr.AM} bit affects multiply result.
3456 \end{DSPOpcodeSeeAlso}
3457
3458 \DSPOpcodeFlagsUnchanged
3459 \end{DSPOpcode}
3460
3461 \begin{DSPOpcode}{MULXAC}
3462 \begin{DSPOpcodeBytefield}{16}
3463 \monobitbox{4}{101s} & \monobitbox{4}{t10r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3464 \end{DSPOpcodeBytefield}
3465
3466 \begin{DSPOpcodeFormat}
3467 MULXAC $ax0.S, $ax1.T, $acR
3468 \end{DSPOpcodeFormat}
3469
3470 \begin{DSPOpcodeDescription}
3471 \item Add product register to accumulator register \Register{\$acR}.
3472 Multiply one part \Register{\$ax0} by one part \Register{\$ax1} (treat them both as signed).
3473 Part is selected by \Value{S} and \Value{T} bits.
3474 Zero selects low part, one selects high part.
3475 \end{DSPOpcodeDescription}
3476
3477 \begin{DSPOpcodeOperation}
3478 $acR += $prod
3479 $prod = (S == 0) ? $ax0.l : ax0.h * (T == 0) ? $ax1.l : $ax1.h
3480 $pc++
3481 \end{DSPOpcodeOperation}
3482
3483 \begin{DSPOpcodeSeeAlso}
3484 \item \RegisterField{\$sr.AM} bit affects multiply result.
3485 \end{DSPOpcodeSeeAlso}
3486
3487 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3488 \end{DSPOpcode}
3489
3490 \begin{DSPOpcode}{MULXMV}
3491 \begin{DSPOpcodeBytefield}{16}
3492 \monobitbox{4}{101s} & \monobitbox{4}{t11r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3493 \end{DSPOpcodeBytefield}
3494
3495 \begin{DSPOpcodeFormat}
3496 MULXMV $ax0.S, $ax1.T, $acR
3497 \end{DSPOpcodeFormat}
3498
3499 \begin{DSPOpcodeDescription}
3500 \item Move product register to accumulator register \Register{\$acR}.
3501 Multiply one part \Register{\$ax0} by one part \Register{\$ax1} (treat them both as signed).
3502 Part is selected by \Value{S} and \Value{T} bits.
3503 Zero selects low part, one selects high part.
3504 \end{DSPOpcodeDescription}
3505
3506 \begin{DSPOpcodeOperation}
3507 $acR = $prod
3508 $prod = (S == 0) ? $ax0.l : ax0.h * (T == 0) ? $ax1.l : $ax1.h
3509 $pc++
3510 \end{DSPOpcodeOperation}
3511
3512 \begin{DSPOpcodeSeeAlso}
3513 \item \RegisterField{\$sr.AM} bit affects multiply result.
3514 \end{DSPOpcodeSeeAlso}
3515
3516 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3517 \end{DSPOpcode}
3518
3519 \begin{DSPOpcode}{MULXMVZ}
3520 \begin{DSPOpcodeBytefield}{16}
3521 \monobitbox{4}{101s} & \monobitbox{4}{t01r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3522 \end{DSPOpcodeBytefield}
3523
3524 \begin{DSPOpcodeFormat}
3525 MULXMVZ $ax0.S, $ax1.T, $acR
3526 \end{DSPOpcodeFormat}
3527
3528 \begin{DSPOpcodeDescription}
3529 \item Move product register to accumulator register \Register{\$acR} and
3530 clear low part of accumulator register \Register{\$acR.l}. Multiply one part \Register{\$ax0} by one
3531 part \Register{\$ax1} (treat them both as signed).
3532 Part is selected by \Value{S} and \Value{T} bits.
3533 Zero selects low part, one selects high part.
3534 \end{DSPOpcodeDescription}
3535
3536 \begin{DSPOpcodeOperation}
3537 $acR.hm = $prod.hm
3538 $acR.l = 0
3539 $prod = (S == 0) ? $ax0.l : ax0.h * (T == 0) ? $ax1.l : $ax1.h
3540 $pc++
3541 \end{DSPOpcodeOperation}
3542
3543 \begin{DSPOpcodeSeeAlso}
3544 \item \RegisterField{\$sr.AM} bit affects multiply result.
3545 \end{DSPOpcodeSeeAlso}
3546
3547 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3548 \end{DSPOpcode}
3549
3550 \begin{DSPOpcode}{NEG}
3551 \begin{DSPOpcodeBytefield}{16}
3552 \monobitbox{4}{0111} & \monobitbox{4}{110d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3553 \end{DSPOpcodeBytefield}
3554
3555 \begin{DSPOpcodeFormat}
3556 NEG $acD
3557 \end{DSPOpcodeFormat}
3558
3559 \begin{DSPOpcodeDescription}
3560 \item Negates accumulator \Register{\$acD}.
3561 \end{DSPOpcodeDescription}
3562
3563 \begin{DSPOpcodeOperation}
3564 $acD = 0 - $acD
3565 FLAGS($acD)
3566 $pc++
3567 \end{DSPOpcodeOperation}
3568
3569 \begin{DSPOpcodeNote}
3570 \item The carry flag is set only if \Register{\$acD} was zero.
3571 The overflow flag is set only if \Register{\$acD} was \Value{0x8000000000} (the minimum value),
3572 as \Code{-INT\_MIN} is \Code{INT\_MIN} in two's complement.
3573 In both of these cases, the value of \Register{\$acD} after the operation is the same as it was before.
3574 \end{DSPOpcodeNote}
3575
3576 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
3577 \end{DSPOpcode}
3578
3579 \begin{DSPOpcode}{NOT}
3580 \begin{DSPOpcodeBytefield}{16}
3581 \monobitbox{4}{0011} & \monobitbox{4}{001d} & \monobitbox{4}{1xxx} & \monobitbox{4}{xxxx}
3582 \end{DSPOpcodeBytefield}
3583
3584 \begin{DSPOpcodeFormat}
3585 NOT $acD.m
3586 \end{DSPOpcodeFormat}
3587
3588 \begin{DSPOpcodeDescription}
3589 \item Invert all bits in the middle part of accumulator \Register{\$acD.m} (i.e. XOR with \Value{0xffff}).
3590 \end{DSPOpcodeDescription}
3591
3592 \begin{DSPOpcodeOperation}
3593 $acD.m = ~acD.m
3594 FLAGS($acD)
3595 $pc++
3596 \end{DSPOpcodeOperation}
3597
3598 \begin{DSPOpcodeNote}
3599 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
3600 \end{DSPOpcodeNote}
3601
3602 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
3603 \end{DSPOpcode}
3604
3605 \begin{DSPOpcode}{NOP}
3606 \begin{DSPOpcodeBytefield}{16}
3607 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{0000}
3608 \end{DSPOpcodeBytefield}
3609
3610 \begin{DSPOpcodeFormat}
3611 NOP
3612 \end{DSPOpcodeFormat}
3613
3614 \begin{DSPOpcodeDescription}
3615 \item No operation.
3616 \end{DSPOpcodeDescription}
3617
3618 \begin{DSPOpcodeOperation}
3619 $pc++
3620 \end{DSPOpcodeOperation}
3621
3622 \DSPOpcodeFlagsUnchanged
3623 \end{DSPOpcode}
3624
3625 \begin{DSPOpcode}{NX}
3626 \begin{DSPOpcodeBytefield}{16}
3627 \monobitbox{4}{1000} & \monobitbox{4}{-000} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3628 \end{DSPOpcodeBytefield}
3629
3630 \begin{DSPOpcodeFormat}
3631 NX
3632 \end{DSPOpcodeFormat}
3633
3634 \begin{DSPOpcodeDescription}
3635 \item No operation, but can be extended with extended opcode.
3636 \end{DSPOpcodeDescription}
3637
3638 \begin{DSPOpcodeOperation}
3639 $pc++
3640 \end{DSPOpcodeOperation}
3641
3642 \DSPOpcodeFlagsUnchanged
3643 \end{DSPOpcode}
3644
3645 \begin{DSPOpcode}{ORC}
3646 \begin{DSPOpcodeBytefield}{16}
3647 \monobitbox{4}{0011} & \monobitbox{4}{111d} & \monobitbox{4}{0xxx} & \monobitbox{4}{xxxx}
3648 \end{DSPOpcodeBytefield}
3649
3650 \begin{DSPOpcodeFormat}
3651 ORC $acD.m, $ac(1-D).m
3652 \end{DSPOpcodeFormat}
3653
3654 \begin{DSPOpcodeDescription}
3655 \item Logic OR middle part of accumulator \Register{\$acD.m} with middle part of accumulator \Register{\$ac(1-D).m}.
3656 \end{DSPOpcodeDescription}
3657
3658 \begin{DSPOpcodeOperation}
3659 $acD.m |= $ac(1-D).m
3660 FLAGS($acD)
3661 $pc++
3662 \end{DSPOpcodeOperation}
3663
3664 \begin{DSPOpcodeNote}
3665 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
3666 \end{DSPOpcodeNote}
3667
3668 \DSPOpcodeFlagsUnchanged
3669 \end{DSPOpcode}
3670
3671 \begin{DSPOpcode}{ORI}
3672 \begin{DSPOpcodeBytefield}{16}
3673 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{0110} & \monobitbox{4}{0000} \\
3674 \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
3675 \end{DSPOpcodeBytefield}
3676
3677 \begin{DSPOpcodeFormat}
3678 ORI $acD.m, #I
3679 \end{DSPOpcodeFormat}
3680
3681 \begin{DSPOpcodeDescription}
3682 \item Logical OR of accumulator mid part \Register{\$acD.m} with immediate value \Value{I}.
3683 \end{DSPOpcodeDescription}
3684
3685 \begin{DSPOpcodeOperation}
3686 $acD.m |= #I
3687 FLAGS($acD)
3688 $pc += 2
3689 \end{DSPOpcodeOperation}
3690
3691 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3692 \end{DSPOpcode}
3693
3694 \begin{DSPOpcode}{ORR}
3695 \begin{DSPOpcodeBytefield}{16}
3696 \monobitbox{4}{0011} & \monobitbox{4}{10sd} & \monobitbox{4}{0xxx} & \monobitbox{4}{xxxx}
3697 \end{DSPOpcodeBytefield}
3698
3699 \begin{DSPOpcodeFormat}
3700 ORR $acD.m, $axS.h
3701 \end{DSPOpcodeFormat}
3702
3703 \begin{DSPOpcodeDescription}
3704 \item Logical OR middle part of accumulator \Register{\$acD.m} with high part of secondary accumulator \Register{\$axS.h}.
3705 \end{DSPOpcodeDescription}
3706
3707 \begin{DSPOpcodeOperation}
3708 $acD.m |= $axS.h
3709 FLAGS($acD)
3710 $pc++
3711 \end{DSPOpcodeOperation}
3712
3713 \begin{DSPOpcodeNote}
3714 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
3715 \end{DSPOpcodeNote}
3716
3717 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{X}
3718 \end{DSPOpcode}
3719
3720 \begin{DSPOpcode}{RET}
3721 \begin{DSPOpcodeBytefield}{16}
3722 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{1101} & \monobitbox{4}{1111}
3723 \end{DSPOpcodeBytefield}
3724
3725 \begin{DSPOpcodeFormat}
3726 RET
3727 \end{DSPOpcodeFormat}
3728
3729 \begin{DSPOpcodeDescription}
3730 \item Return from subroutine. Pops stored PC from call stack \Register{\$st0} and sets \Register{\$pc} to this location.
3731 \end{DSPOpcodeDescription}
3732
3733 \begin{DSPOpcodeOperation}
3734 $pc = $st0
3735 POP_STACK($st0)
3736 \end{DSPOpcodeOperation}
3737
3738 \DSPOpcodeFlagsUnchanged
3739 \end{DSPOpcode}
3740
3741 \begin{DSPOpcode}{RETcc}
3742 \begin{DSPOpcodeBytefield}{16}
3743 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{1101} & \monobitbox{4}{cccc}
3744 \end{DSPOpcodeBytefield}
3745
3746 \begin{DSPOpcodeFormat}
3747 RETcc
3748 \end{DSPOpcodeFormat}
3749
3750 \begin{DSPOpcodeDescription}
3751 \item Return from subroutine if condition \Flag{cc} has been met.
3752 Pops stored PC from call stack \Register{\$st0} and sets \Register{\$pc} to this location.
3753 \end{DSPOpcodeDescription}
3754
3755 \begin{DSPOpcodeOperation}
3756 IF (cc)
3757 POP_STACK($st0)
3758 ELSE
3759 $pc++
3760 ENDIF
3761 \end{DSPOpcodeOperation}
3762
3763 \DSPOpcodeFlagsUnchanged
3764 \end{DSPOpcode}
3765
3766 \begin{DSPOpcode}{RTI}
3767 \begin{DSPOpcodeBytefield}{16}
3768 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{1111} & \monobitbox{4}{1111}
3769 \end{DSPOpcodeBytefield}
3770
3771 \begin{DSPOpcodeFormat}
3772 RTI
3773 \end{DSPOpcodeFormat}
3774
3775 \begin{DSPOpcodeDescription}
3776 \item Return from exception. Pops stored status register \Register{\$sr} from data stack \Register{\$st1} and
3777 program counter PC from call stack \Register{\$st0} and sets \Register{\$pc} to this location.
3778 \end{DSPOpcodeDescription}
3779
3780 \begin{DSPOpcodeOperation}
3781 $sr = $st1
3782 POP_STACK($st1)
3783 $pc = $st0
3784 POP_STACK($st0)
3785 \end{DSPOpcodeOperation}
3786
3787 \DSPOpcodeFlagsUnchanged
3788 \end{DSPOpcode}
3789
3790 \begin{DSPOpcode}{RTIcc}
3791 \begin{DSPOpcodeBytefield}{16}
3792 \monobitbox{4}{0000} & \monobitbox{4}{0010} & \monobitbox{4}{1111} & \monobitbox{4}{cccc}
3793 \end{DSPOpcodeBytefield}
3794
3795 \begin{DSPOpcodeFormat}
3796 RTIcc
3797 \end{DSPOpcodeFormat}
3798
3799 \begin{DSPOpcodeDescription}
3800 \item Return from exception if condition \Flag{cc} has been met. Pops stored status register \Register{\$sr} from data stack \Register{\$st1} and
3801 program counter PC from call stack \Register{\$st0} and sets \Register{\$pc} to this location.
3802 \end{DSPOpcodeDescription}
3803
3804 \begin{DSPOpcodeOperation}
3805 IF (cc)
3806 $sr = $st1
3807 POP_STACK($st1)
3808 $pc = $st0
3809 POP_STACK($st0)
3810 ELSE
3811 $pc++
3812 ENDIF
3813 \end{DSPOpcodeOperation}
3814
3815 \DSPOpcodeFlagsUnchanged
3816 \end{DSPOpcode}
3817
3818 \begin{DSPOpcode}{SBCLR}
3819 \begin{DSPOpcodeBytefield}{16}
3820 \monobitbox{4}{0001} & \monobitbox{4}{0010} & \monobitbox{4}{0000} & \monobitbox{4}{0iii}
3821 \end{DSPOpcodeBytefield}
3822
3823 \begin{DSPOpcodeFormat}
3824 SBCLR #I
3825 \end{DSPOpcodeFormat}
3826
3827 \begin{DSPOpcodeDescription}
3828 \item Clear bit of status register \Register{\$sr}. Bit number is calculated by adding 6 to immediate value \Value{I}; thus, bits 6 through 13 (\texttt{LZ} through \texttt{AM}) can be cleared with this instruction.
3829 \end{DSPOpcodeDescription}
3830
3831 \begin{DSPOpcodeOperation}
3832 $sr &= ~(1 << (I + 6))
3833 $pc++
3834 \end{DSPOpcodeOperation}
3835
3836 \DSPOpcodeFlagsUnchanged
3837 \end{DSPOpcode}
3838
3839 \begin{DSPOpcode}{SBSET}
3840 \begin{DSPOpcodeBytefield}{16}
3841 \monobitbox{4}{0001} & \monobitbox{4}{0011} & \monobitbox{4}{0000} & \monobitbox{4}{0iii}
3842 \end{DSPOpcodeBytefield}
3843
3844 \begin{DSPOpcodeFormat}
3845 SBSET #I
3846 \end{DSPOpcodeFormat}
3847
3848 \begin{DSPOpcodeDescription}
3849 \item Set bit of status register \Register{\$sr}. Bit number is calculated by adding 6 to immediate value \Value{I}; thus, bits 6 through 13 (\texttt{LZ} through \texttt{AM}) can be set with this instruction.
3850 \end{DSPOpcodeDescription}
3851
3852 \begin{DSPOpcodeOperation}
3853 $sr |= 1 << (I + 6)
3854 $pc++
3855 \end{DSPOpcodeOperation}
3856
3857 \DSPOpcodeFlagsUnchanged
3858 \end{DSPOpcode}
3859
3860 \begin{DSPOpcode}{SET15}
3861 \begin{DSPOpcodeBytefield}{16}
3862 \monobitbox{4}{1000} & \monobitbox{4}{1101} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3863 \end{DSPOpcodeBytefield}
3864
3865 \begin{DSPOpcodeFormat}
3866 SET15
3867 \end{DSPOpcodeFormat}
3868
3869 \begin{DSPOpcodeDescription}
3870 \item Sets \RegisterField{\$sr.SU} (bit 15) to 1, causing multiplication to treat its operands as unsigned.
3871 \end{DSPOpcodeDescription}
3872
3873 \begin{DSPOpcodeOperation}
3874 $sr |= 0x8000
3875 $pc++
3876 \end{DSPOpcodeOperation}
3877
3878 \begin{DSPOpcodeSeeAlso}
3879 \item \Opcode{CLR15}
3880 \end{DSPOpcodeSeeAlso}
3881
3882 \DSPOpcodeFlagsUnchanged
3883 \end{DSPOpcode}
3884
3885 \begin{DSPOpcode}{SET16}
3886 \begin{DSPOpcodeBytefield}{16}
3887 \monobitbox{4}{1000} & \monobitbox{4}{1110} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3888 \end{DSPOpcodeBytefield}
3889
3890 \begin{DSPOpcodeFormat}
3891 SET16
3892 \end{DSPOpcodeFormat}
3893
3894 \begin{DSPOpcodeDescription}
3895 \item Sets \RegisterField{\$sr.SXM} (bit 14) to 0, resulting in 16-bit sign extension.
3896 \end{DSPOpcodeDescription}
3897
3898 \begin{DSPOpcodeOperation}
3899 $sr &= ~0x4000
3900 $pc++
3901 \end{DSPOpcodeOperation}
3902
3903 \begin{DSPOpcodeSeeAlso}
3904 \item \Opcode{SET40}
3905 \item \nameref{subsec:SET40}
3906 \end{DSPOpcodeSeeAlso}
3907
3908 \DSPOpcodeFlagsUnchanged
3909 \end{DSPOpcode}
3910
3911 \begin{DSPOpcode}{SET40}
3912 \begin{DSPOpcodeBytefield}{16}
3913 \monobitbox{4}{1000} & \monobitbox{4}{1111} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
3914 \end{DSPOpcodeBytefield}
3915
3916 \begin{DSPOpcodeFormat}
3917 SET40
3918 \end{DSPOpcodeFormat}
3919
3920 \begin{DSPOpcodeDescription}
3921 \item Sets \RegisterField{\$sr.SXM} (bit 14) to 1, resulting in 40-bit sign extension.
3922 \end{DSPOpcodeDescription}
3923
3924 \begin{DSPOpcodeOperation}
3925 $sr |= 0x4000
3926 $pc++
3927 \end{DSPOpcodeOperation}
3928
3929 \begin{DSPOpcodeSeeAlso}
3930 \item \Opcode{SET16}
3931 \item \nameref{subsec:SET40}
3932 \end{DSPOpcodeSeeAlso}
3933
3934 \DSPOpcodeFlagsUnchanged
3935 \end{DSPOpcode}
3936
3937 \begin{DSPOpcode}{SI}
3938 \begin{DSPOpcodeBytefield}{16}
3939 \monobitbox{4}{0001} & \monobitbox{4}{0110} & \monobitbox{4}{mmmm} & \monobitbox{4}{mmmm} \\
3940 \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
3941 \end{DSPOpcodeBytefield}
3942
3943 \begin{DSPOpcodeFormat}
3944 SI @M, #I
3945 \end{DSPOpcodeFormat}
3946
3947 \begin{DSPOpcodeDescription}
3948 \item Store 16-bit immediate value \Value{I} to a memory location pointed by address \Address{0xFF00 | M}.
3949 \end{DSPOpcodeDescription}
3950
3951 \begin{DSPOpcodeOperation}
3952 MEM[0xFF00 | M] = I
3953 $pc += 2
3954 \end{DSPOpcodeOperation}
3955
3956 \begin{DSPOpcodeNote}
3957 \item Unlike \Opcode{SRS}, \Opcode{SRSH}, and \Opcode{LRS}, \Opcode{SI} does not use \Register{\$cr} to decide the base address and instead always uses \Address{0xFF00}.
3958 \end{DSPOpcodeNote}
3959
3960 \DSPOpcodeFlagsUnchanged
3961 \end{DSPOpcode}
3962
3963 \begin{DSPOpcode}{SR}
3964 \begin{DSPOpcodeBytefield}{16}
3965 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{111s} & \monobitbox{4}{ssss} \\
3966 \monobitbox{4}{mmmm} & \monobitbox{4}{mmmm} & \monobitbox{4}{mmmm} & \monobitbox{4}{mmmm}
3967 \end{DSPOpcodeBytefield}
3968
3969 \begin{DSPOpcodeFormat}
3970 SR @M, $S
3971 \end{DSPOpcodeFormat}
3972
3973 \begin{DSPOpcodeDescription}
3974 \item Store value from register \Register{\$S} to a memory pointed by address \Address{M}.
3975 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
3976 \end{DSPOpcodeDescription}
3977
3978 \begin{DSPOpcodeOperation}
3979 MEM[M] = $S
3980 $pc += 2
3981 \end{DSPOpcodeOperation}
3982
3983 \DSPOpcodeFlagsUnchanged
3984 \end{DSPOpcode}
3985
3986 \begin{DSPOpcode}{SRR}
3987 \begin{DSPOpcodeBytefield}{16}
3988 \monobitbox{4}{0001} & \monobitbox{4}{1010} & \monobitbox{4}{0dds} & \monobitbox{4}{ssss}
3989 \end{DSPOpcodeBytefield}
3990
3991 \begin{DSPOpcodeFormat}
3992 SRR @$arD, $S
3993 \end{DSPOpcodeFormat}
3994
3995 \begin{DSPOpcodeDescription}
3996 \item Store value from source register \Register{\$S} to a memory location pointed by addressing
3997 register \Register{\$arD}.
3998 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
3999 \end{DSPOpcodeDescription}
4000
4001 \begin{DSPOpcodeOperation}
4002 MEM[$arD] = $S
4003 $pc++
4004 \end{DSPOpcodeOperation}
4005
4006 \DSPOpcodeFlagsUnchanged
4007 \end{DSPOpcode}
4008
4009 \begin{DSPOpcode}{SRRD}
4010 \begin{DSPOpcodeBytefield}{16}
4011 \monobitbox{4}{0001} & \monobitbox{4}{1010} & \monobitbox{4}{1dds} & \monobitbox{4}{ssss}
4012 \end{DSPOpcodeBytefield}
4013
4014 \begin{DSPOpcodeFormat}
4015 SRRD @$arD, $S
4016 \end{DSPOpcodeFormat}
4017
4018 \begin{DSPOpcodeDescription}
4019 \item Store value from source register \Register{\$S} to a memory location pointed by addressing
4020 register \Register{\$arD}. Decrement register \Register{\$arD}.
4021 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4022 \end{DSPOpcodeDescription}
4023
4024 \begin{DSPOpcodeOperation}
4025 MEM[$arD] = $S
4026 $arD--
4027 $pc++
4028 \end{DSPOpcodeOperation}
4029
4030 \DSPOpcodeFlagsUnchanged
4031 \end{DSPOpcode}
4032
4033 \begin{DSPOpcode}{SRRI}
4034 \begin{DSPOpcodeBytefield}{16}
4035 \monobitbox{4}{0001} & \monobitbox{4}{1011} & \monobitbox{4}{0dds} & \monobitbox{4}{ssss}
4036 \end{DSPOpcodeBytefield}
4037
4038 \begin{DSPOpcodeFormat}
4039 SRRI @$arD, $S
4040 \end{DSPOpcodeFormat}
4041
4042 \begin{DSPOpcodeDescription}
4043 \item Store value from source register \Register{\$S} to a memory location pointed by addressing
4044 register \Register{\$arD}. Increment register \Register{\$arD}.
4045 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4046 \end{DSPOpcodeDescription}
4047
4048 \begin{DSPOpcodeOperation}
4049 MEM[$arD] = $S
4050 $arD++
4051 $pc++
4052 \end{DSPOpcodeOperation}
4053
4054 \DSPOpcodeFlagsUnchanged
4055 \end{DSPOpcode}
4056
4057 \begin{DSPOpcode}{SRRN}
4058 \begin{DSPOpcodeBytefield}{16}
4059 \monobitbox{4}{0001} & \monobitbox{4}{1011} & \monobitbox{4}{1dds} & \monobitbox{4}{ssss}
4060 \end{DSPOpcodeBytefield}
4061
4062 \begin{DSPOpcodeFormat}
4063 SRRN @$arD, $S
4064 \end{DSPOpcodeFormat}
4065
4066 \begin{DSPOpcodeDescription}
4067 \item Store value from source register \Register{\$S} to a memory location pointed by addressing
4068 register \Register{\$arD}. Add indexing register \Register{\$ixD} to register \Register{\$arD}.
4069 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4070 \end{DSPOpcodeDescription}
4071
4072 \begin{DSPOpcodeOperation}
4073 MEM[$arD] = $S
4074 $arD += $ixD
4075 $pc++
4076 \end{DSPOpcodeOperation}
4077
4078 \DSPOpcodeFlagsUnchanged
4079 \end{DSPOpcode}
4080
4081 \begin{DSPOpcode}{SRS}
4082 \begin{DSPOpcodeBytefield}{16}
4083 \monobitbox{4}{0010} & \monobitbox{4}{11ss} & \monobitbox{4}{mmmm} & \monobitbox{4}{mmmm}
4084 \end{DSPOpcodeBytefield}
4085
4086 \begin{DSPOpcodeFormat}
4087 SRS @M, $(0x1C+S)
4088 \end{DSPOpcodeFormat}
4089
4090 \begin{DSPOpcodeDescription}
4091 \item Store value from register \Register{\$(0x1C+S)} to a memory pointed by address \Address{(\$cr << 8) | M}.
4092 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4093 \end{DSPOpcodeDescription}
4094
4095 \begin{DSPOpcodeOperation}
4096 MEM[($cr << 8) | M] = $(0x1C+S)
4097 $pc++
4098 \end{DSPOpcodeOperation}
4099
4100 \begin{DSPOpcodeNote}
4101 \item Unlike \Opcode{LRS}, \Opcode{SRS} and \Opcode{SRSH} only work on \Register{\$acS}.
4102 The pattern \Value{101s} is unused and does not perform any write.
4103 \end{DSPOpcodeNote}
4104
4105 \DSPOpcodeFlagsUnchanged
4106 \end{DSPOpcode}
4107
4108 \begin{DSPOpcode}{SRSH}
4109 \begin{DSPOpcodeBytefield}{16}
4110 \monobitbox{4}{0010} & \monobitbox{4}{100s} & \monobitbox{4}{mmmm} & \monobitbox{4}{mmmm}
4111 \end{DSPOpcodeBytefield}
4112
4113 \begin{DSPOpcodeFormat}
4114 SRSH @M, $acS.h
4115 \end{DSPOpcodeFormat}
4116
4117 \begin{DSPOpcodeDescription}
4118 \item Store value from register \Register{\$acS.h} to a memory pointed by address \Address{(\$cr << 8) | M}.
4119 \end{DSPOpcodeDescription}
4120
4121 \begin{DSPOpcodeOperation}
4122 MEM[($cr << 8) | M] = $acS.h
4123 $pc++
4124 \end{DSPOpcodeOperation}
4125
4126 \begin{DSPOpcodeNote}
4127 \item Unlike \Opcode{LRS}, \Opcode{SRS} and \Opcode{SRSH} only work on \Register{\$acS}.
4128 The pattern \Value{101s} is unused and does not perform any write.
4129 \end{DSPOpcodeNote}
4130
4131 \DSPOpcodeFlagsUnchanged
4132 \end{DSPOpcode}
4133
4134 \begin{DSPOpcode}{SUB}
4135 \begin{DSPOpcodeBytefield}{16}
4136 \monobitbox{4}{0101} & \monobitbox{4}{110d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
4137 \end{DSPOpcodeBytefield}
4138
4139 \begin{DSPOpcodeFormat}
4140 SUB $acD, $ac(1-D)
4141 \end{DSPOpcodeFormat}
4142
4143 \begin{DSPOpcodeDescription}
4144 \item Subtracts accumulator \Register{\$ac(1-D)} from accumulator register \Register{\$acD}.
4145 \end{DSPOpcodeDescription}
4146
4147 \begin{DSPOpcodeOperation}
4148 $acD -= $ac(1-D)
4149 FLAGS($acD)
4150 $pc++
4151 \end{DSPOpcodeOperation}
4152
4153 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
4154 \end{DSPOpcode}
4155
4156 \begin{DSPOpcode}{SUBARN}
4157 \begin{DSPOpcodeBytefield}{16}
4158 \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{0000} & \monobitbox{4}{11dd}
4159 \end{DSPOpcodeBytefield}
4160
4161 \begin{DSPOpcodeFormat}
4162 SUBARN $arD
4163 \end{DSPOpcodeFormat}
4164
4165 \begin{DSPOpcodeDescription}
4166 \item Subtracts indexing register \Register{\$ixD} from addressing register \Register{\$arD}.
4167 \end{DSPOpcodeDescription}
4168
4169 \begin{DSPOpcodeOperation}
4170 $arD -= $ixD
4171 $pc++
4172 \end{DSPOpcodeOperation}
4173
4174 \DSPOpcodeFlagsUnchanged
4175 \end{DSPOpcode}
4176
4177 \begin{DSPOpcode}{SUBAX}
4178 \begin{DSPOpcodeBytefield}{16}
4179 \monobitbox{4}{0101} & \monobitbox{4}{10sd} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
4180 \end{DSPOpcodeBytefield}
4181
4182 \begin{DSPOpcodeFormat}
4183 SUBAX $acD, $axS
4184 \end{DSPOpcodeFormat}
4185
4186 \begin{DSPOpcodeDescription}
4187 \item Subtracts secondary accumulator \Register{\$axS} from accumulator register \Register{\$acD}.
4188 \end{DSPOpcodeDescription}
4189
4190 \begin{DSPOpcodeOperation}
4191 $acD -= $axS
4192 FLAGS($acD)
4193 $pc++
4194 \end{DSPOpcodeOperation}
4195
4196 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
4197 \end{DSPOpcode}
4198
4199 \begin{DSPOpcode}{SUBP}
4200 \begin{DSPOpcodeBytefield}{16}
4201 \monobitbox{4}{0101} & \monobitbox{4}{111d} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
4202 \end{DSPOpcodeBytefield}
4203
4204 \begin{DSPOpcodeFormat}
4205 SUBP $acD
4206 \end{DSPOpcodeFormat}
4207
4208 \begin{DSPOpcodeDescription}
4209 \item Subtracts product register from accumulator register.
4210 \end{DSPOpcodeDescription}
4211
4212 \begin{DSPOpcodeOperation}
4213 $acD -= $prod
4214 FLAGS($acD)
4215 $pc++
4216 \end{DSPOpcodeOperation}
4217
4218 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
4219 \end{DSPOpcode}
4220
4221 \begin{DSPOpcode}{SUBR}
4222 \begin{DSPOpcodeBytefield}{16}
4223 \monobitbox{4}{0101} & \monobitbox{4}{0ssd} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
4224 \end{DSPOpcodeBytefield}
4225
4226 \begin{DSPOpcodeFormat}
4227 SUBR $acD, $(0x18+S)
4228 \end{DSPOpcodeFormat}
4229
4230 \begin{DSPOpcodeDescription}
4231 \item Subtracts register \Register{\$(0x18+S)} from accumulator \Register{\$acD} register.
4232 \end{DSPOpcodeDescription}
4233
4234 \begin{DSPOpcodeOperation}
4235 $acD -= ($(0x18+S) << 16)
4236 FLAGS($acD)
4237 $pc++
4238 \end{DSPOpcodeOperation}
4239
4240 \DSPOpcodeFlags{X}{-}{X}{X}{X}{X}{X}{X}
4241 \end{DSPOpcode}
4242
4243 \begin{DSPOpcode}{TST}
4244 \begin{DSPOpcodeBytefield}{16}
4245 \monobitbox{4}{1011} & \monobitbox{4}{r001} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
4246 \end{DSPOpcodeBytefield}
4247
4248 \begin{DSPOpcodeFormat}
4249 TST $acR
4250 \end{DSPOpcodeFormat}
4251
4252 \begin{DSPOpcodeDescription}
4253 \item Test accumulator \Register{\$acR}.
4254 \end{DSPOpcodeDescription}
4255
4256 \begin{DSPOpcodeOperation}
4257 FLAGS($acR)
4258 $pc++
4259 \end{DSPOpcodeOperation}
4260
4261 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
4262 \end{DSPOpcode}
4263
4264 \begin{DSPOpcode}{TSTAXH}
4265 \begin{DSPOpcodeBytefield}{16}
4266 \monobitbox{4}{1000} & \monobitbox{4}{011r} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
4267 \end{DSPOpcodeBytefield}
4268
4269 \begin{DSPOpcodeFormat}
4270 TSTAXH $axR.h
4271 \end{DSPOpcodeFormat}
4272
4273 \begin{DSPOpcodeDescription}
4274 \item Test high part of secondary accumulator \Register{\$axR.h}.
4275 \end{DSPOpcodeDescription}
4276
4277 \begin{DSPOpcodeOperation}
4278 FLAGS($axR.h)
4279 $pc++
4280 \end{DSPOpcodeOperation}
4281
4282 \DSPOpcodeFlags{-}{-}{X}{0}{X}{X}{0}{0}
4283 \end{DSPOpcode}
4284
4285 \begin{DSPOpcode}{TSTPROD}
4286 \begin{DSPOpcodeBytefield}{16}
4287 \monobitbox{4}{1000} & \monobitbox{4}{0101} & \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx}
4288 \end{DSPOpcodeBytefield}
4289
4290 \begin{DSPOpcodeFormat}
4291 TSTPROD
4292 \end{DSPOpcodeFormat}
4293
4294 \begin{DSPOpcodeDescription}
4295 \item Test the product register \Register{\$prod}.
4296 \end{DSPOpcodeDescription}
4297
4298 \begin{DSPOpcodeOperation}
4299 FLAGS($prod)
4300 $pc++
4301 \end{DSPOpcodeOperation}
4302
4303 \DSPOpcodeFlags{-}{-}{X}{0}{X}{X}{0}{X}
4304 \end{DSPOpcode}
4305
4306 \begin{DSPOpcode}{XORC}
4307 \begin{DSPOpcodeBytefield}{16}
4308 \monobitbox{4}{0011} & \monobitbox{4}{000d} & \monobitbox{4}{1xxx} & \monobitbox{4}{xxxx}
4309 \end{DSPOpcodeBytefield}
4310
4311 \begin{DSPOpcodeFormat}
4312 XORC $acD.m, $ac(1-D).m
4313 \end{DSPOpcodeFormat}
4314
4315 \begin{DSPOpcodeDescription}
4316 \item Logical XOR (exclusive OR) middle part of accumulator \Register{\$acD.m} with middle part of accumulator \Register{\$ac(1-D).m}.
4317 \end{DSPOpcodeDescription}
4318
4319 \begin{DSPOpcodeOperation}
4320 $acD.m ^= $ac(1-D).m
4321 FLAGS($acD)
4322 $pc++
4323 \end{DSPOpcodeOperation}
4324
4325 \begin{DSPOpcodeNote}
4326 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
4327 \end{DSPOpcodeNote}
4328
4329 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
4330 \end{DSPOpcode}
4331
4332 \begin{DSPOpcode}{XORI}
4333 \begin{DSPOpcodeBytefield}{16}
4334 \monobitbox{4}{0000} & \monobitbox{4}{001d} & \monobitbox{4}{0010} & \monobitbox{4}{0000} \\
4335 \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii} & \monobitbox{4}{iiii}
4336 \end{DSPOpcodeBytefield}
4337
4338 \begin{DSPOpcodeFormat}
4339 XORI $acD.m, #I
4340 \end{DSPOpcodeFormat}
4341
4342 \begin{DSPOpcodeDescription}
4343 \item Logical XOR (exclusive OR) of accumulator mid part \Register{\$acD.m} with immediate value \Value{I}.
4344 \end{DSPOpcodeDescription}
4345
4346 \begin{DSPOpcodeOperation}
4347 $acD.m ^= #I
4348 FLAGS($acD)
4349 $pc += 2
4350 \end{DSPOpcodeOperation}
4351
4352 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
4353 \end{DSPOpcode}
4354
4355 \begin{DSPOpcode}{XORR}
4356 \begin{DSPOpcodeBytefield}{16}
4357 \monobitbox{4}{0011} & \monobitbox{4}{00sd} & \monobitbox{4}{0xxx} & \monobitbox{4}{xxxx}
4358 \end{DSPOpcodeBytefield}
4359
4360 \begin{DSPOpcodeFormat}
4361 XORR $acD.m, $axS.h
4362 \end{DSPOpcodeFormat}
4363
4364 \begin{DSPOpcodeDescription}
4365 \item Logical XOR (exclusive OR) middle part of accumulator \Register{\$acD.m} with high part of secondary accumulator \Register{\$axS.h}.
4366 \end{DSPOpcodeDescription}
4367
4368 \begin{DSPOpcodeOperation}
4369 $acD.m ^= $axS.h
4370 FLAGS($acD)
4371 $pc++
4372 \end{DSPOpcodeOperation}
4373
4374 \begin{DSPOpcodeNote}
4375 \item The main opcode is 9 bits and the extension opcode is 7 bits. The extension opcode is treated as if the 8th bit was 0 (i.e. it is \texttt{0xxxxxxx}).
4376 \end{DSPOpcodeNote}
4377
4378 \DSPOpcodeFlags{-}{-}{X}{X}{X}{X}{0}{0}
4379 \end{DSPOpcode}
4380
4381 \section{Extended opcodes}
4382
4383 Extended opcodes do not exist on their own. These opcodes can only be attached to opcodes that allow extending.
4384 Specifically, opcodes where the first nybble is 0, 1, or 2 cannot be extended.
4385 Opcodes where the first nybble is 4 or higher can be extended, using the 8 lower bits.
4386 Opcodes where the first nybble is 3 can also be extended, but the main opcode is 9 bits and the extension opcode is 7 bits. For these instructions, the extension opcode is treated as if the first bit were 0 (i.e. \texttt{0xxxxxxx}).
4387 (\Opcode{NX} has no behavior of its own, so it can be used to get an extended opcode's behavior on its own.)
4388
4389 Extended opcodes do not modify the program counter (\Register{\$pc} register).
4390
4391 Extended opcodes are run \textit{in parallel} with the main opcode; they see the same register state as the input. (For instance, \texttt{\Opcode{MOVR}\Opcode{'MV} \Register{\$ac1}, \Register{\$ax0.l} : \Register{\$ax0.l}, \Register{\$ac1.m}} (encoded as \Value{0x6113}) \textit{swaps} the values of \Register{\$ac1.m} and \Register{\$ax0.l} (and also extends the new value of \Register{\$ac1.m} into \Register{\$ac1.l} and \Register{\$ac1.h}).)
4392
4393 Since they are executed in parallel, the main and extension opcodes could theoretically write to the same registers. All opcodes that support extension only modify a main accumulator \Register{\$acD}, as well as \Register{\$prod}, \Register{\$sr}, and/or \Register{\$pc}, while the extension opcodes themselves generally only modify an additional accumulator \Register{\$axD} and addressing registers \Register{\$arS}. The exception is \Opcode{'L} and \Opcode{'LN}, which has the option of writing to \Register{\$acD}. Thus, \texttt{\Opcode{INC}\Opcode{'L} \Register{\$ac0} : \Register{\$ac0.l}, @\Register{\$ar0}} (encoded as \Value{0x7660}) increments \Register{\$ac0} (and thus \Register{\$ac0.l}), but also sets \Register{\$ac0.l} to the value in data memory at address \Register{\$ar0} and increments \Register{\$ar0}.
4394
4395 When the main and extension opcodes write to the same register, the register is set to the two values bitwise-or'd together. For the above example, \Register{\$ar0.l} would be set to \InlineExpression{(\Register{\$ar0.l} + 1) | MEM[\Register{\$ar0}]}. \textbf{Note that no official uCode writes to the same register twice like this.}
4396
4397 \pagebreak{}
4398
4399 \section{Alphabetical list of extended opcodes}
4400
4401 \pagebreak{}
4402
4403 \begin{DSPOpcode}{'DR}
4404 \begin{DSPOpcodeBytefield}{16}
4405 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{0000} & \monobitbox{4}{01rr}
4406 \end{DSPOpcodeBytefield}
4407
4408 \begin{DSPOpcodeFormat}
4409 'DR $arR
4410 \end{DSPOpcodeFormat}
4411
4412 \begin{DSPOpcodeDescription}
4413 \item Decrement addressing register \Register{\$arR}.
4414 \end{DSPOpcodeDescription}
4415
4416 \begin{DSPOpcodeOperation}
4417 $arR--
4418 \end{DSPOpcodeOperation}
4419 \end{DSPOpcode}
4420
4421 \begin{DSPOpcode}{'IR}
4422 \begin{DSPOpcodeBytefield}{16}
4423 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{0000} & \monobitbox{4}{10rr}
4424 \end{DSPOpcodeBytefield}
4425
4426 \begin{DSPOpcodeFormat}
4427 'IR $arR
4428 \end{DSPOpcodeFormat}
4429
4430 \begin{DSPOpcodeDescription}
4431 \item Increment addressing register \Register{\$arR}.
4432 \end{DSPOpcodeDescription}
4433
4434 \begin{DSPOpcodeOperation}
4435 $arR++
4436 \end{DSPOpcodeOperation}
4437 \end{DSPOpcode}
4438
4439 \begin{DSPOpcode}{'L}
4440 \begin{DSPOpcodeBytefield}{16}
4441 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{01dd} & \monobitbox{4}{d0ss}
4442 \end{DSPOpcodeBytefield}
4443
4444 \begin{DSPOpcodeFormat}
4445 'L $(0x18+D), @$arS
4446 \end{DSPOpcodeFormat}
4447
4448 \begin{DSPOpcodeDescription}
4449 \item Load register \Register{\$(0x18+D)} with value from memory pointed by register \Register{\$arS}.
4450 Post increment register \Register{\$arS}.
4451 \item When loading to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4452 \end{DSPOpcodeDescription}
4453
4454 \begin{DSPOpcodeOperation}
4455 $(0x18+D) = MEM[$arS]
4456 $arS++
4457 \end{DSPOpcodeOperation}
4458 \end{DSPOpcode}
4459
4460 \begin{DSPOpcode}{'LN}
4461 \begin{DSPOpcodeBytefield}{16}
4462 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{01dd} & \monobitbox{4}{d1ss}
4463 \end{DSPOpcodeBytefield}
4464
4465 \begin{DSPOpcodeFormat}
4466 'LN $(0x18+D), @$arS
4467 \end{DSPOpcodeFormat}
4468
4469 \begin{DSPOpcodeDescription}
4470 \item Load register \Register{\$(0x18+D)} with value from memory pointed by register \Register{\$arS}.
4471 Add indexing register \Register{\$ixS} to register \Register{\$arS}.
4472 \item When loading to \Register{\$ac0.m} or \Register{\$ac1.m}, optionally perform sign extension depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4473 \end{DSPOpcodeDescription}
4474
4475 \begin{DSPOpcodeOperation}
4476 $(0x18+D) = MEM[$arS]
4477 $arS += $ixS
4478 \end{DSPOpcodeOperation}
4479 \end{DSPOpcode}
4480
4481 \begin{DSPOpcode}{'LD}
4482 \begin{DSPOpcodeBytefield}{16}
4483 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{11dr} & \monobitbox{4}{00ss}
4484 \end{DSPOpcodeBytefield}
4485
4486 \begin{DSPOpcodeFormat}
4487 'LD $ax0.D, $ax1.R, @$arS
4488 \end{DSPOpcodeFormat}
4489
4490 \begin{DSPOpcodeDescription}
4491 \item Load register \Register{\$ax0.D} (either \Register{\$ax0.l} or \Register{\$ax0.h}, as \Register{\$(0x18+D*2)}) with value from memory pointed by register \Register{\$arS}.
4492 Load register \Register{\$ax1.R} (either \Register{\$ax1.l} or \Register{\$ax1.h}, as \Register{\$(0x19+R*2)}) with value from memory pointed by register \Register{\$ar3}.
4493 Increment both \Register{\$arS} and \Register{\$ar3}.
4494 \end{DSPOpcodeDescription}
4495
4496 \begin{DSPOpcodeOperation}
4497 $ax0.D = MEM[$arS]
4498 $ax1.R = MEM[$ar3]
4499 $arS++
4500 $ar3++
4501 \end{DSPOpcodeOperation}
4502
4503 \begin{DSPOpcodeNote}
4504 \item \texttt{S} cannot be 3, as that instead encodes \Opcode{'LDAX}. Thus, \Register{\$arS} is guaranteed to be distinct from \Register{\$ar3}.
4505 \end{DSPOpcodeNote}
4506 \end{DSPOpcode}
4507
4508 \begin{DSPOpcode}{'LDM}
4509 \begin{DSPOpcodeBytefield}{16}
4510 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{11dr} & \monobitbox{4}{10ss}
4511 \end{DSPOpcodeBytefield}
4512
4513 \begin{DSPOpcodeFormat}
4514 'LDM $ax0.D, $ax1.R, @$arS
4515 \end{DSPOpcodeFormat}
4516
4517 \begin{DSPOpcodeDescription}
4518 \item Load register \Register{\$ax0.D} (either \Register{\$ax0.l} or \Register{\$ax0.h}, as \Register{\$(0x18+D*2)}) with value from memory pointed by register \Register{\$arS}.
4519 Load register \Register{\$ax1.R} (either \Register{\$ax1.l} or \Register{\$ax1.h}, as \Register{\$(0x19+R*2)}) with value from memory pointed by register \Register{\$ar3}.
4520 Add corresponding indexing register \Register{\$ix3} to addressing register \Register{\$ar3} and increment \Register{\$arS}.
4521 \end{DSPOpcodeDescription}
4522
4523 \begin{DSPOpcodeOperation}
4524 $ax0.D = MEM[$arS]
4525 $ax1.R = MEM[$ar3]
4526 $arS++
4527 $ar3 += $ix3
4528 \end{DSPOpcodeOperation}
4529
4530 \begin{DSPOpcodeNote}
4531 \item \texttt{S} cannot be 3, as that instead encodes \Opcode{'LDAXM}. Thus, \Register{\$arS} is guaranteed to be distinct from \Register{\$ar3}.
4532 \end{DSPOpcodeNote}
4533 \end{DSPOpcode}
4534
4535 \begin{DSPOpcode}{'LDNM}
4536 \begin{DSPOpcodeBytefield}{16}
4537 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{11dr} & \monobitbox{4}{11ss}
4538 \end{DSPOpcodeBytefield}
4539
4540 \begin{DSPOpcodeFormat}
4541 'LDNM $ax0.D, $ax1.R, @$arS
4542 \end{DSPOpcodeFormat}
4543
4544 \begin{DSPOpcodeDescription}
4545 \item Load register \Register{\$ax0.D} (either \Register{\$ax0.l} or \Register{\$ax0.h}, as \Register{\$(0x18+D*2)}) with value from memory pointed by register \Register{\$arS}.
4546 Load register \Register{\$ax1.R} (either \Register{\$ax1.l} or \Register{\$ax1.h}, as \Register{\$(0x19+R*2)}) with value from memory pointed by register \Register{\$ar3}.
4547 Add corresponding indexing register \Register{\$ixS} to addressing register \Register{\$arS} and add corresponding
4548 indexing register \Register{\$ix3} to addressing register \Register{\$ar3}.
4549 \end{DSPOpcodeDescription}
4550
4551 \begin{DSPOpcodeOperation}
4552 $ax0.D = MEM[$arS]
4553 $ax1.R = MEM[$ar3]
4554 $arS += $ixS
4555 $ar3 += $ix3
4556 \end{DSPOpcodeOperation}
4557
4558 \begin{DSPOpcodeNote}
4559 \item \texttt{S} cannot be 3, as that instead encodes \Opcode{'LDAXNM}. Thus, \Register{\$arS} is guaranteed to be distinct from \Register{\$ar3}.
4560 \end{DSPOpcodeNote}
4561 \end{DSPOpcode}
4562
4563 \begin{DSPOpcode}{'LDN}
4564 \begin{DSPOpcodeBytefield}{16}
4565 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{11dr} & \monobitbox{4}{01ss}
4566 \end{DSPOpcodeBytefield}
4567
4568 \begin{DSPOpcodeFormat}
4569 'LDN $ax0.D, $ax1.R, @$arS
4570 \end{DSPOpcodeFormat}
4571
4572 \begin{DSPOpcodeDescription}
4573 \item Load register \Register{\$ax0.D} (either \Register{\$ax0.l} or \Register{\$ax0.h}, as \Register{\$(0x18+D*2)}) with value from memory pointed by register \Register{\$arS}.
4574 Load register \Register{\$ax1.R} (either \Register{\$ax1.l} or \Register{\$ax1.h}, as \Register{\$(0x19+R*2)}) with value from memory pointed by register \Register{\$ar3}.
4575 Add corresponding indexing register \Register{\$ixS} to addressing register \Register{\$arS} and increment \Register{\$ar3}.
4576 \end{DSPOpcodeDescription}
4577
4578 \begin{DSPOpcodeOperation}
4579 $ax0.D = MEM[$arS]
4580 $ax1.R = MEM[$ar3]
4581 $arS += $ixS
4582 $ar3++
4583 \end{DSPOpcodeOperation}
4584
4585 \begin{DSPOpcodeNote}
4586 \item \texttt{S} cannot be 3, as that instead encodes \Opcode{'LDAXN}. Thus, \Register{\$arS} is guaranteed to be distinct from \Register{\$ar3}.
4587 \end{DSPOpcodeNote}
4588 \end{DSPOpcode}
4589
4590 \begin{DSPOpcode}{'LDAX}
4591 \begin{DSPOpcodeBytefield}{16}
4592 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{11sr} & \monobitbox{4}{0011}
4593 \end{DSPOpcodeBytefield}
4594
4595 \begin{DSPOpcodeFormat}
4596 'LDAX $axR, @$arS
4597 \end{DSPOpcodeFormat}
4598
4599 \begin{DSPOpcodeDescription}
4600 \item Load register \Register{\$axR.h} with value from memory pointed by register \Register{\$arS}.
4601 Load register \Register{\$axR.l} with value from memory pointed by register \Register{\$ar3}.
4602 Increment both \Register{\$arS} and \Register{\$ar3}.
4603 \end{DSPOpcodeDescription}
4604
4605 \begin{DSPOpcodeOperation}
4606 $axR.h = MEM[$arS]
4607 $axR.l = MEM[$ar3]
4608 $arS++
4609 $ar3++
4610 \end{DSPOpcodeOperation}
4611
4612 \begin{DSPOpcodeNote}
4613 \item \texttt{S} can be either 0 or 1, corresponding to \Register{\$ar0} or \Register{\$ar1}. Thus, \Register{\$arS} is guaranteed to be distinct from \Register{\$ar3}. \Register{\$ar2} cannot be used with this instruction.
4614 \end{DSPOpcodeNote}
4615 \end{DSPOpcode}
4616
4617 \begin{DSPOpcode}{'LDAXM}
4618 \begin{DSPOpcodeBytefield}{16}
4619 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{11sr} & \monobitbox{4}{1011}
4620 \end{DSPOpcodeBytefield}
4621
4622 \begin{DSPOpcodeFormat}
4623 'LDAXM $axR, @$arS
4624 \end{DSPOpcodeFormat}
4625
4626 \begin{DSPOpcodeDescription}
4627 \item Load register \Register{\$axR.h} with value from memory pointed by register \Register{\$arS}.
4628 Load register \Register{\$axR.l} with value from memory pointed by register \Register{\$ar3}.
4629 Add corresponding indexing register \Register{\$ix3} to addressing register \Register{\$ar3} and increment \Register{\$arS}.
4630 \end{DSPOpcodeDescription}
4631
4632 \begin{DSPOpcodeOperation}
4633 $axR.h = MEM[$arS]
4634 $axR.l = MEM[$ar3]
4635 $arS++
4636 $ar3 += $ix3
4637 \end{DSPOpcodeOperation}
4638
4639 \begin{DSPOpcodeNote}
4640 \item \texttt{S} can be either 0 or 1, corresponding to \Register{\$ar0} or \Register{\$ar1}. Thus, \Register{\$arS} is guaranteed to be distinct from \Register{\$ar3}. \Register{\$ar2} cannot be used with this instruction.
4641 \end{DSPOpcodeNote}
4642 \end{DSPOpcode}
4643
4644 \begin{DSPOpcode}{'LDAXNM}
4645 \begin{DSPOpcodeBytefield}{16}
4646 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{11sr} & \monobitbox{4}{1111}
4647 \end{DSPOpcodeBytefield}
4648
4649 \begin{DSPOpcodeFormat}
4650 'LDAXNM $axR, @$arS
4651 \end{DSPOpcodeFormat}
4652
4653 \begin{DSPOpcodeDescription}
4654 \item Load register \Register{\$axR.h} with value from memory pointed by register \Register{\$arS}.
4655 Load register \Register{\$axR.l} with value from memory pointed by register \Register{\$ar3}.
4656 Add corresponding indexing register \Register{\$ixS} to addressing register \Register{\$arS} and add corresponding
4657 indexing register \Register{\$ix3} to addressing register \Register{\$ar3}.
4658 \end{DSPOpcodeDescription}
4659
4660 \begin{DSPOpcodeOperation}
4661 $axR.h = MEM[$arS]
4662 $axR.l = MEM[$ar3]
4663 $arS += $ixS
4664 $ar3 += $ix3
4665 \end{DSPOpcodeOperation}
4666
4667 \begin{DSPOpcodeNote}
4668 \item \texttt{S} can be either 0 or 1, corresponding to \Register{\$ar0} or \Register{\$ar1}. Thus, \Register{\$arS} is guaranteed to be distinct from \Register{\$ar3}. \Register{\$ar2} cannot be used with this instruction.
4669 \end{DSPOpcodeNote}
4670 \end{DSPOpcode}
4671
4672 \begin{DSPOpcode}{'LDAXN}
4673 \begin{DSPOpcodeBytefield}{16}
4674 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{11sr} & \monobitbox{4}{0111}
4675 \end{DSPOpcodeBytefield}
4676
4677 \begin{DSPOpcodeFormat}
4678 'LDAXN $axR, @$arS
4679 \end{DSPOpcodeFormat}
4680
4681 \begin{DSPOpcodeDescription}
4682 \item Load register \Register{\$axR.h} with value from memory pointed by register \Register{\$arS}.
4683 Load register \Register{\$axR.l} with value from memory pointed by register \Register{\$ar3}.
4684 Add corresponding indexing register \Register{\$ixS} to addressing register \Register{\$arS} and increment \Register{\$ar3}.
4685 \end{DSPOpcodeDescription}
4686
4687 \begin{DSPOpcodeOperation}
4688 $axR.h = MEM[$arS]
4689 $axR.l = MEM[$ar3]
4690 $arS += $ixS
4691 $ar3++
4692 \end{DSPOpcodeOperation}
4693
4694 \begin{DSPOpcodeNote}
4695 \item \texttt{S} can be either 0 or 1, corresponding to \Register{\$ar0} or \Register{\$ar1}. Thus, \Register{\$arS} is guaranteed to be distinct from \Register{\$ar3}. \Register{\$ar2} cannot be used with this instruction.
4696 \end{DSPOpcodeNote}
4697 \end{DSPOpcode}
4698
4699 \begin{DSPOpcode}{'LS}
4700 \begin{DSPOpcodeBytefield}{16}
4701 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{10dd} & \monobitbox{4}{000s}
4702 \end{DSPOpcodeBytefield}
4703
4704 \begin{DSPOpcodeFormat}
4705 'LS $(0x18+D), $acS.m
4706 \end{DSPOpcodeFormat}
4707
4708 \begin{DSPOpcodeDescription}
4709 \item Load register \Register{\$(0x18+D)} with value from memory pointed by register \Register{\$ar0}.
4710 Store value from register \Register{\$acS.m} to memory location pointed by register \Register{\$ar3}.
4711 Increment both \Register{\$ar0} and \Register{\$ar3}.
4712 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4713 \end{DSPOpcodeDescription}
4714
4715 \begin{DSPOpcodeOperation}
4716 $(0x18+D) = MEM[$ar0]
4717 MEM[$ar3] = $acS.m
4718 $ar0++
4719 $ar3++
4720 \end{DSPOpcodeOperation}
4721
4722 \begin{DSPOpcodeNote}
4723 \item Differs from \Opcode{'SL} in that \Register{\$(0x18+D)} is associated with \Register{\$ar0} instead of \Register{\$ar3} and \Register{\$acS.m} is associated with \Register{\$ar3} instead of \Register{\$ar0}. In both cases, \Register{\$(0x18+D)} is loaded and \Register{\$acS.m} is stored.
4724 \end{DSPOpcodeNote}
4725 \end{DSPOpcode}
4726
4727 \begin{DSPOpcode}{'LSM}
4728 \begin{DSPOpcodeBytefield}{16}
4729 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{10dd} & \monobitbox{4}{100s}
4730 \end{DSPOpcodeBytefield}
4731
4732 \begin{DSPOpcodeFormat}
4733 'LSM $(0x18+D), $acS.m
4734 \end{DSPOpcodeFormat}
4735
4736 \begin{DSPOpcodeDescription}
4737 \item Load register \Register{\$(0x18+D)} with value from memory pointed by register \Register{\$ar0}.
4738 Store value from register \Register{\$acS.m} to memory location pointed by register \Register{\$ar3}.
4739 Add corresponding indexing register \Register{\$ix3} to addressing register \Register{\$ar3} and increment \Register{\$ar0}.
4740 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4741 \end{DSPOpcodeDescription}
4742
4743 \begin{DSPOpcodeOperation}
4744 $(0x18+D) = MEM[$ar0]
4745 MEM[$ar3] = $acS.m
4746 $ar0++
4747 $ar3 += $ix3
4748 \end{DSPOpcodeOperation}
4749
4750 \begin{DSPOpcodeNote}
4751 \item Differs from \Opcode{'SLM} in that \Register{\$(0x18+D)} is associated with \Register{\$ar0} instead of \Register{\$ar3} and \Register{\$acS.m} is associated with \Register{\$ar3} instead of \Register{\$ar0}. In both cases, \Register{\$(0x18+D)} is loaded and \Register{\$acS.m} is stored.
4752 \end{DSPOpcodeNote}
4753 \end{DSPOpcode}
4754
4755 \begin{DSPOpcode}{'LSNM}
4756 \begin{DSPOpcodeBytefield}{16}
4757 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{10dd} & \monobitbox{4}{110s}
4758 \end{DSPOpcodeBytefield}
4759
4760 \begin{DSPOpcodeFormat}
4761 'LSNM $(0x18+D), $acS.m
4762 \end{DSPOpcodeFormat}
4763
4764 \begin{DSPOpcodeDescription}
4765 \item Load register \Register{\$(0x18+D)} with value from memory pointed by register \Register{\$ar0}.
4766 Store value from register \Register{\$acS.m} to memory location pointed by register \Register{\$ar3}.
4767 Add corresponding indexing register \Register{\$ix0} to addressing register \Register{\$ar0} and add corresponding
4768 indexing register \Register{\$ix3} to addressing register \Register{\$ar3}.
4769 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4770 \end{DSPOpcodeDescription}
4771
4772 \begin{DSPOpcodeOperation}
4773 $(0x18+D) = MEM[$ar0]
4774 MEM[$ar3] = $acS.m
4775 $ar0 += $ix0
4776 $ar3 += $ix3
4777 \end{DSPOpcodeOperation}
4778
4779 \begin{DSPOpcodeNote}
4780 \item Differs from \Opcode{'SLNM} in that \Register{\$(0x18+D)} is associated with \Register{\$ar0} instead of \Register{\$ar3} and \Register{\$acS.m} is associated with \Register{\$ar3} instead of \Register{\$ar0}. In both cases, \Register{\$(0x18+D)} is loaded and \Register{\$acS.m} is stored.
4781 \end{DSPOpcodeNote}
4782 \end{DSPOpcode}
4783
4784 \begin{DSPOpcode}{'LSN}
4785 \begin{DSPOpcodeBytefield}{16}
4786 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{10dd} & \monobitbox{4}{010s}
4787 \end{DSPOpcodeBytefield}
4788
4789 \begin{DSPOpcodeFormat}
4790 'LSN $(0x18+D), $acS.m
4791 \end{DSPOpcodeFormat}
4792
4793 \begin{DSPOpcodeDescription}
4794 \item Load register \Register{\$(0x18+D)} with value from memory pointed by register \Register{\$ar0}.
4795 Store value from register \Register{\$acS.m} to memory location pointed by register \Register{\$ar3}.
4796 Add corresponding indexing register \Register{\$ix0} to addressing register \Register{\$ar0} and increment \Register{\$ar3}.
4797 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4798 \end{DSPOpcodeDescription}
4799
4800 \begin{DSPOpcodeOperation}
4801 $(0x18+D) = MEM[$ar0]
4802 MEM[$ar3] = $acS.m
4803 $ar0 += $ix0
4804 $ar3++
4805 \end{DSPOpcodeOperation}
4806
4807 \begin{DSPOpcodeNote}
4808 \item Differs from \Opcode{'SLN} in that \Register{\$(0x18+D)} is associated with \Register{\$ar0} instead of \Register{\$ar3} and \Register{\$acS.m} is associated with \Register{\$ar3} instead of \Register{\$ar0}. In both cases, \Register{\$(0x18+D)} is loaded and \Register{\$acS.m} is stored.
4809 \end{DSPOpcodeNote}
4810 \end{DSPOpcode}
4811
4812 \begin{DSPOpcode}{'MV}
4813 \begin{DSPOpcodeBytefield}{16}
4814 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{0001} & \monobitbox{4}{ddss}
4815 \end{DSPOpcodeBytefield}
4816
4817 \begin{DSPOpcodeFormat}
4818 'MV $(0x18+D), $(0x1c+S)
4819 \end{DSPOpcodeFormat}
4820
4821 \begin{DSPOpcodeDescription}
4822 \item Move value of register \Register{\$(0x1c+S)} to the register \Register{\$(0x18+D)}.
4823 \item When moving from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4824 \end{DSPOpcodeDescription}
4825
4826 \begin{DSPOpcodeOperation}
4827 $(0x18+D) = $(0x1c+S)
4828 \end{DSPOpcodeOperation}
4829 \end{DSPOpcode}
4830
4831 \begin{DSPOpcode}{'NOP}
4832 \begin{DSPOpcodeBytefield}{16}
4833 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{0000} & \monobitbox{4}{00xx}
4834 \end{DSPOpcodeBytefield}
4835
4836 \begin{DSPOpcodeFormat}
4837 'NOP
4838 \end{DSPOpcodeFormat}
4839
4840 \begin{DSPOpcodeDescription}
4841 \item No operation.
4842 \end{DSPOpcodeDescription}
4843
4844 \begin{DSPOpcodeNote}
4845 \item Generally written by not including any extension operation, such as writing \texttt{INC \$ac0} instead of writing \texttt{INC'NOP \$ac0}.
4846 \end{DSPOpcodeNote}
4847 \end{DSPOpcode}
4848
4849 \begin{DSPOpcode}{'NR}
4850 \begin{DSPOpcodeBytefield}{16}
4851 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{0000} & \monobitbox{4}{11rr}
4852 \end{DSPOpcodeBytefield}
4853
4854 \begin{DSPOpcodeFormat}
4855 'NR $arR
4856 \end{DSPOpcodeFormat}
4857
4858 \begin{DSPOpcodeDescription}
4859 \item Add corresponding indexing register \Register{\$ixR} to addressing register \Register{\$arR}.
4860 \end{DSPOpcodeDescription}
4861
4862 \begin{DSPOpcodeOperation}
4863 $arR += $ixR
4864 \end{DSPOpcodeOperation}
4865 \end{DSPOpcode}
4866
4867 \begin{DSPOpcode}{'S}
4868 \begin{DSPOpcodeBytefield}{16}
4869 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{001s} & \monobitbox{4}{s0dd}
4870 \end{DSPOpcodeBytefield}
4871
4872 \begin{DSPOpcodeFormat}
4873 'S @$arD, $(0x1c+S)
4874 \end{DSPOpcodeFormat}
4875
4876 \begin{DSPOpcodeDescription}
4877 \item Store value of register \Register{\$(0x1c+S)} in the memory pointed by register \Register{\$arD}.
4878 Post increment register \Register{\$arD}.
4879 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4880 \end{DSPOpcodeDescription}
4881
4882 \begin{DSPOpcodeOperation}
4883 MEM[$arD] = $(0x1c+S)
4884 $arD++
4885 \end{DSPOpcodeOperation}
4886 \end{DSPOpcode}
4887
4888 \begin{DSPOpcode}{'SL}
4889 \begin{DSPOpcodeBytefield}{16}
4890 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{10dd} & \monobitbox{4}{001s}
4891 \end{DSPOpcodeBytefield}
4892
4893 \begin{DSPOpcodeFormat}
4894 'SL $acS.m, $(0x18+D)
4895 \end{DSPOpcodeFormat}
4896
4897 \begin{DSPOpcodeDescription}
4898 \item Store value from register \Register{\$acS.m} to memory location pointed by register \Register{\$ar0}.
4899 Load register \Register{\$(0x18+D)} with value from memory pointed by register \Register{\$ar3}.
4900 Increment both \Register{\$ar0} and \Register{\$ar3}.
4901 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4902 \end{DSPOpcodeDescription}
4903
4904 \begin{DSPOpcodeOperation}
4905 $(0x18+D) = MEM[$ar3]
4906 MEM[$ar0] = $acS.m
4907 $ar0++
4908 $ar3++
4909 \end{DSPOpcodeOperation}
4910
4911 \begin{DSPOpcodeNote}
4912 \item Differs from \Opcode{'LS} in that \Register{\$(0x18+D)} is associated with \Register{\$ar3} instead of \Register{\$ar0} and \Register{\$acS.m} is associated with \Register{\$ar0} instead of \Register{\$ar3}. In both cases, \Register{\$(0x18+D)} is loaded and \Register{\$acS.m} is stored.
4913 \end{DSPOpcodeNote}
4914 \end{DSPOpcode}
4915
4916 \begin{DSPOpcode}{'SLM}
4917 \begin{DSPOpcodeBytefield}{16}
4918 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{10dd} & \monobitbox{4}{101s}
4919 \end{DSPOpcodeBytefield}
4920
4921 \begin{DSPOpcodeFormat}
4922 'SLM $acS.m, $(0x18+D)
4923 \end{DSPOpcodeFormat}
4924
4925 \begin{DSPOpcodeDescription}
4926 \item Store value from register \Register{\$acS.m} to memory location pointed by register \Register{\$ar0}.
4927 Load register \Register{\$(0x18+D)} with value from memory pointed by register \Register{\$ar3}.
4928 Add corresponding indexing register \Register{\$ix3} to addressing register \Register{\$ar3} and increment \Register{\$ar0}.
4929 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4930 \end{DSPOpcodeDescription}
4931
4932 \begin{DSPOpcodeOperation}
4933 $(0x18+D) = MEM[$ar3]
4934 MEM[$ar0] = $acS.m
4935 $ar0++
4936 $ar3 += $ix3
4937 \end{DSPOpcodeOperation}
4938
4939 \begin{DSPOpcodeNote}
4940 \item Differs from \Opcode{'LSM} in that \Register{\$(0x18+D)} is associated with \Register{\$ar3} instead of \Register{\$ar0} and \Register{\$acS.m} is associated with \Register{\$ar0} instead of \Register{\$ar3}. In both cases, \Register{\$(0x18+D)} is loaded and \Register{\$acS.m} is stored.
4941 \end{DSPOpcodeNote}
4942 \end{DSPOpcode}
4943
4944 \begin{DSPOpcode}{'SLNM}
4945 \begin{DSPOpcodeBytefield}{16}
4946 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{10dd} & \monobitbox{4}{111s}
4947 \end{DSPOpcodeBytefield}
4948
4949 \begin{DSPOpcodeFormat}
4950 'SLNM $acS.m, $(0x18+D)
4951 \end{DSPOpcodeFormat}
4952
4953 \begin{DSPOpcodeDescription}
4954 \item Store value from register \Register{\$acS.m} to memory location pointed by register \Register{\$ar0}.
4955 Load register \Register{\$(0x18+D)} with value from memory pointed by register \Register{\$ar3}.
4956 Add corresponding indexing register \Register{\$ix0} to addressing register \Register{\$ar0} and add corresponding
4957 indexing register \Register{\$ix3} to addressing register \Register{\$ar3}.
4958 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4959 \end{DSPOpcodeDescription}
4960
4961 \begin{DSPOpcodeOperation}
4962 $(0x18+D) = MEM[$ar3]
4963 MEM[$ar0] = $acS.m
4964 $ar0 += $ix0
4965 $ar3 += $ix3
4966 \end{DSPOpcodeOperation}
4967
4968 \begin{DSPOpcodeNote}
4969 \item Differs from \Opcode{'LSNM} in that \Register{\$(0x18+D)} is associated with \Register{\$ar3} instead of \Register{\$ar0} and \Register{\$acS.m} is associated with \Register{\$ar0} instead of \Register{\$ar3}. In both cases, \Register{\$(0x18+D)} is loaded and \Register{\$acS.m} is stored.
4970 \end{DSPOpcodeNote}
4971 \end{DSPOpcode}
4972
4973 \begin{DSPOpcode}{'SLN}
4974 \begin{DSPOpcodeBytefield}{16}
4975 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{10dd} & \monobitbox{4}{011s}
4976 \end{DSPOpcodeBytefield}
4977
4978 \begin{DSPOpcodeFormat}
4979 'SLN $acS.m, $(0x18+D)
4980 \end{DSPOpcodeFormat}
4981
4982 \begin{DSPOpcodeDescription}
4983 \item Store value from register \Register{\$acS.m} to memory location pointed by register \Register{\$ar0}.
4984 Load register \Register{\$(0x18+D)} with value from memory pointed by register \Register{\$ar3}.
4985 Add corresponding indexing register \Register{\$ix0} to addressing register \Register{\$ar0} and increment \Register{\$ar3}.
4986 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
4987 \end{DSPOpcodeDescription}
4988
4989 \begin{DSPOpcodeOperation}
4990 $(0x18+D) = MEM[$ar3]
4991 MEM[$ar0] = $acS.m
4992 $ar0 += $ix0
4993 $ar3++
4994 \end{DSPOpcodeOperation}
4995
4996 \begin{DSPOpcodeNote}
4997 \item Differs from \Opcode{'LSN} in that \Register{\$(0x18+D)} is associated with \Register{\$ar3} instead of \Register{\$ar0} and \Register{\$acS.m} is associated with \Register{\$ar0} instead of \Register{\$ar3}. In both cases, \Register{\$(0x18+D)} is loaded and \Register{\$acS.m} is stored.
4998 \end{DSPOpcodeNote}
4999 \end{DSPOpcode}
5000
5001 \begin{DSPOpcode}{'SN}
5002 \begin{DSPOpcodeBytefield}{16}
5003 \monobitbox{4}{xxxx} & \monobitbox{4}{xxxx} & \monobitbox{4}{001s} & \monobitbox{4}{s1dd}
5004 \end{DSPOpcodeBytefield}
5005
5006 \begin{DSPOpcodeFormat}
5007 'SN @$arD, $(0x1c+S)
5008 \end{DSPOpcodeFormat}
5009
5010 \begin{DSPOpcodeDescription}
5011 \item Store value of register \Register{\$(0x1c+S)} in the memory pointed by register \Register{\$arD}.
5012 Add indexing register \Register{\$ixD} to register \Register{\$arD}.
5013 \item When storing from \Register{\$ac0.m} or \Register{\$ac1.m}, optionally apply saturation depending on the value of \RegisterField{\$sr.SXM} (see \nameref{subsec:SET40}).
5014 \end{DSPOpcodeDescription}
5015
5016 \begin{DSPOpcodeOperation}
5017 MEM[$arD] = $(0x1c+S)
5018 $arD += $ixD
5019 \end{DSPOpcodeOperation}
5020 \end{DSPOpcode}
5021
5022 \section{Instructions sorted by opcode}
5023
5024 \newcommand{\OpcodeRow}[2]{\Opcode{#2} & \texttt{#1} & \pageref{instruction:#2} \\*}
5025 \newcommand{\OpcodeRowUnk}[1]{Unknown & \texttt{#1} \\*}
5026 \newcommand{\OpcodeRowSkip}[0]{\\}
5027
5028 \begin{center}
5029 \begin{longtable}{llr}
5030 Instruction & Opcode & Page \\ \hline
5031 \endhead
5032 \OpcodeRow{0000 0000 0000 0000}{NOP}
5033 \OpcodeRow{0000 0000 0000 01dd}{DAR}
5034 \OpcodeRow{0000 0000 0000 10dd}{IAR}
5035 \OpcodeRow{0000 0000 0000 11dd}{SUBARN}
5036 \OpcodeRow{0000 0000 0001 ssdd}{ADDARN}
5037 \OpcodeRow{0000 0000 0010 0001}{HALT}
5038 \OpcodeRowSkip
5039 \OpcodeRow{0000 0000 010r rrrr}{LOOP}
5040 \OpcodeRow{0000 0000 011r rrrr aaaa aaaa aaaa aaaa}{BLOOP}
5041 \OpcodeRowSkip
5042 \OpcodeRow{0000 0000 100d dddd iiii iiii iiii iiii}{LRI}
5043 \OpcodeRowUnk{0000 0000 101x xxxx}
5044 \OpcodeRow{0000 0000 110d dddd mmmm mmmm mmmm mmmm}{LR}
5045 \OpcodeRow{0000 0000 111s ssss mmmm mmmm mmmm mmmm}{SR}
5046 \OpcodeRowSkip
5047 \OpcodeRow{0000 0010 0111 cccc}{IFcc}
5048 \OpcodeRow{0000 0010 1001 cccc aaaa aaaa aaaa aaaa}{Jcc}
5049 \OpcodeRow{0000 0010 1011 cccc aaaa aaaa aaaa aaaa}{CALLcc}
5050 \OpcodeRow{0000 0010 1101 cccc}{RETcc}
5051 \OpcodeRow{0000 0010 1111 cccc}{RTIcc}
5052 \OpcodeRowSkip
5053 \OpcodeRow{0000 001d 0000 0000 iiii iiii iiii iiii}{ADDI}
5054 \OpcodeRow{0000 001d 0010 0000 iiii iiii iiii iiii}{XORI}
5055 \OpcodeRow{0000 001d 0100 0000 iiii iiii iiii iiii}{ANDI}
5056 \OpcodeRow{0000 001d 0110 0000 iiii iiii iiii iiii}{ORI}
5057 \OpcodeRow{0000 001d 1000 0000 iiii iiii iiii iiii}{CMPI}
5058 \OpcodeRow{0000 001d 1010 0000 iiii iiii iiii iiii}{ANDF}
5059 \OpcodeRow{0000 001d 1100 0000 iiii iiii iiii iiii}{ANDCF}
5060 \OpcodeRowSkip
5061 \OpcodeRow{0000 0010 1100 1010}{LSRN}
5062 \OpcodeRow{0000 0010 1100 1011}{ASRN}
5063 \OpcodeRowSkip
5064 \OpcodeRow{0000 001d 0001 00ss}{ILRR}
5065 \OpcodeRow{0000 001d 0001 01ss}{ILRRD}
5066 \OpcodeRow{0000 001d 0001 10ss}{ILRRI}
5067 \OpcodeRow{0000 001d 0001 11ss}{ILRRN}
5068 \OpcodeRowSkip
5069 \OpcodeRow{0000 010d iiii iiii}{ADDIS}
5070 \OpcodeRow{0000 011d iiii iiii}{CMPIS}
5071 \OpcodeRow{0000 1ddd iiii iiii}{LRIS}
5072 \OpcodeRowSkip
5073 \OpcodeRow{0001 0000 iiii iiii}{LOOPI}
5074 \OpcodeRow{0001 0001 iiii iiii aaaa aaaa aaaa aaaa}{BLOOPI}
5075 \OpcodeRow{0001 0010 xxxx xiii}{SBCLR}
5076 \OpcodeRow{0001 0011 xxxx xiii}{SBSET}
5077 \OpcodeRowSkip
5078 \OpcodeRow{0001 010r 00ii iiii}{LSL}
5079 \OpcodeRow{0001 010r 01ii iiii}{LSR}
5080 \OpcodeRow{0001 010r 10ii iiii}{ASL}
5081 \OpcodeRow{0001 010r 11ii iiii}{ASR}
5082 \OpcodeRow{0001 0110 mmmm mmmm iiii iiii iiii iiii}{SI}
5083 \OpcodeRow{0001 0111 rrr0 cccc}{JRcc}
5084 \OpcodeRow{0001 0111 rrr1 cccc}{CALLRcc}
5085 \OpcodeRowSkip
5086 \OpcodeRow{0001 1000 0ssd dddd}{LRR}
5087 \OpcodeRow{0001 1000 1ssd dddd}{LRRD}
5088 \OpcodeRow{0001 1001 0ssd dddd}{LRRI}
5089 \OpcodeRow{0001 1001 1ssd dddd}{LRRN}
5090 \OpcodeRow{0001 1010 0dds ssss}{SRR}
5091 \OpcodeRow{0001 1010 1dds ssss}{SRRD}
5092 \OpcodeRow{0001 1011 0dds ssss}{SRRI}
5093 \OpcodeRow{0001 1011 1dds ssss}{SRRN}
5094 \OpcodeRow{0001 11dd ddds ssss}{MRR}
5095 \OpcodeRowSkip
5096 \OpcodeRow{0010 0ddd mmmm mmmm}{LRS}
5097 \OpcodeRow{0010 100s mmmm mmmm}{SRSH}
5098 \OpcodeRowUnk{0010 101x mmmm mmmm}
5099 \OpcodeRow{0010 11ss mmmm mmmm}{SRS}
5100 \OpcodeRowSkip
5101 \OpcodeRow{0011 00sd 0xxx xxxx}{XORR}
5102 \OpcodeRow{0011 01sd 0xxx xxxx}{ANDR}
5103 \OpcodeRow{0011 10sd 0xxx xxxx}{ORR}
5104 \OpcodeRow{0011 110d 0xxx xxxx}{ANDC}
5105 \OpcodeRow{0011 111d 0xxx xxxx}{ORC}
5106 \OpcodeRowSkip
5107 \OpcodeRow{0011 000d 1xxx xxxx}{XORC}
5108 \OpcodeRow{0011 001d 1xxx xxxx}{NOT}
5109 \OpcodeRow{0011 01sd 1xxx xxxx}{LSRNRX}
5110 \OpcodeRow{0011 10sd 1xxx xxxx}{ASRNRX}
5111 \OpcodeRow{0011 110d 1xxx xxxx}{LSRNR}
5112 \OpcodeRow{0011 111d 1xxx xxxx}{ASRNR}
5113 \OpcodeRowSkip
5114 \OpcodeRow{0100 0ssd xxxx xxxx}{ADDR}
5115 \OpcodeRow{0100 10sd xxxx xxxx}{ADDAX}
5116 \OpcodeRow{0100 110d xxxx xxxx}{ADD}
5117 \OpcodeRow{0100 111d xxxx xxxx}{ADDP}
5118 \OpcodeRowSkip
5119 \OpcodeRow{0101 0ssd xxxx xxxx}{SUBR}
5120 \OpcodeRow{0101 10sd xxxx xxxx}{SUBAX}
5121 \OpcodeRow{0101 110d xxxx xxxx}{SUB}
5122 \OpcodeRow{0101 111d xxxx xxxx}{SUBP}
5123 \OpcodeRowSkip
5124 \OpcodeRow{0110 0ssd xxxx xxxx}{MOVR}
5125 \OpcodeRow{0110 10sd xxxx xxxx}{MOVAX}
5126 \OpcodeRow{0110 110d xxxx xxxx}{MOV}
5127 \OpcodeRow{0110 111d xxxx xxxx}{MOVP}
5128 \OpcodeRowSkip
5129 \OpcodeRow{0111 00sd xxxx xxxx}{ADDAXL}
5130 \OpcodeRow{0111 010d xxxx xxxx}{INCM}
5131 \OpcodeRow{0111 011d xxxx xxxx}{INC}
5132 \OpcodeRow{0111 100d xxxx xxxx}{DECM}
5133 \OpcodeRow{0111 101d xxxx xxxx}{DEC}
5134 \OpcodeRow{0111 110d xxxx xxxx}{NEG}
5135 \OpcodeRow{0111 111d xxxx xxxx}{MOVNP}
5136 \OpcodeRowSkip
5137 \OpcodeRow{1000 x000 xxxx xxxx}{NX}
5138 \OpcodeRow{1000 r001 xxxx xxxx}{CLR}
5139 \OpcodeRow{1000 0010 xxxx xxxx}{CMP}
5140 \OpcodeRow{1000 0011 xxxx xxxx}{MULAXH}
5141 \OpcodeRow{1000 0100 xxxx xxxx}{CLRP}
5142 \OpcodeRow{1000 0101 xxxx xxxx}{TSTPROD}
5143 \OpcodeRow{1000 011r xxxx xxxx}{TSTAXH}
5144 \OpcodeRowSkip
5145 \OpcodeRow{1000 1010 xxxx xxxx}{M2}
5146 \OpcodeRow{1000 1011 xxxx xxxx}{M0}
5147 \OpcodeRow{1000 1100 xxxx xxxx}{CLR15}
5148 \OpcodeRow{1000 1101 xxxx xxxx}{SET15}
5149 \OpcodeRow{1000 1110 xxxx xxxx}{SET16}
5150 \OpcodeRow{1000 1111 xxxx xxxx}{SET40}
5151 \OpcodeRowSkip
5152 \OpcodeRow{1001 s000 xxxx xxxx}{MUL}
5153 \OpcodeRow{1001 r001 xxxx xxxx}{ASR16}
5154 \OpcodeRow{1001 s01r xxxx xxxx}{MULMVZ}
5155 \OpcodeRow{1001 s10r xxxx xxxx}{MULAC}
5156 \OpcodeRow{1001 s11r xxxx xxxx}{MULMV}
5157 \OpcodeRowSkip
5158 \OpcodeRow{101s t000 xxxx xxxx}{MULX}
5159 \OpcodeRow{1010 d001 xxxx xxxx}{ABS}
5160 \OpcodeRow{1011 r001 xxxx xxxx}{TST}
5161 \OpcodeRow{101s t01r xxxx xxxx}{MULXMVZ}
5162 \OpcodeRow{101s t10r xxxx xxxx}{MULXAC}
5163 \OpcodeRow{101s t11r xxxx xxxx}{MULXMV}
5164 \OpcodeRowSkip
5165 \OpcodeRow{110s t000 xxxx xxxx}{MULC}
5166 \OpcodeRow{110r s001 xxxx xxxx}{CMPAXH}
5167 \OpcodeRow{110s t01r xxxx xxxx}{MULCMVZ}
5168 \OpcodeRow{110s t10r xxxx xxxx}{MULCAC}
5169 \OpcodeRow{110s t11r xxxx xxxx}{MULCMV}
5170 \OpcodeRowSkip
5171 \OpcodeRow{1110 00st xxxx xxxx}{MADDX}
5172 \OpcodeRow{1110 01st xxxx xxxx}{MSUBX}
5173 \OpcodeRow{1110 10st xxxx xxxx}{MADDC}
5174 \OpcodeRow{1110 11st xxxx xxxx}{MSUBC}
5175 \OpcodeRowSkip
5176 \OpcodeRow{1111 000r xxxx xxxx}{LSL16}
5177 \OpcodeRow{1111 001s xxxx xxxx}{MADD}
5178 \OpcodeRow{1111 010r xxxx xxxx}{LSR16}
5179 \OpcodeRow{1111 011s xxxx xxxx}{MSUB}
5180 \OpcodeRow{1111 10sd xxxx xxxx}{ADDPAXZ}
5181 \OpcodeRow{1111 110r xxxx xxxx}{CLRL}
5182 \OpcodeRow{1111 111d xxxx xxxx}{MOVPZ}
5183 \end{longtable}
5184 \end{center}
5185
5186 \pagebreak
5187
5188 \begin{center}
5189 Extension Opcodes
5190 \begin{longtable}{llr}
5191 Instruction & Opcode & Page \\ \hline
5192 \OpcodeRow{xxxx xxxx 0000 00xx}{'NOP}
5193 \OpcodeRow{xxxx xxxx 0000 01rr}{'DR}
5194 \OpcodeRow{xxxx xxxx 0000 10rr}{'IR}
5195 \OpcodeRow{xxxx xxxx 0000 11rr}{'NR}
5196 \OpcodeRow{xxxx xxxx 0001 ddss}{'MV}
5197 \OpcodeRow{xxxx xxxx 001s s0dd}{'S}
5198 \OpcodeRow{xxxx xxxx 001s s1dd}{'SN}
5199 \OpcodeRow{xxxx xxxx 01dd d0ss}{'L}
5200 \OpcodeRow{xxxx xxxx 01dd d1ss}{'LN}
5201 \OpcodeRowSkip
5202 \OpcodeRow{xxxx xxxx 10dd 000s}{'LS}
5203 \OpcodeRow{xxxx xxxx 10dd 001s}{'SL}
5204 \OpcodeRow{xxxx xxxx 10dd 010s}{'LSN}
5205 \OpcodeRow{xxxx xxxx 10dd 011s}{'SLN}
5206 \OpcodeRow{xxxx xxxx 10dd 100s}{'LSM}
5207 \OpcodeRow{xxxx xxxx 10dd 101s}{'SLM}
5208 \OpcodeRow{xxxx xxxx 10dd 110s}{'LSNM}
5209 \OpcodeRow{xxxx xxxx 10dd 111s}{'SLNM}
5210 \OpcodeRowSkip
5211 \OpcodeRow{xxxx xxxx 11dr 00ss}{'LD}
5212 \OpcodeRow{xxxx xxxx 11sr 0011}{'LDAX}
5213 \OpcodeRow{xxxx xxxx 11dr 01ss}{'LDN}
5214 \OpcodeRow{xxxx xxxx 11sr 0111}{'LDAXN}
5215 \OpcodeRow{xxxx xxxx 11dr 10ss}{'LDM}
5216 \OpcodeRow{xxxx xxxx 11sr 1011}{'LDAXM}
5217 \OpcodeRow{xxxx xxxx 11dr 11ss}{'LDNM}
5218 \OpcodeRow{xxxx xxxx 11sr 1111}{'LDAXNM}
5219 \end{longtable}
5220 \end{center}
5221
5222 \end{document}