ctfix

Convert To Fixed

ctfix FRT,FRA

Converts a decimal floating-point value to a fixed-point integer.

Encoding

Binary Layout
10011000
0:5
FRT
6:10
FRA
11:15
0000000000000000
16:31
 
Format X-form
Opcode 0xEC000000

Operands

  • FRT
    Target Floating-Point Register
  • FRA
    Source Floating-Point Register

Example

ctfix f1, f2

Registers Altered

FI, FR, VXCVI, VXSNAN, XX, FPSCR

Related

More in Decimal Floating-Point

Reference

Description

Converts a Decimal Floating-Point value in FRA to a fixed-point integer representation and stores the result in FRT. This instruction requires the Decimal Floating-Point category and may set exception flags in FPSCR if conversion fails or overflow/underflow occurs.

Operation

FRT ← convert_dfp_to_fixed(FRA)
# FPSCR exception flags updated as needed

Programming Note

The ctfix instruction is used to convert floating-point numbers to fixed-point integers. Ensure the source operand is properly aligned and within valid range to avoid exceptions. Be cautious of rounding modes as they can affect the result significantly. This instruction operates at user privilege level but may trigger exceptions like inexact conversion or invalid operations, which need to be handled appropriately.