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

Accessing the Accumulator Registers

3.2 Accessing the Accumulator Registers

An accumulator register can be accessed in two different ways:

as an entire register (F)

by the individual register portion (F2, F1, or F0)

The ability to access the accumulator registers in both ways provides important flexibility, allowing for powerful DSP algorithms as well as general-purpose computing tasks.

Accessing an entire accumulator register (A or B) is particularly useful for DSP tasks, since it preserves the complete 36-bit register—and thus the entire precision of a multiplication or other ALU operation. It also provides limiting (or saturation) capability in cases when storing a result of a computation that would overflow the destination size. See Section 3.4, “Saturation and Data Limiting.”

Accessing an accumulator through its individual portions (F2, F1, or F0) is useful for systems and control programming. For example, if a DSP algorithm is in progress and an interrupt is received, it is usually necessary to save every accumulator used by the interrupt service routine. Since an interrupt can occur at any step of the DSP task (that is, right in the middle of a DSP algorithm), it is important that no saturation takes place. Thus, an interrupt service routine can store the individual accumulator portions on the stack, effectively saving the entire 36-bit value without any limiting. Upon completion of the interrupt routine, the contents of the accumulator can be exactly restored from the stack.

The DSP56800 instruction set transparently supports both methods of access. An entire accumulator may be accessed simply through the specification of the full-register name (A or B), while portions are accessed through the use of their respective names (A0, B1, and so on).

Table 3-1 provides a summary of the various access methods. These are described in more detail in Section 3.2.1, “Accessing an Accumulator by Its Individual Portions,” and Section 3.2.2, “Accessing an Entire Accumulator.”

Table 3-1. Accessing the Accumulator Registers

Register

Read of an Accumulator Register

Write to an Accumulator Register

 

 

 

 

 

 

A

For a MOVE instruction:

For a MOVE instruction:

B

If the extension bits are not in use for the

The 16 bits of the CGDB bus are written into

 

accumulator to be read, then the 16-bit con-

the 16-bit F1 portion of the register.

 

tents of the F1 portion of the accumulator are

The extension portion of the same accumula-

 

read onto the CGDB bus.

tor, F2, is filled with sign extension. The F0

 

If the extension bits are in use, then a 16-bit

portion is set to zero.

 

“limited” value is instead read onto the CGDB.

 

 

See Section 3.4.1, “Data Limiter.”

 

 

When used in an arithmetic operation:

 

 

All 36 bits are sent to the MAC unit without

 

 

limiting.

 

 

 

 

A2

For a MOVE instruction:

For a MOVE instruction:

B2

The 4-bit register is read onto the 4 LSBs of

The 4 LSBs of the CGDB are written into the

 

the CGDB bus.

4-bit register; the upper 12 bits are ignored.

 

The upper 12 bits of the bus are sign

The corresponding F1 and F0 portions are not

 

extended.

modified.

 

See Figure 3-5 on page 3-9.

See Figure 3-4 on page 3-8.

 

 

 

Data Arithmetic Logic Unit

3-7

Data Arithmetic Logic Unit

Table 3-1. Accessing the Accumulator Registers (Continued)

Register

Read of an Accumulator Register

Write to an Accumulator Register

 

 

 

 

 

 

A1

For a MOVE instruction:

For a MOVE instruction:

B1

The 16-bit F1 portion is read onto the CGDB

The contents of the CGDB bus are written into

 

bus.

the 16-bit F1 register.

 

 

The corresponding F2 and F0 portions are not

 

When used in an arithmetic operation:

modified.

 

The F1 register is used as a 16-bit source

 

 

operand for an arithmetic operation.

 

 

F1 can be used in the following:

 

 

MOVE

 

 

Parallel Move

 

 

Several different arithmetic

 

 

 

 

A0

For a MOVE instruction:

For a MOVE instruction:

B0

The 16-bit F0 register is read onto the CGDB

The contents of the CGDB bus are written into

 

bus.

the 16-bit F0 register.

 

 

