zoukankan      html  css  js  c++  java
  • 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).

  • 相关阅读:
    初识nginx
    Keepalived 配置实例
    ssh学习小记
    代码开发、测试及发布
    需求改进&系统设计
    软件设计原则、设计模式学习+部分实现
    自我介绍+课程 6 问
    python函数嵌套出现报错UnboundLocalError原理的猜测(有解决办法,但是对于报错原理不确定)
    python tkinter 问题(多个Listbox选取显示问题,虚拟事件的特点为何虚拟,listbox.nearest函数与虚拟事件绑定返回值错误,StringVar类参数调用时单向性,线程无响应)
    python tkinter pack布局遇到的错误和问题总结(无图)
  • 原文地址:https://www.cnblogs.com/qiyuexin/p/6387545.html
Copyright © 2011-2022 走看看