fixed point syntax question

S

sanborne

I cannot figure out what the problem is in the following code:

-- begin code
library ieee_proposed;
use ieee_proposed.std_logic_1164_additions.all;
use ieee_proposed.math_utility_pkg.all;
use ieee_proposed.fixed_pkg.all;

library ieee;
use ieee.numeric_std.all;

entity test is

port (
a : in unsigned(31 downto 0);
x : out sfixed(1 downto -30));

end test;

architecture imp1 of test is
begin -- imp1
--the following works:
-- x <= resize(sfixed(a) * to_sfixed(0.5,0,-1), 1, -30);

--this does not...I need to be able to control the rounding and
overflow behavior
x <= resize(sfixed(a) * to_sfixed(0.5,0,-1), 1, -30, true, false);

end imp1;
-- end code

I expect that this is an easy problem, but the error the ModelSim
compiler gives is that there is no feasible subprogram "resize". The
syntax above is definitely in the documentation, and I have found some
examples online also. Any thoughts? Is it a problem with my conversion
from the unsigned input? But then why would the code that is commented
out compile? I would sure like to understand this.

SY
 
K

KJ

sanborne said:
I cannot figure out what the problem is in the following code:
--the following works:
-- x <= resize(sfixed(a) * to_sfixed(0.5,0,-1), 1, -30);

--this does not...I need to be able to control the rounding and
overflow behavior
x <= resize(sfixed(a) * to_sfixed(0.5,0,-1), 1, -30, true, false);

The last two parameters to resize are not booleans. Your choices are

type fixed_round_style_type is (fixed_round, fixed_truncate);

type fixed_overflow_style_type is (fixed_saturate, fixed_wrap);

Kevin Jennings
 

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,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top