Академический Документы
Профессиональный Документы
Культура Документы
INSTRUCTION SET
register
Functional Units
The eight functional units can be divided into two groups of four;
each functional unit in one data path is almost identical to the
corresponding unit in the other data path.
All units ending in 1 (for example, .L1) write to register file A,
and all units ending in 2 write to register file B.
Functional Unit
Fixed-Point Operations
Floating-Point Operations
Arithmetic operations
DP SP, INT DP,
INT SP conversion
operations
Functional Units
Functional Unit
Fixed-Point Operations
Floating-Point Operations
Compare
Reciprocal and reciprocal
square-root operations
Absolute value operations
SP DP conversion
operations
SP and DP adds and
subtracts
SP and DP reverse
subtracts (src2 src1)
Functional Units
Functional Unit
Fixed-Point Operations
Floating-Point Operations
.M unit
(.M1, .M2)
Floating-point multiply
operations
Mixed-precision multiply
operations
Bit expansion
Bit interleaving or de-interleaving
Variable shift operations
Rotation
Galois field multiply
Functional Units
Functional Unit
Fixed-Point Operations
Floating-Point Operations
Indirect Addressing
Indirect Addressing
Circular Addressing
Two independent circular buffers are available using BK0 and BK1
within the address mode register (AMR)
10
11
12
Parallel Operations
Instructions are always fetched eight at a time - fetch packet.
The fetch packets which are aligned on 256-bit (8-word)
boundaries have a basic format as given.
13
Parallel Operations
The p-bit (bit 0) determines whether the instruction
executes in parallel with another instruction.
The p-bits are scanned from left to right (lower to higher
address). If the p-bit of instruction i is 1, then instruction i +
1 is to be executed in parallel with (in the same cycle as)
instruction i.
If the p-bit of instruction i is 0, then instruction i + 1 is
executed in the cycle after instruction i.
14
Parallel Operations
All instructions executing in parallel constitute an execute
packet. An execute packet can contain up to eight
instructions.
Each instruction in an execute packet must use a different
functional unit.
An execute packet cannot cross an 8-word boundary.
Therefore, the last p-bit in a fetch packet is always set to 0,
and each fetch packet starts a new execute packet.
15
Parallel Operations
There are three types of p-bit patterns for fetch packets.
Fully serial
Fully parallel
Partially serial
16
Parallel Operations
Fully serial p-bit Pattern:
17
Parallel Operations
Fully parallel p-bit pattern:
18
Parallel Operations
Partially serial p-bit pattern:
19
Parallel Operations
Example Parallel Code:
The || characters signify that an instruction is to execute in
parallel with the previous instruction.
20
Resource Constraints
No two instructions within the same execute packet can use
the same resources.
The following execute packet is invalid:
ADD
.S1
A0,
A1,
A2
;.S1
|| SHR .S1 A3, 15, A4 ;...both instructions
is
used
for
21
22
For example, the .S1 unit can read both its operands from the A
register file; or it can read an operand from the B register file
using the 1X cross path and the other from the A register file.
The use of a cross path is denoted by an X following the
functional unit name in the instruction syntax (as in S1X).
23
24
25
26
27
28
Constraints on Floating-Point
Instructions
If an instruction has a multicycle functional unit latency, it
locks the functional unit for the necessary number of cycles.
29
30
Common Instructions
.L Unit
.M Unit
.S Unit
.D Unit
ABS
LMBD
SSUB
MPY
MPYHLU
ADD
EXTU
SHL
ADD
LDBU**
MV
ADD
MV
SUB
MPYU
MPYHULS
ADDK
MV
SHR
ADDAB
LDH**
ZERO
ADDU
ZERO
SUBU
MPYUS
MPYHSLU
ADD2
MVC*
SHRU
ADDAH
LDHU**
STB**
AND
NEG
SUBC
MPYSU
MPYLH
AND
MVK
SSHL
ADDAW
STB
STH**
CMPEQ
NORM
XOR
MPYH
MPYLHU
B disp
MVKH
SUB
LDB
STH
STW**
CMPGT
NOT
MPYHU
MPYLUHS
BIRP*
MVKLH
SUBU
LDBU
STW
LDW**
CMPGTU
OR
MPYHUS
MPYLSHU
BNRP*
NEG
SUB2
LDH
SUB
CMPLT
SADD
MPYHSU
SMPYHL
B reg
NOT
XOR
LDHU
SUBAB
CMPLTU
SAT
MPYHL
SMPYLH
CLR
OR
ZERO
LDW
SUBAH
SMPYH
EXT
SET
LDB**
SUBAW
* : .S2 only
** : .D2 only (with 15-bit offset)
Abdulkareem V., Assistant Professor, ECED
31
32
Addition/Subtraction Operations
ADD(U): Signed or Unsigned Integer Addition Without
Saturation
Syntax
ADD (.unit) src1, src2, dst
ADDU (.unit) src1, src2, dst
.unit = .L1, .L2, .S1, .S2 or .unit = .D1, .D2, .S1, .S2
src2 is added to src1. The result is placed in dst.
Eg: ADD .L1 A3,A7,A7 ;add A3 + A7 ->A7 (accum in A7)
The unit .L1 is optional.
If the destination or result is in B7, the unit would be .L2.
33
Addition/Subtraction Operations
34
Addition/Subtraction Operations
35
Addition/Subtraction Operations
ADDAB/ADDAH/ADDAW - Integer Addition Using Byte,
Half word, word Addressing Mode
Syntax :
ADDAB (.unit) src2, src1, dst
ADDAH (.unit) src2, src1, dst
ADDAW (.unit) src2, src1, dst
.unit = .D1 or .D2
36
Addition/Subtraction Operations
37
Addition/Subtraction Operations
38
Addition/Subtraction Operations
39
Addition/Subtraction Operations
SUB(U): Signed or Unsigned Integer Subtraction Without
Saturation
Syntax:
.unit = .L1, .L2, .S1, .S2 or .unit = .D1, .D2, .S1, .S2
40
Addition/Subtraction Operations
41
Addition/Subtraction Operations
SUBAB/SUBAH/SUBAW - Integer Subtraction Using
Addressing Mode
Syntax :
42
Addition/Subtraction Operations
43
Addition/Subtraction Operations
ADDK - Integer Addition Using Signed 16-Bit Constant
Syntax :
44
Addition/Subtraction Operations
ADD2 - Two 16-Bit Integer Adds on Upper and Lower
Register Halves.
45
Addition/Subtraction Operations
SUB2 - Two 16-Bit Integer Subtractions on Upper and
Lower Register Halves.
Syntax
SUB2 (.unit) src1, src2, dst
.unit = .S1 or .S2
The upper and lower halves of src2 are subtracted from
the upper and lower halves of src1.
Any borrow from the lower-half subtraction does not
affect the upper-half subtraction.
46
Addition/Subtraction Operations
47
Addition/Subtraction Operations
SUBC - Conditional Integer Subtract and Shift Used for
Division.
Syntax :
SUBC (.unit) src1, src2, dst
48
Addition/Subtraction Operations
49
Addition/Subtraction Operations
SADD - Integer Addition With Saturation to Result Size
Syntax
SADD (.unit) src1, src2, dst
50
Addition/Subtraction Operations
51
Addition/Subtraction Operations
52
Addition/Subtraction Operations
SSUB - Integer Subtraction With Saturation to Result Size.
Syntax :
SSUB (.unit) src1, src2, dst
If the result is an int and src1 src2 > 231 1, then the result is 231 1
If the result is an int and src1 src2 < 231, then the result is 231.
If the result is a long and src1 src2 > 239 1, then the result is 239 1
If the result is a long and src1 src2 < 239, then the result is 239.
53
Addition/Subtraction Operations
54
Multiplication Operations
MPY(U/US/SU) - Signed or Unsigned Integer Multiply 16lsb
x 16lsb.
Syntax: MPY/MPYU/MPYUS/MPYSU (.unit) src1, src2, dst
55
Multiplication Operations
56
Multiplication Operations
57
Multiplication Operations
MPYH(U/US/SU) - Signed or Unsigned Integer Multiply
16msb x 16msb.
Syntax: MPYH/MPYHU/MPYHUS/MPYHSU
src2, dst
(.unit) src1,
58
Multiplication Operations
59
Multiplication Operations
60
Multiplication Operations
MPYHL(U)/MPYHULS/MPYHSLU - Signed or Unsigned
Integer Multiply 16msb x 16lsb.
Syntax :
MPYHL/MPYHLU/MPYHULS/MPYHSLU (.unit)
src1, src2, dst
61
Multiplication Operations
62
Multiplication Operations
MPYLH/MPYLHU/MPYLUHS/MPYLSHU Unsigned Integer Multiply 16lsb x 16msb.
Signed
or
63
Multiplication Operations
64
Multiplication Operations
SMPY(HL/LH/H) - Integer Multiply With Left Shift and Saturation.
Syntax: SMPY/SMPYHL/SMPYLH/SMPYH (.unit) src1, src2, dst
SMPY (Multiply Signed 16 LSB by Signed 16 LSB With Left Shift and
Saturation)
SMPYHL (Multiply Signed 16 MSB by Signed 16 LSB With Left Shift
and Saturation)
SMPYLH (Multiply Signed 16 LSB by Signed 16 MSB With Left Shift
and Saturation)
SMPYH (Multiply Signed 16 MSB by Signed 16 MSB With Left Shift
and Saturation)
65
Multiplication Operations
66
Multiplication Operations
67
Logical Operations
AND - Bitwise AND
OR - Bitwise OR
Syntax
OR (.unit) src1, src2, dst
.unit = .L1 or .L2, .S1 or .S2
A bitwise OR is performed between src1 and src2. The result is
placed in dst.
The scst5 operands are sign extended to 32 bits.
68
Logical Operations
69
Logical Operations
70
Logical Operations
XOR - Bitwise Exclusive OR
Syntax :
XOR (.unit) src1, src2, dst
.unit = .L1 or .L2, .S1 or .S2
A bitwise exclusive OR is performed between src1 and src2. The
result is placed in dst.
The scst5 operands are sign extended to 32 bits.
Syntax
NOT (.unit) src, dst
(.unit) = .L1, .L2, .S1, or .S2
This is a pseudo operation used to bitwise NOT the src operand
and place the result in dst.
The assembler uses the operation XOR (.unit) 1, src, dst to
perform this task.
71
Logical Operations
72
Shift Operations
73
Shift Operations
74
Shift Operations
75
Shift Operations
SHR - Arithmetic Shift Right.
Syntax
SHR (.unit) src2, src1, dst
.unit = .S1 or .S2
The src2 operand is shifted to the right by the src1 operand.
The sign-extended result is placed in dst.
When a register is used, the six LSBs specify the shift
amount and valid values are 040.
When an immediate is used, valid shift amounts are 031.
If 39 < src1 < 64, src2 is shifted to the left by 40. Only the six
LSBs of src1 are used by the shifter, so any bits set above bit
5 do not affect execution.
76
Shift Operations
77
Shift Operations
78
Shift Operations
SHRU - Logical Shift Right.
Syntax
SHRU (.unit) src2, src1, dst
.unit = .S1 or .S2
The src2 operand is shifted to the right by the src1 operand.
The zero-extended result is placed in dst.
When a register is used, the six LSBs specify the shift
amount and valid values are 040.
When an immediate is used, valid shift amounts are 031.
If 39 < src1 < 64, src2 is shifted to the right by 40. Only the
six LSBs of src1 are used by the shifter, so any bits set above
bit 5 do not affect execution.
79
Shift Operations
80
Shift Operations
SSHL - Shift Left With Saturation.
Syntax
SSHL (.unit) src2, src1, dst
.unit = .S1 or .S2
The src2 operand is shifted to the left by the src1 operand. The
result is placed in dst.
When a register is used to specify the shift, the five least
significant bits specify the shift amount.
Valid values are 0 through 31, and the result of the shift is invalid
if the shift amount is greater than 31.
The result of the shift is saturated to 32 bits.
If a saturate occurs, the SAT bit in the CSR is set one cycle after dst
is written.
if ( bit(31) through bit(31src1) of src2 are all 1s or all 0s)
dst = src2 << src1;
else if (src2 > 0)
saturate dst to 0x7FFF FFFF;
else if (src2 < 0)
saturate dst to 0x8000 0000;
Abdulkareem V., Assistant Professor, ECED
81
Shift Operations
82