No. Macros are so-called compile directives. They do not fit in the the Verilog/SV scope. So, if you define a macro in one module, it is visible globally: www.edaplayground.com/x/fkMB . So, passing a macro hierarchically like a parameter doesn't make sense.
@@Edaplayground_EPWave I wanted to to understand this: Consider I have a module_A with different compilation statement based on MACRO1. Can I have two instances of module_A in my top file - one instance with MACRO1 and another without MACRO1? Is there any ways of doing it? Thanks in advance...
@@karthikkotebagilu3421 I can't think of way. This sounds like it might be an "XY" problem (a problem where we spend time focussing on a specific solution to a more general problem, when the specific solution is not a good solution to the general problem). What are you actually trying to do?
Great stuff - Cheers :)
Nice work. I finally connected the pieces regarding using `define and `ifdef in Verilog.
Recommend viewing in 720p quality or higher.
how to create macros in which we are calling function realtime type from class a in system verilog
If i want to write an if else staement in user defined macro for function(here ADD5), can I do it. It is throwing me a syntax error.
You ought to be able to do it. Can you post the EDA Playground URL of your code?
Can we pass macros heirarchically like parameter?
No. Macros are so-called compile directives. They do not fit in the the Verilog/SV scope. So, if you define a macro in one module, it is visible globally: www.edaplayground.com/x/fkMB . So, passing a macro hierarchically like a parameter doesn't make sense.
@@Edaplayground_EPWave I wanted to to understand this:
Consider I have a module_A with different compilation statement based on MACRO1. Can I have two instances of module_A in my top file - one instance with MACRO1 and another without MACRO1? Is there any ways of doing it? Thanks in advance...
@@karthikkotebagilu3421 I can't think of way. This sounds like it might be an "XY" problem (a problem where we spend time focussing on a specific solution to a more general problem, when the specific solution is not a good solution to the general problem). What are you actually trying to do?