Mobile
Verilog Online Help Prev Page Prev Page
Table of Contents
Bit-select
Block Statements
Built-in Primitives
Case Statement
Continuous Assignments
Conversion Functions
Comments
Compiler Directives
Concatenations
Conditional Operator
Delays
Disable Statement
Display Tasks
Edge Sensitive Path
Expression Bit Length
File I/O Functions
Functions
Identifiers
If Statement
Integer Constants
Intra-assignment Timing Controls
Keywords
Loop Statements
Memories
min:typ:max Delays
Module Declaration
Module Instantiation
Module Path Declaration
Module Path Polarity
Net Data Types
Operators
Parameters
Part-select
PLA Modeling Tasks
Probabilistic Distribution Functions
Procedural Assignments
Procedural Continuous Assignments
Procedural Timing Control
Range Specification
Real Constants
Register Data Types
Simulation Control Tasks
Simulation Time Functions
Specify Block
State Dependent Path
Stochastic Analysis Tasks
Strengths
Strings
Structured Procedures
Tasks
Timescale System Tasks
Timing Check Tasks
UDP Declaration
UDP Instantiation
UDP State Table
Value Change Dump (VCD) File
Vectors

Disable Statement

Formal Definition

The disable statement provides means of terminating active procedures.

Simplified Syntax

disable task_identifier;

disable block_identifier;

Description

The disable statement can be used to terminate tasks (Example 1), named blocks (Example 2) and loop statements (Example 3) or for skipping statements in loop iteration statements (Example 4). Using the disable keyword followed by a task or block identifier will only disable tasks and named blocks. It cannot disable functions. If the task that is being disabled enables other tasks, all enabled tasks will be terminated.

If a task is enabled more than once, then disabling that task terminates all its instances.

Examples

Example 1

task t;
output o;
integer o;
#100 o = 15;
endtask
disable t; // Disabling task t.

Example 2

begin : named_block
a = 1; // #1
disable named_block;
a = 2; // #2
end

Statement #2 will never be executed, therefore after execution of this block, variable 'a' will have 1 as its value.

Example 3

begin : break_block
i = 0;
forever begin
  if (i==a)
  disable break_block;
  #1 i = i + 1;
  end
end

The forever statement will be executed until 'i' is not equal to 'a'.

Example 4

begin
i = 0;
forever begin : continue_block
  if (i==a)
  disable continue_block;
  #1 i = i + 1;
  end
end

If 'i' is equal to 'a' then statement (#1 i = i + 1) that appears after the disable statement will not be executed.

Important Notes

  • The disable statement cannot be used to disable functions.

  • If a task or a named block contains other tasks or named blocks then disabling that task or a named block terminates all tasks and blocks within.

  • The disable statement can appear only within the procedural blocks.

 

Powered by IXwebhosting