Quantcast
Channel: Cadence Functional Verification Forum
Viewing all articles
Browse latest Browse all 1075

$display() is executed immediately after simulation start although the condition in always statement (under which $display() resides) is not satisfied

$
0
0

Hello!

I'm testing a small design of my own and I stumbled upon something I can't understand. When I hit 'run', I see immediately "Hello!" printed. Here is part of my testmodule:

initial begin

  init_done=0;

  .

  <some other signals inits go here>

  .

  <some delays goes here>

  init_done=1;

end

.

.

.

always @(negedge sig1) begin

    if (init_done) begin

       $display("Hello!");

       test_done <= 1;

    end

end

sig1 is raised for a couple of clocks when the DUT finishes its job. test_done is probed on each clock and when it is high, $finish() is issued.

So there are actually 2 questions here I can't answer:

1. Why always block executed without its condition being satisfied? I mean, if $display() is executed, it should mean that both negedge sig1 and init_done were satisfied?

2. Assuming always block was indeed executed, why test_done variable wasn't affected? 

I'm aware of the "Events in Sequence Time" concept but I'd expect these to happen after "solid" init - starting from time 0, and not during init itself. Anyway, it does not describe the test_done being unaffected....

Would be glad for any help!


Viewing all articles
Browse latest Browse all 1075

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>