Emulating floating point

G

gthorpe

Hi,

I would like to convert an algorithm that uses floating point ('real' and it's
subtypes defined by me) into a fixed point version so that the design that
uses the algorithm can be synthesize-able (the synopsys tool I am going to use
cannot synthesize 'real' and it seems no tools can do this yet).

First, I plan to make a package for a type based on std_ulogic_vector which
will store the unsigned versions of the whole and fractional part of the
corresponding 'real'. Are there already packages out there to for this type
of conversion or should I continue writing my own? If the latter, is this the
right approach/what are alternate approaches?

I will appreciate any pointers.
 
D

David Bishop

Hi,

I would like to convert an algorithm that uses floating point ('real' and it's
subtypes defined by me) into a fixed point version so that the design that
uses the algorithm can be synthesize-able (the synopsys tool I am going to use
cannot synthesize 'real' and it seems no tools can do this yet).

First, I plan to make a package for a type based on std_ulogic_vector which
will store the unsigned versions of the whole and fractional part of the
corresponding 'real'. Are there already packages out there to for this type
of conversion or should I continue writing my own? If the latter, is this the
right approach/what are alternate approaches?

I will appreciate any pointers.

you will find synthesizable packages for fixed and floating point at:
http://www.eda.org/vhdl-200x/vhdl-200x-ft/packages/files.html

I've had some success with Synopsys. You may need to tweek a few functions.
 
G

Gary Thorpe

David said:
you will find synthesizable packages for fixed and floating point at:
http://www.eda.org/vhdl-200x/vhdl-200x-ft/packages/files.html

I've had some success with Synopsys. You may need to tweek a few
functions.

I get these errors using 'ncvhdl -v93' (05.40-s008) when compiling
fixed_pkg_c.vhd:

VALUE (VALUE'range) := (others => 'U');
|
ncvhdl_p: *W,WAGNOOT (fixed_pkg_c.vhd,5865|33): OTHERS choice not
allowed in this context [7.3.2.2].
VALUE (VALUE'range) := (others => 'U');
|
ncvhdl_p: *W,WAGNOOT (fixed_pkg_c.vhd,5912|33): OTHERS choice not
allowed in this context [7.3.2.2].

[more similar errors on lines with the same problem]

I corrected these by using "VALUE := ((VALUE'range)=>'U');" instead of
the offending line. I don't know if this is helpful for the pending VHDL
standard, or even the VHDL'93 standard (could be just this tool).

I got these errors when compiling fixed_synth.vhd:

variable in1min2 : sfixed (SFixed_high(in1reg3, '*', in2reg3) downto
|
ncvhdl_p: *E,ILSGRD (fixed_synth_custom.vhd,105|49): illegal reference
of a signal (IN1REG3) during static elaboration [12.3].
variable in1min2 : sfixed (SFixed_high(in1reg3, '*', in2reg3) downto
|
ncvhdl_p: *E,ILSGRD (fixed_synth_custom.vhd,105|63): illegal reference
of a signal (IN2REG3) during static elaboration [12.3].
SFixed_low(in1reg3, '*', in2reg3));
|
ncvhdl_p: *E,ILSGRD (fixed_synth_custom.vhd,106|48): illegal reference
of a signal (IN1REG3) during static elaboration [12.3].
SFixed_low(in1reg3, '*', in2reg3));
|
ncvhdl_p: *E,ILSGRD (fixed_synth_custom.vhd,106|62): illegal reference
of a signal (IN2REG3) during static elaboration [12.3].


It seems that it doesn't like using signals to define variables: perhaps
sfixed16 could be used to get the ranges instead?
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top