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世界觀篇之十三(終):宏的優劣探討 .