Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can we disable Always block using disable statement?

module xyz;
  
  always
  begin : b1
    $display("I am executing"); // statement 1
    disable b1;
    $display("I am still executing"); // statement 2    
  end  
  
endmodule  

I am unable to understand how disable statement actually behaves in the above code.

I was expecting that the statement 1 will execute only once and then the always block (b1) will be disabled forever.
But actually statement 1 is being executed infinitely (until the process is killed) and statement 2 is being skipped.

I am executing
I am executing
I am executing
      .
      .
      .

I have tried all simulators of EDA Playground.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

A disable statement is essentially a jump to the end of the named block. It does terminate any processes.

The always construct creates a permanent process that executes the procedural statement that follows it. Once that statement completes, it executes it over again indefinitely. In your example, that procedural statement is a begin/end block

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading