Three major types of data transfer instructions for coprocessor

Source: Internet
Author: User
Tags rounds

Reproduced in: http://cs.fjzs.edu.cn/ketang/hbyy/11-3-2.htm11.3.2 data transfer Instructions

To meet the need for data exchange between the coprocessor and the CPU, it is necessary to implement the instructions for data transfer between the memory unit and the coprocessor. In the coprocessor's instruction system, there are three classes of data transfer instructions: BCD transfer instruction, floating-point number transfer, and integer transfer instruction.

First, the BCD transfer instructions

1, Fbld

Instruction format: fbld MEMBCD (*)
Instruction function: To press the in-memory BCD data into the coprocessor's stack;

(*) Memtype is a memory unit that specifies the type of data, such as: MEMBCD is a storage unit of the BCD type. It is not explained thereafter.

2, FBSTP

Instruction format: FBSTP MEMBCD
Instruction function: The BCD data in the coprocessor is stored in memory and the stack is ejected.

For example:

.387
Data1 DT 123,-543
Data2 DT 2.5
......
Fbld Data1 To push the BCD data 123 into the stack.
Fbstp Data2 The current heap top data is ejected and transmitted to the BCD type's internal reference unit

Second, floating point transfer instructions

1, FLD

Instruction format: FLD Streg (*)/memreal
Command function: The floating-point data is pressed into the coprocessor's stack. When the memory unit content is stacked, the system automatically determines the accuracy of the transmitted data. For example, a memory unit value defined with DD or REAL4 is a single-precision number.

(*) Streg is the coprocessor stack register ST (0) ~st (7).

For example:

  .387
data1 dd 123, -543
data2 real8-321.5
data3 real10 2.5
...
fld data1 press a single-precision data into the stack
fld data2
fld st (0) ; push the value of the stack register ST (0) back into the stack
fld data3 press an extended precision data stack

2, FST

Instruction format: FST Streg/memreal
Command function: Transfers the data at the top of the coprocessor stack to the target operand. When data transfer occurs, the system automatically rounds the top floating point number to the corresponding precision based on the setting of the rounding control bit in the control register.

3, FSTP

Instruction format: FSTP Streg/memreal
Command function: Similar to FST, the difference is that after the instruction FST executes, the stack is not ejected, that is, the stack does not change, and when the instruction FSTP executes, the stack is ejected and the stack changes. See instructions for naming rules for instruction operators in section 11.3.1.

4, Fxch

Instruction format: Fxch [Streg]
Command function: Swaps the floating-point number in the specified register with the top floating-point number of the stack. If you do not specify an operand, the default St and St (1) Exchange data between them.

For example: Fxch St (2)--stack top data and Stack Register ST (2) for data exchange.

Three, integer transmission instructions

1, Fild

Instruction format: Fild memint

Where: Memint is a memory unit defined as an integer data type, but not a storage unit defined in DB. The same, no longer described.

2, FIST/FISTP

Instruction format: FIST Memint
FISTP Memint
which MEM is a memory unit that defines an integer data type, but not a storage unit defined in DB.
Command function: Transfer the data from the top of the coprocessor stack to the destination storage unit. When data transfer occurs, the system automatically rounds the stack top floating-point number to integer data based on the setting of the rounding control bit in the control register.

The difference between Directives fist and FISTP is the stack operation, see the naming rules description in 11.3.1 for details.

Another: A site to learn the assembly instructions: http://courses.engr.illinois.edu/ece390/archive/spr2002/books/labmanual/inst-ref.html

http://blog.csdn.net/chence19871/article/details/7398012

Three major types of data transfer instructions for coprocessor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.