Guarded

LRM §4.3.1.2, §9.1, §9.5.

A Boolean-valued expression associated with a block statement that controls assignments to guarded signals within a block. A guard expression defines an implicit signal GUARD that may be used to control the operation of certain statements within the block (by connecting or disconnecting the drivers of those statements).

Syntax:

block_signal <= guarded expression; 

Description:

The characteristic feature of the block statement is the guard expression. It is a logical expression of the Boolean type, declared implicitly after the reserved word block whenever a guarded expression appears inside the block.

The guard expression implies a signal named 'guarded' at the beginning of the block declaration part. This signal can be read as any other signal inside the block statement but no assignment statement can update it. This signal is visible only within the given block. Whenever a transaction occurs on any of the signals on the right hand side of the guard expression, the expression is evaluated and the 'guarded' signal is immediately updated. The 'guarded' signal takes on the True value when the value of the guard expression is True. Otherwise, 'guarded' takes on the False value.

The 'guarded' signal may also be declared explicitly as a Boolean signal in the block statement. The advantage of this approach is that more complex (than a simple Boolean expression) algorithm to control the guard signal can be used. In particular, a separate process can drive the guard signal.

If there is no guard expression and the guard signal is not declared explicitly, then by default the guard signal is always True.

The guard signal is used to control so called guarded concurrent signal assignment statements contained inside the block. Each such statement contains the reserved word guarded placed after the symbol "<=". They assign a new value to the signal only when the guard signal is true. Otherwise, the signal assignment statement does not change the value of the given signal.

Example:

RisingEdge : block (Clk'Event and Clk ='1') 
begin 
  Output1 <= guarded not Input1 after 15 ns; 
end block RisingEdge; 

Blk1 : block 
  signal SGuard: boolean := false; 
begin 
  Output1 <= guarded not Input1 after 15 ns; 
  Pr1: process 
  begin 
    SGuard <= true; 
  end process Pr1; 
end block Blk1;

Note:

See also:

Block