Motorola DSP96002 User Manual
Page 571
B-52
DSP96002 USER’S MANUAL
MOTOROLA
3. Dynamic bit field extraction, zero extend. Register d1.l contains FOFF,
d2.l contains FSIZE.
Program
ICycles
Words
move #32,d3.l ;register size 1 1 sub
d2,d3 ;32-fsize 1 1 sub d1,d3
d3.l,d4.h ;32-fsize-foff, 32-fsize 1 1 move d3.l,d0.h
;move 32-fsize-foff 1 1 lsl d0,d0 d4.h,d0.h ;shift
off upper bits 1 1 lsr d0,d0 ;right justify
1 1
--- ---
Totals: 6 6
4. Dynamic bit field extraction, sign extend. Register d1.l contains FOFF,
d2.l contains FSIZE.
Program
ICycles
Words
move #32,d3.l ;register size 1 1 sub
d2,d3 ;32-fsize 1 1 sub d1,d3
d3.l,d4.h ;32-fsize-foff, 32-fsize 1 1 move d3.l,d0.h
;move 32-fsize-foff 1 1 lsl d0,d0 d4.h,d0.h ;shift
off upper bits 1 1 asr d0,d0 ;right justify
1 1
--- ---
Totals: 6 6
5.
Static bit field insertion.
Program
ICycles
Words
move #-1,d2.l ;get all ones mask 1 1 lsl
#32-fsize,d2 ;keep field fsize long 1 1 lsr #32-
(fsize+foff),d2 ;move to insertion 1 1 andc d2,d0
;clear field 1 1 lsl #foff,d1 ;move
field to insert 1 1 or d1,d0 ;insert bit
field 1 1
--- ---
Totals: 6 6