create circuit from truth table
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.
Exams/ece241 2013 q7 - HDLBits (01xz.net)

1 module top_module ( 2 input clk, 3 input j, 4 input k, 5 output Q); 6 always @(posedge clk) begin 7 case({j,k}) 8 2'b00:Q<=Q; 9 2'b01:Q<=1'b0; 10 2'b10:Q<=1'b1; 11 2'b11:Q<=~Q; 12 endcase 13 end 14 endmodule
module top_module ( input clk, input j, input k, output Q); always@(posedge clk)begin Q<=(j*(~Q))|((~k)*Q); end endmodule

浙公网安备 33010602011771号