denbcd

Decimal Encode BCD

denbcd FRT, FRB, S

Encodes a DFP number into BCD format.

Details

Encodes a decimal floating-point number in FRB into Binary Coded Decimal (BCD) format and places the result in FRT. The sign control field S determines how the sign is encoded. This instruction handles conversion of the coefficient and exponent into BCD representation. FPSCR is updated based on invalid operations.

Pseudocode Operation

dfp_value ← FRB
sign ← extract_sign(dfp_value)
coefficient ← extract_coefficient(dfp_value)
exponent ← extract_exponent(dfp_value)
bcd_result ← encode_to_bcd(sign, coefficient, exponent, S)
FRT ← bcd_result
FPSCR ← updated based on encoding result

Programming Note

The denbcd instruction is used to convert a Binary-Coded Decimal (BCD) value into Data-Packed Decimal (DPD) format. Ensure that the input BCD value in FRB is correctly formatted and aligned as required by the instruction. This operation does not raise exceptions for valid inputs but may require careful handling of special cases like overflow or invalid data.

Example

denbcd f1, f3, 0

Encoding

Binary Layout
59
0
FRT
6
S
11
FRB
16
834
21
/
31
 
Format X-form
Opcode 0xEC000684
Extension Decimal Floating-Point
Registers Altered FPSCR

Operands

  • FRT
    Target
  • FRB
    Source
  • S
    Sign Control