【发布时间】:2018-12-15 20:50:39
【问题描述】:
VHDL 允许通过端口传递实数(浮点数)?
对于此代码:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use IEEE.math_real.all;
entity FPP_MULT is
port(A : in integer; --input operands
B : in real
);
end FPP_MULT;
architecture (...)
输出:
Error (10414): VHDL Unsupported Feature error at real.vhd(8): cannot synthesize non-constant real objects or values
Error: Quartus II Create Symbol File was unsuccessful. 1 error, 0 warnings
【问题讨论】:
-
阅读错误信息。这与港口无关。 Quartus(以及我知道的所有其他综合工具)不能综合实数/浮点数。
-
IEEE Std 1076-2008 5.2.5 Floating-point types “实现应选择符合 IEEE Std 754-1985 或 IEEE Std 854 的除universal_real 之外的所有浮点类型的表示-1987;在任何一种情况下,此选择的表示都需要 64 位的最小表示大小。”类型 real 取决于主机实现。另请参阅附录 D 可能不可移植的构造。相反,请考虑使用符合综合条件的实例化包 float_pkg 类型 float,其中可以可移植地指定 binary 格式。
-
参见 github 上的VHDL-2008 Support Library。有一个 -1993 兼容版本已成功与 Quartus II 一起使用。