ARM Technical Support Knowledge Articles

CREATING FLOATING-POINT CONSTANTS

Applies to: A51 Macro Assembler

Answer


Information in this article applies to:


QUESTION

Is there any method of specifying a floating point number in the A51 Assembler so that it will be stored in 4 byte IEEE floating point format within the code?

ANSWER

There is no easy way in the assembler to declare floating point numbers. However, it is easy to declare them in a C module, then compile and create an assembler source file. For example, the following C file:

#pragma SRC
code float j [] = { 1.1, 2.2, 3.3 };

Generates the following .SRC file when compiled:

NAME    J

?CO?J                SEGMENT CODE
        PUBLIC  j

        RSEG  ?CO?J
j:
        DB      03FH,08CH,0CCH,0CDH     ; 1.100000
        DB      040H,00CH,0CCH,0CDH     ; 2.200000
        DB      040H,053H,033H,033H     ; 3.300000

; code float j [] = { 1.1, 2.2, 3.3 };

You may either include this file in your assembler files or use it as an external table.

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-07-15 14:07:26

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential