How can I obtain code coverage information in ModelSim?
A procedure is:
-
prep mentor
-
vsim -coverage entity_name
i.e., for the entity tb_h4b,
vsim -coverage tb_h4ba
-
The ModelSim main window will open. Open the ModelSim source window by entering the command,
view source
in the ModelSim main window.
-
Run the simulation, i.e.,
run -all
-
From the ModelSim main window menu, choose View | Structure. The structure window will open. Select the entity in the structure window whose code coverage statistics you wish to view in the ModelSim source window. The code corresponding to that entity will be displayed in the ModelSim source window.
In the ModelSim source window, the executable lines of code are denoted by their line number set in blue font.
A check symbol to the left of a line number means the line was executed at least once in the run and a 'X' symbol means that the line was not executed or that a branch condition on the line did not evaluate to true in the run.
To view the number of hits for an executable line of code, place the mouse pointer over the VHDL code
corresponding to that line. This will cause the line to be highlighted in blue and the number of hits for that line to be displayed
at the left side of the window. Each branch statement will also indicate the number of times
it evaluated to true and the number of times it evaluated to false in the run.
-
To view a coverage report,
-
From the Modelsim Main window menu, choose Tools > Coverage > Reports...
-
The Coverage Report window will open.
-
In the Coverage Report window, Select "Include Line Details" in addition to the defaults. Select "OK".
-
A Notepad window will open with a code coverage report listing the number of hits from the run for each
executable line of code.
|