0

I have a compilation script I run before simulating on QuestaSim 10.7:

vcom -vhdl -2008 my_lib -check_synthesis src/mux.vhd
vcom -vhdl -2008 my_lib -check_snythesis src/clockdivdeby2.vhd
...

I receive an output on terminal as follows:

vcom -vhdl -2008 my_lib -check_synthesis src/mux.vhd
-- Loading package STANDARD
-- Loading package TEXTIO
-- Loading package std_logic_1164
-- Loading package std_logic_arith
-- Loading package STD_LOGIC_UNSIGNED
-- Compiling entity eop_counter_tb
-- Compiling architecture rtl of eop_counter_tb
-- Loading entity eop_counter
End time: HH:MM:SS on Mon, DY, YEAR, Elapsed time: 0:00:00
Errors: 0, Warnings: 0
vcom -vhdl -2008 my_lib -check_synthesis src/mux2.vhd
-- Loading package STANDARD
-- Loading package TEXTIO
-- Loading package std_logic_1164
-- Loading package std_logic_arith
-- Loading package STD_LOGIC_UNSIGNED
-- Compiling entity eop_counter_tb
-- Compiling architecture rtl of eop_counter_tb
-- Loading entity eop_counter
** Error: src/mux2.vhd (LINE NUMBER): something something, bad syntax
End time: HH:MM:SS on Mon, DY, YEAR, Elapsed time: 0:00:00
Errors: 1, Warnings: 0

I was wondering, is it possible to suppress the output message of loading and compiling and timing? I would like to know the errors and warnings however. Something like this:

vcom -vhdl -2008 my_lib -check_synthesis src/mux.vhd
Errrors: 0, Warnings: 0
vcom -vhdl -2008 my_lib -check_synthesis src/badfile.vhd
** Error: src/badfile.vhd(LINE NUMBER): something something, bad synthax
Errrors: 1, Warnings: 0

I do know that the whole output can be logged. However, I wanted to know right away if there are any errors instead of opening the file and searching for it in the log file.

Cit5
  • 235
  • 2
  • 9
  • 1
    First check if there are options to `vcom` then see if it is segregating output between stdout and stderr in any useful way. In desperation, on a unix-like system you could combine the two output streams and pipe through `grep` designed to accept or ignore a number of things, something like `vcom -whatever 2>&1 | grep 'Error\|Something Else You Want to See'` – Chris Stratton Aug 04 '18 at 15:48
  • Perfect man! Idk why I didn't think of grep. I did `source COMPILE_ME_SCRIPT | grep 'vcom\|Error'` to print out each vcom command, error & warning report and it automagically prints error message if it has one. Best answer for sure – Cit5 Aug 04 '18 at 16:41
  • Interesting that the output is on stdout and not stderror. Anyway, glad it works. – Chris Stratton Aug 04 '18 at 16:43

1 Answers1

1

First check if there are options to vcom which accomplish what you want.

Then see (at least on a unix-like system) if it is segregating output between stdout and stderr in any useful way.

In desperation, on a unix-like system a technique you can use to solve this type of problem for just about any command-line tool is to combine the two output streams and pipe through one (or more) instances of grep instructed to pass or ignore a customized set of things.

For example,

vcom -whatever 2>&1 | grep 'Error\|Something Else You Want to See'

Would pass only lines containing one of those two patterns.

  • 2>&1 is bash syntax to merge stderr with stdout, other shells will do this differently.

  • The escaped vertical bar is a logical "or"

  • Beware that the patterns are regular expressions not simple strings. Certain characters will have special meanings unless escaped. If you're feeling lazy you can also replace ones you're uncertain about with the single-character wildcard .

You can also do a negative match to reject things

vcom -whatever 2>&1 | grep -v 'Loading package'

And you can string together multiple instance of grep, or even use sed to alter messages, for example to get errors into a format where some IDE's driver can recognize line numbers and make them clickable. Worth noting however that if you pipe together instances (so the earlier stages output is no longer a terminal) on a longer-running job, you may want to use the --line-buffered option to grep so that it outputs on a continuous basis rather than block buffering.

Finally the program tee can be useful to give you both live output and capture to a file.

Chris Stratton
  • 33,282
  • 3
  • 43
  • 89