Truncate with fixed_pkg

A

Alfreeeeed

I have been using fixed_pkg vhdl package and works fine for me
but..........as I use the resize function a lot for math operations, a
rounding routine is implemented synthesizing a lot of logic I wouldnt
need to use if I only truncate the result. I know truncate can be
implemented by modifying generics or constants but I couldnt figure
out HOW.

Is my point clear enough? If so, can you help me?

sorry for my not-so-good english.


Alfredo
 
K

KJ

I have been using fixed_pkg vhdl package and works fine for me
but..........as I use the resize function a lot for math operations, a
rounding routine is implemented synthesizing a lot of logic I wouldnt
need to use if I only truncate the result. I know truncate can be
implemented  by modifying generics or constants but I couldnt figure
out HOW.

Is my point clear enough? If so, can you help me?

sorry for my not-so-good english.

Alfredo

Refer to page 4 of the user's guide (Fixed_ug.pdf) for more info.

In short, the resize function has an argument for the rounding style,
if you don't specify a value for that argument it defaults to
'fixed_round'. There is also an argument for overflow style that
defaults to 'fixed_saturate'. You'll probably want to change both of
these. Modify your use of resize to be of the form

xyz <= resize(abc, xyz'left, xyz'right, fixed_wrap, fixed_truncate);

KJ
 
K

KJ

I have been using fixed_pkg vhdl package and works fine for me
but..........as I use the resize function a lot for math operations, a
rounding routine is implemented synthesizing a lot of logic I wouldnt
need to use if I only truncate the result. I know truncate can be
implemented  by modifying generics or constants but I couldnt figure
out HOW.

Is my point clear enough? If so, can you help me?

sorry for my not-so-good english.

Alfredo

Refer to page 4 of the user's guide (Fixed_ug.pdf) for more info.

Basically the resize function has a parameter for controlling how
rounding is performed that if you don't specify it, defaults to the
rounding style that causes the additional synthesized logic. It also
has a parameter for controlling overflow that you may want to specify
as well since it defaults to 'saturate' style which will consume more
logic as well instead of wrapping. Refer to the user's guide about
some of the considerations you should make but basically you'll need
to change your use of resize from this...

xyz <= resize(abc, xyz'left, xyz'right);

to this...

xyz <= resize(abc, xyz'left, xyz'right,fixed_truncate, fixed_wrap);

KJ
 
A

Alfreeeeed

Refer to page 4 of the user's guide (Fixed_ug.pdf) for more info.

Basically the resize function has a parameter for controlling how
rounding is performed that if you don't specify it, defaults to the
rounding style that causes the additional synthesized logic.  It also
has a parameter for controlling overflow that you may want to specify
as well since it defaults to 'saturate' style which will consume more
logic as well instead of wrapping.  Refer to the user's guide about
some of the considerations you should make but basically you'll need
to change your use of resize from this...

xyz <= resize(abc, xyz'left, xyz'right);

to this...

xyz <= resize(abc, xyz'left, xyz'right,fixed_truncate, fixed_wrap);

KJ

KJ,what you suggested went really well. I even didn´t have to look for
the pdf.
Thanks a lot.
 
A

Alfreeeeed

Is Xilinx synthesis 9.2 or 10.1 good enough to translate them?

I have a lot of DSP/filtering/demodulation algorithms that
I would like to prettify for publication and getting rid
of all that explicit scaling/rounding/saturating would be
a major step forward.

regards, Gerhard

David, thanks for this package. A lot of time has been saved
programming with it, specially for the Signal Processing algorithms. I
wish the new VHDL was out soon so we can take advantage of all its
features.

Regards

Alfredo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top