While the resulting values of multiply driven 4-state logic nets are relatively obvious, it is not obvious what the result value on a wreal net should be if one driver provides 2.7 and another -4.87 at the same time. You can use the six built-in resolution functions that Cadence delivers, to instruct the elaborator how to resolve wreal nets that have more than one driver. The built-in resolution function can be specified using the -wreal_resolution command-line option with xmelab or xrun.
Syntax
The syntax is:
-wreal_resolution resolutionFunction
where, resolutionFunction can be any one of the following six resolution functions are:
DEFAULT: Single active driver only, support for Z state4STATE: Similar to Verilog 4-State resolution for digital netsSUM: Resolves to a summation of all the driver valuesAVG: Resolves to the average of all the driver valuesMIN: Resolves to the least value of all the driver valuesMAX: Resolves to the greatest value of all the driver values
The following shows the results of a wreal, which is being driven by two drivers using different resolution functions:
|
|
|
|
|
|
|
|
|
|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example
The following example illustrates the use of multiple drivers on a wreal net. The top-level wire real_wire is driven by the two blocks source1 and source2. A third module is reading and displaying the result value of the net.
`include "disciplines.vams"module top(); wreal real_wire; source1 I1 (real_wire); source2 I2 (real_wire); sink I3 (real_wire);endmodule
module source1(r);
output r; wreal r; real realnumber; initial begin #1 realnumber = `wrealXState; #1 realnumber = `wrealXState; #1 realnumber = `wrealXState; #1 realnumber = `wrealZState; #1 realnumber = `wrealZState; #1 realnumber = 2.2; #1 realnumber = 1.1; #1 $stop; end assign r = realnumber;endmodule // send
module source2(r); output r; wreal r; real realnumber; initial begin #1 realnumber = `wrealXState; #1 realnumber = `wrealZState; #1 realnumber = 1.1; #1 realnumber = `wrealZState; #1 realnumber = 1.1; #1 realnumber = 1.1; #1 realnumber = 1.1; #1 $stop; end assign r = realnumber;endmodule // send
module sink(r); input r; wreal r; always @(r) begin $display(" real value = %f", r); endendmodule
The output of the simulation depends on the –wreal_resolution argument to xrun. For example, if the following statement is used for simulation:
xrun multi_driver.vams -exit -wreal_resolution sum
The resulting output is displayed as shown below:
real value = `wrealXStatereal value = `wrealXStatereal value = `wrealXStatereal value = `wrealZStatereal value = 1.100000real value = 3.300000real value = 2.200000
In the given example, the wreal drivers and receivers are nicely separated in different modules; however, the resolution function feature works the same way inside a single model. If you display r and realnumber in one of the source modules in the example, you will notice that the driven real value realnumber and the received wreal value r are different. The received wreal value represents the end result of the overall resolution process.
The resolution function provides you the ability to model analog behaviors, such as current summing nodes, in a straightforward manner.
The resolution function defined by the –wreal_resolution command line switch is a global setting that applies to all wreal nets in the design. However, Cadence also supports local resolution functions defined using disciplines.
