Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
46
Добавлен:
27.04.2015
Размер:
4.26 Mб
Скачать

A.4.2 Effects of the Operating Mode Register’s SA Bit

The SA bit in the Operating Mode Register (OMR) can affect the computation of certain condition code bits. This bit enables the MAC Output Limiter within the data ALU. When enabled, the results of many operations are limited to fit with 32 bits, the extension portion containing only sign information. This limiting operation has both direct and indirect effects on the way condition codes are computed.

The SA bit directly affects the following condition code bits:

U—cleared if saturation occurs in the MAC Output Limiter

V—set when saturation occurs in the MAC Output Limiter

The remaining bits in the Condition Code Register are not affected by the SA bit, with the following exceptions:

L—may be indirectly affected through effects on the V bit

N—affected only by the ASRAC, LSRAC, and IMPY instructions

C—affected only by the ASL instruction

The value of the SA bit is designed not to affect condition code computation for the TSTW instructions. Only the U condition code bit is affected by the SA bit for the CMP instruction. These instructions operate independently of the CC bit and correctly generate both signed and unsigned condition codes.

The SA bit only affects operations in the data ALU, not operations performed in other blocks. These include move instructions, bit-manipulation instructions, and address calculations performed by the AGU.

NOTE:

When SA is set to one for an application, condition codes are not always set in an intuitive manner. It is best to examine the instruction details to determine the effect on condition codes when SA is one. See Section A.7, “Instruction Descriptions.”

A.4.3 Effects of the OMR’s CC Bit

The CC bit in the OMR may affect the computation of the condition code bits. The CC bit establishes how many of the bits of an arithmetic or logic operation result are used when calculating condition codes. Specifically:

When CC = 0, the result is interpreted as 36 bits with a valid extension portion.

When CC = 1, the result is interpreted as 32 bits with the extension portion ignored.

Signed values can be computed in both cases, but computation of unsigned values must be performed with the CC bit set to one. Without setting CC to one prior to executing the TST and CMP instructions, the HI, HS, LO, and LS branch/jump conditions cannot be used.

When the CC bit is set, the following condition code bits are affected:

V—set based on the MSB of the result’s MSP portion

Z—set using only the MSP and LSP portions of the result

The remaining bits in the Condition Code Register are not affected by the CC bit, with the following exceptions:

L—may be indirectly affected through effects on the V bit

N—affected only by the ASRAC, LSRAC, IMPY, and ASLL instructions

C—affected only by the ASL instruction

 

Instruction Set Details

A-11

The value of the CC bit does not affect condition code computation for the TSTW instructions. These instructions operate independently of the CC bit and correctly generate both signed and unsigned condition codes.

The CC bit only affects operations in the data ALU, not operations performed in other blocks. These include move instructions, bit-manipulation instructions, and address calculations performed by the AGU.

A.4.4 Condition Code Summary by Instruction

Table A-9 provides a detailed view of the condition codes affected by each instruction, and the circumstances under which each condition code is set or cleared. Table A-8 describes the notation used. Items in the “Notes” column of Table A-9 are explained immediately following the table on page A-15.

 

Table A-8. Notation Used for the Condition Code Summary Table

 

 

Notation

Description

 

 

 

 

*

Set by the result of the operation according to the standard definition.

 

 

Not affected by the operation.

 

 

*16

Set according to the standard definition for 16-bit results.

 

 

*32

Set according to the standard definition for 32-bit results.

 

 

*36

Set according to the standard definition for 36-bit results.

 

 

*A

Set by the result of the operation according to the size of destination.

 

 

*B

Set by the result of the operation according to the size of destination.

 

 

=0

Cleared.

 

 

=1

Set.

 

 

?

Set according to the special computation defined for the operation.

 

 

(number)

Set according to the special computation defined by the note with the corresponding number.

 

The notes may be found immediately after Table A-9.

 

 

C

L bit can be set if overflow has occurred in result.

 

 

T

L bit can be set if limiting occurs when reading an accumulator during a parallel move or by the

 

instruction itself. An example of the latter case is BFCHG #$8000,A, which must first read the

 

A accumulator before performing the bit-manipulation operation.

 

 

CT

L bit can be set if overflow has occurred in the result or if limiting occurs when an accumulator is

 

