When I'm trying to simulating the code, getting the Error message
Error-[SE] Syntax error
"test_jkflipflop.v", 10: token is '('
My source code:
( .J(J), .K(K), .Clk(Clk), .R(R), .S(S), .Q(Q), .Qbar(Qbar));
So please let me know my problem
here i had Written the JK_Flip FLop Structural code and Test bench code.
******Structural*******
`timescale 1ns/1ps
module JKflipflop(J,K,Clk,R,S,Q,Qbar);
input J,K;
input Clk;
input R;
input S;
input Q;
output Qbar;
reg Qbar;
always@ (posedge(Clk))
begin
if(R == 1)
Qbar = 0;
else
if(S == 1)
Qbar = 1;
else
if(Q == 1)
if(J == 0 && K == 0)
Qbar = Qbar;
else
if(J == 0 && K == 1)
Qbar = 0;
else
if(J == 1 && K == 0)
Qbar = 1;
else
Qbar = ~Qbar;
else
Qbar = Qbar;
end
endmodule
*******testbench*****
`timescale 1ns/1ps
module test_JK_flipflop;
reg J;
reg K;
reg Clk;
reg R;
reg S;
reg Q;
wire Qbar;
( .J(J), .K(K), .Clk(Clk), .R(R), .S(S), .Q(Q), .Qbar(Qbar));
initial begin
$monitor ("J=%b K=%b Clk=%b R=%b S=%b Q=%b Qbar=%b", J,K,Clk,R,S,Q,Qbar);
end
initial Clk = 0;
always
#10
Clk = ~Clk;
initial begin
J = 0;
K = 0;
R = 0;
S = 0;
Q = 0;
#30;
R = 1;
#50;
R = 0;
S = 1;
#50;
S = 0;
J = 1; K = 1;
#50;
Q= 1; #50;
J = 0; K = 0;
#50;
J = 0; K = 1;
#50;
J = 1; K = 0;
#50;
J = 1; K = 1;
#50;
Q = 0;
end
endmodule