329 lines
9.3 KiB
HTML
329 lines
9.3 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<!-- This HTML file has been created by texi2html 1.52
|
|
from ../texi/as.texinfo on 24 April 1999 -->
|
|
|
|
<TITLE>Using as - D10V Dependent Features</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
Go to the <A HREF="as_1.html">first</A>, <A HREF="as_11.html">previous</A>, <A HREF="as_13.html">next</A>, <A HREF="as_27.html">last</A> section, <A HREF="as_toc.html">table of contents</A>.
|
|
<P><HR><P>
|
|
|
|
|
|
<H1><A NAME="SEC160" HREF="as_toc.html#TOC160">D10V Dependent Features</A></H1>
|
|
|
|
<P>
|
|
<A NAME="IDX493"></A>
|
|
|
|
</P>
|
|
|
|
|
|
<H2><A NAME="SEC161" HREF="as_toc.html#TOC161">D10V Options</A></H2>
|
|
<P>
|
|
<A NAME="IDX494"></A>
|
|
<A NAME="IDX495"></A>
|
|
The Mitsubishi D10V version of <CODE>as</CODE> has a few machine
|
|
dependent options.
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><SAMP>`-O'</SAMP>
|
|
<DD>
|
|
The D10V can often execute two sub-instructions in parallel. When this option
|
|
is used, <CODE>as</CODE> will attempt to optimize its output by detecting when
|
|
instructions can be executed in parallel.
|
|
<DT><SAMP>`--nowarnswap'</SAMP>
|
|
<DD>
|
|
To optimize execution performance, <CODE>as</CODE> will sometimes swap the
|
|
order of instructions. Normally this generates a warning. When this option
|
|
is used, no warning will be generated when instructions are swapped.
|
|
</DL>
|
|
|
|
|
|
|
|
<H2><A NAME="SEC162" HREF="as_toc.html#TOC162">Syntax</A></H2>
|
|
<P>
|
|
<A NAME="IDX496"></A>
|
|
<A NAME="IDX497"></A>
|
|
|
|
</P>
|
|
<P>
|
|
The D10V syntax is based on the syntax in Mitsubishi's D10V architecture manual.
|
|
The differences are detailed below.
|
|
|
|
</P>
|
|
|
|
|
|
|
|
<H3><A NAME="SEC163" HREF="as_toc.html#TOC163">Size Modifiers</A></H3>
|
|
<P>
|
|
<A NAME="IDX498"></A>
|
|
<A NAME="IDX499"></A>
|
|
The D10V version of <CODE>as</CODE> uses the instruction names in the D10V
|
|
Architecture Manual. However, the names in the manual are sometimes ambiguous.
|
|
There are instruction names that can assemble to a short or long form opcode.
|
|
How does the assembler pick the correct form? <CODE>as</CODE> will always pick the
|
|
smallest form if it can. When dealing with a symbol that is not defined yet when a
|
|
line is being assembled, it will always use the long form. If you need to force the
|
|
assembler to use either the short or long form of the instruction, you can append
|
|
either <SAMP>`.s'</SAMP> (short) or <SAMP>`.l'</SAMP> (long) to it. For example, if you are writing
|
|
an assembly program and you want to do a branch to a symbol that is defined later
|
|
in your program, you can write <SAMP>`bra.s foo'</SAMP>.
|
|
Objdump and GDB will always append <SAMP>`.s'</SAMP> or <SAMP>`.l'</SAMP> to instructions which
|
|
have both short and long forms.
|
|
|
|
</P>
|
|
|
|
|
|
<H3><A NAME="SEC164" HREF="as_toc.html#TOC164">Sub-Instructions</A></H3>
|
|
<P>
|
|
<A NAME="IDX500"></A>
|
|
<A NAME="IDX501"></A>
|
|
The D10V assembler takes as input a series of instructions, either one-per-line,
|
|
or in the special two-per-line format described in the next section. Some of these
|
|
instructions will be short-form or sub-instructions. These sub-instructions can be packed
|
|
into a single instruction. The assembler will do this automatically. It will also detect
|
|
when it should not pack instructions. For example, when a label is defined, the next
|
|
instruction will never be packaged with the previous one. Whenever a branch and link
|
|
instruction is called, it will not be packaged with the next instruction so the return
|
|
address will be valid. Nops are automatically inserted when necessary.
|
|
|
|
</P>
|
|
<P>
|
|
If you do not want the assembler automatically making these decisions, you can control
|
|
the packaging and execution type (parallel or sequential) with the special execution
|
|
symbols described in the next section.
|
|
|
|
</P>
|
|
|
|
|
|
<H3><A NAME="SEC165" HREF="as_toc.html#TOC165">Special Characters</A></H3>
|
|
<P>
|
|
<A NAME="IDX502"></A>
|
|
<A NAME="IDX503"></A>
|
|
<SAMP>`;'</SAMP> and <SAMP>`#'</SAMP> are the line comment characters.
|
|
<A NAME="IDX504"></A>
|
|
<A NAME="IDX505"></A>
|
|
Sub-instructions may be executed in order, in reverse-order, or in parallel.
|
|
Instructions listed in the standard one-per-line format will be executed sequentially.
|
|
To specify the executing order, use the following symbols:
|
|
<DL COMPACT>
|
|
|
|
<DT><SAMP>`->'</SAMP>
|
|
<DD>
|
|
Sequential with instruction on the left first.
|
|
<DT><SAMP>`<-'</SAMP>
|
|
<DD>
|
|
Sequential with instruction on the right first.
|
|
<DT><SAMP>`||'</SAMP>
|
|
<DD>
|
|
Parallel
|
|
</DL>
|
|
<P>
|
|
The D10V syntax allows either one instruction per line, one instruction per line with
|
|
the execution symbol, or two instructions per line. For example
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>abs a1 -> abs r0</CODE>
|
|
<DD>
|
|
Execute these sequentially. The instruction on the right is in the right
|
|
container and is executed second.
|
|
<DT><CODE>abs r0 <- abs a1</CODE>
|
|
<DD>
|
|
Execute these reverse-sequentially. The instruction on the right is in the right
|
|
container, and is executed first.
|
|
<DT><CODE>ld2w r2,@r8+ || mac a0,r0,r7</CODE>
|
|
<DD>
|
|
Execute these in parallel.
|
|
<DT><CODE>ld2w r2,@r8+ ||</CODE>
|
|
<DD>
|
|
<DT><CODE>mac a0,r0,r7</CODE>
|
|
<DD>
|
|
Two-line format. Execute these in parallel.
|
|
<DT><CODE>ld2w r2,@r8+</CODE>
|
|
<DD>
|
|
<DT><CODE>mac a0,r0,r7</CODE>
|
|
<DD>
|
|
Two-line format. Execute these sequentially. Assembler will
|
|
put them in the proper containers.
|
|
<DT><CODE>ld2w r2,@r8+ -></CODE>
|
|
<DD>
|
|
<DT><CODE>mac a0,r0,r7</CODE>
|
|
<DD>
|
|
Two-line format. Execute these sequentially. Same as above but
|
|
second instruction will always go into right container.
|
|
</DL>
|
|
<P>
|
|
<A NAME="IDX506"></A>
|
|
<A NAME="IDX507"></A>
|
|
Since <SAMP>`$'</SAMP> has no special meaning, you may use it in symbol names.
|
|
|
|
</P>
|
|
|
|
|
|
<H3><A NAME="SEC166" HREF="as_toc.html#TOC166">Register Names</A></H3>
|
|
<P>
|
|
<A NAME="IDX508"></A>
|
|
<A NAME="IDX509"></A>
|
|
You can use the predefined symbols <SAMP>`r0'</SAMP> through <SAMP>`r15'</SAMP> to refer to the D10V
|
|
registers. You can also use <SAMP>`sp'</SAMP> as an alias for <SAMP>`r15'</SAMP>. The accumulators
|
|
are <SAMP>`a0'</SAMP> and <SAMP>`a1'</SAMP>. There are special register-pair names that may
|
|
optionally be used in opcodes that require even-numbered registers. Register names are
|
|
not case sensitive.
|
|
|
|
</P>
|
|
<P>
|
|
Register Pairs
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>r0-r1</CODE>
|
|
<DD>
|
|
<DT><CODE>r2-r3</CODE>
|
|
<DD>
|
|
<DT><CODE>r4-r5</CODE>
|
|
<DD>
|
|
<DT><CODE>r6-r7</CODE>
|
|
<DD>
|
|
<DT><CODE>r8-r9</CODE>
|
|
<DD>
|
|
<DT><CODE>r10-r11</CODE>
|
|
<DD>
|
|
<DT><CODE>r12-r13</CODE>
|
|
<DD>
|
|
<DT><CODE>r14-r15</CODE>
|
|
<DD>
|
|
</DL>
|
|
|
|
<P>
|
|
The D10V also has predefined symbols for these control registers and status bits:
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>psw</CODE>
|
|
<DD>
|
|
Processor Status Word
|
|
<DT><CODE>bpsw</CODE>
|
|
<DD>
|
|
Backup Processor Status Word
|
|
<DT><CODE>pc</CODE>
|
|
<DD>
|
|
Program Counter
|
|
<DT><CODE>bpc</CODE>
|
|
<DD>
|
|
Backup Program Counter
|
|
<DT><CODE>rpt_c</CODE>
|
|
<DD>
|
|
Repeat Count
|
|
<DT><CODE>rpt_s</CODE>
|
|
<DD>
|
|
Repeat Start address
|
|
<DT><CODE>rpt_e</CODE>
|
|
<DD>
|
|
Repeat End address
|
|
<DT><CODE>mod_s</CODE>
|
|
<DD>
|
|
Modulo Start address
|
|
<DT><CODE>mod_e</CODE>
|
|
<DD>
|
|
Modulo End address
|
|
<DT><CODE>iba</CODE>
|
|
<DD>
|
|
Instruction Break Address
|
|
<DT><CODE>f0</CODE>
|
|
<DD>
|
|
Flag 0
|
|
<DT><CODE>f1</CODE>
|
|
<DD>
|
|
Flag 1
|
|
<DT><CODE>c</CODE>
|
|
<DD>
|
|
Carry flag
|
|
</DL>
|
|
<P>
|
|
|
|
|
|
|
|
<H3><A NAME="SEC167" HREF="as_toc.html#TOC167">Addressing Modes</A></H3>
|
|
<P>
|
|
<A NAME="IDX510"></A>
|
|
<A NAME="IDX511"></A>
|
|
<CODE>as</CODE> understands the following addressing modes for the D10V.
|
|
<CODE>R<VAR>n</VAR></CODE> in the following refers to any of the numbered
|
|
registers, but <EM>not</EM> the control registers.
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>R<VAR>n</VAR></CODE>
|
|
<DD>
|
|
Register direct
|
|
<DT><CODE>@R<VAR>n</VAR></CODE>
|
|
<DD>
|
|
Register indirect
|
|
<DT><CODE>@R<VAR>n</VAR>+</CODE>
|
|
<DD>
|
|
Register indirect with post-increment
|
|
<DT><CODE>@R<VAR>n</VAR>-</CODE>
|
|
<DD>
|
|
Register indirect with post-decrement
|
|
<DT><CODE>@-SP</CODE>
|
|
<DD>
|
|
Register indirect with pre-decrement
|
|
<DT><CODE>@(<VAR>disp</VAR>, R<VAR>n</VAR>)</CODE>
|
|
<DD>
|
|
Register indirect with displacement
|
|
<DT><CODE><VAR>addr</VAR></CODE>
|
|
<DD>
|
|
PC relative address (for branch or rep).
|
|
<DT><CODE>#<VAR>imm</VAR></CODE>
|
|
<DD>
|
|
Immediate data (the <SAMP>`#'</SAMP> is optional and ignored)
|
|
</DL>
|
|
|
|
|
|
|
|
<H3><A NAME="SEC168" HREF="as_toc.html#TOC168">@WORD Modifier</A></H3>
|
|
<P>
|
|
<A NAME="IDX512"></A>
|
|
<A NAME="IDX513"></A>
|
|
Any symbol followed by <CODE>@word</CODE> will be replaced by the symbol's value
|
|
shifted right by 2. This is used in situations such as loading a register
|
|
with the address of a function (or any other code fragment). For example, if
|
|
you want to load a register with the location of the function <CODE>main</CODE> then
|
|
jump to that function, you could do it as follws:
|
|
|
|
<PRE>
|
|
ldi r2, main@word
|
|
jmp r2
|
|
</PRE>
|
|
|
|
|
|
|
|
<H2><A NAME="SEC169" HREF="as_toc.html#TOC169">Floating Point</A></H2>
|
|
<P>
|
|
<A NAME="IDX514"></A>
|
|
<A NAME="IDX515"></A>
|
|
The D10V has no hardware floating point, but the <CODE>.float</CODE> and <CODE>.double</CODE>
|
|
directives generates IEEE floating-point numbers for compatibility
|
|
with other development tools.
|
|
|
|
</P>
|
|
|
|
|
|
<H2><A NAME="SEC170" HREF="as_toc.html#TOC170">Opcodes</A></H2>
|
|
<P>
|
|
<A NAME="IDX516"></A>
|
|
<A NAME="IDX517"></A>
|
|
<A NAME="IDX518"></A>
|
|
<A NAME="IDX519"></A>
|
|
For detailed information on the D10V machine instruction set, see
|
|
<CITE>D10V Architecture: A VLIW Microprocessor for Multimedia Applications</CITE>
|
|
(Mitsubishi Electric Corp.).
|
|
<CODE>as</CODE> implements all the standard D10V opcodes. The only changes are those
|
|
described in the section on size modifiers
|
|
|
|
</P>
|
|
|
|
<P><HR><P>
|
|
Go to the <A HREF="as_1.html">first</A>, <A HREF="as_11.html">previous</A>, <A HREF="as_13.html">next</A>, <A HREF="as_27.html">last</A> section, <A HREF="as_toc.html">table of contents</A>.
|
|
</BODY>
|
|
</HTML>
|