issue when using to_SFix

A

axr0284

Hi,
I tried using to_SFix from the IEEE fixed point package but I am
getting this error. I am using Active HDL as the simulator.
<CODE>
entity scaler is
generic(
GAIN_FRACTIONAL_BITS : integer := 4;
GAIN_INTEGER_BITS : integer := 12

);
port(
gain : in std_logic_vector((GAIN_FRACTIONAL_BITS +
GAIN_INTEGER_BITS)-1 downto 0)
);
end scaler;

architecture scaler of scaler is

signal s_gain : sfixed(GAIN_INTEGER_BITS-1 downto -
GAIN_FRACTIONAL_BITS);

begin

s_gain <= to_SFix(gain, GAIN_INTEGER_BITS, GAIN_FRACTIONAL_BITS);

end scaler;
</CODE>

The error I am getting is the following:
# EXECUTION:: ERROR : :work:fixed_generic_pkg:TO_SFIX
(STD_ULOGIC_VECTOR) Vector lengths do not match. Input length is 16
and output will be 12 wide.

# RUNTIME: Fatal Error: RUNTIME_0046 scaler.vhd (71): Incompatible
ranges; left: (11 downto -4), right: (null range).

Anybody can help me figure this out. Thanks a lot.
Amish
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top