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

Question: auto not descending into `include files ... #181

Closed
veripoolbot opened this issue Nov 17, 2009 · 6 comments
Closed

Question: auto not descending into `include files ... #181

veripoolbot opened this issue Nov 17, 2009 · 6 comments
Labels

Comments

@veripoolbot
Copy link
Collaborator


Author Name: Clay Douglass
Original Redmine Message: 176 from https://www.veripool.org


I am working with some files that have the port list and input/output declaration in included files e.g.

xunit.ports.v:1:   // Outputs
xunit.ports.v:2:   foo,
xunit.ports.v:3:   // Inputs
xunit.ports.v:4:   bar

xunit.tinc.vs:1:  input bar;
xunit.tinc.vs:2:  output foo;

xunit.v:1:
xunit.v:2:module xunit (
xunit.v:3:`include "xunit.ports.v"
xunit.v:4:)
xunit.v:5:`include "xunit.tinc.vs"
xunit.v:6:  assign foo = bar;
xunit.v:7:endmodule // xunit
xunit.v:8:
xunit.v:9:// Local Variables:
xunit.v:10:// verilog-library-flags:("-y ./ ")
xunit.v:11:// verilog-library-extensions:(".v" ".h" ".sv" ".vs")
xunit.v:12:// eval:(verilog-read-defines)
xunit.v:13:// eval:(verilog-read-includes)
xunit.v:14:// eval:(setq verilog-auto-read-includes t)
xunit.v:15:// End:

xunit_top.v:1:
xunit_top.v:2:module xunit_top ( /*AUTOARG*/)
xunit_top.v:3:  xunit i_xunit(/*AUTOINST*/);
xunit_top.v:4:
xunit_top.v:5:endmodule // xunit_top
xunit_top.v:6:// Local Variables:
xunit_top.v:7:// verilog-library-flags:("-y ./")
xunit_top.v:8:// verilog-library-extensions:(".v" ".h" ".sv" ".vs")
xunit_top.v:9:// eval:(verilog-read-defines)
xunit_top.v:10:// eval:(verilog-read-includes)
xunit_top.v:11:// eval:(setq verilog-auto-read-includes t)
xunit_top.v:12:// End:

If I verilog-auto in xunit_top.v it does nothing. If I manually replace the include with the file content it works fine. Is there a setting to make it follow the `include when it parse for ports?

Thanks,

Clay

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Clay Douglass
Original Date: 2009-11-17T23:31:57Z


Hmmm, forum formated my post poorly. Attaching files.

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2009-11-18T13:37:08Z


Is there a setting to make it follow the `include when it parse for ports?

No, sorry. The way it's assumed you'd do things like this is to use /AUTOINOUTMODULE("xunit.ports.v")/

xunit.ports.v would then need a module/endmodule; they can be ifdef'ed if you wish:

`ifdef NEVER  // Just for emacs
module never;
`endif

input a;

`ifdef NEVER
endmodukle
`endif

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2009-11-18T13:37:56Z


BTW the other advantage of AUTOINOUTMODULE is then you don't need to maintain two includes; just one will do it and use /AUTOARG/ to autogenerate the port list (or use verilog 2001 syntax).

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2009-11-18T15:32:15Z


Hmm.... Maybe this instead of the include? I'm not sure it will be replaced in time for the autos to work.

/*AUTOINSERTLISP(insert-file "foo.port.v")*/

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2009-11-18T16:56:46Z


[I put AUTOINSERTLISP] in the same file and it still does not expand. I guess the AUTOINSERTLISP happens after the parsing.

If it doesn't expand at all you might have a old version. If it doesn't
work, it will expand, but it won't recognize the new ports.

I'm curious, and didn't want you to download with little hope of success, so ran an experiment. It works great. BTW There's no point in using the port file, Verilog-Mode will do it for you:

module xunit (/*AUTOARG*/
    // Outputs
    foo,
    // Inputs
    bar
    );

    //`include "xunit.tinc.vs"
    /*AUTOINSERTLISP(insert-file "xunit.tinc.vs")*/
  input bar;
  output foo;

    assign foo = bar;

endmodule

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2009-11-18T18:08:46Z


I am using verilog-mode 475. Your version behaved the same way mine did
initially. Then I copied the xunit.tinc.vs to the local dir and that worked!
Thanks. Is there a way to set the search path for AUTOINSERTLISP(insert-file?

I tried it, and noticed there's a bug that it doesn't clean up what it inserts properly.
So, grab new version 551 from here, then use:

/*AUTOINSERTLISP(verilog-library-filenames (insert-file "xunit.tinc.vs"))*/

Oops. I just saw the input and output for foo and bar in your module def.
When I removed them it no long expands the AUTOINST... So I the
AUTOINSERTLISP is not working for me. Are you sure it's working for you? Can
you add an output to xunit.tinc.vs and have it show up in your AUTOINST
list?

It works. Since it's inlined, you need to save the tinc file, auto-expand the child (module with insertlisp) first, then move to the parent. (Just as if you added the input in the non-included place.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant