搜索
bottom↓
回复: 3

求助:SOPC中CPU的硬件浮点单元如何使用

[复制链接]

出0入0汤圆

发表于 2010-9-13 19:48:20 | 显示全部楼层 |阅读模式
我加了怎么好像没效果,在编软件时要加什么设置么,还是硬件加了就行了?

阿莫论坛20周年了!感谢大家的支持与爱护!!

知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)

出0入0汤圆

发表于 2010-9-13 21:22:31 | 显示全部楼层
我一直想写博文专门论述,无奈最近有点忙。都是大白话,我就不翻译了。

介绍:http://www.altera.com.cn/literature/hb/nios2/n2cpu_nii51002.pdf P5~6
通过自定义指令来实现硬件单精度乘除法,双精度的只能用软件实现。


You can add floating-point custom instructions to any Nios II processor core
using the Nios II Processor MegaWizard? interface. The loating-point division
hardware requires more resources than the other instructions. The MegaWizard
interface allows you to omit the floating-point division hardware for cases
in which code running on your hardware design does not make heavy use of
floating-point division. When you omit the floating-point divide instruction,
the Nios II compiler implements floating-point division in software.

All the floating-point custom instructions are single-precision operations.
Double-precision operations are implemented in software. By default, the Nios
II compiler treats floating-point constants as double-precision numbers.
To use the floating-point custom instructions for operations with floating-point
constants, append an “f” to the constant. This tells the compiler to treat
the constant as a single-precision floating-point value, rather than promote
the other variables in your equation to double precision numbers. Table 2–3
shows code examples using constants.



使用:http://www.altera.com.cn/literature/hb/nios2/n2cpu_nii51004.pdf P17~18
默认情况下单精度的除法不打开。

资源消耗:Nios/f开单精度乘法(EP2C8)大约消耗接近6000的LEs;Nios/f开单精度乘除法(EP2C8)大约消耗9000多LEs;而不开单精度乘除法的Nios/f仅需4000左右的LEs。

出0入0汤圆

发表于 2010-9-13 21:51:28 | 显示全部楼层
( ⊙ o ⊙ )啊!出现了!
怎么换马甲了

出0入0汤圆

 楼主| 发表于 2010-9-14 10:33:05 | 显示全部楼层
回复【1楼】yuphone .COM 缺氧®
-----------------------------------------------------------------------

果然是浮点数精度的问题,我全部搞成单精度就行了。谢谢。。。。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-24 17:36

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表