Main Content

IBIS and Timing File Preprocessor

The preprocessor is used in timing and IBIS files. This is a convenient way of handling parts that can programmatically configure either I/O buffers or timing and for handling multiple revisions or variants of parts that vary I/O buffers and timing.

In the part properties file, you can specify timing_options and IBIS_options that use the preprocessor. The preprocessor lets you parameterize strings and conditionally include or exclude sections in timing and IBIS files.

Specify Preprocessor Parameters

To specify the IBIS_options and timing_options in the parts properties, use the syntax:

ibis_option string1 string2 …
timing_option string1 string2

A string is case sensitive and can be either of the form xyz or abc=def. For example:

ibis_option xyz abc=def

In this example, both $xyz and $abc are defined. The value of xyz is NULL (blank) and the value of abc is def.

So in the IBIS file specified for this part, the string $xyz is replaced by a NULL (blank) and the string $abc is replaced by def. Therefore, the IBIS record [Model] $abc is converted to [Model] def

Specify Conditional Statements

You can include or exclude sections of an IBIS file or timing file using an if, elseif, else, endif construct. A conditional block consists of an if statement followed by any number of elseif statements followed by up to one else statement and ended by a required endif statement.

One of the following if statements can start a conditional block:

  • if <Boolean expression>

  • ifall <Boolean expression>

  • ifany <Boolean expression>

  • ifnone <Boolean expression>

One or more of the following elseif statements are allowed:

  • elseif <Boolean expression>

  • elseifall <Boolean expression>

  • elseifany <Boolean expression>

  • elseifnone <Boolean expression>

One else statement is allowed:

  • else

One endif statement is required to end a conditional block:

  • endif

A Boolean expression consists of one or more Boolean fields. A Boolean field either tests the existence of a parameter, compares two strings, or compares a clock domain variable to a value. If a parameter exists, the value of a Boolean field is true. A Boolean fields can compare two strings for equality (==) or inequality (!=). In addition, the value of a Boolean field can be negated by inserting an ! at the beginning of the field.

Each Boolean field can have either a true or false value. An if, ifall, elseif, or elseifall statement is true if all of the Boolean fields in the Boolean expression are true. An ifany or elseifany statement is true if any of the Boolean fields in the Boolean expression are true. An ifnone or elseifnone statement is true of all of the Boolean fields in the Boolean expression are false.

For the ibis_option xyz abc=def example, example Boolean field values are:

Boolean FieldValue
$xyzTrue
$XYZFalse
$abcTrue
$ruvFalse
!$xyzFalse
$xyz==defFalse
$abc==defTrue
$abc==DEFFalse
$abc!=defFalse
$abc!=$xyzTrue
!$abc==defFalse

For the ibis_option xyz abc=def example, example Boolean expression values are:

Boolean ExpressionValue
if ($abc==def)True
if ($abc==def $xyz)True
ifnone ($xyz)False
ifany ($xyz $ruv)True
ifany (!$xyz $ruv)False

The Serial Link Designer or Parallel Link Designer app evaluates the Boolean expression of each if statement. The data records after the first if statement whose Boolean expression is true and up to the next elseif, else, or endif statement are included. All other blocks are excluded, unless the Boolean expression of all if statements are false and there is an else statement. In this case, the records between the else and endif statements are included.

Conditional Block Example 1

For the ibis_option xyz abc=def example, consider the conditional block segment:

Sub-BlockBoolean ExpressionValue
1if ($abc!=def)False
2elseif ($ruv)False
3elseif ($abc==def)True
4elseif ($xyz)True
5else 
 endif 

The statement in sub-block 3 is the first true if or elseif statement, therefore sub-block 3 is included and all other blocks are excluded.

Conditional Block Example 2

For the ibis_option xyz abc=def example, consider the conditional block segment:

Sub-BlockBoolean ExpressionValue
1if ($abc!=def)False
2elseif ($ruv)False
3else 
 endif 

All of the if and elseif statements are false, so the else sub-block 3 is included.

Conditional Block Example 3

For the ibis_option xyz abc=def example, consider the conditional block segment:

Sub-BlockBoolean ExpressionValue
1if ($abc!=def)False
2elseif ($ruv)False
 endif 

All of the if and elseif statements are false and since there is no else statement, none of the blocks in the this condition block are included.

Pass Information to Clock Domain File

The preprocessor keyword $clock_domain(domain) is used in the timing file to pass a variable to a parameter definition in the clock domain file. It can also be combined with other pre-processing parameters.

Syntax:

<param_name> = $clock_domain(<domain>)

Or, in a boolean field:

$clock_domain(<name>)==<value>

where <name> is the name of a clock domain defined in the clock domain file.

Preprocessor Examples

Parts Properties and Timing File

In the part properties:

timing_option delay=1. phase=2 clock=.5

In the timing file:

PARAMS:
if ($phase==1)
  DATA_DELAY = $delay - $clock
elseif ($phase==2)
  DATA_DELAY = $delay + $clock
else
  DATA_DELAY = $delay
endif
END_PARAMS

Clock Domain and Timing File

In the clock_domain.txt file:

ddr_data_rate = 4ns

In the timing file:

BIT_TIME = $clock_domain(ddr_data_rate)
DDR_ADDR_DELAY = BIT_TIME * 2
OR
DDR_ADDR_DELAY = $clock_domain(ddr_data_rate) * 2

See Also

|

Topics