Conversion from std_logic_vector to sfixed

Status
Not open for further replies.

Hugo17

Junior Member level 1
Joined
Oct 8, 2015
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
162
Hello
I do have following signals:

Code:
pos             : in std_logic_vector(15 downto 0) := (others => '0'); 

constant PtA    : real := 1.0;
signal ang      : sfixed(2*PtA_FP'high + 1 downto 2*PtA_FP'low);


Now I would like to multiply following expression with a type conversion to sfixed:

Code:
ang <= PtA_FP * to_sfixed(signed(pos),PtA_FP'high,PtA_FP'low);


for some reason the value ang is wrong and I assume the type conversion from the pos to a to_sfixed is not correct. Can anyone tell me what goes wrong here? :bang:

Thanks in advance
 

to_sfixed can covert signed or std_logic_vector types to sfixed, so the signed conversion is not necessary
Without the error, not much more can say really, as it is possible - you must have an error elsewhere. Please post the whole code
 
Reactions: Hugo17

    Hugo17

    Points: 2
    Helpful Answer Positive Rating
strange, but after I removed the 'signed' part it works and the conversion seems to be correct now!

Thanks for the fast answer :smile:
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…