본문 바로가기

Verilog/HDLbits

[HDLBits] Dualedge

1. 문제 및 설명

  • 듀올 엣지 트리거 플립플롭은 클록의 양쪽 엣지 모두에서 트리거된다.
    • FPGA에는 듀얼 엣지 트리거 플립플롭이 존재하지 않으며, always@(posedge clk or negedge clk)와 같은 구문을 사용할 수 없다.
    • 다음은 출력 예시이다.

 

2. 모듈 정의

module top_module (
    input clk,
    input d,
    output q
);

 

 

 

3. 답

module top_module (
    input clk,
    input d,
    output q
);
    reg p, n;
    
    assign q = (clk&p) | (!clk&n);
    
    always@(posedge clk)
        begin
            p <= d;
        end
    
    always@(negedge clk)
        begin
            n <= d;
        end
    

endmodule

'Verilog > HDLbits' 카테고리의 다른 글

[HDLBits] Count10  (0) 2026.01.05
[HDLBits] Count15  (0) 2026.01.03
[HDLBits] Edgecapture  (0) 2026.01.03
[HDLBits] Edgedetect2  (0) 2026.01.01
[HDLBits] Edgedetect  (0) 2026.01.01