Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TMS320C2x DSP - syntax [<label>] norm (tms32020) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SYNTAX      [<LABEL>] NORM          (TMS32020)
            [<LABEL>] NORM {ind}    (TMS320C25)
OPERANDS    None

EXECUTION   TMS32020
                  (PC) + 1 . PC
                  If (ACC(31).XOR.(ACC(30)) = 0:
                    Then TC . 0,
                      (ACC) * 2 . ACC,
                      Modify AR(ARP) as specified;
                    Else TC . 1.
                  Affects TC; affected by TC.

            TMS320C25
                  (PC) + 1 . PC
                  If (ACC) = 0:
                    Then TC . 1
                  Else, if (ACC(31)).XOR.(ACC(30)) = 0:
                          Then TC . 0,
                            (ACC) * 2 . ACC,
                            Modify AR(ARP) as specified;
                           Else TC . 1
                  Affects TC; affected by TC.

DESCRIPTION The NORM instruction is provided for normalizing a signed
            number that is contained in the accumulator. Normalizing a
            fixed-point number separates it into a mantissa and an
            exponent. To do this, the magnitude of a sign-extended number
            must be found. ACC bit 31 is exclusive-OR'ed with the ACC bit
            30 to determine if bit 30 is part of the magnitude or part of
            the sign extension. If they are both the same, they are both
            sign bits and the accumulator is left-shifted to eliminate the
            extra sign bit. The AR(ARP) is modified as specified to
            generate the magnitude of the exponent. It is assumed that
            AR(ARP) is initialized before the normalization begins. The
            default modification of the AR(ARP) is an increment.

            Multiple executions of the NORM instruction may be required
            to completely normalize a 32-bit number in the accumulator.
            Although using NORM with RPT or RPTK does not cause execution
            of NORM to "fall out" of the repat loop automatically when the
            normalization is complete, no operation is performed for the
            remainder of the repeat loop. Note that NORM functions on both
            positive and negative two's complement numbers.

WORDS       1

ENCODING    15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
            +-----------------------------------------------+
            |1  1  0  0  1  1  1  0  1|modify AR|0  0  1  0 |
            +-----------------------------------------------+


CYCLES

            +------------------------------------------------+
            |    Cycle Timings for a Single Instruction      |
            |------------------------------------------------|
            | PI/DI | PI/DE | PE/DI | PE/DE  | PR/DI | PR/DE |
            |-------+-------+-------+--------+-------+-------|
      '20   |   1   |   1   |  1+p  |  1+p   |   -   |   -   |
            |-------+-------+-------+--------+-------+-------|
     'C25   |   1   |   1   |  1+p  |  1+p   |   1   |   1   |
            |------------------------------------------------|
            |    Cycle Timings for a Repeat Instruction      |
            |------------------------------------------------|
      '20   |   n   |   n   |  n+p  |  n+p   |   -   |   -   |
            |-------+-------+-------+--------+-------+-------|
     'C25   |   n   |   n   |  n+p  |  n+p   |   n   |   n   |
            +------------------------------------------------+



EXAMPLE     31-bit normalization:

                  LARP  1           Use AR1 for exponent storage
                  LARK  1,0         Clear out exponent counter
            LOOP  NORM  *+          One bit is normalized
                  BBZ   LOOP        If TC = 0, magnitude not found yet

EXAMPLE     15-bit normaliztion:

                  LARP  1           Use AR1 to store the exponent
                  LARK  1,15        Initialize exponent counter
                  RPTK  14          15-bit normalization is specified
                                    (yielding 4-bit exponent and 16-bit
                                    mantissa)
                  NORM  *-          NORM automatically stops shifting when
                                    the first significant magnitude bit
                                    is found, performing NOP's for the
                                    remainder of the repeat loop

            The first method is used to normalize a 32-bit number and
            yields a 5-bit exponent magnitude. The second method is used
            to normalize a 16-bit number and yields a 4-bit exponent
            magnitude. If the number requires only a small amount of
            normalization, the first method may be preferable to the
            second. This results because the first example runs only until
            normaliztion is complete. The second example executes all 15
            cycles of the repeat loop. Specifically, the first is more
            efficient if the number requires five or less shifts. If the
            number reqires six or more shifts, the second example is more
            efficient.

            Note: The TMS32020 accepts only the NORM instruction (no
                  operand). Source code compatibility of the TMS320C25
                  with the TMS32020 allows the NORM instruction to also
                  be used without a specified operand. If the first
                  character is is an asterisk (*), then the instruction
                  will be assembled as NORM * with no auxiliary register
                  modification taking place upon execution. The user is
                  therefore advised to replace the NORM instructions with
                  the NORM *+ when default modification of increment is
                  desired.

                  The resulting value in the auxiliary register will not
                  be the real exponent of the number for all modification
                  options; however, it can always be used to obtain the
                  exponent.




Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson