How to read and use the alert_counters

Hi,

In the example testbenches I see
report_alert_counters(FINAL);
I need not the reporting, but I need the actual values.
How do you read a t_alert_level?

For example, to through an error in ModelSIM.

So I want conceptual:

if (TB_WARNING == 0) then
“no tb_warnings seen”
end if;
if (TB_ERROR != 0) then
“Throw Fatal”
exit(1);
else
exit(0);
end if;

Hi Eric,

First of all, please note that UVVM has 4 different status variables that can be used to check the result of your simulation, Util Quick reference page 8. These are intended for exactly this.

You can also check the error counters directly using:
protected_alert_attention_counters.get(alert_level, attention); or
protected_alert_attention_counters.get(alert_level);
where attention is one of regard, expect, ignore (default here is regard)
and allert_level is for instance TB_ERROR - and all the other UVVM alert levels.

– Espen

Hi Espen,

I’m still missing something, as I can’t get it compiled.
What should I change to the uart_vvc_demo_tb.vhd for example to be able to test these status variables?

I tried the following:

  • added a variable sim_results in the main process
...
 p_main: process
           variable sim_results : t_alert_level;
begin
...

And then trying to assign a value to it

...
report_final_counters(FINAL);
sim_result: protected_alert_attention_counters.get(TB_ERROR);
...

But this then results in an error
Unknown identifier "protected_alert_attention_counters"

Question 2: If that is solved
Can I then do

if (sim_result /= 0) then
 $fatal()
end if

Rgds,
Eric

Hi Eric,

Sorry, but that I just noticed that solution is actually not availabe externally.
It seems this shared variable is private (i.e. only inside the body of the methods package).
I’m afraid that only leaves the status variables as mentioned in my initial answer.
I would recommend that you manage with that - if possible?

Otherwise - you could also modify the methods package and move
‘shared variable protected_alert_attention_counters : t_protected_alert_attention_counters;’ from the body to the header of the package, thus making it available outside this package.

So far users have managed with the 4 status variables, but please let me know if that is not sufficient. Then at least we need to re-evaluate the visibility of the counters.

– Espen

Just to let you know that reading the shared variables solves this issue. I now have

if (shared_uvvm_status.found_unexpected_similation_warnings_or_worse /= 0) or
  ( ... the other 3 that are mentioned in the reference from Espen... ) then
  simulation_result <= "FAILED";
else
  simulation_result <= "PASSED";
end if;

Good to hear :slight_smile:
– Espen