Check the value of `define macro

In reply to sharvil111:

Sometimes, you can check the macro value in procedural code. There’s no performance penalty because the way compilers propagate constants and eliminate dead code.

module top();
  `ifdef MY_MACRO
    initial if(`MY_MACRO == 1) begin                   // If MY_MACRO is defined and value is 1
       $display("MY_MACRO equal to 1");
           end else begin                              // If MY_MACRO is defined and value is not 1
       $display("MY_MACRO not equal to 1");
    end
  `else 
      initial $display("MY_MACRO not defined");  // If MY_MACRO is not defined 
  `endif
endmodule