dsp浮点数运算程序(精)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

;/*

=============================================================== =============*/

;/* Copyright (C 2004 YINXING TECHNOLOGY CO., LTD */

;/* All Rights Reserved. */

;/* ----------------------------------------------------------------------------*/

;/*

=============================================================== =============*/

;---------------------------------------------------------------

;

; USER Program Demo !

; It Start At 0x1800,and interrupt vector don't changed,

; At 200h !

;

; Please Don't modify PMST !

;

; Some data put in 080h DP=1

; SP may use system stack,so user needn't setup SP !

;

;------------------------------------------------------------------

.title "for test user program ... "

.mmregs

.global _c_int00

.ref fs_start,errno

op1valh .set 4140h ;floating point number 12.0

op1vall .set 0000h

op2valh .set 4140h ;floating point number 12.0

op2vall .set 0000h

initst0 .set 1800h ;set st0 initial number

initst1 .set 2900h ;set st1 initial number

.bss rlthm,1 ;result high mantissa,address is 80h .bss rltlm,1 ;result low mantissa,address is 81h

.bss rltsign,1 ;ressult sigh,address is 82h

.bss rltexp,1 ;result exponent,address is 83h

.bss op1hm,1 ;op1 high mantissa,address is 84h

.bss op1lm,1 ;op1 low mantissa,address is 85h

.bss op1se,1 ;op1 sigh and exp,address is 86h

.bss op2se,1 ;op2 sigh and exponent,address is 87h .bss op2hm,1 ;op2 high mantissa,address is 88h

.bss op2lm,1 ;op2 low mantissa,address is 89h

.bss op1_hsw,1 ;op1 packed high,address is 8ah .bss op1_lsw,1 ;op1 packed low,address is 8bh

.bss op2_hsw,1 ;op2 packed high,address is 8ch .bss op2_lsw,1 ;op2 packed low,address is 8dh

_c_int00:

stm #initst0,st0

stm #initst1,st1

rsbx C16

ld #op1lm,dp

ld #op1valh,a ;load float number

stl a,op1_hsw

ld #op1vall,a

stl a,op1_lsw

ld #op2valh,a ;load float number

stl a,op2_hsw

ld #op2vall,a

stl a,op2_lsw

nop

nop

nop ;1st breakpoint in CCS!

;----------- conversion of floating point format - unpack ------- dld op1_hsw,a ;load OP1 to acc a

sfta a,8

sfta a,-8

bc op1_zero,AEQ ;if op1 is 0,jump to special case

sth a,-7,op1se ;store sign and exponent to stack

stl a,op1lm ;store low mantissa

and #07Fh,16,a ;mask off sign and exp to get high mantissa add #080h,16,a ;add implied 1 to mantissa

sth a,op1hm ;store mantissa to stack

dld op2_hsw,a ;load OP2 to acc a

sfta a,8

sfta a,-8

bc op2_zero,AEQ ;if op2 is 0,jump to special case

sth a,-7,op2se ;store sign and exponent to stack

stl a,op2lm ;store low mantissa

相关文档
最新文档