Predefined symbols
These predefined symbols are available:
Symbol | Value |
|---|---|
The name of the base source file being assembled (string). | |
A unique integer that identifies the build number of the assembler currently in use. The build number does not necessarily increase with an assembler that is released later. | |
The current date in | |
The name of the current source file (string). | |
IAR assembler identifier (number). The current value is 9. Note that the number could be higher in a future version of the product. This symbol can be tested with | |
An integer that is set to | |
The current source line number (number). | |
An integer that is set to | |
An integer that is set to | |
This is an architecture extension test macro. It is defined when the code is assembled for a RISC-V core with the A extension. The value of the symbol is an integer that identifies the version of the extension. | |
An integer that is set to
Example: If the F extension is version 2.2, If the B extension is version 0.92, | |
An integer that is set to | |
This is an architecture extension test macro. It is defined when the code is assembled for a RISC-V core with the B extension. The value of the symbol is an integer that identifies the version of the extension. | |
An integer that is set to | |
This is an architecture extension test macro. It is defined when the code is assembled for a RISC-V core with the C extension. The value of the symbol is an integer that identifies the version of the extension. | |
An integer that is set to | |
An integer that is set to | |
An integer that is set to | |
This is an architecture extension test macro. It is defined when the code is assembled for a RISC-V core with the D extension. The value of the symbol is an integer that identifies the version of the extension. | |
An integer that is set to | |
An integer that is set to | |
This is an architecture extension test macro. It is defined when the code is assembled for the RV32E base instruction set. The value of the symbol is an integer that identifies the version of the instruction set. | |
This is an architecture extension test macro. It is defined when the code is assembled for a RISC-V core with the F extension. The value of the symbol is an integer that identifies the version of the extension. | |
An integer that is set to | |
An integer that is set to | |
An integer that is set to | |
This is an architecture extension test macro. It is defined when the code is assembled for the RV32I base instruction set. The value of the symbol is an integer that identifies the version of the instruction set. | |
This is an architecture extension test macro. It is defined when the code is assembled for a RISC-V core with the M extension. The value of the symbol is an integer that identifies the version of the extension. | |
An integer that is set to | |
An integer that is set to | |
This is an architecture extension test macro. It is defined when the code is assembled for a RISC-V core with the P extension. The value of the symbol is an integer that identifies the version of the extension. | |
An integer that is set to | |
An integer that is set to the integer register size of the current base instruction set. This is 32 for RV32 and 64 for RV64.. | |
An integer that is set to the version number of the B extension when the code is assembled for a RISC-V core with the standard name extension Zba (“base” bit manipulation instructions). | |
An integer that is set to the version number of the B extension when the code is assembled for a RISC-V core with the standard name extension Zbb (“best of” bit manipulation instructions). | |
An integer that is set to the version number of the B extension when the code is assembled for a RISC-V core with the standard name extension Zbc (“carry-less” bit manipulation instructions). | |
An integer that is set to the version number of the P extension when the code is assembled for a RISC-V core with the standard name extension Zbpbo (bit manipulation instructions required by the P extension). | |
An integer that is set to the version number of the B extension when the code is assembled for a RISC-V core with the standard name extension Zbs (“single bit” bit manipulation instructions). | |
An integer that is set to the version number of the Zdinx extension when the code is assembled for a RISC-V core with the standard name extension Zdinx (double-precision floating-point in integer registers). | |
An integer that is set to the version number of the Zfinx extension when the code is assembled for a RISC-V core with the standard name extension Zfinx (single-precision floating-point in integer registers). | |
An integer that is set to the version number of the RISC-V CMO standard when the code is assembled for a RISC-V core with the standard name extension Zicbom (cache block management operations). | |
An integer that is set to the version number of the RISC-V CMO standard when the code is assembled for a RISC-V core with the standard name extension Zicbop (cache block prefetch operations). | |
An integer that is set to the version number of the RISC-V CMO standard when the code is assembled for a RISC-V core with the standard name extension Zicboz (cache block zero operations). | |
An integer that is set to the version number of the P extension when the code is assembled for a RISC-V core with the standard name extension Zpsfoperand (P extension instructions for accessing register pairs). | |
An integer that is set to the version number of the P extension when the code is assembled for a RISC-V core with the standard name extension Zpn (P extension instructions that are not included in Zbpbo or Zpsfoperand). | |
The current time in | |
The version number in integer format; for example, version 4.17 is returned as 417 (number). |
Including symbol values in code
Several data definition directives make it possible to include a symbol value in the code. These directives define values or reserve memory. To include a symbol value in the code, use the symbol in the appropriate data definition directive.
For example, to include the time of assembly as a string for the program to display:
name timeOfAssembly
extern printStr
public printTime
rseg `,text`:CODE(2)
printTime lui a0, %hi(time) ; Load address of time
addi a0, a0, %lo(time)
tail printStr ; Jump to string output
; routine.
time dc8 __TIME__ ; String representing
; the time of assembly.
endTesting symbols for conditional assembly
To test a symbol at assembly time, use one of the conditional assembly directives. These directives let you control the assembly process at assembly time.
For example, if you want to assemble separate code sections depending on whether you are using an old assembler version or a new assembler version, do as follows:
#if (__VER__ > 300) ; New assembler version
;…
;…
#else ; Old assembler version
;…
;…
#endifFor more information, see Conditional assembly directives.