Monday, 23 February 2015

4-bit Asynchronous up counter using JK-FF (Structural model)



Circuit Diagram for 4-bit Asynchronous up counter using JK-FF:
 


Verilog Code for jkff: (Behavioural model)
module jkff(j,k,clock,reset,q,qb);
input j,k,clock,reset;
output reg q,qb;
always@(negedge clock)
begin
case({reset,j,k})
3'b100 :q=q;
3'b101 :q=0;
3'b110 :q=1;
3'b111 :q=~q;
default :q=0;
endcase
qb<=~q;
end
endmodule

Verilog Code for 4-bit Asynchronous up counter using JK-FF (Structural model):
module ripple_count(j,k,clock,reset,q,qb);
input j,k,clock,reset;
output wire [3:0]q,qb;

jkff JK1(j,k,clock,reset,q[0],qb[0]);
jkff JK2(j,k,q[0],reset,q[1],qb[1]);
jkff JK3(j,k,q[1],reset,q[2],qb[2]);
jkff JK4(j,k,q[2],reset,q[3],qb[3]);

endmodule

5 comments:

  1. can you provide testbench for this

    ReplyDelete
  2. sir,i want the text bench for this code
    give reply

    ReplyDelete
  3. Can u send mode10 structural programs code using jk flipflop in verliog

    ReplyDelete
  4. Shouldn't clock be negative edge triggered here..

    ReplyDelete
  5. need 4 bit asynchronous uper counter D,T Ff

    ReplyDelete