初始化VHDL中的记录数组 [英] Initializing an array of records in VHDL

查看:483
本文介绍了初始化VHDL中的记录数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一条定义如下的记录

I have an record defined as follows

type ifx_t is
record
  data                        : std_logic_vector(127 downto 0);
  address                     : std_logic_vector (19 downto 0); 
  WrReq                       : std_logic;-- 
  RdReq                       : std_logic; --
end record;
type Array_ifx_t is array (0 to 2) of ifx_t;

我必须初始化该记录数组的实例,并且尝试了以下方法,但它不起作用

And I have to initialize an instance of this array of records and I have tried the following way and it doesn't work

signal pair_in       : Array_ifx_t:= (others =>((others =>'0'),(others=>'0'),'0','0')); 

请帮助.

推荐答案

如评论中所述,当使用ModelSim编译问题代码时,ModelSim可以正常工作.但是,对于Array_ifx_t中的元素使用类型化的值,其他工具可能会更严格.

As said in the comment, ModelSim work when compiling the code from question with ModelSim. However, other tools may be more strict about using a typed value for elements in Array_ifx_t.

对于类型化的分配和命名记录元素的使用,我认为这可以使getter概述并避免位置引用引起的错误,您可以使用以下方法进行初始化:

For a typed assign and use of named record elements, which I think gives getter overview and avoid mistakes by position references, you can make the initialization with:

constant IFX_T_0S : ifx_t := (data => (others =>'0'),
                              address => (others=>'0'),
                              WrReq => '0',
                              RdReq => '0');

signal pair_in : Array_ifx_t:= (others => IFX_T_0S);

这篇关于初始化VHDL中的记录数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