Vdsp(bf561)中的浮点运算(1):文档的说法

本文探讨了VisualDSP++5.0环境下浮点数类型的细节,特别是针对ADIBF561DSP处理器。文章详细解释了double类型在默认情况下被配置为32位而非64位的原因,并讨论了这种设置可能带来的问题及其解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

快乐虾

http://blog.youkuaiyun.com/lights_joy/

lights@hb165.com

本文适用于

ADI BF561 DSP

优视BF561EVB开发板

Visual DSP++ 5.0 (update 5)

欢迎转载,但请保留作者信息

vdsp提供的《VisualDSP++ 5.0 C/C++ Compiler and Library Manual for Blackfin Processors Revision 5.1, August 2008》中列出了vdsp支持的所有数据类型,其中与浮点有点的类型有:

Type

Bit Size

Number Representation

sizeof returns

double

32 bits

32-bit IEEE single-precision

4

float

32 bits

32-bit IEEE single-precision

4

double

64 bits

64-bit IEEE double-precision

8

long double

64 bits

64-bit IEEE

8

fract16

16 bits signed

1.15 fract

2

fract32

32 bits signed

1.31 fract

4

其中前4个采用了IEEE的格式,而fract则是ADI自己定义的格式。

在这里容易混淆的一点是通过project options -> compilers中的参数配置可以控制使用的double类型是32位的还是64位的,可恶的是在默认情况下,vdsp是将double当成32位来处理的,这对于某些科学计算相关的代码来说简直是一个噩梦!

当然了,由于bf561硬件本身不支持浮点运算,只能通过软件模拟来实现,所以文档中这样解释为什么默认情况下要使用32位的double

On Blackfin processors, the float data type is 32 bits, and the double data type default size is 32 bits. This size is chosen because it is the most efficient. The 64-bit long double data type is available if more precision is needed, although this is more costly because the type exceeds the data sizes supported natively by hardware.

似乎勉强也说得过去。

但由此造成的一个问题是:如果在要使用的dlb库和调用者之间是使用不同的选项来编译的,那么将造成程序运行时不可避免的错误!

参考资料

vdsp(bf561)中自定义StackHeap(<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><chsdate w:st="on" isrocdate="False" islunardate="False" day="9" month="11" year="2007">2007/11/9</chsdate>)

VDSP.doj文件到uClinx.O文件的转换<chsdate w:st="on" isrocdate="False" islunardate="False" day="17" month="12" year="2007"><b><span lang="EN-US" style="FONT-SIZE: 11.5pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 18.0pt">2007/12/17</span></b></chsdate>

VDSP函数调用时的参数传递<chsdate w:st="on" isrocdate="False" islunardate="False" day="2" month="1" year="2008"><b><span lang="EN-US" style="FONT-SIZE: 11.5pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 18.0pt">2008/1/2</span></b></chsdate>

VDSP中使用FP取得函数的调用堆栈<chsdate w:st="on" isrocdate="False" islunardate="False" day="2" month="1" year="2008"><b><span lang="EN-US" style="FONT-SIZE: 11.5pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 18.0pt">2008/1/2</span></b></chsdate>

vdsp4.5(bf561)中的CPLB<chsdate w:st="on" isrocdate="False" islunardate="False" day="18" month="2" year="2008"><b><span lang="EN-US" style="FONT-SIZE: 11.5pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 18.0pt">2008/2/18</span></b></chsdate>

Bf533 Ldr文件到DXE文件的转换-jack<chsdate w:st="on" isrocdate="False" islunardate="False" day="10" month="3" year="2008"><b><span lang="EN-US" style="FONT-SIZE: 11.5pt; COLOR: black; FONT-FAMILY: Verdana; mso-font-kerning: 18.0pt">2008/3/10</span></b></chsdate>

说说VDSP5(<chsdate w:st="on" isrocdate="False" islunardate="False" day="18" month="7" year="2008">2008/7/18</chsdate>)

doj文件中的.annotation(<chsdate w:st="on" isrocdate="False" islunardate="False" day="8" month="12" year="2008">2008-12-8</chsdate>)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值