|
发表于 2013-7-22 23:50:19
|
显示全部楼层
- /*
- (C) OOMusou 2008 http://oomusou.cnblogs.com
- Filename : posedge_detection2.v
- Compiler : Quartus II 7.2 SP3
- Description : Demo how to design posedge detection circuit
- Release : 08/11/2008 1.0
- */
- module posedge_detection2 (
- input clk,
- input rst_n,
- input i_data_in,
- output reg o_rising_edge
- );
- reg r_data_in0;
- always@(posedge clk, negedge rst_n) begin
- if (!rst_n)
- r_data_in0 <= 0;
- else begin
- r_data_in0 <= i_data_in;
-
- if ({r_data_in0, i_data_in} == 2'b01)
- o_rising_edge <= 1;
- else
- o_rising_edge <= 0;
- end
- end
- endmodule
复制代码 你可以到原作者的博客上看看,一堆的方法。 |
|