I2I : Integer To Integer Conversion

Format:

SPA 5.0:
        {@{!}Pg}   I2I{.dstfmt.srcfmt}{.SAT}   Rd{.CC},{-}{|}Sb{.extract}{|}   {&req_6}   {&rdN}   {&wrN}   {?sched}   ;   

 .dstfmt:     { .S8, .U8, .S16, .U16, .S32*, .U32 } 
 .srcfmt:     { .S8, .U8, .S16, .U16, .S32*, .U32 } 
              All srcfmt/dstfmt combinations are supported.

 .SAT         Saturate to output format range

 .CC:         Write condition codes


  .extract:    byte/word extraction parameter
               if (.srcfmt = U16/S16) {.H0*,.H1}
                where
                    .H0 // Sb[15:00]
                    .H1 // Sb[31:16]
               else                   { B0*,.B1,.B2,.B3}
                where
                    .B0 // Sb[07:00] 
                    .B1 // Sb[15:08]
                    .B2 // Sb[23:16]
                    .B3 // Sb[31:24]
               .H0/.H1 only legal if srcfmt=.U16 or .S16
               .B0/.B1/.B2/.B3 only legal if srcfmt=.U8 or .S8

The following source Sb combinations are allowed:
    Sb(register)
    Sb(constant with immediate address)
    Sb(sign-extended #IMM20)

Description:

The integer contents of source are moved into destination with optional conversions.

Here are the steps:

  1. If byte (.U8,.S8) or short (.U16,.S16) .srcfmt is specified, extract raw bits
          Sb.H0           // Sb[15:00], .srcfmt must be .U16 or .S16
          Sb.H1           // Sb[31:16], .srcfmt must be .U16 or .S16
          Sb.B0           // Sb[07:00], .srcfmt must be .U8  or .S8
          Sb.B1           // Sb[15:08], .srcfmt must be .U8  or .S8
          Sb.B2           // Sb[23:16], .srcfmt must be .U8  or .S8
          Sb.B3           // Sb[31:24], .srcfmt must be .U8  or .S8
    
  2. Convert input to 2's complement integer, specified by .srcfmt
         .U8   :  input  8b,   0 extend
         .S8   :  input  8b, sign extend
         .U16  :  input 16b,   0 extend
         .S16  :  input 16b, sign extend
         .U32  :  input 32b,   0 extend
         .S32  :  input 32b, sign extend
    
  3. Optional 2's complement absolute value and/or negate. If both are specified, the abs is done first.
  4. Saturate or Wrap.
         if (.SAT && .dstfmt == .S8,.S16,.S32) {
           if (srcB < -(1<<(DRANGE-1)))        // DRANGE is 8b,16b,32b = size of .dstfmt
             srcB = -(1<<(DRANGE-1));
           else if (srcB > (1<<(DRANGE-1))-1)
             srcB = (1<<(DRANGE-1))-1;
         }
         else if (.SAT && .dstfmt == .U8,.U16,.U32) {
           if (srcB < 0)
             srcB = 0;
           else if (srcB > (1<< DRANGE)-1)
             srcB = (1<< DRANGE)-1);
         }
         else
           srcB &= (1<< DRANGE)-1;
    
  5. Destination write of 32b

Examples:

I2I.S16.S8.SAT R0,R1.B1;

Back to Index of Instructions