没有合适的资源?快使用搜索试试~ 我知道了~
首页浮点转定点原理及Matlab例码
浮点转定点原理及Matlab例码
3星 · 超过75%的资源 需积分: 41 221 下载量 140 浏览量
更新于2023-03-16
评论 9
收藏 218KB PDF 举报
本人正在学习浮点与定点转化,查阅了好多资源,包括硕士论文,其中讲解大都泛泛,并不适合初学者,而该文档是唯一让我眼前一亮的好文档。原理讲述特别清楚。
资源详情
资源评论
资源推荐
1
Floating‐pointtoFixed‐point
conversion
Fixed‐PointDesign
2
Fixed‐PointDataTypes
In adigitalhardware,numbersare storedin binarywords.A binaryword is afixed‐length
sequenceof bits(1'sand 0's).How hardwarecomponents orsowarefunconsinterpretthis
sequenceof1'sand0'sisde finedbythedatatype.Binarynumbersarerepresentedaseither
fixed‐point or floating‐point data types. In order to implement an algorithm such as
communication algorithms, the algorithm should be converted to the fixed‐point domain and
thenitshouldbedescribedwithHardwareDescriptionLanguage(HDL).InHDLcodingprocess,
itis necessaryto indicate thesize ofthe variablesandregisters. Theregisters should belarge
enoughtorepresentthevalueofparameterswiththedesiredprecision.
Fixed‐pointdatatypehelpsustoknowwhathappensinthehardware.Intheotherwords
whenan algorithmis representedin floating‐pointdomain, allof the
variables have64 bits(in
MATLABprogramming).Soalloftheoperationsaredonewithlargenumberofbits.Weknow
that itisimpossibleto implement an algorithm with large number of flip flops. Because large
number of flip flops need a larger area, and more power consumption. In order
to solve this
problem the algorithm should be converted to the fixed‐point domain. In the fixed‐point
domainapair (W,F)isconsideredforeachoftheparametersinthealgorithm,whereWisthe
word length of the parameters and F is the fractional length of the parameters. It is obvious
that larger W and F results in a better performance and lower bit error rate (BER) but the
designneedsalarge siliconarea.OntheotherhandsmallerWandFresultinalargerBERbut
lessarea.Soweshouldchoosesuitablevaluesof(W,F)foreachparameterinthealgorithm.For
this reason a simulation should be ran for the algorithm to get the dynamic range of the
parameters.Simulationresultsindicatethedynamicrangeofthevariablesandthenumberof
bitsforWandF,whichareusedtorepresentthevariableswiththedesiredprecision.
According to the previous section, a fixed‐point data type is characterized by the word
length in bits, the position of the binary point, and whether it is signed or unsigned. The
positionofthebinarypointisthemeansbywhichfixed‐point
valuesarescaledandinterpreted.
Forexample,abinaryrepresentationofageneralizedfixed‐pointnumber(eithersignedor
unsigned)isshownbelow:
0
b
1
b
2
b
3
b
1‐wl
b
2‐wl
b
Fixed‐PointDesign
3
Where:
istheithbinarydigit
isthewordlengthinbits
isthelocationofthemostsignificant,orhighest,bit(MSB)
isthelocationoftheleastsignificant,orlowest,bit(LSB).
The binary point is shown three places to the left of the LSB. In this example, therefore, the
numberissaidtohavethreefractionalbits,orafractionlengthofthree.
Fixed‐pointdatatypescanbeeithersignedorunsigned.Signedbinaryfixed‐pointnumbers
aretypicallyrepresentedinoneoftheseways:
¾ Sign/magnitude
¾ One'scomplement
¾ Two'scomplement
Two's complement is the most common representation of signed fixed‐point numbers and is
theonlyrepresentationusedbyFixed‐PointToolboxinMATLAB.
Fixed‐pointnumberscanbeencodedaccordingtothefollowingscheme:
(1)
where is the raw binary number, in which the binary point assumed to be at
thefarrightoftheword.
Conversionofan algorithmfromfloating‐pointdomain tofixed‐pointdomaincanbe done
throughtheMATLABfixed‐pointtoolbox.
Fixed‐Point Toolbox provides fixed‐point data types in MATLAB and enables algorithm
developmentbyprovidingfixed‐pointarithmetic.Fixed‐PointToolboxenablesyoutocreatethe
followingtypesofobjects:
¾ fi — Defines a fixed‐point numeric object in the MATLAB workspace. Each fi object is
composedofvaluedata,afimathobject,
andanumerictypeobject.
¾ fimath—Governshowoverloadedarithmeticoperatorsworkwithfiobjects
¾ fipref—Definesthedisplay,logging,anddatatypeoverridepreferencesoffiobjects
¾ numerictype—Definesthedatatypeandscalingattributesoffiobjects
¾ quantizer—Quantizesdatasets
Fixed‐PointDesign
4
Normallycomplicatedalgorithmshavemanyvariablessothenumberoffixed‐pointobjects
growssignificantly.Moreover,insomecasesalongtimesimulationisneededtoobtaintheBER
curves of the algorithm. In the above cases fixed‐point simulation with MATLAB fixed‐point
toolboxneedsalargeamountofmemory,time,andCPUusageandinmostofthecasesitwill
crash.
In order to solve the above problem a simple method for floating‐point to fixed‐point
conversion is proposed in this tutorial. Simulation results with this method and simulation
results with the MATLAB fixed‐point toolbox are the same, but the simulation with the
proposed method is significantly faster than the other. For example one iteration of K‐Best
algorithmsimulationwithMATLABfixed‐pointtoolbox,takes237secondsbutsimulationwith
the proposed method, needs only 36 seconds. So in a long‐timesimulation for example 5000
iterationMATLABfixed‐pointtoolboxdoesn’tworkwell.
Floating‐pointtoFixed‐pointconversion:
Inthispartasimplemethodforfloating‐pointtofixed‐pointconversionwilldescribe.Then
we consider the various arithmetic operations and mention a lot of examples for them and
finallycomparetheirresultswiththeresultsofMATLABfixed‐pointtoolbox.
In order to convert a floating‐point value to the corresponding fixed‐point vlaue use the
followingsteps.
Considerafloating‐pointvariable, :
Step 1: Calculate2
, where F is the fractional length of the variable. Note thatis
representedindecimal.
Step 2:Roundthevalueoftothenearestintegervalue.Forexample:
3.56
4
1.9
2
1.5
2
Step 3:Convertfromdecimaltobinaryrepresentationandnamethenewvariable.
Step 4: Now, we assume that, needsbits to represent the value ofin binary. On the
otherhandweobtainthevaluesofWandF,fromthesimulation.SothevalueofWshouldbe
剩余18页未读,继续阅读
Pamela_ouyang
- 粉丝: 13
- 资源: 40
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论2