Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > fixed point syntax question

Reply
Thread Tools

fixed point syntax question

 
 
sanborne
Guest
Posts: n/a
 
      12-11-2008
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
 
Reply With Quote
 
 
 
 
KJ
Guest
Posts: n/a
 
      12-11-2008

"sanborne" <> wrote in message
news:b973d511-61b2-4055-ab5d-...
>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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
Scenario 5: IS-IS routing on Frame Relay Multi-point and Point-to-Point David Sudjiman Cisco 0 06-08-2006 09:11 AM
converting floating point to fixed point H aka N VHDL 15 03-02-2006 02:26 PM
floating point to fixed point conversion riya1012@gmail.com C Programming 4 02-22-2006 05:56 PM
Fixed-point format for floating-point numbers Motaz Saad Java 7 11-05-2005 05:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57