Procedural Continuous Assignment

LRM §9.2.

A procedural continuous assignment assigns a value to a register.

Syntax:

assign register_name = expression;
deassign register_name;

force net_or_register_name = expression;
release net_or_register_name;

Description:

A procedural continuous assignments overrides any other procedural assignment. After the procedural continuous assignment is executed, it remains in force on the assigned register or net until it is deassigned, or until another procedural continuous assignment is made to the same register or net.

The keywords assign and deassign can be used for registers, or a concatenation of registers only. It can not be used for memories and bit- or part-select of a register.

The keywords force and release can be used for nets, registers, bit- or part select of a net (not register), or a concatenation.

Deassign and release de-activate a procedural continuous assignment. The register value remains after the de-activation until a new value is assigned.

A procedural continuous assignment is not the same as a continuous assignment. Procedural continuous assignments are declared inside procedural blocks.

Example:

always @(posedge Clk)
  Cnt = Cnt + 1;

always @(Reset)
  if (Reset)
    assign Cnt = 0;       // prevents counting until Reset is 0
  else
    deassign Cnt;         // resume counting on next posedge Clk

initial
  begin
    #100 force Rst = 1'b0;
    #200 release Rst;
  end

See also:

Continuous assignment