Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Syntax error verilog defining module iverilog

I’m getting a syntax error at 11 line
Full adder using xor and mux2x1

module xormux(x1, x2, x3, y1, y2);
  input x1, x2, x3;
  output y1, y2;
  wire w1, w2;

  xor gate1(w1, x1, x2);
  xor gate2(y1, w1, x3);
  mux2x1 gate3(y2, w1, x3, x2);
endmodule

module xor(output o, input i1, i2);
  assign o = i1 ^ i2;
endmodule

module mux2x1(output o, input i1, i2, s);
  assign o = s ? i2 : i1;
endmodule

Full adder using xor and mux2x1

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

xor is a reserved keyword in Verilog, per Table 22-1 in the standard (see IEEE Std 1800-2017, "22.14.2 IEEE 1364-1995 keywords").

Use a different identifier for your module.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading