Blackfin-Syntax.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2017 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>Using as: Blackfin Syntax</title>
  15. <meta name="description" content="Using as: Blackfin Syntax">
  16. <meta name="keywords" content="Using as: Blackfin Syntax">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="Blackfin_002dDependent.html#Blackfin_002dDependent" rel="up" title="Blackfin-Dependent">
  25. <link href="Blackfin-Directives.html#Blackfin-Directives" rel="next" title="Blackfin Directives">
  26. <link href="Blackfin-Options.html#Blackfin-Options" rel="prev" title="Blackfin Options">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.smallquotation {font-size: smaller}
  31. div.display {margin-left: 3.2em}
  32. div.example {margin-left: 3.2em}
  33. div.indentedblock {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style:oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nocodebreak {white-space:nowrap}
  49. span.nolinebreak {white-space:nowrap}
  50. span.roman {font-family:serif; font-weight:normal}
  51. span.sansserif {font-family:sans-serif; font-weight:normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  57. <a name="Blackfin-Syntax"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Blackfin-Directives.html#Blackfin-Directives" accesskey="n" rel="next">Blackfin Directives</a>, Previous: <a href="Blackfin-Options.html#Blackfin-Options" accesskey="p" rel="prev">Blackfin Options</a>, Up: <a href="Blackfin_002dDependent.html#Blackfin_002dDependent" accesskey="u" rel="up">Blackfin-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Syntax-7"></a>
  64. <h4 class="subsection">9.6.2 Syntax</h4>
  65. <a name="index-Blackfin-syntax"></a>
  66. <a name="index-syntax_002c-Blackfin"></a>
  67. <dl compact="compact">
  68. <dt><code>Special Characters</code></dt>
  69. <dd><p>Assembler input is free format and may appear anywhere on the line.
  70. One instruction may extend across multiple lines or more than one
  71. instruction may appear on the same line. White space (space, tab,
  72. comments or newline) may appear anywhere between tokens. A token must
  73. not have embedded spaces. Tokens include numbers, register names,
  74. keywords, user identifiers, and also some multicharacter special
  75. symbols like &quot;+=&quot;, &quot;/*&quot; or &quot;||&quot;.
  76. </p>
  77. <p>Comments are introduced by the &lsquo;<samp>#</samp>&rsquo; character and extend to the
  78. end of the current line. If the &lsquo;<samp>#</samp>&rsquo; appears as the first
  79. character of a line, the whole line is treated as a comment, but in
  80. this case the line can also be a logical line number directive
  81. (see <a href="Comments.html#Comments">Comments</a>) or a preprocessor control command
  82. (see <a href="Preprocessing.html#Preprocessing">Preprocessing</a>).
  83. </p>
  84. </dd>
  85. <dt><code>Instruction Delimiting</code></dt>
  86. <dd><p>A semicolon must terminate every instruction. Sometimes a complete
  87. instruction will consist of more than one operation. There are two
  88. cases where this occurs. The first is when two general operations
  89. are combined. Normally a comma separates the different parts, as in
  90. </p>
  91. <div class="smallexample">
  92. <pre class="smallexample">a0= r3.h * r2.l, a1 = r3.l * r2.h ;
  93. </pre></div>
  94. <p>The second case occurs when a general instruction is combined with one
  95. or two memory references for joint issue. The latter portions are
  96. set off by a &quot;||&quot; token.
  97. </p>
  98. <div class="smallexample">
  99. <pre class="smallexample">a0 = r3.h * r2.l || r1 = [p3++] || r4 = [i2++];
  100. </pre></div>
  101. <p>Multiple instructions can occur on the same line. Each must be
  102. terminated by a semicolon character.
  103. </p>
  104. </dd>
  105. <dt><code>Register Names</code></dt>
  106. <dd>
  107. <p>The assembler treats register names and instruction keywords in a case
  108. insensitive manner. User identifiers are case sensitive. Thus, R3.l,
  109. R3.L, r3.l and r3.L are all equivalent input to the assembler.
  110. </p>
  111. <p>Register names are reserved and may not be used as program identifiers.
  112. </p>
  113. <p>Some operations (such as &quot;Move Register&quot;) require a register pair.
  114. Register pairs are always data registers and are denoted using a colon,
  115. eg., R3:2. The larger number must be written firsts. Note that the
  116. hardware only supports odd-even pairs, eg., R7:6, R5:4, R3:2, and R1:0.
  117. </p>
  118. <p>Some instructions (such as &ndash;SP (Push Multiple)) require a group of
  119. adjacent registers. Adjacent registers are denoted in the syntax by
  120. the range enclosed in parentheses and separated by a colon, eg., (R7:3).
  121. Again, the larger number appears first.
  122. </p>
  123. <p>Portions of a particular register may be individually specified. This
  124. is written with a dot (&quot;.&quot;) following the register name and then a
  125. letter denoting the desired portion. For 32-bit registers, &quot;.H&quot;
  126. denotes the most significant (&quot;High&quot;) portion. &quot;.L&quot; denotes the
  127. least-significant portion. The subdivisions of the 40-bit registers
  128. are described later.
  129. </p>
  130. </dd>
  131. <dt><code>Accumulators</code></dt>
  132. <dd><p>The set of 40-bit registers A1 and A0 that normally contain data that
  133. is being manipulated. Each accumulator can be accessed in four ways.
  134. </p>
  135. <dl compact="compact">
  136. <dt><code>one 40-bit register</code></dt>
  137. <dd><p>The register will be referred to as A1 or A0.
  138. </p></dd>
  139. <dt><code>one 32-bit register</code></dt>
  140. <dd><p>The registers are designated as A1.W or A0.W.
  141. </p></dd>
  142. <dt><code>two 16-bit registers</code></dt>
  143. <dd><p>The registers are designated as A1.H, A1.L, A0.H or A0.L.
  144. </p></dd>
  145. <dt><code>one 8-bit register</code></dt>
  146. <dd><p>The registers are designated as A1.X or A0.X for the bits that
  147. extend beyond bit 31.
  148. </p></dd>
  149. </dl>
  150. </dd>
  151. <dt><code>Data Registers</code></dt>
  152. <dd><p>The set of 32-bit registers (R0, R1, R2, R3, R4, R5, R6 and R7) that
  153. normally contain data for manipulation. These are abbreviated as
  154. D-register or Dreg. Data registers can be accessed as 32-bit registers
  155. or as two independent 16-bit registers. The least significant 16 bits
  156. of each register is called the &quot;low&quot; half and is designated with &quot;.L&quot;
  157. following the register name. The most significant 16 bits are called
  158. the &quot;high&quot; half and is designated with &quot;.H&quot; following the name.
  159. </p>
  160. <div class="smallexample">
  161. <pre class="smallexample"> R7.L, r2.h, r4.L, R0.H
  162. </pre></div>
  163. </dd>
  164. <dt><code>Pointer Registers</code></dt>
  165. <dd><p>The set of 32-bit registers (P0, P1, P2, P3, P4, P5, SP and FP) that
  166. normally contain byte addresses of data structures. These are
  167. abbreviated as P-register or Preg.
  168. </p>
  169. <div class="smallexample">
  170. <pre class="smallexample">p2, p5, fp, sp
  171. </pre></div>
  172. </dd>
  173. <dt><code>Stack Pointer SP</code></dt>
  174. <dd><p>The stack pointer contains the 32-bit address of the last occupied
  175. byte location in the stack. The stack grows by decrementing the
  176. stack pointer.
  177. </p>
  178. </dd>
  179. <dt><code>Frame Pointer FP</code></dt>
  180. <dd><p>The frame pointer contains the 32-bit address of the previous frame
  181. pointer in the stack. It is located at the top of a frame.
  182. </p>
  183. </dd>
  184. <dt><code>Loop Top</code></dt>
  185. <dd><p>LT0 and LT1. These registers contain the 32-bit address of the top of
  186. a zero overhead loop.
  187. </p>
  188. </dd>
  189. <dt><code>Loop Count</code></dt>
  190. <dd><p>LC0 and LC1. These registers contain the 32-bit counter of the zero
  191. overhead loop executions.
  192. </p>
  193. </dd>
  194. <dt><code>Loop Bottom</code></dt>
  195. <dd><p>LB0 and LB1. These registers contain the 32-bit address of the bottom
  196. of a zero overhead loop.
  197. </p>
  198. </dd>
  199. <dt><code>Index Registers</code></dt>
  200. <dd><p>The set of 32-bit registers (I0, I1, I2, I3) that normally contain byte
  201. addresses of data structures. Abbreviated I-register or Ireg.
  202. </p>
  203. </dd>
  204. <dt><code>Modify Registers</code></dt>
  205. <dd><p>The set of 32-bit registers (M0, M1, M2, M3) that normally contain
  206. offset values that are added and subtracted to one of the index
  207. registers. Abbreviated as Mreg.
  208. </p>
  209. </dd>
  210. <dt><code>Length Registers</code></dt>
  211. <dd><p>The set of 32-bit registers (L0, L1, L2, L3) that normally contain the
  212. length in bytes of the circular buffer. Abbreviated as Lreg. Clear
  213. the Lreg to disable circular addressing for the corresponding Ireg.
  214. </p>
  215. </dd>
  216. <dt><code>Base Registers</code></dt>
  217. <dd><p>The set of 32-bit registers (B0, B1, B2, B3) that normally contain the
  218. base address in bytes of the circular buffer. Abbreviated as Breg.
  219. </p>
  220. </dd>
  221. <dt><code>Floating Point</code></dt>
  222. <dd><p>The Blackfin family has no hardware floating point but the .float
  223. directive generates ieee floating point numbers for use with software
  224. floating point libraries.
  225. </p>
  226. </dd>
  227. <dt><code>Blackfin Opcodes</code></dt>
  228. <dd><p>For detailed information on the Blackfin machine instruction set, see
  229. the Blackfin(r) Processor Instruction Set Reference.
  230. </p>
  231. </dd>
  232. </dl>
  233. <hr>
  234. <div class="header">
  235. <p>
  236. Next: <a href="Blackfin-Directives.html#Blackfin-Directives" accesskey="n" rel="next">Blackfin Directives</a>, Previous: <a href="Blackfin-Options.html#Blackfin-Options" accesskey="p" rel="prev">Blackfin Options</a>, Up: <a href="Blackfin_002dDependent.html#Blackfin_002dDependent" accesskey="u" rel="up">Blackfin-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  237. </div>
  238. </body>
  239. </html>