FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > DSP

DSP comp.dsp newsgroup, mailing list

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-18-2007, 12:16 AM
[email protected]
Guest
 
Posts: n/a
Default Question about Fixed-point Arithmetic!

I've worked with assembly code for texas C5410 for 2 months and I'm
learning some concepts of fixed point arithmetic.
One of the things I've learned so far is that there is only intergers,
so, if my dynamic range is +/- 1, I may represent it as (-32767 +
32768) or (8000 and 7FFF in hex). So, for example, for a sin function
I have numbers between that values.
So,If I want to this: x = 2*0,5 = 1. Since I have no fractional
numbers, I would have to do something like:2*16384 = 32768.
What if i actually want to do 2*16284(meaning 16284 not 0,5) = 32768,
the result would be the same! Or even worse, what if I want to do
2*16384.26 = 32768,52???
My question is probably a dumb question but I find out I dont know how
to program fixed point DSP's. Can anyone help me?
Thanks
Boris

Reply With Quote
  #2 (permalink)  
Old 08-18-2007, 03:39 AM
Tim Wescott
Guest
 
Posts: n/a
Default Re: Question about Fixed-point Arithmetic!

On Fri, 17 Aug 2007 22:16:57 +0000, borinhos wrote:

> I've worked with assembly code for texas C5410 for 2 months and I'm
> learning some concepts of fixed point arithmetic.
> One of the things I've learned so far is that there is only intergers,
> so, if my dynamic range is +/- 1, I may represent it as (-32767 +
> 32768) or (8000 and 7FFF in hex). So, for example, for a sin function
> I have numbers between that values.
> So,If I want to this: x = 2*0,5 = 1. Since I have no fractional
> numbers, I would have to do something like:2*16384 = 32768.
> What if i actually want to do 2*16284(meaning 16284 not 0,5) = 32768,
> the result would be the same! Or even worse, what if I want to do
> 2*16384.26 = 32768,52???
> My question is probably a dumb question but I find out I dont know how
> to program fixed point DSP's. Can anyone help me?
> Thanks
> Boris


What you do is you _call_ the range from 0x8000 to 0x7fff -1 to 1 (-1 to
almost 1, actually). Then you select operations that support that
interpretation. Addition and subtraction don't change. The DSP chip
probably supports the 'right' kind of multiply -- dig for it, it's there.
Division has to be done carefully, but then it always does.

The only thing left is I/O operations, but if you're just passing it from
an ADC to a DAC with all appropriate bit-fondling in between then you
don't have to worry about what the ADC or DAC calls it, just what they do
with it.

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fixed point arithmetic [email protected] DSP 4 11-29-2006 06:56 AM
multiplication (by 0.1, 0.5, 0.7, 1.3 ...) in fixed point arithmetic Stefan Huber DSP 2 08-31-2004 05:16 PM
Synthesisable fixed-point arithmetic package Jonathan Bromley VHDL 1 08-15-2003 05:32 PM
Synthesisable fixed-point arithmetic package Jonathan Bromley FPGA 1 08-15-2003 05:32 PM
Fixed Point Arithmetic resources Ashwin DSP 6 07-14-2003 08:26 AM


All times are GMT +1. The time now is 02:09 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved