2

I am writing a test bench for AND module but it gives me the following error near "end": syntax error, unexpected end.

here is my code:

module TestAND();

reg A;
reg B;
wire C;

AND inst(A,B,C);


initial begin
 A=1;
 B=0;
 #100
end 
1
  • do #100;, instead of #100 Commented Oct 17, 2016 at 4:05

2 Answers 2

4

You need to add ;after #100 and you also missing endmodule at the end.

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

Comments

0

I see a couple things here, you have an incorrect data type: reg is only used in an always block, and so here everything should be type wire. Also if I recall correctly the primitives usually have the output first, so you would probably want AND my_and (c,a,b);

However, usually you don't use primitives directly unless you're creating libraries, and would want to use assign c = a & b; instead.

1 Comment

A reg can be assigned in an always or initial block. A wire can be assigned by an assign statement or module/primitive instantiation. Verilog primitives have lower-case names, AND could a user defined module not being shown.

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.