Memory write to stack in a return delay slot -42 – Freescale Semiconductor StarCore SC140 User Manual

Page 275

Advertising
background image

Static Programming Rules

SC140 DSP Core Reference Manual

7-25

Example 7-43. SR Write to SR Status Bit Use

bmclr #$ffff,sr.h

;change SR

move.w #$1234,d0

;allowed, not affected by SR

bmclr #$ffff,sr.h

;change SR

rol d0

;not allowed, affected by SR[C]

bmclr #$ffff,sr.h

;change SR

nop
rol d0

;not allowed, affected by SR[C]

bmclr #$ffff,sr.h

;change SR

nop
nop
rol d0

;allowed

bmclr #<1,sr.l

;change SR

nop
push d0

;not allowed, affected by SR[EXP]

bmclr #<1,sr.h

;change SR

nop
ift clr d0

;not allowed, affected by SR[T]

bmtstc #$0001,sr.l

;read SR, affects SR[T], not a SR write

add d1,d5,d1

;allowed

pop sr
bmset #$a,sr.l

;allowed

move.l d0,sr
move.l sr,d5

;allowed

bmset

#$a,sr.h

and.w

#$1234,(sp-8)

;not allowed

bmset

#$a,sr.l

and.w

#$1234,(sp-8)

;not allowed

bmset #$a,sr.l
bmset #$b,sr.h

;allowed

move.l d1,sr
move.l d0,(sp+4)

;not allowed

move.l d1,sr
move.l d0,(r0+4)

;allowed

move.l d1,sr

;change SR

nop
clr d0

;allowed, clear not effected by SR

move.l d1,sr

;change SR

nop
sub d1,d2,d3

;not allowed, sub effected by S0,S1

move.l d1,sr

;change SR

nop
sub d1,d1,d3

;allowed, this is a CLR

Advertising