我的项目中有此代码。
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library ieee_proposed;
use ieee_proposed.fixed_pkg.all;
entity sfixed_test is
port(x1 : in integer :=20;
x2 : in integer := 23;
N : out sfixed( 8 downto -8));
end sfixed_test;
architecture Behavioral of sfixed_test is
signal Ni,Nii,No,Noo,nb :integer;
signal Niii : sfixed(4 downto -20);
signal Nn : sfixed(4 downto -20);
signal N1max : integer := 34;
signal N1min : integer := 14;
signal N2max : integer := 56;
signal n2min : integer := 0;
begin
Ni <= x1-N1min;
Nii <= N1max-N1min;
Niii <= to_sfixed(Ni/Nii,Niii);
No <= x2-N2min;
Noo <= N2max-N2min;
Nn <= to_sfixed(No/Noo,Nn);
end Behavioral;
我想转换除法运算的结果值,但是 Niii 和 Nn 的值为零,所以我尝试在模拟器中运行代码。我的项目结果不正确。 请帮助我。
谢谢