在VHDL中,是否可以将textio包中的"file"类型作为记录结构的元素包含在内? 我想有一个名为 init(( 的功能来打开一个文件,将处理程序保存到记录结构中的文件中,然后有另一个称为 next(( 的函数,该函数将从记录中的文件描述符中读取一条记录,并在每次调用 next(( 时将数据从文件加载到记录结构中。
例:
library ieee;
use ieee.std_logic_1164.all;
use std.textio.all;
entity testbench is
end entity;
architecture sim of sim_apb is
type rec_t is record
file F :text; --Produces a syntax error
-- composite type not allowed
state :natural;
end record;
signal rec: rec_t
begin
end architecture;
当我尝试删除代码中的文件时,出现此错误:
错误: [VRFC 10-602] 复合类型中不允许文件类型的元素
所以我认为你不能在记录中使用文件类型。
我不太了解您的需求,但您可以尝试使用记录中允许的字符串。