Friday 21 January 2022

Verilog Code for JK Flipflop


 



Gate Level Modelling

module jkflipflop(j,k,clk,q, qbar)

input j,k,clk;

output reg q,qbar;

wire x,y;

nand g1(x, j, qbar, clk);

nand g2(y, k, q, clk);

nand g3(q, qbar, x);

nand g4(qbar,q,y);

endmodule

Behavioral Level Modelling

module jkflipflop(j,k,clk,q)

input j,k,clk;

output reg q;

always @(posedge clk)

begin

case({j,k})

2'b00: begin q<=q; end

2'b01: begin q<=1; end

2'b10: begin q<=0; end

2'b11: begin q<=~q; end

endcase

end

endmodule

No comments:

Post a Comment

Verilog Code for Universal Shift Register

  Universal Shift Register module universalshift (clr,clk,sel,in,out); input clr,clk; input [1:0]sel; input [3:0]parin; output reg[3:0]out; ...