-应用程序设计教案分析.pptVIP

  • 5
  • 0
  • 约 83页
  • 2016-11-10 发布于湖北
  • 举报
第7章 应用程序设计 (第10讲) 7.1 定标与溢出处理 补充:定点运算实现的基本原理 7.2 基础算术运算 7.3 FIR滤波器 7.4 IIR滤波器 7.5 快速傅立叶变换FFT 浮点数的计算机存储格式 7.1 定标与溢出处理 C55x子系列 16位定点DSP 参与运算的数是16位的整型数 如何处理小数? 数的定标 由程序员确定一个数的小数点的位置 C55x中的定标方法 参与运算的数:16位整型数 数定标的Q表示法:每个采用Qi定标的16位数 1 个符号位、 i 个小数位、 15-i 个整数位 定点数 小数点固定的数 123.45 比较 精度较低,数值范围较大 实现简单,效率较高 硬件支持定点数运算 浮点数 小数点不固定的数 12.345x101 1.2345 x102 0.12345 x103 精度较高,数值范围较小(定标后) 实现复杂,效率较低 硬件不一定支持浮点运算 转换方法 浮点数(x)→定点数(xq) xq=(int)(x*2Q) = x Q 定点数(xq) →浮点数转换(x) x=(float)(xq*2-Q) = xq Q 溢出 溢出 算术运算结果超出寄存器所能表示的最大数 C55x的溢出处理机制 保护位 C55x的每个累加器都有8个保护位(39~32位) 溢出标志位 饱和方式位 SATD控制D单元的操作、SATA控制A单元的操作 溢出的处理方法 饱和、输入定标、固定定标和动态定标 补充:定点运算实现的基本原理 B.1 加法/减法的C语言定点模拟 B.2 乘法的C语言定点模拟 B.3 除法的C语言定点模拟 B.1 加法/减法的C语言定点模拟 浮点 定点 x的Q值为Qx,标定值为xq x= xq*2-Qx, xq=(int)(x*2Qx) y的Q值为Qy,标定值为yq y= yq*2-Qy, yq=(int)(y*2Qy) z的Q值为Qz,标定值为zq z= zq*2-Qz, zq=(int)(z*2Qz) B.2 乘法的C语言定点模拟 浮点 定点 B.3 除法的C语言定点模拟 浮点 定点 7.2 基础算术运算 7.2.1 加减运算 7.2.2 乘法运算 7.2.3 除法运算 7.2.4 小数乘法 7.2.1 加减运算 加法指令 单周期内完成32位加法运算 MOV40 dbl(Lmem),ACx ADD dbl(Lmem),ACx 64位的高32位加法要考虑低32位加法产生的进位 ADD [ uns(]Smem[)], CARRY, ACx 例7-1,64位加法运算 .sym 伪指令(1) 格式 功能 The .sym directive specifies symbolic debug information about a global variable, local variable, or a function. .sym 伪指令(2) 参数 Name is the name of the variable that is put in the object symbol table. The first 32 characters of the name are significant. Value is the value associated with the variable. Any legal expression (absolute or relocatable) is acceptable. Type is the C/C++ type of the variable. Appendix A, Common Object File Format, contains more information about C/C++ types. Storage class is the C/C++ storage class of the variable. Appendix A, Common Object File Format, contains more information about C/C++ storage classes. Size is the number of bits of memory required to contain this variable. Tag is the name of the type (if any) or structure of which this variable is a type. This name must have been previously declared by a .stag, .etag, or .utag directive. Dims may

文档评论(0)

1亿VIP精品文档

相关文档