• 9.3.2 The force and release procedural statements


    Frm: IEEE Std 1364™-2001, IEEE Standard Verilog® Hardware Description Language

    Another form of procedural continuous assignment is provided by the force and release procedural statements. These statements have a similar effect to the assign-deassign pair, but a force can be applied to nets as well as to variables. The left-hand side of the assignment can be a variable, a net, a constant bit-select of a vector net, a part-select of a vector net, or a concatenation. It cannot be a memory word (array reference) or a bit-select or a part-select of a vector variable.

    A force statement to a variable shall override a procedural assignment or procedural continuous assignment that takes place on the variable until a release procedural statement is executed on the variable. After the release procedural statement is executed, the variable shall not immediately change value (as would a net that is assigned with a procedural continuous assignment). The value specified in the force statement shall be maintained in the variable until the next procedural assignment takes place, except in the case where a procedural continuous assignment is active on the variable.

    A force procedural statement on a net overrides all drivers of the net—gate outputs, module outputs, and continuous assignments—until a release procedural statement is executed on the net.

    Releasing a variable that currently has an active procedural continuous assignment shall re-establish that assignment.

    Example:

    module test;
    reg a, b, c, d;
    wire e;
    and and1 (e, a, b, c);
    initial begin
    $monitor("%d d=%b,e=%b", $stime, d, e);
    assign d = a & b & c;
    a = 1;
    b = 0;
    c = 1;
    #10;
    force d = (a | b | c);
    force e = (a | b | c);
    #10 $stop;
    release d;
    release e;
    #10 $finish;
    end
    endmodule
    Results:
    0 d=0,e=0
    10 d=1,e=1
    20 d=0,e=0

    In this example, an and gate instance and1 is “patched” as an or gate by a force procedural statement that forces its output to the value of its logical or inputs, and an assign procedural statement of logical and values is “patched” as an assign procedural statement of logical or values.

    The right-hand side of a procedural continuous assignment or a force statement can be an expression. This shall be treated just as a continuous assignment; that is, if any variable on the right-hand side of the assignment changes, the assignment shall be re-evaluated while the assign or force is in effect. For example:

    force a = b + f(c) ;

    Here, if b changes or c changes, a will be forced to the new value of the expression b+f(c).

  • 相关阅读:
    Windows Svr 2008 Ent R2 性能计数器显示不全
    SQL Server的keepalive
    C语言字符串常见操作-strcpy、strlen、strcat和strcmp实现
    计算机中数据的编码方式
    OC中的排序方法
    关于C语言内存对齐
    C语言内存管理总结-野指针
    Objective-C基础学习笔记(九)-Foundation
    Objective-C基础学习笔记(八)-内存管理-autorelease使用-property创建对象的内存管理-循环引用的内管管理
    Objective-C基础学习笔记(七)-分类-Category-类的本质-load和+initialize方法-SEL数据
  • 原文地址:https://www.cnblogs.com/qiyuexin/p/6387545.html
Copyright © 2020-2023  润新知