解析dsp c6000 MVK 指令

MVK/MVKL - Move a Signed Constant into a Register and Sign-Extend  ('C64x)

Syntax

MVK (.unit) cst, dst
.unit = .L1 or .L2, .S1 or .S2, .D1 or .D2

//c6000 dsp 结构中包括寄存器文件A 和寄存器文件B,其中A包括单元.L1 .S1 .M1 .D1 B包括.D2 .M2 .S2 .L2
Opcode map field used... For operand type Unit Opfield
cst
dst scst16
sint .S1, .S2 
cst
dst scst5
sint .L1, .L2 00101
cst
dst scst5
sint .D1, .D2 000000

//上述表示操作16bit 的常数时要使用单元.S1 .S2,操作5bit常数时要使用.L1 .L2 或者.D1 .D2
Opcode 

.S Unit
 
.L Unit
 
.D Unit
 

Description

In the MVK/MVKL instruction, the cst (constant) is sign extended and placed in dst. The .S unit form allows for a 16-bit signed constant. This is the same MVK instruction that is found on the C62x but with the added flexibility of being able to perform this operation not only on the .S unit but also on the .L and .D units when the constant is limited to a 5-bit signed constant.
Since many non-address constants fall into a 5-bit sign constant range, this allows the flexibility to schedule the MVK instruction on the .L or .D units. In the .D unit form, the constant is in the position normally used by src1, as for address math. Only the MVK instruction is supported on the .L or .D units. The .S unit supports both MVK and MVKL.

In most cases, the C6000 assembler and linker issue a warning or an error when a constant is outside the range supported by the instruction. In the case of MVK .S, a warning is issued whenever the constant is outside the signed 16-bit range, ?2768 to 32767 (or 0XFFFF8000 to 0x 00007FFF).
For example:

MVK  .S1   0x00008000X, A0

will generate a warning, whereas

MVK  .S1  0 x FFFF8000, A0

will not generate a warning.
The MVKL instruction is equivalent to the MVK instruction, except that the MVKL disables the constant range checking normally performed by the assembler/linker. This allows MVKL to be paired with MVKH to generate 32-bit constants.
To load 32-bit constants, such as 0x1234 ABCD, use the following pair of instructions:

 MVKL  S1 0x0ABCD, A4 MVKLH .S1 0x1234, A4

This could also be used:

 MVKL  .S1 0x1234ABCD, A4 MVKH  .S1 0x1234ABCD, A4

Use this to load the address of a label:

 MVKL .S2 label, B5 MVKH .S2 label, B5

Execution

if (cond) scst ?dst
else nop

Pipeline

Pipeline
Stage E1
Read 
Written dst
Unit in use  .L, .S, or .D
Instruction Type

Single Cycle

Delay Slots

0

See Also 

MVKH, MVKLH

Example 1

MVK .L2 ?,B8

 

Example 2

MVK .D2 14,B8

 

Example 3

MVKL .S1 5678h,A8

 

Example 4

MVKL .S1 0C678h,A8

 


 

你可能感兴趣的:(解析dsp c6000 MVK 指令)