Skip to content

uvm_severity Error #27

Description

@SurbhiSachdeva

While running this program error exists for uvm_severity. Compilation errors are listed beneath the code.

import esdl;
import uvm;
import std.stdio;

class test_root: uvm_root
{
mixin uvm_component_utils;
}

class TestBench: RootEntity
{
uvm_root_entity!(test_root) tb;
}

bool pass = 1;

class my_catcher: uvm_report_catcher
{
byte sev[uvm_severity];
uvm_severity s;

override action_e do_catch()
{
s = uvm_severity(get_severity());

// if(get_client() == uvm_coreservice.get_root()){
//return THROW;
// }
sev[s] ++;

writeln("%0t: got severity %d for id %s",getRootEntity.getSimTime(), this.get_severity(), get_id());

if(getRootEntity.getSimTime() <10)
{
if(s != UVM_INFO)
{
writeln("**** UVM TEST FAILED expected UVM_INFO but got %d", this.get_severity());
pass =0;
}
}

else if(getRootEntity.getSimTime() <20){
if(s != UVM_WARNING)
{
writeln("**** UVM TEST FAILED expected UVM_WARNING but got %s", this.get_severity());
pass =0;
}
}

else if(getRootEntity.getSimTime() <30)
{
if(s != UVM_ERROR)
{
writeln("*** UVM TEST FAILED expected UVM_ERROR but got %s", this.get_severity());
pass=0;
}
}

else if(getRootEntity.getSimTime() <40)
{
if(s != UVM_FATAL)
{
writeln("*** UVM TEST FAILED expected UVM_FATAL but got %s", this.get_severity());
pass=0;
}
}

return CAUGHT;
}
}

class test: uvm_test
{
mixin uvm_component_utils;
my_catcher ctchr;

this(string name, uvm_component parent){
super(name, parent);

ctchr = new my_catcher;
}

override void run_phase(uvm_phase phase)
{

phase.raise_objection(this);
uvm_report_cb.add(null,ctchr);

set_all_severities(UVM_INFO);
try_all_severities();

wait(15);

set_all_severities(UVM_INFO);
try_all_severities();

wait(10);
set_all_severities(UVM_WARNING);
try_all_severities();

wait(10);

set_all_severities(UVM_ERROR);
try_all_severities();

wait(10);

set_all_severities(UVM_FATAL);
try_all_severities();

phase.drop_objection(this);
}

override void report()
{
if(ctchr.sev.length != 4)
{
writeln("*** UVM TEST FAILED Expected to catch four different severities, but got %0d instead _", ctchr.sev.length);
pass = 0;
}
foreach(x;ctchr.sev)
if(ctchr.sev[x] != 8)
{
uvm_severity s = x;
{
writeln("
_ UVM TEST FAILED Expected to catch 8 messages of type %s, but got %0d instead ***", s.to!string, ctchr.sev[x]);
pass = 0;

}
}

if (pass){
  writeln("** UVM TEST PASSED **\n");}

}

void set_all_severities(uvm_severity sev)
{
set_report_severity_override(UVM_INFO, sev);
set_report_severity_override(UVM_WARNING, sev);
set_report_severity_override(UVM_ERROR, sev);
set_report_severity_override(UVM_FATAL, sev);
}

void try_all_severities()
{
uvm_info("INFO1", "first info message", UVM_NONE);
uvm_warning("WARNING1", "first warning message");
uvm_error("ERROR1", "first error message");
uvm_fatal("FATAL1", "first fatal message");

uvm_info("INFO2", "second info message", UVM_NONE);
uvm_warning("WARNING2", "second warning message");
uvm_error("ERROR2", "second error message");
uvm_fatal("FATAL2", "second fatal message");
}
}

void main(string[] argv) {
TestBench tb = new TestBench;
tb.multiCore(0, 0);
tb.elaborate("tb", argv);
tb.simulate();
}

test.d(161): Error: function uvm.base.uvm_report_object.uvm_report_object.set_report_severity_override (uvm_severity_type cur_severity, uvm_severity_type new_severity) is not callable using argument types (uvm_severity_type, byte)
test.d(162): Error: function uvm.base.uvm_report_object.uvm_report_object.set_report_severity_override (uvm_severity_type cur_severity, uvm_severity_type new_severity) is not callable using argument types (uvm_severity_type, byte)
test.d(163): Error: function uvm.base.uvm_report_object.uvm_report_object.set_report_severity_override (uvm_severity_type cur_severity, uvm_severity_type new_severity) is not callable using argument types (uvm_severity_type, byte)
test.d(164): Error: function uvm.base.uvm_report_object.uvm_report_object.set_report_severity_override (uvm_severity_type cur_severity, uvm_severity_type new_severity) is not callable using argument types (uvm_severity_type, byte)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions