【问题标题】:VHDL record fields do not update in Simulation in Vivado 2020.2VHDL 记录字段在 Vivado 2020.2 的模拟中不更新
【发布时间】:2021-10-01 11:10:35
【问题描述】:

我第一次注意到这个问题是在this 在这里发帖。我现在已经着手制作了一个 MCVE。被测设备:

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 数组的同步和启用字段没有按照函数指定的方式更新。在测试台上,我希望 output_custom_arr 中每个元素的同步和启用字段为 '1'

此问题与 here 发生的情况不同,其中未触及的字段正在被更改。但是,除非我在这里犯了错误,否则这是否再次证实了 Vivado 在正确模拟记录方面的努力? Windows 10 上的版本是否为 2020.2?

谢谢。 利爪 Myburgh。

【问题讨论】:

  • constant half_period : time := 10ns; IEEE Std 1076-2008 15.3 词法元素、分隔符和定界符 “标识符或抽象文字与相邻标识符或抽象文字之间至少需要一个分隔符。”结果是执行此要求的那些工具缺乏可移植性。请注意,在您的包和前两个实体/架构对中未使用 IEEE 包 numeric_std 中的任何声明。

标签: vhdl simulation record vivado


【解决方案1】:

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

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

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

谢谢大家。

【讨论】:

  • 我不知道你问了第二个问题!您的“MCVE”缺少一堆库和使用子句;在搜索完这些之后,我可以看到 Vivado 2021.1 产生了上述结果,而不是问题中的结果,所以显然 Xilinx 已经修复了它(至少是这个!)。
  • 抱歉,我不确定我错过了哪些库。我直接从一个工作项目中复制了这些文件(所有文件都在同一个库中)。很高兴知道他们已修复它。
  • 再次查看您的消息来源,我不得不撤回该评论:在我进入 Vivado 的 C&P 期间似乎发生了一些奇怪的事情。嗯...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-08-11
  • 1970-01-01
  • 2023-02-08
  • 2011-04-10
  • 1970-01-01
  • 1970-01-01
  • 2013-03-20
相关资源
最近更新 更多