我正在创建一个硬件模块,它使用固定点进行计算。但是输入是浮点,因此我希望将浮点输入转换为定点(Q8.8)。浮点到定点覆盖
我一直在尝试使用的是David Bishops库(http://vhdl.org/fphdl/)的浮点和固定点。它在模拟中效果很好,但是在我综合它的时候效果不好。例如。在下面的代码中,输出y在合成时路由到地面。
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
library ieee_proposed;
use ieee_proposed.fixed_float_types.all;
use ieee_proposed.fixed_pkg.all;
use ieee_proposed.float_pkg.all;
entity sigmoid is
Port (
clk : in std_logic;
x : in float32;
y : out sfixed(15 downto -16)
);
end sigmoid;
architecture Behavioral of sigmoid is
signal size : sfixed(15 downto -16);
begin
set_c: process(clk)
begin
if rising_edge(clk) then
y <= to_sfixed(x, size);
end if;
end process;
end Behavioral;
从我一直在阅读各种论坛和文档中,这段代码应该综合罚款。此外,使用to_float(固定)固定到浮点转换工作得很好。我错过了什么吗?是否有其他简单的方法来实现浮动 - >固定转换?
我假设你的综合工具有'ieee_proposed'可用,你期望的功能是什么?模拟和综合工具之间对库的支持差异是问题的常见原因。你使用什么工具?他们有VHDL-2008的支持吗? – Josh
如果这些工具具有良好的VHDL-2008 supprort,则不需要ieee_proposed库,这些软件包已移入库ieee。 –