module dual_edge_detect ( clk, signal, pulse ); input clk; input signal; output pulse; reg signal_prev; always @(posedge clk) signal_prev <= signal; assign pulse = (~signal & signal_prev) | (signal & ~signal_prev); endmodule module rising_edge_detect ( clk, signal, pulse ); input clk; input signal; output pulse; reg signal_prev; always @(posedge clk) signal_prev <= signal; assign pulse = signal & ~signal_prev; endmodule module falling_edge_detect ( clk, signal, pulse ); input clk; input signal; output pulse; reg signal_prev; always @(posedge clk) signal_prev <= signal; assign pulse = ~signal & signal_prev; endmodule
성공을 향해 날개를 피는 자신의 창조물을 볼 때만큼 발명가로써 흥분될 때는 없다. 그런 감정은 음식, 잠, 친구, 사랑, 모든 것조차 잊게 한다. - 니콜라 테슬라 -
Tuesday, October 14, 2014
[verilog] edge detector
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment