Hi folks,
I came across some issue to understand about +define+macro vs define Macro in SV.
When passing macro define from compile option like +define+macro always takes effect even if it is put at the end of the file.
But it is different when a SV macro puts in the SV file.
I am confused on that. Can someone give some clue how tool process +define+macro differently from the SV macro in SV file?
//filelist.f
tb.sv
+define+TOMMA
//tb.sv
module tb;
`ifdef TOMMA
string name = "tomma";
`else
string name = "matthewma";
`endif
//`define US
`ifdef US
string cn = "USA";
`else
string cn = "ASU";
`endif
initial begin
$display("name:%s",name); //why name's value even if +define+TOMMA after tb.sv, how tool handle SV macro in this case? Does macro define order not matter?
$display("cn:%s",cn); //expected, as US define after cn declaration, so cn = "ASU"
end
`define US
endmodule
https://www.edaplayground.com/x/Xyc3