denbcd
Decimal Encode BCD
denbcd FRT, FRB, S
Encodes a DFP number into BCD format.
Encoding
Binary Layout
59
0:5
FRT
6:10
S
11:15
FRB
16:20
834
21:30
/
31
Operands
-
FRT
Target -
FRB
Source -
S
Sign Control
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
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.
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.