being read.

 

 

The condition code computation shown in Table A-9 may differ from that defined in the opcode descriptions; see Section A.7, “Instruction Descriptions.” This indicates that the standard definition may be used to generate the specific condition code result. For example, the Z flag computation for the CLR instruction is shown as the standard definition, while the opcode description indicates that the Z flag is always set. Table A-9 gives the chip implementation viewpoint, while the opcode descriptions give the user viewpoint.

A-12

DSP56800 Family Manual

 

The “Comments” column in the table is also used to report if any of the upper bits in the status register are modified. These are not status bits because they do not lie in the status portion of the status register, but rather in the control portion. Sometimes these bits are also affected by instructions. Examples include the interrupt mask bits, I1 and I0, and the looping bits, LF and NL (NL lies in the OMR register).

The following instruction mnemonics are not found in Table A-9: ANDC, EORC, NOTC and ORC. This is because each of these is an alias for another instruction and not an instruction in its own right. To determine condition code calculation for each of these, determine the instructions to which these mnemonics are mapped (see Section 6.5.1, “ANDC, EORC, ORC, and NOTC Aliases,” on page 6-12) and look at the condition code information for the corresponding real instructions.

Table A-9. Condition Code Summary

Instruction

SZ

L

 

E

 

U

N

 

Z

V

C

Comments

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ABS

*

CT

 

*36

 

*36

*36

 

*36

*36

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ADC

C

 

*36

 

*36

*36

 

*36

*36

*36

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ADD

*

CT

 

*A

 

*A

*A

 

*A

*A

*A

 

 

 

 

 

 

 

 

 

 

 

 

 

 

AND

 

 

*16

 

*16

=0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ASL

*

CT

 

*A

 

*A

*A

 

*A

(1)

(2)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ASLL

 

 

(18)

 

*32

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ASR

*

T

 

*A

 

*A

*A

 

*A

=0

(3)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ASRAC

 

 

(16)

 

*36

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ASRR

 

 

*32

 

*32

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bcc

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BFCHG

T

 

 

 

(4)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BFCLR

T

 

 

 

(4)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BFSET

T

 

 

 

(4)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BFTSTH

T

 

 

 

(4)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BFTSTL

T

 

 

 

(5)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BRA

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BRCLR

T

 

 

 

(5)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BRSET

T

 

 

 

(4)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CLR

*

CT

 

*36

 

*36

*36

 

*36

*36

Never overflows

 

 

 

 

 

 

 

 

 

 

 

 

 

CMP

*

CT

 

*A

 

*A

*A

 

*A

*A

*A

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DEBUG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DEC(W)

*

CT

 

*B

 

*B

*B

 

*B

*B

*B

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DIV

C

 

 

 

(1)

(6)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Instruction Set Details

A-13

Table A-9. Condition Code Summary (Continued)

Instruction

SZ

L

E

 

U

N

 

Z

V

C

Comments

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DO

T

 

 

Affects LF, NL bits

 

 

 

 

 

 

 

 

 

 

 

 

ENDDO

 

 

Condition code not affected

 

 

 

 

 

 

 

 

 

 

 

 

EOR

 

*16

 

*16

=0

 

 

 

 

 

 

 

 

 

 

 

 

 

ILLEGAL

 

 

Sets I1, I0 bits in SR

 

 

 

 

 

 

 

 

 

 

 

 

IMPY(16)

C

 

(17)

 

*16

(15)

 

 

 

 

 

 

 

 

 

 

 

 

 

INC(W)

*

CT

*B

 

*B

*B

 

*B

*B

*B

 

 

 

 

 

 

 

 

 

 

 

 

 

Jcc

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

JMP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

JSR

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LEA

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LSL

 

*16

 

*16

=0

(7)

 

 

 

 

 

 

 

 

 

 

 

 

 

LSLL

 

*32

 

*32

 

 

 

 

 

 

 

 

 

 

 

 

 

LSR

 

*16

 

*16

=0

(8)

 

 

 

 

 

 

 

 

 

 

 

 

 

LSRAC

 

(16)

 

*36

 

 

 

 

 

 

 

 

 

 

 

 

 

LSRR

 

*32

 

*32

 

 

 

 

 

 

 

 

 

 

 

 

 

