# Compiler directives for re-defination of user code and macro expansion with backstic

**URL:** <https://verificationacademy.com/forums/t/compiler-directives-for-re-defination-of-user-code-and-macro-expansion-with-backstic/39377>\
**Category:** UVM\
**Tags:** compilation-macro, compiler-directive, UVM\
**Created:** [July 28, 2021, 12:19am UTC](https://verificationacademy.com/forums/t/compiler-directives-for-re-defination-of-user-code-and-macro-expansion-with-backstic/39377 "2021-07-28T00:19:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aneesh2010](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/c5a1d2/32.png) [@aneesh2010](https://verificationacademy.com/forums/u/aneesh2010)\
**Post date:** [July 28, 2021, 12:19am UTC](https://verificationacademy.com/forums/t/compiler-directives-for-re-defination-of-user-code-and-macro-expansion-with-backstic/39377/1 "2021-07-28T00:19:16Z")

</div>

Hi Folks,

I need help with compiler directives or macro expansion with backstic”. I have below code and I want to re-define either from command line or last compiled file.

`ifndef VIP_LOG_ERR_MSG `define VIP\_LOG\_ERR\_MSG(MY\_STRING) $display(`MY_STRING`)  
`endif

initial begin  
` LOG\_ERR\_MSG(“This is local VIP error at %t”, $realtime);  
end

///Last compiled code in my TB (last\_file.vh)  
`define VIP_LOG_ERR_MSG(MY_STRING) \ `uvm\_error(“New definition of VIP\_LOG\_ERR\_MSG here : %s”,`MY_STRING`);

xmvlog: \*W,NONPRT (last\_file.vh ,23|24): non-printable character (0x9d) ignored.  
`uvm\_error(“New definition of VIP\_LOG\_ERR\_MSG here : %s”,`MY_STRING`);  
|  
xmvlog: \*W,MACRDF (last\_file.vh ,23|46): text macro ’ VIP\_LOG\_ERR\_MSG’ redefined - replaced with new definition.  
file: (last\_file.vh )

Even though it logs “text macro ’ VIP\_LOG\_ERR\_MSG’ redefined - replaced with new definition” message in log, but still I don’t see the definition re-defined. Any pointers would be much apricated.  
I still see “This is local VIP error at 1111.12ps” message in log instead (expecting) of “New definition of VIP\_LOG\_ERR\_MSG here :”

Thanks,  
Aneesh

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [July 28, 2021, 3:23pm UTC](https://verificationacademy.com/forums/t/compiler-directives-for-re-defination-of-user-code-and-macro-expansion-with-backstic/39377/2 "2021-07-28T15:23:23Z")

</div>

_In reply to [aneesh2010](https://verificationacademy.com/forums/t/compiler-directives-for-re-defination-of-user-code-and-macro-expansion-with-backstic/39377):_

Text macros get expended as they are encountered in the source. If you change a text macro later in the source, it has no effect on the previous expansion

---

<div class="post-metadata">

**Author:** ![aneesh2010](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/c5a1d2/32.png) [@aneesh2010](https://verificationacademy.com/forums/u/aneesh2010)\
**Post date:** [July 28, 2021, 5:37pm UTC](https://verificationacademy.com/forums/t/compiler-directives-for-re-defination-of-user-code-and-macro-expansion-with-backstic/39377/3 "2021-07-28T17:37:24Z")

</div>

Thank you Dave. Do you have any suggestion to override that code, any other method or pointers would be really helpful.
