Macros usage

24 просмотра
Перейти к первому непрочитанному сообщению

mah...@gmail.com

не прочитано,
24 июл. 2021 г., 03:31:5024.07.2021
– EDA Playground
Hi All,


code sample:
//////////////////////////////////////////////////
module ex;
  int res;
 
  initial begin
    for (int i=0; i<=1; i++) begin

   `ifndef MODULE1
`define MODULE1
  if (!res)begin
    $display("MODULE First Time");
    res = 1;
  end 
  else begin
    $display("MODULE Second Time");
  end
`endif
      
    end
  end
endmodule

//compile options: How to run two times?
///////////////////////////////////////////////////

As a compilation argument, I am not passing +MODULE1.  So default, it is enabled and I get the "MODULE First Time Display".  Now for the second run, since MODULE1 is already defined, code should not run and no display should come out. 
How to make code runs two times in eda playground?
For the first run, MODULE1 should be defined and for the next run, it should not be enabled. How to do this?

Thank You,
Mahesh

EDA Playground

не прочитано,
9 авг. 2021 г., 08:45:0209.08.2021
– EDA Playground
The URL is private.
Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений