]>
Commit | Line | Data |
---|---|---|
f7e42eb4 | 1 | @c Copyright 1997 Free Software Foundation, Inc. |
252b5132 RH |
2 | @c This is part of the GAS manual. |
3 | @c For copying conditions, see the file as.texinfo. | |
4 | ||
5 | @node V850-Dependent | |
6 | @chapter v850 Dependent Features | |
7 | ||
8 | @cindex V850 support | |
9 | @menu | |
10 | * V850 Options:: Options | |
11 | * V850 Syntax:: Syntax | |
12 | * V850 Floating Point:: Floating Point | |
13 | * V850 Directives:: V850 Machine Directives | |
14 | * V850 Opcodes:: Opcodes | |
15 | @end menu | |
16 | ||
17 | @node V850 Options | |
18 | @section Options | |
19 | @cindex V850 options (none) | |
20 | @cindex options for V850 (none) | |
21 | @code{@value{AS}} supports the following additional command-line options | |
22 | for the V850 processor family: | |
23 | ||
24 | @cindex command line options, V850 | |
25 | @cindex V850 command line options | |
26 | @table @code | |
27 | ||
28 | @cindex @code{-wsigned_overflow} command line option, V850 | |
29 | @item -wsigned_overflow | |
30 | Causes warnings to be produced when signed immediate values overflow the | |
31 | space available for then within their opcodes. By default this option | |
32 | is disabled as it is possible to receive spurious warnings due to using | |
33 | exact bit patterns as immediate constants. | |
34 | ||
35 | @cindex @code{-wunsigned_overflow} command line option, V850 | |
36 | @item -wunsigned_overflow | |
37 | Causes warnings to be produced when unsigned immediate values overflow | |
38 | the space available for then within their opcodes. By default this | |
39 | option is disabled as it is possible to receive spurious warnings due to | |
40 | using exact bit patterns as immediate constants. | |
41 | ||
42 | @cindex @code{-mv850} command line option, V850 | |
43 | @item -mv850 | |
44 | Specifies that the assembled code should be marked as being targeted at | |
45 | the V850 processor. This allows the linker to detect attempts to link | |
46 | such code with code assembled for other processors. | |
47 | ||
48 | @cindex @code{-mv850e} command line option, V850 | |
49 | @item -mv850e | |
50 | Specifies that the assembled code should be marked as being targeted at | |
51 | the V850E processor. This allows the linker to detect attempts to link | |
52 | such code with code assembled for other processors. | |
53 | ||
54 | @cindex @code{-mv850any} command line option, V850 | |
55 | @item -mv850any | |
56 | Specifies that the assembled code should be marked as being targeted at | |
57 | the V850 processor but support instructions that are specific to the | |
58 | extended variants of the process. This allows the production of | |
59 | binaries that contain target specific code, but which are also intended | |
60 | to be used in a generic fashion. For example libgcc.a contains generic | |
61 | routines used by the code produced by GCC for all versions of the v850 | |
62 | architecture, together with support routines only used by the V850E | |
63 | architecture. | |
64 | ||
65 | @end table | |
66 | ||
67 | ||
68 | @node V850 Syntax | |
69 | @section Syntax | |
70 | @menu | |
71 | * V850-Chars:: Special Characters | |
72 | * V850-Regs:: Register Names | |
73 | @end menu | |
74 | ||
75 | @node V850-Chars | |
76 | @subsection Special Characters | |
77 | ||
78 | @cindex line comment character, V850 | |
79 | @cindex V850 line comment character | |
80 | @samp{#} is the line comment character. | |
81 | @node V850-Regs | |
82 | @subsection Register Names | |
83 | ||
84 | @cindex V850 register names | |
85 | @cindex register names, V850 | |
86 | @code{@value{AS}} supports the following names for registers: | |
87 | @table @code | |
88 | @cindex @code{zero} register, V850 | |
89 | @item general register 0 | |
90 | r0, zero | |
91 | @item general register 1 | |
92 | r1 | |
93 | @item general register 2 | |
94 | r2, hp | |
95 | @cindex @code{sp} register, V850 | |
96 | @item general register 3 | |
97 | r3, sp | |
98 | @cindex @code{gp} register, V850 | |
99 | @item general register 4 | |
100 | r4, gp | |
101 | @cindex @code{tp} register, V850 | |
102 | @item general register 5 | |
103 | r5, tp | |
104 | @item general register 6 | |
105 | r6 | |
106 | @item general register 7 | |
107 | r7 | |
108 | @item general register 8 | |
109 | r8 | |
110 | @item general register 9 | |
111 | r9 | |
112 | @item general register 10 | |
113 | r10 | |
114 | @item general register 11 | |
115 | r11 | |
116 | @item general register 12 | |
117 | r12 | |
118 | @item general register 13 | |
119 | r13 | |
120 | @item general register 14 | |
121 | r14 | |
122 | @item general register 15 | |
123 | r15 | |
124 | @item general register 16 | |
125 | r16 | |
126 | @item general register 17 | |
127 | r17 | |
128 | @item general register 18 | |
129 | r18 | |
130 | @item general register 19 | |
131 | r19 | |
132 | @item general register 20 | |
133 | r20 | |
134 | @item general register 21 | |
135 | r21 | |
136 | @item general register 22 | |
137 | r22 | |
138 | @item general register 23 | |
139 | r23 | |
140 | @item general register 24 | |
141 | r24 | |
142 | @item general register 25 | |
143 | r25 | |
144 | @item general register 26 | |
145 | r26 | |
146 | @item general register 27 | |
147 | r27 | |
148 | @item general register 28 | |
149 | r28 | |
150 | @item general register 29 | |
151 | r29 | |
152 | @cindex @code{ep} register, V850 | |
153 | @item general register 30 | |
154 | r30, ep | |
155 | @cindex @code{lp} register, V850 | |
156 | @item general register 31 | |
157 | r31, lp | |
158 | @cindex @code{eipc} register, V850 | |
159 | @item system register 0 | |
160 | eipc | |
161 | @cindex @code{eipsw} register, V850 | |
162 | @item system register 1 | |
163 | eipsw | |
164 | @cindex @code{fepc} register, V850 | |
165 | @item system register 2 | |
166 | fepc | |
167 | @cindex @code{fepsw} register, V850 | |
168 | @item system register 3 | |
169 | fepsw | |
170 | @cindex @code{ecr} register, V850 | |
171 | @item system register 4 | |
172 | ecr | |
173 | @cindex @code{psw} register, V850 | |
174 | @item system register 5 | |
175 | psw | |
176 | @cindex @code{ctpc} register, V850 | |
177 | @item system register 16 | |
178 | ctpc | |
179 | @cindex @code{ctpsw} register, V850 | |
180 | @item system register 17 | |
181 | ctpsw | |
182 | @cindex @code{dbpc} register, V850 | |
183 | @item system register 18 | |
184 | dbpc | |
185 | @cindex @code{dbpsw} register, V850 | |
186 | @item system register 19 | |
187 | dbpsw | |
188 | @cindex @code{ctbp} register, V850 | |
189 | @item system register 20 | |
190 | ctbp | |
191 | @end table | |
192 | ||
193 | @node V850 Floating Point | |
194 | @section Floating Point | |
195 | ||
196 | @cindex floating point, V850 (@sc{ieee}) | |
197 | @cindex V850 floating point (@sc{ieee}) | |
198 | The V850 family uses @sc{ieee} floating-point numbers. | |
199 | ||
200 | @node V850 Directives | |
201 | @section V850 Machine Directives | |
202 | ||
203 | @cindex machine directives, V850 | |
204 | @cindex V850 machine directives | |
205 | @table @code | |
206 | @cindex @code{offset} directive, V850 | |
207 | @item .offset @var{<expression>} | |
208 | Moves the offset into the current section to the specified amount. | |
209 | ||
210 | @cindex @code{section} directive, V850 | |
211 | @item .section "name", <type> | |
212 | This is an extension to the standard .section directive. It sets the | |
213 | current section to be <type> and creates an alias for this section | |
214 | called "name". | |
215 | ||
216 | @cindex @code{.v850} directive, V850 | |
217 | @item .v850 | |
218 | Specifies that the assembled code should be marked as being targeted at | |
219 | the V850 processor. This allows the linker to detect attempts to link | |
220 | such code with code assembled for other processors. | |
221 | ||
222 | @cindex @code{.v850e} directive, V850 | |
223 | @item .v850e | |
224 | Specifies that the assembled code should be marked as being targeted at | |
225 | the V850E processor. This allows the linker to detect attempts to link | |
226 | such code with code assembled for other processors. | |
227 | ||
228 | @end table | |
229 | ||
230 | @node V850 Opcodes | |
231 | @section Opcodes | |
232 | ||
233 | @cindex V850 opcodes | |
234 | @cindex opcodes for V850 | |
235 | @code{@value{AS}} implements all the standard V850 opcodes. | |
236 | ||
237 | @code{@value{AS}} also implements the following pseudo ops: | |
238 | ||
239 | @table @code | |
240 | ||
241 | @cindex @code{hi0} pseudo-op, V850 | |
242 | @item hi0() | |
243 | Computes the higher 16 bits of the given expression and stores it into | |
244 | the immediate operand field of the given instruction. For example: | |
245 | ||
246 | @samp{mulhi hi0(here - there), r5, r6} | |
247 | ||
248 | computes the difference between the address of labels 'here' and | |
249 | 'there', takes the upper 16 bits of this difference, shifts it down 16 | |
250 | bits and then mutliplies it by the lower 16 bits in register 5, putting | |
251 | the result into register 6. | |
252 | ||
253 | @cindex @code{lo} pseudo-op, V850 | |
254 | @item lo() | |
255 | Computes the lower 16 bits of the given expression and stores it into | |
256 | the immediate operand field of the given instruction. For example: | |
257 | ||
258 | @samp{addi lo(here - there), r5, r6} | |
259 | ||
260 | computes the difference between the address of labels 'here' and | |
261 | 'there', takes the lower 16 bits of this difference and adds it to | |
262 | register 5, putting the result into register 6. | |
263 | ||
264 | @cindex @code{hi} pseudo-op, V850 | |
265 | @item hi() | |
266 | Computes the higher 16 bits of the given expression and then adds the | |
267 | value of the most significant bit of the lower 16 bits of the expression | |
268 | and stores the result into the immediate operand field of the given | |
269 | instruction. For example the following code can be used to compute the | |
270 | address of the label 'here' and store it into register 6: | |
271 | ||
272 | @samp{movhi hi(here), r0, r6} | |
273 | @samp{movea lo(here), r6, r6} | |
274 | ||
275 | The reason for this special behaviour is that movea performs a sign | |
276 | extention on its immediate operand. So for example if the address of | |
277 | 'here' was 0xFFFFFFFF then without the special behaviour of the hi() | |
278 | pseudo-op the movhi instruction would put 0xFFFF0000 into r6, then the | |
279 | movea instruction would takes its immediate operand, 0xFFFF, sign extend | |
280 | it to 32 bits, 0xFFFFFFFF, and then add it into r6 giving 0xFFFEFFFF | |
281 | which is wrong (the fifth nibble is E). With the hi() pseudo op adding | |
282 | in the top bit of the lo() pseudo op, the movhi instruction actually | |
283 | stores 0 into r6 (0xFFFF + 1 = 0x0000), so that the movea instruction | |
284 | stores 0xFFFFFFFF into r6 - the right value. | |
285 | ||
286 | @cindex @code{hilo} pseudo-op, V850 | |
287 | @item hilo() | |
288 | Computes the 32 bit value of the given expression and stores it into | |
289 | the immediate operand field of the given instruction (which must be a | |
290 | mov instruction). For example: | |
291 | ||
292 | @samp{mov hilo(here), r6} | |
293 | ||
294 | computes the absolute address of label 'here' and puts the result into | |
295 | register 6. | |
296 | ||
297 | @cindex @code{sdaoff} pseudo-op, V850 | |
298 | @item sdaoff() | |
299 | Computes the offset of the named variable from the start of the Small | |
300 | Data Area (whoes address is held in register 4, the GP register) and | |
301 | stores the result as a 16 bit signed value in the immediate operand | |
302 | field of the given instruction. For example: | |
303 | ||
304 | @samp{ld.w sdaoff(_a_variable)[gp],r6} | |
305 | ||
306 | loads the contents of the location pointed to by the label '_a_variable' | |
307 | into register 6, provided that the label is located somewhere within +/- | |
308 | 32K of the address held in the GP register. [Note the linker assumes | |
309 | that the GP register contains a fixed address set to the address of the | |
310 | label called '__gp'. This can either be set up automatically by the | |
311 | linker, or specifically set by using the @samp{--defsym __gp=<value>} | |
312 | command line option]. | |
313 | ||
314 | @cindex @code{tdaoff} pseudo-op, V850 | |
315 | @item tdaoff() | |
316 | Computes the offset of the named variable from the start of the Tiny | |
317 | Data Area (whoes address is held in register 30, the EP register) and | |
318 | stores the result as a 4,5, 7 or 8 bit unsigned value in the immediate | |
319 | operand field of the given instruction. For example: | |
320 | ||
321 | @samp{sld.w tdaoff(_a_variable)[ep],r6} | |
322 | ||
323 | loads the contents of the location pointed to by the label '_a_variable' | |
324 | into register 6, provided that the label is located somewhere within +256 | |
325 | bytes of the address held in the EP register. [Note the linker assumes | |
326 | that the EP register contains a fixed address set to the address of the | |
327 | label called '__ep'. This can either be set up automatically by the | |
328 | linker, or specifically set by using the @samp{--defsym __ep=<value>} | |
329 | command line option]. | |
330 | ||
331 | @cindex @code{zdaoff} pseudo-op, V850 | |
332 | @item zdaoff() | |
333 | Computes the offset of the named variable from address 0 and stores the | |
334 | result as a 16 bit signed value in the immediate operand field of the | |
335 | given instruction. For example: | |
336 | ||
337 | @samp{movea zdaoff(_a_variable),zero,r6} | |
338 | ||
339 | puts the address of the label '_a_variable' into register 6, assuming | |
340 | that the label is somewhere within the first 32K of memory. (Strictly | |
341 | speaking it also possible to access the last 32K of memory as well, as | |
342 | the offsets are signed). | |
343 | ||
344 | @cindex @code{ctoff} pseudo-op, V850 | |
345 | @item ctoff() | |
346 | Computes the offset of the named variable from the start of the Call | |
347 | Table Area (whoes address is helg in system register 20, the CTBP | |
348 | register) and stores the result a 6 or 16 bit unsigned value in the | |
349 | immediate field of then given instruction or piece of data. For | |
350 | example: | |
351 | ||
352 | @samp{callt ctoff(table_func1)} | |
353 | ||
354 | will put the call the function whoes address is held in the call table | |
355 | at the location labeled 'table_func1'. | |
356 | ||
357 | @end table | |
358 | ||
359 | ||
360 | For information on the V850 instruction set, see @cite{V850 | |
361 | Family 32-/16-Bit single-Chip Microcontroller Architecture Manual} from NEC. | |
362 | Ltd. | |
363 |