Author Topic: Can SE display preprocessor expansions?  (Read 3123 times)

warnerrs

  • Senior Community Member
  • Posts: 114
  • Hero Points: 4
Can SE display preprocessor expansions?
« on: November 26, 2016, 07:18:50 AM »
I'm defining preprocessor macros to be expanded under SystemVerilog options. The tagger sees the expanded code, but is there some way to preview the expansion in the editor? Selective Display's "Preprocessor directives" option is greyed out for SystemVerilog, but even when I played around with that in C++ it only seems to support hiding #if/else branches.

And while a selective display like expansion would be best, even a command that would just do the expansion in the buffer would be acceptable. I can always revert it later.

Graeme

  • Senior Community Member
  • Posts: 2821
  • Hero Points: 347
Re: Can SE display preprocessor expansions?
« Reply #1 on: November 26, 2016, 10:15:45 AM »
Maybe you could write a macro that calls Verilog:Preproc for the current buffer and shows the result in another buffer that auto synchs to the current buffer.
http://search.cpan.org/~wsnyder/Verilog-Perl-3.418/Preproc/Preproc.pm
I don't know whether the preproc output would have the same number of lines as the input, if not, the synch probably wouldn't work.
http://search.cpan.org/dist/Verilog-Perl/vppreproc

You could probably use vppreproc to generate the expansion of the current line with a little bit of fudging.