2

I'm trying to create a testbench file for the sequential circuit in Modelsim (Verilog). But, I'm getting the following syntax error.

** Error: (vlog-13069) /Assignment_2x2_tb.v(6): near "initial": syntax error, unexpected initial, expecting ';' or ','.

Here's my code

module seq_circuit1_tb;
reg x,clk;
wire q;
seq_circuit1 seqct(x, clk, Q0, Q1)
//Module to generate clock with period 10 time units
initial begin
  forever begin
  clk=0;
  #10
  clk=1;
  #10
  clk=0;
  end
end
initial begin
  x=0;
  #50
  x=0;
  #50
  x=1;
  #50
  x=1;
  #50
end
endmodule

Why am I getting this error?

2 Answers 2

2

You need a semicolon (;) after the line seq_circuit1 seqct(x, clk, Q0, Q1).

Sign up to request clarification or add additional context in comments.

2 Comments

Getting new error near "end": syntax error, unexpected end. at Line 24 just before endmodule.
#50 just before end seems to be invalid. Maybe you should add $finish; or something before the end
0

The initial block cannot end with a delay. You need to have some statement after the last #50 as follows

initial begin
  x=0;
  #50
  x=0;
  #50
  x=1;
  #50
  x=1;
  #50 $finish;
end
endmodule 

or

initial begin
  x=0;
  #50
  x=0;
  #50
  x=1;
  #50
  x=1;
  // last #50 removed
end
endmodule

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.