I programmed all night.
Through the window, on my screen,
The rising sun shined.
编程一整夜,
透过窗户,照在屏幕上。
初升的太阳。
计算机科学里的宏是一种抽象(Abstraction),它根据一系列预定义的规则替换一定的文本模式。解释器或编译器在遇到宏时会自动进行这一模式替换。对于编译语言,宏展开在编译时发生,进行宏展开的工具常被称为宏展开器。宏的用途在于自动化频繁使用的序列或者是获得一种更强大的抽象能力。uvm_marcos包含了UVM中所有的宏定义。
文件:
$UVM_HOME/src/uvm_macros.svh
类:
无
`ifndef UVM_MACROS_SVH `define UVM_MACROS_SVH // // Any vendor specific defines go here. // `ifdef MODEL_TECH `ifndef QUESTA `define QUESTA `endif `endif `ifndef UVM_USE_STRING_QUEUE_STREAMING_PACK `define UVM_STRING_QUEUE_STREAMING_PACK(q) uvm_pkg::m_uvm_string_queue_join(q) `endif `ifndef QUESTA `define uvm_typename(X) $typename(X) `else `define uvm_typename(X) $typename(X,39) `endif `ifdef VCS // `ifndef UVM_DISABLE_RESOURCE_CONVERTER //UVM_USE_RESOURCE_CONVERTER enables UVM-1.1d to print resources output to match uvm-1.1c. VCS2014.03 or later does not need resource_converter object. // As per agreement in Committee at time of UVM-1.1d, from UVM-1.2 onwards the default is to disable resource converter and allow simulators to deal with %p natively. If a user wishes to enable resource converter then they need to compile using +define+UVM_USE_RESOURCE_CONVERTER. The resource converter was never officially sanctioned by Accellera and is placed in the deprecated directory which may be removed in future version. // `define UVM_USE_RESOURCE_CONVERTER // `endif `endif `ifdef INCA `define UVM_USE_PROCESS_CONTAINER `endif // // Deprecation Control Macros // `ifdef UVM_NO_DEPRECATED `endif `define uvm_delay(TIME) #(TIME); `include "macros/uvm_version_defines.svh" `include "macros/uvm_global_defines.svh" `include "macros/uvm_message_defines.svh" `include "macros/uvm_phase_defines.svh" `include "macros/uvm_object_defines.svh" `include "macros/uvm_printer_defines.svh" `include "macros/uvm_tlm_defines.svh" `include "macros/uvm_sequence_defines.svh" `include "macros/uvm_callback_defines.svh" `include "macros/uvm_reg_defines.svh" `include "macros/uvm_deprecated_defines.svh" `endif
参考文献:
1 路客验证. UVM世界观篇之十三(终):宏的优劣探讨 .