Timing Diagram Editing and Analysis

5.7 Time Formulas for Clocks and Parameters

5.7 Time Formulas for Clocks and Parameters

Previous topic Next topic  

5.7 Time Formulas for Clocks and Parameters

Previous topic Next topic  

The information below is a duplicate of the material in section 2.5 of the clocks chapter, but it's repeated here because of it's high importance for specifying timing parameters.

A Time formula can be used wherever a time value is required. For example the min/max for parameters, clock period, clock offset, and clock jitter all can accept time formulas. Time formulas are in display time units (see 1.10 Base and Display Time Units). Some examples of time formulas:

5 +  2 * F0 

is parsed as  5(time value) + 2(constant) * F0(free parameter)

D0.max - D1.min 

is parsed as  (parameter D0's max value) - (parameter D1's min value)

Clock0.period / 2  

is parsed as  Clock0.period(Clock0's period value) / 2(constant)

A quick way to grab a parameter name for use in a formula is to click into the min or max box in the Properties dialog, then press the Library button to open the View Parameters in Libraries dialog (see section 10.2 Referencing Parameters). This will list all parameters in the project and the associated libraries, once you select a parameter it will be inserted into the box in the Properties dialog that you were in.

Time formulas are algebraic combinations of the following:

Parameter names, parameters with dot attributes, and clocks  with dot attributes can be used in formulas. If just the parameter name is used, the formula operator will use the min value if the formula is in the min column, and it will use the max value if the formula is in the max column.

D0

D1.min

D2.max 

Clk0.period

Function Calls defined in the Parameter window. The dot-max and the dot-min properties can be used to force the equation to use a particular value. Also, the input arguments can be used in the expressions.

f(4,5)

func.max(2+D0,4)

Time Values are fixed point numbers in display units. Fractional parts depend on base time unit and display time unit.

5

2.010

255E-3 

Constants are fixed point numbers that are unit-less. Multiplication and division operations automatically assume that the result is a value of time (not time squared) so constants are assumed to be where needed. The only time when a constant needs to be explicitly defined is when you plan to change the base time unit of an existing timing diagram. In this case, a constant must be preceded by a single quote or they will be converted to display time units. Constants do not scale (unlike time values) when the base time unit is changed.

'2 

'4.1e2

Macro names enclosed with percentage marks will be replace with the macro value as defined in the Edit Formula Macro dialog. See Section 10.1 Adding Libraries, Specifications, and Macros.

%lib_spec$.F0

Dot Attributes

Parameters and User defined functions support min and max attributes.

F(5).min

D0.max

Clocks can only be referenced with an attribute of period, duty, offset, and jrise (rising jitter) and jfall (falling jitter), and the four buffer delays: minLH, maxLH, minHL, maxHL.

Clk.duty

Clk.offset

Clk.jrise

Function Definitions in the Parameter Window

Click the Add Free Parameter button in the Parameter window, to add a free parameter.

Double click on the free parameter to open the Properties dialog.

freeparm

The function name defines both the name and the input argument list. There must be a least one argument. Arguments are separated by commas.

 

 

FunctionName(input1<,Input2,….,inputN>)

The min and max fields define the body of the function.

Built in Functions supported:

Function

Description

abs        

Returns the absolute value of the number.

acos

Returns the arccosine of a number in radians. The number must be a value from –1 to 1.

asin

Returns the arcsine of a number in radians. The number must be a value from –1 to 1.

atan

Returns the arctangent of a number in radians.

cos

Returns the cosine of a number expressed in radians.

cosh

Returns the hyperbolic cosine of the number.

degrees

Converts radians to degrees.

exp

Returns e raised to the power of the number.

fact

Returns the factorial of the number. The number must be in the range of 0 to 69. If the number is not an integer, the decimal will be truncated.                

int

Rounds the number down to the nearest integer. Example: int 4.1 = 4      

ln

Returns the natural logarithm (log base e) of the number. The number must be greater than zero.

log

Returns the logarithm to the base 10 of the number. The number must be greater than zero.

radians

Converts degrees to radians.

rand

Returns a random integer between 0 and 32,767 based on the seed number given.

sign

Returns -1 if the number is negative, 1 if the number is positive, and zero if the number is zero.

sin

Returns the sine of the number expressed in radians.

sinh

Returns the hyperbolic sine of the number.

sqr

Returns the square root of the number.

sqrt

Returns the square root of the number.

tan

Returns the tangent of the number expressed in radians.

tanh

Returns the hyperbolic tangent of the number.

trunc

Truncates the number to an integer by removing the decimal.

Example: trunc 4.1 = 4

Mathematical Operators

The timing diagram editor supports the +, -, *, and / mathematical operators. The editor also uses the operator ^ to raise a number to a power.

No Circular Dependencies:

Time formulas in parameters can not have circular dependencies. For example, assume A, B, and C are parameters. If A is referenced by B, and B is referenced by C, then C cannot be referenced by A. Each time a parameter is modified, the new value is checked for circular dependencies. When this error is detected, the new data will not be accepted and a message box will appear.