【发布时间】: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