2017-12-31 207 views

답변

5

dut_error()는 실제로 메소드가 아니며 (여러 메소드를 호출하는 매크로) 확장 할 수 없습니다.

하지만 dut_error_struct를 확장 한 다음 원하는 코드를 추가 할 수 있습니다. source_struct()를 사용하면 dut_error()라는 구조체가 무엇인지 알 수 있고 리플렉션을 사용하여 정의 된 패키지를 알 수 있습니다. 예를 들어 -

extend dut_error_struct { 
    write() is first { 
    out(source_struct() is a any_unit ? "UNIT " : "STRUCT ", 
     source_struct_name(), " reporting of error: "); 


    // Special output for errors coming from the ahb package: 

    // Using reflection, can get lots of info about the reporting struct. 
    // For example - in which package it was defined 

    // If using annotation - can use them as well. 
    // For example - different messages for annotated features 

    var reporter_rf : rf_struct = 
     rf_manager.get_struct_of_instance(source_struct()); 
    if reporter_rf.get_package().get_name() == "ahb" { 
     out(append("xxxxxx another bug in AHB package, ", 
         "\nreported ", source_location())); 
    }; 
}; 

내가 도움에 dut_error_struct을 찾는 것이 좋습니다,이 구조체의 방법을 볼 수 있습니다.