ISIM信号分配延迟

时间:2016-09-02 14:03:05

标签: vhdl

我预计信号'延迟'将延迟到实体'端口'输入'的一个时钟周期,但ISIM没有显示相移。 我认为信号分配和实际值之间总是存在延迟(当进程暂停时),但我不会在这里看到它。

为什么会这样?

enter image description here

代码:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity test is
Port ( clk:   in  std_logic;
          input: in  std_logic
        );
end test;

architecture Behavioral of test is
    signal delay: std_logic:= '0';

    begin   
    proc1: process(clk)
    begin
        if(rising_edge(clk)) then
            delay <= input;                -- ISIM shows no delay between them
        end if;             
    end process;

end Behavioral;

测试平台:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;


ENTITY tb_testbench_test IS
END tb_testbench_test;

ARCHITECTURE behavior OF tb_testbench_test IS 

-- Component Declaration for the Unit Under Test (UUT) 
COMPONENT test
PORT(
          clk:   in  std_logic;
          input: in  std_logic
    );
END COMPONENT;


--Inputs
signal clk: std_logic := '0';
signal input: std_logic := '0';

-- Clock period definitions
constant clk_period : time := 10 ns;

BEGIN

-- Instantiate the Unit Under Test (UUT)
uut: test PORT MAP (
      clk => clk,
      input => input
    );

-- Clock process definitions
clk_process :process
begin
    clk <= '0';
    wait for clk_period/2;
    clk <= '1';
    wait for clk_period/2;
end process;


-- Stimulus process
stim_proc: process
begin       
  wait for clk_period * 9.5;    

    input <= '1';
    wait for clk_period;
    input <= '0';

  wait;
end process;

end;

2 个答案:

答案 0 :(得分:2)

您的测试平台同时描述了clkinput。然后,您的实体中有一个正在寻找rising_edge clk的流程。因此,当您的流程运行时,并且询问时钟是否有上升沿?&#39;,如果答案是“是”,那么时钟信号刚刚成为{ {1}},然后'1'的状态也必须为input,因为这两个信号同时发生了变化。然后,'1'信号将获取此新delay,并显示您看到的结果。

更现实的情况是input的上升沿导致input 引起的变化。您可以通过修改刺激过程轻松模拟这一点:

clk

答案 1 :(得分:1)

信号分配与其值出现之间的延迟是......一个增量循环。并且一个delta周期所花费的时间是0 fS。

您的测试平台所代表的是竞争条件,您可以在完全相同的时间呈现输入信号和时钟信号 - 即在相同的增量周期中。

在实际硬件中,无论输入是在时钟边缘还是下一个时钟边缘看到输入,或者在时钟边缘发生时都是中间值,会发生什么事情,这会增加metastable的可能性。操作。 模拟意外地提醒您这种误操作的可能性。

如果您将数据信号延迟一个增量周期(如果它是前一个时钟进程的输出,则保证会发生),例如在进程外部的并发信号分配,您将消除时序危险并查看延迟你期待。

相关问题