2017-07-31 49 views
0

我有一个组合代码,在该代码中,我想在1个时钟周期之后关闭一个信号,即最初为1,并且在一个时钟周期它应该是0.有什么办法可以做到这一点,如果可能的话,它应该能够在FPGA上进行合成。 的代码如下:如何在组合模块中给出1个时钟周期的延迟verilog

[email protected](ao or bo or co or dod or eo or fo or go or ho) 
    begin 
    temp_out = {ho,go,fo,eo,dod,co,bo,ao}; 
    out_flag = 1; 
    //after one clock cycle it should go to 0 ; 
    //help is required over here 
    out_flag = 0; 
    end 

回答

1

你不能做一个纯组合合成的方式。你需要一个触发器(这是合成的)和一个复位设置信号到一个已知值,表示为0。所以,你可以延迟复位后1个时钟周期,如下所示:

always @(posedge clk) begin 
    if (reset) 
     out_flag <= 0; 
    else 
     out_flag <= 1; 
end 

你需要图拿出确切的时间和使用正确数量的触发器为你特定的情况。如上例所示,您可能想要对异步进行异步复位。

相关问题