Sun Microelectronics
203
13. UltraSPARC Extended Instructions
13.5.3.2 FPACK32
FPACK32 takes two 32-bit fixed values in rs2, scales, truncates and clips them
into two 8-bit unsigned integers. The two 8-bit integers are merged at the corre-
sponding least significant byte positions of each 32-bit word in rs1 left shifted by
8 bits. The 64-bit result is stored in the rd register. This allows two pixels to be as-
sembled by successive FPACK32 instructions using three or four pairs of 32-bit
fixed values.
This operation, illustrated in Figure 13-4, is carried out as follows:
1.
Left shift each 32-bit value in rs2 by the number of bits in the
GSR.scale_factor, while maintaining clipping information.
2.
For each 32-bit value, truncate and clip to an 8-bit unsigned integer starting
at the bit immediately to the left of the implicit binary point (i.e. between
bits 23 and 22 of each 32-bit word). Truncation is performed to convert the
scaled value into a signed integer (that is, round toward negative infinity).
If the resulting value is negative (that is, the MSB is set), zero is delivered
as the clipped value. If the value is greater than 255, then 255 is delivered.
Otherwise the scaled value is the final result.
3.
Left shift each 32-bit values in rs1 by 8 bits.
4.
Merge the two clipped 8-bit unsigned values into the corresponding least
significant byte positions in the left-shifted rs2 value.
5.
Store the result in the rd register.
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com