MAC

*

CT

*A

 

*A

*A

 

*A

*A

 

 

 

 

 

 

 

 

 

 

 

 

 

MACR

*

CT

*A

 

*A

*A

 

*A

*A

 

 

 

 

 

 

 

 

 

 

 

 

 

MACSU

C

*A

 

*A

*A

 

*A

*A

 

 

 

 

 

 

 

 

 

 

 

 

 

MOVE

*

T

 

 

 

 

(10)

(10)

(10)

 

(10)

(10)

 

(10)

(10)

(10)

NA unless SR is the desti-

 

 

 

 

 

 

 

 

 

 

 

nation in the instruction

 

 

 

 

 

 

 

 

 

 

 

 

MPY

*

CT

*A

 

*A

*A

 

*A

*A

V cleared

 

 

 

 

 

 

 

 

 

 

 

 

MPYR

*

CT

*A

 

*A

*A

 

*A

*A

V cleared

 

 

 

 

 

 

 

 

 

 

 

 

MPYSU

C

*A

 

*A

*A

 

*A

*A

V cleared

 

 

 

 

 

 

 

 

 

 

 

 

NEG

*

CT

*A

 

*A

*A

 

*A

*A

*A

 

 

 

 

 

 

 

 

 

 

 

 

 

NOP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

NORM

C

*36

 

*36

*36

 

*36

(1)

 

 

 

 

 

 

 

 

 

 

 

 

 

NOT

 

*16

 

*16

=0

 

 

 

 

 

 

 

 

 

 

 

 

 

OR

 

*16

 

*16

=0

 

 

 

 

 

 

 

 

 

 

 

 

 

POP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A-14

DSP56800 Family Manual

 

Table A-9. Condition Code Summary (Continued)

Instruction

SZ

L

E

U

 

 

N

 

Z

V

 

C

Comments

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

REP

T

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

RND

*

CT

*36

*36

 

 

*36

 

*36

*36

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ROL

 

 

*16

 

*16

=0

 

(7)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ROR

 

 

*16

 

*16

=0

 

(8)

 

 

 

 

 

 

 

 

 

 

 

 

 

RTI

 

 

 

Restored — (9)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

RTS

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SBC

C

*36

*36

 

 

*36

 

*36

*36

 

*36

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

STOP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SUB

*

CT

*A

*A

 

 

*A

 

*A

*A

 

*A

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SWI

 

 

 

 

Affects I1, I0 bits in SR

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Tcc

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

TFR

T

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

TST

*

CT

*36

*36

 

 

*36

 

*36

0

 

0

Never overflows

 

 

 

 

 

 

 

 

 

 

 

 

 

 

TSTW

*

 

 

*36

 

*36

0

 

0

Never overflows

 

 

 

 

 

 

 

 

 

 

 

 

 

 

WAIT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

NOTES:

1.V is set if the MSB of the destination operand (bit 35 for an accumulator or bit 31 for the Y register) is changed as a result of the left shift; V is cleared otherwise.

2.C is set if the MSB of the source operand (bit 35 for an accumulator or bit 31 for the Y register) is set and is cleared otherwise.

3.C is set if bit 0 of the source operand is set and is cleared otherwise.

4.C is set if all bits specified by the mask are set and is cleared otherwise. Bits that are not set in the mask should be ignored. If a bit-field instruction is performed on the status register, all bits in this register selected by the bit field’s mask can be affected.

5.C is set if all bits specified by the mask are cleared and is cleared otherwise. Ignore bits that are not set in the mask. Note that if a bit-field instruction is performed on the status register, all bits in this register selected by the bit field’s mask can be affected.

6.C is set if the MSB of the result is cleared (bit 35 for an accumulator or bit 31 for the Y register). The C bit is cleared if the MSB of the result is set.

7.For the accumulators, C is set if bit 31 of the source operand is set and is cleared otherwise. For the Y1, Y0, and X0 registers, C is set if bit 15 of the source operand is set and is cleared otherwise.

8.For the accumulators, C is set if bit 16 of the source operand is set and is cleared otherwise. For the Y1, Y0, and X0 registers, C is set if bit 0 of the source operand is set and is cleared otherwise.

 

Instruction Set Details

A-15

Соседние файлы в папке DSP568xx