N
nezhate
Guest
Hi all,
i'm newer to the verilog world, i have to model a negative
edge-triggered JK flipflop, jk_ff with asynchronous preset and clear as
a UDP. q = 1 when preset = 1 and q = 0 when clear = 1.
The problem is when J=K=1 the next ouput(q+) must be = not(q), but
after testing with ICARUS VERILOG i get x.
also: when J=K=0 the next output (q+) must be = (q) = unchanged, but
the execution gives x.
Can you tell me why it doesn't work correctly?
Thanks for all.
Here's the code that i've used:
primitive JK_ff(q,clear,preset,clk,j,k);
output q;
reg q;
input clear,preset,clk,j,k;
initial
q=0;
table
//clear preset clk j k : q : q+;
1 0 ? ? ? : ? : 0;
0 1 ? ? ? : ? : 1;
0 0 (10) 0 1 : ? : 0;
0 0 (10) 1 0 : ? : 1;
0 0 (10) 0 0 : ? : -; // in this case i got q=x,
expected q+ = q
0 0 (10) 1 1 : 0 : 1; //in this case i got q=x, expected
q+ = 1
0 0 (10) 1 1 : 1 : 0; //is it wright this code ?
endtable
endprimitive // JK_ff
i'm newer to the verilog world, i have to model a negative
edge-triggered JK flipflop, jk_ff with asynchronous preset and clear as
a UDP. q = 1 when preset = 1 and q = 0 when clear = 1.
The problem is when J=K=1 the next ouput(q+) must be = not(q), but
after testing with ICARUS VERILOG i get x.
also: when J=K=0 the next output (q+) must be = (q) = unchanged, but
the execution gives x.
Can you tell me why it doesn't work correctly?
Thanks for all.
Here's the code that i've used:
primitive JK_ff(q,clear,preset,clk,j,k);
output q;
reg q;
input clear,preset,clk,j,k;
initial
q=0;
table
//clear preset clk j k : q : q+;
1 0 ? ? ? : ? : 0;
0 1 ? ? ? : ? : 1;
0 0 (10) 0 1 : ? : 0;
0 0 (10) 1 0 : ? : 1;
0 0 (10) 0 0 : ? : -; // in this case i got q=x,
expected q+ = q
0 0 (10) 1 1 : 0 : 1; //in this case i got q=x, expected
q+ = 1
0 0 (10) 1 1 : 1 : 0; //is it wright this code ?
endtable
endprimitive // JK_ff