unit = .S1 or .S2
Description A 16-bit signed constant, cst16, is added to the dst register specified. The result is
placed in dst.
Execution
if (cond) cst16 + dst → dst else nop
ADDKPC
ADDKPC (.unit) src1, dst, src2
1. 把Src1的值设置到dst中,并NOP src2 个cycle. 2. 即本指令需要src2 + 1个slot才能完成。 3. 这个指令并不是跳转指令,仅仅是同时完成了高低16bit赋值以及NOP控制的一个指
令。如果NOP为0此,则高低16bit赋值仅仅为1个cycle
SWE
SWE Software Exception
Syntax SWE
unit = none
Compatibility C64x+ CPU Description:
Software sprint an exception by this instruction. It will set SXF bit in EFR to 1.
And when it complete, CPU will continue with the instructions specified by NRP register
SWENR no-return SWE
It is the same as SWE, but NRP will be invalid.
21
MV系列
1. MV (.unit) src2, dst:Move From Register to Register AB寄存器之前的MV
2. MVC (.unit) src2, dst:Move Data from AB register to Control register, such as ARM/IRP 3. MVD (.unit) src2, dst:Move From Register to Register, 和MV一样,但是需要3个NOP。 4. MVK (.Unit) src dst 把有符号数的立即数赋值到dst中
5. MVKH (.unit) cst, dst:把立即数的MSB 16bit 赋值到 dst的MSB 16bit 6. MVKLH (.unit) cst, dst:把立即数的LSB 16bit赋值到 dst的MSB 16bit
大小对比操作
1. CMPLT (.unit) src1, src2, dst
a) if (src1 < src2), 1 → dst else else 0 → dst
b) src1是否小于src2,是的话dst=1;否则等0 c)
Delay Slots 0
2. CMPEQ (.unit) src1, src2, dst
a) if (src1 == src2), 1 → dst else else 0 → dst b) Delay Slots 0
逻辑操作系列
AND Src1 Src2 dst:Src1安位与 Src2 结果赋值到dst
Store系列(STDW/)
1. 所有的store指令的delay slot都是0,但是数据真正写入内存的delay slot = 3. 2. 就是说,如果要从内存中直接去看数值的改变需要4个slot后。
3. 但是在第一个slot后,如果代码去Load此地址的值,则能够Load新的值。因为系统
并没有真正的直接从内存中获取,而是半路拦截了正在保存的数据(因为是同一地址),所delay slot为0了。
STB
STB Store Byte to Memory With a 5-Bit Unsigned Constant Offset or Register Offset 存储寄存器的低8bit到内存中。
SIZE = 1B
22
STH
SIZE = 2B
STW
SIZE = 4B
STDW (DW store (8Bytes))
SIZE = 8B
STDW (.unit) src, *+baseR[ucst5] DW store
if (cond) src → mem mem = *BaseR + (ucst5 * 8) 或者
STDW (.unit) src, *+baser(ucst5)
if (cond) src → mem mem = *BaseR + ucst5
Delay Slots 0
23
Load系列(LDW)
LDW
Syntax
Register Offset Unsigned Constant Offset
LDW (.unit) *+baseR[offsetR], dst LDW (.unit) *+baseR[ucst5], dst unit = .D1 or .D2
Delay Slots 4 for loaded value
Example
LDW .D1 *A10,B1
把 *A10的值Load到B1.但是B1只有在执行后4 slot后才会有可用的值。 也就是说,这个指令要5个slot才能完成。
jump(B/BNOP/BDEC/ CALLP)
Only PFC jump(B/BNOP/BDEC)
1. B:
a) 修改FP指针的值,让程序后面从一个新的位置开始取指(PG、PS、PW、PR的开
始)
b) B Src: Src? PFC B IRP: IRP? PFC B NRP: NRP? PFC c) Delay 5个slot,即在执行此指令后5个slot时才开始真正的跳转。 2. BNOP:
a) 修改PFC指针的值的同时,后面添加N个NOP指令。一般都要添加4个,因为B
指令跳转到新的地方取指后,新取的指令需要等待取指、分发才会进入执行阶段,所以需要等待。 b) Delay 5个slot(不包括其包含的NOP数),即在执行此指令后5个slot时才开始真
正的跳转。
3. BDEC (BDEC (.unit) src, dst):
a) 如果dst>=0,则先dst -= 1, 后PFC = src。
b) 否则,直接PFC = src c) Delay Slots 5
PCE1 jump(CALLP/)
1. CALLP (.unit) label, A3/B3:
Execution(跳转到label,并把返回值保存在A3或B3中)
24
(cst21 << 2) + PCE1 →PFC (label –> PFC) if (unit = S2), retPC → B3 else if (unit = S1), retPC → A3
nop 5 (Delay Slots 5) (注: cst21 = (label - PCE1) >> 2)
a) 这个在修改FP的同时,会保存retPC指针,用于返回return地址。在return后会
把这个地址赋值给PFC,然后从这条指令开始重新执行。 b) Delay Slots 5
SPLOOP系列(SPLOOPD/
SPLOOP
Software Pipelined Loop (SPLOOP) Buffer Operation With Delayed Testing 是通过延时,获取L2/Ext 内存的数据Copy到L1 Memory中。
典型汇编语句解析
STXX REG *B15--[1]
把REG的值保存到内存中。
具体的操作SIZE要看存储的指令。 STB = 1B; STDW = 8B;
REG *B15- - [x]
REG *B15++ [x]
先把REG的值赋值到*B15开始的地址中,然后B15减、加x个REG SIZE
REG *-- B15[x] REG *++B15[x]
先B15减、加x个REG SIZE,然后先把REG的值赋值到*B15开始的地址中。 例子:
83689CB0 8577 STDW.D2T1 A11:A10,*B15--[1] 83689CB2 4646 || MV.L1 A4,A10 //写A10会在读A10之后执行 *B15 = A11:A10
*B15 -= 8 (A11:A10是8Byte)
注:每个cycle,写是在读之前完成的,所以此语言写入*B15还是老的A10的值。
25
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库DSP汇编指令学习笔记(5)在线全文阅读。
相关推荐: