Skip to main content
Post Reopened by Voltage Spike
Post Closed as "Needs details or clarity" by ocrdu, user319836, Voltage Spike
edited body
Source Link
toolic
  • 9.8k
  • 9
  • 27
  • 35

I have written Verilog code for a JK flip flop (gate level modelling), and I am getting an error in the output (error means x propagation). Why are my q and qb outputs x (the unknown Verilog value)? For example, when k=`k=1 and j=0, I expect q=0.

module jk (q,qb,j,k,clk);
    output q,qb;
    input j,k,clk;
    wire [1:0]a;
    nand (a[0],j,clk,qb), (a[1],k,clk,q);
    nand (q,a[0],qb), (qb,a[1],qb);
endmodule

module tb;
wire q,qb;
reg j,k,clk;
jk ff (.j(j), .k(k), .clk(clk), .q(q), .qb(qb));

initial begin
    clk=0;
    forever #5 clk=~clk;
end

initial begin
        j=1'b0; k=1'b1;
    #10 j=1'b1; k=1'b0;
    #10 j=1'b1; k=1'b1;
    #10 j=1'b0; k=1'b0;
    #10 $finish;
end
endmodule

I have written Verilog code for a JK flip flop (gate level modelling), and I am getting an error in the output (error means x propagation). Why are my q and qb outputs x (the unknown Verilog value)? For example, when k=` and j=0, I expect q=0.

module jk (q,qb,j,k,clk);
    output q,qb;
    input j,k,clk;
    wire [1:0]a;
    nand (a[0],j,clk,qb), (a[1],k,clk,q);
    nand (q,a[0],qb), (qb,a[1],qb);
endmodule

module tb;
wire q,qb;
reg j,k,clk;
jk ff (.j(j), .k(k), .clk(clk), .q(q), .qb(qb));

initial begin
    clk=0;
    forever #5 clk=~clk;
end

initial begin
        j=1'b0; k=1'b1;
    #10 j=1'b1; k=1'b0;
    #10 j=1'b1; k=1'b1;
    #10 j=1'b0; k=1'b0;
    #10 $finish;
end
endmodule

I have written Verilog code for a JK flip flop (gate level modelling), and I am getting an error in the output (error means x propagation). Why are my q and qb outputs x (the unknown Verilog value)? For example, when k=1 and j=0, I expect q=0.

module jk (q,qb,j,k,clk);
    output q,qb;
    input j,k,clk;
    wire [1:0]a;
    nand (a[0],j,clk,qb), (a[1],k,clk,q);
    nand (q,a[0],qb), (qb,a[1],qb);
endmodule

module tb;
wire q,qb;
reg j,k,clk;
jk ff (.j(j), .k(k), .clk(clk), .q(q), .qb(qb));

initial begin
    clk=0;
    forever #5 clk=~clk;
end

initial begin
        j=1'b0; k=1'b1;
    #10 j=1'b1; k=1'b0;
    #10 j=1'b1; k=1'b1;
    #10 j=1'b0; k=1'b0;
    #10 $finish;
end
endmodule
added 66 characters in body
Source Link
toolic
  • 9.8k
  • 9
  • 27
  • 35

I have written Verilog code for a JK flip flop (gate level modelling), and I am getting an error in the output (error means x propagation). Why are my q and qb outputs x (the unknown Verilog value)? For example, when k=` and j=0, I expect q=0.

module jk (q,qb,j,k,clk);
    output q,qb;
    input j,k,clk;
    wire [1:0]a;
    nand (a[0],j,clk,qb), (a[1],k,clk,q);
    nand (q,a[0],qb), (qb,a[1],qb);
endmodule

module tb;
wire q,qb;
reg j,k,clk;
jk ff (.j(j), .k(k), .clk(clk), .q(q), .qb(qb));

initial begin
    clk=0;
    forever #5 clk=~clk;
end

initial begin
        j=1'b0; k=1'b1;
    #10 j=1'b1; k=1'b0;
    #10 j=1'b1; k=1'b1;
    #10 j=1'b0; k=1'b0;
    #10 $finish;
end
endmodule

I have written Verilog code for a JK flip flop (gate level modelling), and I am getting an error in the output (error means x propagation).

module jk (q,qb,j,k,clk);
    output q,qb;
    input j,k,clk;
    wire [1:0]a;
    nand (a[0],j,clk,qb), (a[1],k,clk,q);
    nand (q,a[0],qb), (qb,a[1],qb);
endmodule

module tb;
wire q,qb;
reg j,k,clk;
jk ff (.j(j), .k(k), .clk(clk), .q(q), .qb(qb));

initial begin
    clk=0;
    forever #5 clk=~clk;
end

initial begin
        j=1'b0; k=1'b1;
    #10 j=1'b1; k=1'b0;
    #10 j=1'b1; k=1'b1;
    #10 j=1'b0; k=1'b0;
    #10 $finish;
end
endmodule

I have written Verilog code for a JK flip flop (gate level modelling), and I am getting an error in the output (error means x propagation). Why are my q and qb outputs x (the unknown Verilog value)? For example, when k=` and j=0, I expect q=0.

module jk (q,qb,j,k,clk);
    output q,qb;
    input j,k,clk;
    wire [1:0]a;
    nand (a[0],j,clk,qb), (a[1],k,clk,q);
    nand (q,a[0],qb), (qb,a[1],qb);
endmodule

module tb;
wire q,qb;
reg j,k,clk;
jk ff (.j(j), .k(k), .clk(clk), .q(q), .qb(qb));

initial begin
    clk=0;
    forever #5 clk=~clk;
end

initial begin
        j=1'b0; k=1'b1;
    #10 j=1'b1; k=1'b0;
    #10 j=1'b1; k=1'b1;
    #10 j=1'b0; k=1'b0;
    #10 $finish;
end
endmodule
added 72 characters in body
Source Link
toolic
  • 9.8k
  • 9
  • 27
  • 35

I have written Verilog code for a JK flip flop (gate level modelling), and I am getting an error in the output (error means x propagation).

module jk (q,qb,j,k,clk);
    output q,qb;
    input j,k,clk;
    wire [1:0]a;
    nand (a[0],j,clk,qb), (a[1],k,clk,q);
    nand (q,a[0],qb), (qb,a[1],qb);
endmodule

module tb;
wire q,qb;
reg j,k,clk;
jk ff (.j(j), .k(k), .clk(clk), .q(q), .qb(qb)); 

initial begin
    clk=0;
    forever #5 clk=~clk;
end 

initial begin
j=1'b0;k=1'b1;        j=1'b0; k=1'b1;
    #10 j=1'b1;k=1'b0;j=1'b1; k=1'b0;
    #10 j=1'b1;k=1'b1;j=1'b1; k=1'b1;
    #10 j=1'b0;k=1'b0;j=1'b0; k=1'b0;
    #10 $finish;
end
endmodule

I have written Verilog code for a JK flip flop (gate level modelling), and I am getting an error in the output (error means x propagation).

module jk(q,qb,j,k,clk);
output q,qb;
input j,k,clk;
wire [1:0]a;
nand(a[0],j,clk,qb),(a[1],k,clk,q);
nand(q,a[0],qb),(qb,a[1],qb);
endmodule

module tb;
wire q,qb;
reg j,k,clk;
jk ff(.j(j),.k(k),.clk(clk),.q(q),.qb(qb));
initial begin
clk=0;
forever #5 clk=~clk;
end
initial begin
j=1'b0;k=1'b1;
#10 j=1'b1;k=1'b0;
#10 j=1'b1;k=1'b1;
#10 j=1'b0;k=1'b0;
#10 $finish;
end
endmodule

I have written Verilog code for a JK flip flop (gate level modelling), and I am getting an error in the output (error means x propagation).

module jk (q,qb,j,k,clk);
    output q,qb;
    input j,k,clk;
    wire [1:0]a;
    nand (a[0],j,clk,qb), (a[1],k,clk,q);
    nand (q,a[0],qb), (qb,a[1],qb);
endmodule

module tb;
wire q,qb;
reg j,k,clk;
jk ff (.j(j), .k(k), .clk(clk), .q(q), .qb(qb)); 

initial begin
    clk=0;
    forever #5 clk=~clk;
end 

initial begin
        j=1'b0; k=1'b1;
    #10 j=1'b1; k=1'b0;
    #10 j=1'b1; k=1'b1;
    #10 j=1'b0; k=1'b0;
    #10 $finish;
end
endmodule
edited tags
Source Link
toolic
  • 9.8k
  • 9
  • 27
  • 35
Loading
added 145 characters in body; edited tags; edited title
Source Link
toolic
  • 9.8k
  • 9
  • 27
  • 35
Loading
Source Link
Loading