DSP++ EXTRACT

General Form

dest_reg = EXTRACT ( scene_reg, pattern_reg ) (Z)

dest_reg = EXTRACT ( scene_reg, pattern_reg ) (X)

Syntax

Dreg = EXTRACT ( Dreg, Dreg_lo ) (Z) ;   /* zero-extended (b)*/

Dreg = EXTRACT ( Dreg, Dreg_lo ) (X) ;   /* sign-extended (b)*/

Syntax Terminology

Dreg: R7–0

Dreg_lo: R7–0.L

Instruction Length

In the syntax, comment (b) identifies 32-bit instruction length.

Functional Description

The Bit Field Extraction instruction moves only specific bits from the scene_reg into the low-order bits of the dest_reg. The user determines the length of the pattern bit field and its position in the scene field. 





Example

Bit Field Extraction Unsigned

r7 = extract (r4, r3.l) (z) ;   /* zero-extended*/

  • If
    • R4=0b1010 0101 1010 0101 1100 0011 1010 1010
      where this is the scene bit field
    • R3=0bxxxx xxxx xxxx xxxx 0000 0111 0000 0100
      where bits 15–8 are the position, and bits 7–0 are the length
  • then the Bit Field Extraction (unsigned) instruction produces:
    • R7=0b0000 0000 0000 0000 0000 0000 0000 0111
  • If
    • R4=0b1010 0101 1010 0101 1100 0011 1010 1010
      where this is the scene bit field
    • R3=0bxxxx xxxx xxxx xxxx 0000 1101 0000 1001
      where bits 15–8 are the position, and bits 7–0 are the length
  • then the Bit Field Extraction (unsigned) instruction produces:
    • R7=0b0000 0000 0000 0000 0000 0001 0010 1110

Bit Field Extraction Sign-Extended

r7 = extract (r4, r3.l) (x) ;   /* sign-extended*/

  • If
    • R4=0b1010 0101 1010 0101 1100 0011 1010 1010
      where this is the scene bit field
    • R3=0bxxxx xxxx xxxx xxxx 0000 0111 0000 0100
      where bits 15–8 are the position, and bits 7–0 are the length
  • then the Bit Field Extraction (sign-extended) instruction produces:
    • R7=0b0000 0000 0000 0000 0000 0000 0000 0111
  • If
    • R4=0b1010 0101 1010 0101 1100 0011 1010 1010
      where this is the scene bit field
    • R3=0bxxxx xxxx xxxx xxxx 0000 1101 0000 1001
      where bits 15–8 are the position, and bits 7–0 are the length
  • Then the Bit Field Extraction (sign-extended) instruction produces:
    • R7=0b1111 1111 1111 1111 1111 1111 0010 1110

ps:移动位置+移动位数不能超过32,否则R7盛不下
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值