ElectroDitzy
Module:
module jk_ff_(J,K,En,R,P,clk,Q,Qbar);
input J,K,En,R,P,clk;
output reg Q,Qbar;
end
endmodule
Test Bench:
module testing_jk_ff;
reg i1,i2,Enable,clock,reset,preset;
wire q,qcomp;
jk_ff_ tb(.J(i1),.K(i2),.En(Enable),.R(reset),.P(preset),.clk(clock),.Q(q),.Qbar(qcomp));
initial
begin
clock = 0;
forever begin
#5 clock = ~clock;
end
end
initial
begin
end
endmodule
https://electroditzy.wordpress.com/2014/02/08/verilog-code-for-jk-flipflop-with-asychronous-resetclear-synchronous-presetset-and-enable/ 2/3
8/2/2018 Verilog for JK Flip-Flop – ElectroDitzy
BLOG AT WORDPRESS.COM.
https://electroditzy.wordpress.com/2014/02/08/verilog-code-for-jk-flipflop-with-asychronous-resetclear-synchronous-presetset-and-enable/ 3/3