The corresponding F2 and F1 portions are not

 

 

modified.

 

 

 

In all cases in Table 3-1 where a MOVE operation is specified, it is understood that the function is identical for parallel moves and bit-field operations.

3.2.1 Accessing an Accumulator by Its Individual Portions

The instruction set provides instructions for loading and storing one of the portions of an accumulator register without affecting the other two portions. When an instructions uses the F1 or F0 notation instead of F, the instruction only operates on the 16-bit portion specified without modifying the other two portions. When an instruction specifies F2, then the instruction operates only on the 4-bit accumulator extension register without modifying the F1 or F0 portions of the accumulator. Refer to Table 3-1 for a summary of accessing the accumulator registers.

Data limiting, as outlined in Section 3.4, “Saturation and Data Limiting,” is enabled only when an entire accumulator is being stored to memory. When only a portion of an accumulator is being stored (by using an instruction which specifies F2, F1, or F0), limiting through the data limiter does not occur.

When F2 is written, the register receives the low-order portion of the word; the high-order portion is not used. See Figure 3-4.

15

4

3

0

CGDB Bus Contents

 

 

 

 

 

 

 

 

 

 

 

 

Not Used

 

LSB of

 

 

 

 

 

 

 

Word

 

 

 

 

 

15

4

3

 

0

 

 

Register F2 Used

No Bits Present

 

F2

 

Register F2

as a Destination

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 3-4. Writing the Accumulator Extension Registers (F2)

3-8

DSP56800 Family Manual

 

Accessing the Accumulator Registers

When F2 is read, the register contents occupy the low-order portion (bits 3–0) of the word; the high-order portion (bits 15–4) is sign extended. See Figure 3-5.

 

 

15

4

3

0

 

 

Register F2

No Bits Present

F2

 

Register F2

Used as a Source

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LSB Of

 

 

 

 

 

 

 

Word

 

 

 

 

 

15

4

3

0

 

 

 

 

Sign Extension

 

Contents

CGDB Bus Contents

 

 

of F2

 

of F2

 

 

 

 

 

 

 

Figure 3-5. Reading the Accumulator Extension Registers (F2)

Figure 3-6 shows the result of writing values to each portion of the accumulator. Note that only the portion specified in the instruction is modified; the other two portions remain unchanged.

Writing the F2 Portion Example: MOVE #$ABCD,A2

 

 

 

 

 

 

 

 

Before Execution

 

 

 

 

 

After Execution

 

 

A2

 

A1

 

A0

 

A2

 

A1

 

A0

 

 

 

 

 

 

 

 

A

X

X X X X

X X X X

A

D

X X X X

X X X X

 

 

 

 

 

 

 

 

 

 

 

 

 

 

35

32

31

16

15

0

35

32

31

16

15

0

Writing the F1 Portion Example: MOVE #$1234,A1

 

 

 

 

 

 

 

 

Before Execution

 

 

 

 

 

After Execution

 

 

A2

 

A1

 

A0

 

A2

 

A1

 

A0

A

X

X X X X

X X X X

A

X

1 2 3 4

X X X X

 

 

 

 

 

 

 

 

 

 

 

 

 

 

35

32

31

16

15

0

35

32

31

16

15

0

Writing the F0 Portion Example: MOVE #$A987,A0

 

 

 

 

 

 

 

 

Before Execution

 

 

 

 

 

After Execution

 

 

A2

 

A1

 

A0

 

A2

 

A1

 

A0

A

X

X X X X

X X X X

A

X

X X X X

A 9 8 7

 

 

 

 

 

 

 

 

 

 

 

 

 

 

35

32

31

16

15

0

35

32

31

16

15

0

Figure 3-6. Writing the Accumulator by Portions

See Section 3.2, “Accessing the Accumulator Registers,” for a discussion of when it is appropriate to access an accumulator by its individual portions and when it is appropriate to access it as an entire accumulator.

Data Arithmetic Logic Unit

3-9

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