Prev Problem
Next Problem

73. SR Latch

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

Code

module sr_latch_nor (
    input  S,
    input  R,
    output reg Q,
    output reg Qn
);
    always @(*) begin
        case ({S, R})
            2'b00: {Q, Qn} = {Q, Qn}; // HOLD
            2'b01: {Q, Qn} = 2'b01; // RESET
            2'b10: {Q, Qn} = 2'b10; // SET
            2'b11: {Q, Qn} = 2'b01; // RESET
        endcase
    end
endmodule
Was this helpful?
Upvote
Downvote