将real转换为IEEE双精度std_logic_vector(63 downto 0)

问题描述 投票:1回答:3

这真的不应该这么困难。

我想从文件中读取原始的64位IEEE 754 double-precision floating-point数据,并在std_logic_vector(63 downto 0)中使用它。我正在使用ModelSim ALTERA 10.1b。

我试着将原始二进制数据读入64位向量:

type double_file is file of std_logic_vector(63 downto 0);
file infile1: double_file open read_mode is "input1.bin";

variable input1 : std_logic_vector(63 downto 0) := (others => '0');

read(infile1, input1);

但这不起作用。显然,ModelSim试图将输入数据的每个字节解释为std_logic'U''Z''-'等)。


但是,我可以成功地将数据读入real变量:

type real_file is file of real;
file infile1: real_file open read_mode is "input1.bin";

variable input1 : real;

read(infile1, input1);

但在这一点上,我无法弄清楚如何将real变量转换为std_logic_vector(63 downto 0)。几乎所有的Google results都说“你不能这样做; real不可合成”。我完全明白 - 这只是为了模拟。

floating-point vhdl ieee-754
3个回答
© www.soinside.com 2019 - 2024. All rights reserved.