For functions, we can use pass by name as below:
function void xyz(string x,int y);
$display(x,,y);
endfunction
initial begin
xyz(.x("Hi"),.y(2));
end
Now, I have a macro like below:
`define XYZ(name,number) \
int num; \
num=number; \
$display("%s %d",``name``,num);
It is invoked as XYZ(hi,2). I would like to know how I can use pass by name in macros just as we do for functions.
You can not use pass-by-name for
definemacros like you do for functions. You can not do something like this:Refer to IEEE Std 1800-2017, section 22.5.1 `define. This shows the complete supported syntax for macros with several examples.