VHDL语言记录字段在VIVADO 2020.2的模拟中不会更新 [英] VHDL record fields do not update in Simulation in Vivado 2020.2

查看:21
本文介绍了VHDL语言记录字段在VIVADO 2020.2的模拟中不会更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次注意到这个问题是在this这里的帖子中。我现在已经做了一个MCVE。DUT:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use work.top_pkg.all;

entity top is
  Port ( 
      clk : in std_logic;
      ce : in std_logic;
      input_custom_arr : in custom_record_array(4 downto 0);
      info : in custom_record;
      ctrl : in custom_record;
      output_custom_arr : out custom_record_array(4 downto 0)
  );
end top;

architecture Behavioral of top is

begin
    process(clk)
    begin
      if(ce = '1' and rising_edge(clk)) then
        output_custom_arr <= func_manipulate_custom_record_array(input_custom_arr, info, ctrl);
      end if;
    end process;
end Behavioral;

它使用的包含自定义函数和类型的包:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;

package top_pkg is
    type custom_record is record
        data_1 : std_logic_vector(3 downto 0);
        data_2 : std_logic_vector(3 downto 0); 
        sync   : std_logic;   
        enable : std_logic;
    end record;

    type custom_record_array is ARRAY (INTEGER RANGE <>) of custom_record;

    FUNCTION func_manipulate_custom_record_array(dp : custom_record_array; info, ctrl : custom_record) RETURN custom_record_array;
    end package;

package body top_pkg is

    FUNCTION func_manipulate_custom_record_array(dp : custom_record_array; info, ctrl : custom_record) RETURN custom_record_array is
        VARIABLE v_dp : custom_record_array(dp'RANGE) := dp;
        begin
            for I IN dp'RANGE LOOP
                v_dp(I).sync := info.sync;
                v_dp(I).enable := ctrl.enable;
            end loop;
        return v_dp;
        END func_manipulate_custom_record_array;
end package body;

和要模拟的测试平台:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;
use work.top_pkg.all;

entity tb_top is
end tb_top;

architecture Behavioral of tb_top is
constant half_period : time := 10ns;
constant num_of_clocks : integer := 10;

signal input_custom_arr : custom_record_array(4 downto 0);
signal output_custom_arr : custom_record_array(4 downto 0);
signal info : custom_record := ((others=>'0'),(others=>'0'),'1','0');
signal ctrl : custom_record := ((others=>'0'),(others=>'0'),'0','1');
signal clk : std_logic := '0';
signal ce : std_logic := '0';
signal i : integer := 0;

begin
    -- continuous clock
    process 
    begin
        clk <= '0';
        wait for half_period;
        clk <= '1';
        wait for half_period;

        if (i = num_of_clocks) then
            wait;
        elsif (i < 5) then
            input_custom_arr(i).data_1 <= std_logic_vector(TO_SIGNED(i,4));
            input_custom_arr(i).data_2 <= std_logic_vector(TO_SIGNED(4-i,4));
            i <= i + 1;
        elsif ( i = 5) then
            ce <= '1';
            i <= i + 1;
        else
            i <= i + 1;
        end if;
    end process;

    --DUT
    u_dut : entity work.top
    port map(
        clk => clk,
        ce => ce,
        input_custom_arr => input_custom_arr,
        output_custom_arr => output_custom_arr,
        info => info,
        ctrl => ctrl
    );
end Behavioral;
如果进行模拟,您将获得以下波形窗口:

在第7个周期之后,您会注意到output_custom_arr数组的sync和enable字段没有按照函数的指定进行更新。在测试平台中,我预计output_custom_arr中每个元素的sync和enable字段都是'1'

此问题与更改未触及字段时发生的here不同。然而,除非我在这里犯了一个错误,否则这是否重申了Vivado很难正确地模拟记录呢?至少适用于Windows10上的2020.2版?

谢谢。 塔隆·迈堡

推荐答案

我发现这似乎是此问题和提到的here的版本问题。

在Windows10上的Vivado 2020.1中,对于与上面完全相同的项目,我得到了我们在模拟中所期望的:

我不知道此问题在Vivado 2020.2中扩展到什么程度,但我建议暂时避免使用该版本中的记录数组进行设计。

谢谢所有人。

这篇关于VHDL语言记录字段在VIVADO 2020.2的模拟中不会更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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