Prev Problem
Next Problem

84. T Flip-Flop with Asynchronous Preset and Reset

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

Code

module t_ff_async_pr (
    input  CLK,
    input  RST,
    input  PRE,
    input  T,
    output reg Q
);
    // Write your code here
    always@(posedge CLK or posedge PRE or posedge RST)begin
        if(RST) Q <= 0;
        else if(PRE) Q <= 1'b1;
        else Q <= (T) ? ~Q : Q;
    end 
endmodule

 

Was this helpful?
Upvote
Downvote