简体   繁体   English

有源HDL仿真时钟交叉

[英]Active-HDL simulation clock crossing

I have 2 modules using the same clock but in different files, when I sample signal that come from module A in module B , in the Waveform simulation it doesn't get samples after one clock cycle like it should , it shows that is samples in the same rising edge(behavior that fit to asynchronous instasiation) . 我有2个模块使用相同的时钟,但是在不同的文件中,当我对来自模块B中的模块A的信号进行采样时,在波形模拟中,它不会在一个时钟周期之后得到样本,它表明它是样本中的相同的上升沿(适合异步instasiation的行为)。

I have been told it happens because Active-HDL consider it to 2 differnet clock because of the different component and thats why it sample in the same rising edge(because of the delta time that the signal goes from A to B). 有人告诉我发生这种情况是因为Active-HDL认为它是2个不同的时钟因为不同的组件,这就是为什么它在同一个上升沿采样(因为信号从A到B的增量时间)。

how can i define that Active-HDL will understand they both use the same clock in same area ? 我如何定义Active-HDL会理解它们在同一区域使用相同的时钟?

This has nothing to do with your simulator. 这与您的模拟器无关。 I assume that you're doing something like this: 我假设你做的是这样的:

        +----------+           +----------+
        |          |-- clk --->|          |
clk --->| Module A |           | Module B |
        |          |-- data -->|          |
        +----------+           +----------+

where you should be doing something like that: 你应该在哪里做这样的事情:

        +----------+           +----------+
        |          |           |          |
clk -+->| Module A |-- data -->| Module B |
     |  |          |           |          |
     |  +----------+           |          | 
     |                         |          |
     +-----------------------> |          |
                               +----------+

The problem with the first configuration is that your clock signal gets delayed by one or more delta cycles when it goes through module A. It may thus toggle in the same, or in a later delta cycle than the data signal. 第一种配置的问题在于,当您的时钟信号通过模块A时,它会延迟一个或多个增量周期。因此,它可以在与数据信号相同或更晚的增量周期中切换。 This is something that you will not see in the simulator's waveform view (unless it has an option to expand delta cycles) but you can have a look at the list view to see exactly what happens in delta-time. 这是您在模拟器的波形视图中看不到的内容(除非它有扩展delta周期的选项),但您可以查看列表视图以确切了解delta时间中发生的情况。

The handling of clock within your chip and within your simulation environment requires the same type of care you take in doing a board design. 在芯片内和模拟环境中处理时钟需要您在进行电路板设计时采取相同的谨慎态度。 In particular clock skew must always be smaller than the smallest propagation delay. 特别是时钟偏差必须始终小于最小传播延迟。

In an RTL simulation environment, all of the delays on signals are measured in terms of delta cycles (the default delay for any signal assignment when you are not using after). 在RTL仿真环境中,信号的所有延迟都是根据增量周期(当您不使用之后的任何信号分配的默认延迟)来测量的。 Going through a port does not incur any delta cycles. 通过端口不会产生任何增量周期。 However, every assignment to a signal causes a delta cycle delay. 但是,对信号的每次分配都会导致增量循环延迟。

One method to insure successful data transfer is to make sure all clocks in the design are delta cycle aligned when they are used. 确保成功传输数据的一种方法是确保设计中的所有时钟在使用时都是三角形循环对齐的。 The simplest way to make sure this happens is to make sure that none of the blocks do an assignment to the clock they use. 确保发生这种情况的最简单方法是确保没有任何块对它们使用的时钟进行分配。 Hence, do not do any of the following: 因此,请勿执行以下任何操作:

LocalClk <= PortClk ;    -- each assignment causes a delta cycle of clock skew 
GatedClk <= Clk and Enable ;   -- clock gates are bad.  See alternative below

Generally we rarely use clock gates - and then we only do it when it is an approved part of our methodology (usually not for FPGAs). 通常我们很少使用时钟门 - 然后我们只在它是我们方法的批准部分时才这样做(通常不适用于FPGA)。 In place of using gated clocks in your design, use data path enables: 在您的设计中使用门控时钟代替,使用数据路径启用:

process (Clk) 
begin
  if rising_edge(Clk) then
    if Enable = '1' then 
      Q <= D ; 
    end if ; 
  end if ; 
end process ; 

There are other methodologies to sort this out. 还有其他方法可以解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM