Prev Problem
Next Problem

80. DFF with Async Reset and Preset

Back To All Submissions
Previous Submission
Next Submission

4 line code

How do you plan to solve it?

 

Code

module dff_async_reset_preset (
    input  CLK,
    input  RST,
    input  PRE,
    input  D,
    output reg Q
);
    always@(posedge RST or posedge PRE or posedge CLK)begin
        if(RST) Q <= 0;
        else if(PRE) Q <= 1;
        else Q <= D;
    end

endmodule
Was this helpful?
Upvote
Downvote