$moniotr

24 views
Skip to first unread message

lakshmi priya

unread,
Sep 30, 2021, 5:19:34 AM9/30/21
to EDA Playground
module mom;
int a,b;
   initial
             begin 
               for (a = 0 ; a< 10; a++)
                begin
                  $display("value of a = %d",a);
                  
                    $display("value of a = %d",a);
      end
               for ( b = 0 ; b< 11; b++)
                begin
                  $monitor("value of b = %d",b);
      end
             end

endmodule

$moniotr is display the value 11,why is that so?it should display 10 right? can you please help me over this?

Stefano Devecchi

unread,
Sep 30, 2021, 9:57:21 AM9/30/21
to lakshmi priya, EDA Playground
let's focus only on the part of the code that matters: 

I made a small change, I am printing only for b both with $display and $monitor, do you see the difference? 

I recommend you to read this really nice paper from Clifford Cummings: http://www.sunburst-design.com/papers/CummingsSNUG2006Boston_SystemVerilog_Events.pdf 

Enjoy! 


--
You received this message because you are subscribed to the Google Groups "EDA Playground" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eda-playgroun...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eda-playground/4310eeca-73ee-424a-9b54-8b5952126a02n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages