The problem is nothing to do with the compiler directives. It's because you have an instance statement inside the analog block - structural things go outside the analog block. So if you removed all the 'ifdef stuff, but left the instance statement, you'd still have the problem.
Here's what I did instead:
Code:`include "constants.vams"
`include "disciplines.vams"
`define test1
module TEST (pin);
electrical pin;
integer t1;
`ifdef test1
tim #(.th_start(1), .th_stop(4), .dir(1)) (*integer library_binding = "TESTBENC
H";*) test1 (.tim(pin));
`endif
analog begin
`ifndef test1
t1 = 1;
`endif
@(final_step) begin
if (t1)begin
$strobe("No EXECUTION OF test1");
end
end
end //end of analog process
endmodule
Presumably the real code is a bit more complicated, since there's no analog behaviour here - but you hopefully get the point.
Regards,
Andrew.