[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: working with fixed point
From: |
Per Persson |
Subject: |
Re: working with fixed point |
Date: |
Mon, 25 Aug 2003 10:31:38 +0200 |
On Monday, August 25, 2003, at 11:56 AM, Zdenek Hurak wrote:
Well, I think this will not be as easy as that. Converting the data is
one
step only, but Ravid obviously wants to calculate in fixed point
arithmetics
too.
Hmm,
multiplying two integers will give the same result whether or not that
multiplication was performed using integer or floting point arithmetics.
With a limited number of bits available for representation, the result
may overflow. This will have to be handled in some way, such as
truncating or saturating the result, in the fpga (or VHDL/Verilog code)
as well as in an octave script.
It is quite possible to have a per-sample correspondance between the
output of a VHDL simulation and a simulation run in octave.
The following is an example of a first order link of a wave digital
filter. It was used to simulate the effect of varying wordlength in
octave before moving to VHDL code and simulation.
function [y state] = qaplink1(x, alpha, B, W, state);
u = alpha*(-x+state);
##
## Quantize u
##
u = truncate(u, B, W-1);
y = u + state;
y = saturate(y, B);
state = u + x;
state = saturate(state, B);
## endfunction
Considering that the "fixed-point skills" are by far the most expensive
component in commercial Matlab suite, it can be expected that solution
is not
trivial.
AFAIK commercial software is not normally priced by its complexity or
the amount of time spent developing it, but rather from an estimate of
how much that particular functionality is worth to the customer.
/Per
------------
Per Persson
Blekinge Institute of Technology
Dept. of Signal Processing and Telecommunications
www: http://www.its.bth.se/staff/pee
e-mail: address@hidden
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------