Exams/ece241 2013 q7

2023. 6. 19. 23:45FPGA/HDLBits

728x90

Problem Statement

A JK flip-flop has the below truth table. Implement a JK flip-flop with only a D-type flip-flop and gates. Note: Qold is the output of the D flip-flop before the positive clock edge.

 

module top_module (
    input clk,
    input j,
    input k,
    output Q); 
    
    always @(posedge clk)begin
        if(j == 0 && k == 0)
            Q <= Q;
        else if(j == 0 && k == 1)
            Q <= 0;
        else if(j == 1 && k == 0)
            Q <= 1;
        else if(j == 1 && k == 1)
            Q <= ~Q;
    end
endmodule

 

'FPGA > HDLBits' 카테고리의 다른 글

Gates100  (0) 2023.06.20
Bugs case  (0) 2023.06.20
Exams/ece241 2014 q4  (0) 2023.06.19
Exams/2014 q4a  (0) 2023.06.19
Mt2015 muxdff  (0) 2023.06.19