2017-12-31 180 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を探してお勧めします。

関連する問題