在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
芯片精品文章合集(500篇!) 创芯人才网--重磅上线啦!
查看: 6696|回复: 0

[原创] 指令vector search的格式和功能是什么

[复制链接]
发表于 2011-10-4 15:32:08 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 cjsb37 于 2013-4-29 09:02 编辑

英文的看不大明白,牛人的给翻译一下下。。。
This instruction is used in a loop to locate a maximum or minimum ele-
ment in an array of 16-bit packed data. Two values are tested at a time.
The Vector Search instruction compares two 16-bit, signed half-words to
values stored in the Accumulators. Then, it conditionally updates each
Accumulator and destination pointer based on the comparison.
Pointer register P0 is always the implied array pointer for the elements
being searched.
More specifically, the signed high half-word of src_reg is compared in
magnitude with the 16 low-order bits in A1. If src_reg_hi meets the com-
parison criterion, then A1 is updated with src_reg_hi, and the value in
pointer register P0 is stored in dest_pointer_hi. The same operation is
performed for src_reg_low and A0.
Based on the search mode specified in the syntax, the instruction tests for
maximum or minimum signed values.
Values are sign extended when copied into the Accumulator(s).
See “Example” for one way to implement the search loop. After the vector
search loop concludes, A1 and A0 hold the two surviving elements, and
dest_pointer_hi and dest_pointer_lo contain their respective addresses.
The next step is to select the final value from these two surviving elements.
Example
/* Initialize Accumulators with appropriate value for the type of
search. */
r0.l=0x7fff ;
r0.h=0 ;
a0=r0 ; /* max positive 16-bit value */
a1=r0 ; /* max positive 16-bit value */
/* Initialize R2. */
r2=[p0++] ;
/* Assume P1 is initialized to the size of the vector length. */
LSETUP (loop_, loop_) LC0=P1>>1 ; /* set up the loop */
loop_: (r1,r0) = SEARCH R2 (LE) || R2=[P0++];
/* search for the last minimum in all but the
last element of the array */
(r1,r0) = SEARCH R2 (LE);
/* finally, search the last element */
/* The lower 16 bits of A1 and A0 contain the last minimums of the
array. R1 contains the value of P0 corresponding to the value in
A1. R0 contains the value of P0 corresponding to the value in A0.
Next, compare A1 and A0 together and R1 and R0 together to find
the single, last minimum in the array.
Note: In this example, the resulting pointers are past the actual
surviving array element due to the post-increment operation. */
cc = a0 <= a1 ;
r0 += -4 ;
r1 += -2 ;
if !cc r0 = r1 ; /* the pointer to the survivor is in r0 */






您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-12-21 04:45 , Processed in 0.020127 second(s), 10 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表