ctfix

Convert To Fixed

ctfix FRT,FRA

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

Details

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.

Pseudocode 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.

Example

ctfix f1, f2

Encoding

Binary Layout
10011000
0
FRT
6
FRA
11
0000000000000000
16
 
Format X-form
Opcode 0xEC000000
Extension Decimal Floating-Point
Registers Altered FI, FR, VXCVI, VXSNAN, XX, FPSCR

Operands

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