Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

resizing sfixed number

Altera_Forum
Honored Contributor II
1,881 Views

i want to resize a sfixed number of size(9 downto -6) to sfixed/signed of size (9 downto 0): 

here's the code: 

 

 

 

library IEEE; 

use IEEE.STD_LOGIC_1164.ALL; 

library ieee_proposed; 

use ieee_proposed.fixed_pkg.all; 

USE ieee.numeric_std.all; 

 

 

ENTITY dwt IS 

 

END dwt; 

 

 

 

ARCHITECTURE dwt_behaviour OF dwt IS 

 

 

 

signal k : sfixed(9 downto -6) ; 

 

 

signal kk : signed(9 downto 0); 

 

 

 

 

 

 

 

BEGIN 

k <= "1100110011000010"; 

kk <= signed(resize(signed(k), kk'length)); -- error line 

 

END dwt_behaviour;  

 

 

error is: 

Index value -6 (of type std.STANDARD.NATURAL) is out of range 0 to 2147483647.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
874 Views

Whats wrong with just using the resize function? 

 

signal kk : sfixed(9 downto 0); 

 

kk <= resize(k, kk ); 

 

or to convert to signed  

 

kk <= to_signed(k, kk'length);
0 Kudos
Altera_Forum
Honored Contributor II
874 Views

thanks it worked

0 Kudos
Reply