Verilog语言及应用技术9

  • 格式:pdf
  • 大小:1.10 MB
  • 文档页数:88

Quasi-Continuous Assign
• The Quasi-Continuous Assign, or QCA is used to override the normal operation of a model in order to temporarily fix a problem, or to cause a behavior that does not yet have a physical realization. • If you want the output of a flip-flop to be high for 2 cycles after the occurrence of a reference signal, The following would allow you to model that behavior: • Quasi-continuous assign is a procedural assignment statement that acts like a continuous assignment. There are two forms of QCA,
Upward references
• The following hierarchy uses an upward XMR with instance names which can not be resolved. Can you modify it so that both instances of module moda will print out the value of z contained in their sibling? That is, one should print xx.z = 2 and the other should print xx.z = 4.
– Procedural Assign – Force
• They can both be used with cross-module references or with local identifiers for overriding the normally assigned value of the assigned identifier.
– – – – References to a Different Scope within a Module References between Modules Downward Reference Upward Reference
different scope within a module
Reference between modules
• Any identifier in the model can be accessed from any location by means of its fully qualified path name. • Such a cross-module reference can occur on the left or righthand side of an assignment, both procedural and continuous, or it can be a task enable or function call..
Upward references
• An upward reference is a reference to an identifier that is defined in some other part of the hierarchy than the reference point. • the first component of the XMR is a module name, not an instance name. This type of reference is useful if there is a common parent module type for all instances of the module containing the XMR.

QCA-Force Statement
• The force quasi-continuous assign statement has the same syntax as assign, but uses the force keyword: force lhs = rhs; • The primary difference between force and the assign QCA is that the lhs of a force can be either a register or a net. If it is a register, then force acts very much like assign, the only difference being that force has higher precedence than assign. • If the lhs of the force is a net, when the force is removed, the net reverts back to its "normal" value immediately, unlike a register, which will not change until the next procedural assignment. • The lhs may be a bit-select or part-select of a net, but not of a register. • The release statement is used to remove a force condition from a register or net: release lhs;
• There is a static scope within each module definition with which one can locate any identifier. • there is a module, a task, and two named blocks. There are four distinct registers, each named x within its local scope. • Identifier references are resolved by means of normal scope rules. • cross-module reference: using its hierarchical name
QCA-Procedural
• The procedural continuous assign is simply an assign statement used in procedural code. It works just like a continuous assign, but it is applied only to a register. assign lhs = rhs; • The effect of the assignment is like a continuous assignment, in that the left-hand side register will be updated with a new value whenever the right-hand side expression changes value. • Unlike a continuous assignment, however, the procedural continuous assign may be in effect for a limited period of time. It does not take effect until the assign statement is executed (remember, this is a procedural statement, so it does not get executed until the program counter reaches it). • Once the assign statement has been executed, the right-hand side expression writes over any previous value in the register. Subsequent blocking and non-blocking assignments to that register will be ignored as long as the assign is in effect.
Reference between modules
• The same naming convention is extended across modules. • A fully qualified hierarchical path name begins with the top-level module name, followed by each module instance name until the enclosing module is reached, then followed by the task, function, or block names of the local scope of the identifier.
Downward references
• If the identifier being referenced is below the reference point in the hierarchy, it can be referenced beginning with the instance it is contained in. In our previous example, if the reference point was in: top.childB.node1 then: top.childB.node1.leaf2.x could be simply referenced as: leaf2.x • The rule is that the XMR begins with an instance name and proceeds downward. The instance name is found in the module which contains the reference. • Downward references are always unambiguous and well-defined.