Chapter 8. Line-Based Format Definition Language

From time to time, you may come across a video format for which rules are difficult to write. Either the format is too complicated or the rules just do not quite apply. Rather than contort rules files unnecessarily, there is an escape mechanism.

Writing a video format in line-based language allows you to express some or all of the generated signals for each line.


Note: Normally, writing line-based definitions is reserved only for Silicon Graphics engineering personnel who can anticipate problems in the relationship to other signals this might cause in rules generation; proceed only if you understand those relationships!


The Line-Based Language

The line-based language has but two components, one to set initial state, the other to specify a transition:

Signal signal-name initial state = direction;
Transition Line Range signal-name = start-line to end-line direction at time-expression;

The line-based language is very simple. For each transition, you specify a line number and time on that line. The components are as follows:

  • signal-name is the signal being addressed. This is often the synchronization signal produced by the hardware. You may also use one of the user signals as the signal name (see “The User Signals for Reference”).

  • direction is high or low, as described in “The set signal Statement for Transitions”.

  • Both start-line and end-line are integer line numbers on which the transition is to occur. If you wish a transition to occur on only one line, specify both values to be the same line number.

  • For time-expression, you can use any of the time expressions specified in “Time Expressions”.

The line-based initial state has the same function as the same statement in rules generation, described in “Initial State”. The transition line range statement is similar to the “The set signal Statement for Transitions”.

Anticipating Line-Based Definitions in the Rules

Did you read about “The Edge Database”? Most of the activity in writing a format and rules is the act of adding transitions to the edge database. Without taking some care, you can add too many transitions if you write in line-based language.

How can you add too many transitions? If you specify a transition in line-based language and then specify similar transitions in rules (using “The set signal Statement for Transitions”), you will find both transitions in the edge database.

The solution? Use the function TransitionsDefinedOnSignal, described in Table 7-5. This function allows you to detect whether the edge database already contains any transitions on a specified signal.

Example 8-1. Use of Function TransitionsDefineOnSignal


/*
 * COMP_SYNC
 */
if (!TransitionsDefinedOnSignal("COMP_SYNC")) {

    /*
     * Should follow user sync exactly 
     */
    signal "COMP_SYNC" initial state = high;
    within each (edge of user sync) {
        set signal "COMP_SYNC" CorrespondingPolarity at BeginTime;
    }
}

Example 8-1 shows proper use of the TransitionsDefinedOnSignal function. You can see that no additional transitions are added using set signal if line-based language has already been used to set the transitions.