Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-E repeats output #1226

Closed
veripoolbot opened this issue Oct 9, 2017 · 2 comments
Closed

-E repeats output #1226

veripoolbot opened this issue Oct 9, 2017 · 2 comments
Assignees
Labels
area: wrong runtime result Issue involves an incorrect runtine result from Verilated model resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Odd Magne Reitan
Original Redmine Issue: 1226 from https://www.veripool.org

Original Assignee: Wilson Snyder (@wsnyder)


In a verilog project, common structures like defines, macro functions, system verilog functions and tasks may be contained within one or more include files. Any file that makes use these common structures include the include file. A common way to ensure the definitions take place only once is to include in the top of the include file:

`ifndef INC1
 `define INC1
.. <Content to be defined only once>
`endif

However, if the same include file is included from different files, it seems like verilator in precompile mode (-E option) forget the `define INC1 and includes the content of inc1.sv also second time.
Run
verilator -E -P -F test.mft
Output is

module dummy ();
  initial
     $display("This should occur only once");
endmodule  
module dummy ();
  initial
     $display("This should occur only once");
endmodule  

This duplication will (dependent of the content of the include file) lead to error if the precompiled output file is simulated in a simulator. If the include file is included twice or more from within the same file, the module "dummy" will be included only once as expected.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-10-10T02:10:15Z


In your example it looked like the `define was ignored, but really it was repeating the first file's output twice. This only occurred with -E which is why it likely hadn't been noticed. Thanks for the report.

Fixed in git towards 3.914.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-10-14T20:22:36Z


In 3.914.

@veripoolbot veripoolbot added area: wrong runtime result Issue involves an incorrect runtine result from Verilated model resolution: fixed Closed; fixed labels Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: wrong runtime result Issue involves an incorrect runtine result from Verilated model resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

2 participants