Application
Notes > Using the MASK_PINS Command
Application Notes:
Masking Pins in Target Vector File using MASK_PINS
SYNOPSIS
This Application Note focuses on the MASK_PINS feature of the Vtran command
file.
The MASK_PINS command can be used to modify the state of signals in the Vtran
Target Vector File (TVF), overriding the state defined for a signal in the
Original Vector File (OVF).
This command can be applied both to input and output signals,
and to both the input and output data of a bidirectional signal.
Pin states can be masked within each cycle,
or in multiple vectors within a time range,
or when specified masking conditions are met.
The first can be used, for example, to mask output signals for times in the
cycle they are not in a stable state.
The second can be used, for example, for debugging a functional test program.
There are several mechanisms to define when and how a signal should be masked.
These provide both flexibility and power to the user.
They will be explained in this document.
VTRAN OVERVIEW
The Vtran translation process is divided into three separate tasks or blocks,
which correspond to the three blocks in the vtran command file
the OVF_BLOCK, the PROC_BLOCK and the TVF_BLOCK.
The commands and parameters in these blocks direct the details of the
translation.
In general, the OVF_BLOCK contains information necessary
for vtran to read the input file or "Original Vector File".
The PROC_BLOC contains commands that tell vtran what data processing functions
you want performed on the simulation data during translation.
This typically would include such functions as how to map state characters
between the two formats, dealing with bi-directional data, or
perhaps some desired signal masking.
Finally, the TVF_BLOCK contains commands that specify the desired output
format.
There may also be some final processing to be done
or some optional user-supplied parameters that appear in the TVF_BLOCK.
The MASK_PINS command is a part of the Vtran command file PROC_BLOCK.
MASK_PINS FEATURE
There are five different ways to specify where a signal should be masked:
- vector time range
- signal state transitions on mask signals
- signal state transitions on control signal
- compound logic expressions
- state sequences on OVF vectors
The MASK_PINS command has the following syntax:
MASK_PINS [MASK_CHARACTER=mask_value,]
pin_list
@ [NOT] time, time
[-CYCLE];
OR
MASK_PINS [MASK_CHARACTER=mask_value,]
pin_list
@ [NOT] CONDITION
compound_logic_expression;
OR
MASK_PINS [MASK_CHARACTER=mask_value,]
pin_list
@ [NOT] TRANSITION state->state
[,start_cycle] [,end_cycle];
OR
MASK_PINS [MASK_CHARACTER=mask_value,]
pin_list
@ [NOT] CONTROL_TRANSITION ctl_pin state->state
[,start_cycle] [,end_cycle];
OR
MASK_PINS pin_list
@ SEQUENCE
"input_sequence",
"output_sequence";
In all forms, the pin_list field is required.
It is a comma-separated list of one or more signal and/or group names.
The first four forms support an optional MASK_CHARACTER field.
This specifies the state to be assigned to the signals in the pin_list
when the specified TIME, TRANSITION, or CONDITION control is satisfied.
The default value for the mask character is 'X'.
This can be overridden in one of two ways.
In the first case, the state to be used for masking is specified.
The single-quote marks enclosing this constant state character are optional.
Examples of the MASK_CHARACTER field are:
MASK_PINS MASK_CHARACTER=Z outpin1...
MASK_PINS MASK_CHARACTER='Z' outpin1...
In the second case, the state of another signal,
at the time the masking condition is met, is used for the mask character.
The signal name is enclosed in double-quotes.
If the signal name is preceded by a tilde character ("~"),
the inverse of the signal's state is used for the mask character.
The tilde appears inside the double-quote marks surrounding the signal name.
Examples of the MASK_CHARACTER field are:
MASK_PINS MASK_CHARACTER="other_pin" outpin1...
MASK_PINS MASK_CHARACTER="~other_pin" outpin1...
The first four forms support an optional NOT keyword before the masking
condition is defined.
When used, the signals in the pin_list will be masked when the
masking condition is not satisfied;
they will retain their states from the OVF when the masking condition is
satisfied.
This is useful if it is more straightforward to describe
when the pin_list should not be masked,
than to describe when it should be masked.
The MASK_PINS feature can be applied both to input signals and to
output signals.
When it is used with bidirectional signals, the input side of the signal is
referred to with the signal name,
while the output side of the signal is referred to with the signal name
followed by the suffix ".O".
As an example, the signal name sig1 refers to the input side of a
bidirectional signal,
and sig1.O refers to the output side of the same signal. An example for a bidirectional bus
pin would be bus[1] and bus.O[1] as the input and output versions respectively.
The MASK_PINS feature is applied before state translations
(STATE_TRANS command) occur.
Therefore, any states included in a MASK_PINS command need to be the states
on the signals in the Original Vector File, not the Target Vector File.
Furthermore, any signal state modified by the MASK_PINS command will be
subject to potential further modification when the state translations
are applied.
It is risky to use a signal both in a pin_list
(as a signal to be masked)
and as a control signal in a CONTROL_TRANSITION or CONDITION clause.
The order of evaluation of MASK_PINS control conditions and
of the application of MASK_PINS to signals in the pin_lists may lead
to unexpected results.
TIME CONTROL DETAILS
When a time range is used to specify the controlling condition for a
MASK_PINS command,
it either refers to an absolute time range or to a relative time range
applicable to all cycles.
The absolute time range is the default;
the relative time range is selected with the -CYCLE flag.
For an absolute time range, the masking condition starts at the first
time of the time range in the OVF vectors,
and ends at the second time of the time range.
This can be used both with print-on-change and cycle-based TVF formats.
For a relative time range,
the masking condition starts at the first time of the time range
within every cycle,
and ends at the second time of the time range within a cycle.
This control type is applicable to print-on-change TVF formats.
The Vtran CYCLE command can be used to define the cycle length.
If not defined, 100ns is the default cycle length.
The time values are specified in units of nanoseconds.
TRANSITION CONTROL DETAILS
There are times when the state of a given signal is unstable,
around the time of a transition on that signal or a different signal.
The TRANSITION control type of the MASK_PINS command can be used to
mask the signal's state during the unstable region.
The region can be defined to span cycles, both before and after the
defining transition.
Prop delays are one application for this control.
The TRANSITION keyword is used to specify masking conditions based on
transitions on the signal itself.
The CONTROL_TRANSITION keyword is used when transitions on a different
signal are used to define the masking condition for the signals in the
pin_list.
This MASK_PINS control type is applicable only to cycle-based TVF formats,
not to print-on-change TVF.
If the OVF is a print-on-change format,
one of the Vtran cyclization features
(e.g., ALIGN_TO_CYCLE, Template Cyclization)
needs to be used with the MASK_PINS command.
Since the cyclization process precedes the application of MASK_PINS commands,
the state transition is compared to states in cycle-based vectors,
not print-on-change vectors.
The asterisk character ("*") can be used as a shorthand,
to refer to any state.
It can be used on either side of the arrow, or on both sides.
The transition *->1 defines a transition from any state to logic-1.
The transition 0->* defines a transition from logic-0 to any state.
The transition *->* defines any transition.
By default, the masking of the signals in the pin_list applies to the
current cycle in which the masking condition is satisfied.
The optional start_cycle and end_cycle parameters specify that
the masking should occur in all cycles in a range.
The range is defined relative to that current cycle.
Both start_cycle and end_cycle can be (+ or -) any integer number,
but the value of start_cycle must be less than or equal to the value of
end_cycle.
The default value of both is 0 (referring to current cycle).
CONDITION CONTROL DETAILS
The conditions under which a signal should be masked
might be dependent on the state of the device,
A "compound logic expression" can be used to specify the device
state that determines when the signal should be masked in the TVF.
Compound logic expressions are described in Section 2.4 of the Vtran Users
Guide. They can include the operators OR (|), AND (&), and NOT (~).
They are evaluated left-to-right, unless overridden by parentheses.
The operands of a compound logic expression are pin names and states.
The states are those read from the OVF,
prior to the application of state translations (STATE_TRANS command).
By default, the state for a pin is its value in the current vector,
at the time the expression is being evaluated.
The user can specify that the pin's state from a later or earlier vector
should be used for the expression evaluation, with an optional vector offset.
This is accomplished by following the pin name with (+/-n), where n is the
number of vectors following or preceding the current vector.
An example of a compound logic expression which is true when pin1 is a logic 1 in the current vector, pin2 was a logic 0 three vectors ago and pin3 will be a logic Z two vectors from now:
(pin1=1) & ((pin2(-3)=0) | (pin3(+2)=Z))
SEQUENCE CONTROL DETAILS
The masking condition selected by the SEQUENCE keyword is based on a
signal's state values in a sequence of vectors from the OVF.
When the defined input_sequence is found on a set of consecutive
vectors,
the signal's state in that set of vectors is replaced with the states
defined by the output_sequence.
The number of states in the output_sequence need not match the number of
states in the input_sequence. When the input_sequence<\i> is detected, the states characters, beginning with the first one, in the sequence are replaced by the corresponding output_sequence<\i> states until all of those in the output_sequence<\i> are used up.
The SEQUENCE control type is applicable only to cycle-based TVF formats,
not to print-on-change TVF.
If the OVF is a print-on-change format,
one of the Vtran cyclization features
(e.g., ALIGN_TO_CYCLE, Template Cyclization)
needs to be used with the MASK_PINS command.
Since the cyclization process precedes the application of MASK_PINS commands,
the vectors compared to the input_sequence and replaced by
the output_sequence are cycle-based vectors,
not print-on-change vectors.
The comparison of vectors to the input_sequence is done
for each sequence in the stream of input vectors.
The first comparison is to the set of vectors starting with the first vector.
The next comparison is to the set of vectors starting with the second vector;
it does not start with the vector following the first set.
The masking condition is evaluated this way until the last sequence of
vectors has been compared to the input_sequence.
Thus, when the masking condition has been satisfied for one set of vectors,
the next comparison will include modified (masked) signal states.
EXAMPLES: TIME CONTROL TYPE
The following example demonstrates the relative time range control type:
cycle 1000;
mask_pins mask_character=M j @ 0, 990 -cycle;
mask_pins mask_character=M j @ 995, 1000 -cycle;
mask_pins mask_character=W jj @ 400, 435 -cycle;
mask_pins k @ NOT 990, 995 -cycle;
The state of the signal j is set to M
for all but the time range between 990ns and 995ns in each 1000ns cycle.
The state of the signal jj is set to W from 400ns to 435ns in each cycle. The state of k is set to X (the default mask character) everywhere in the cycle except for between 990 and 995.
The next example demonstrates the absolute time range control type:
mask_pins outputs @ 0,2000;
All output signals are masked during initialization.
The state of each output signal is set to X
(the default mask character) for the first 2000 nanoseconds of the test.
EXAMPLES: TRANSITION CONTROL TYPE
The following examples demonstrate the TRANSITION control type.
mask_pins mask_character=Q OutData @
NOT TRANSITION 0->1 -1, 1;
The above example defines the conditions under which the signal OutData
should retain its state (not be masked).
When OutData changes state from logic-0 to logic-1,
its state in that cycle, the previous cycle, and the following cycle
will be the value from the OVF.
In all other cycles, the state of OutData is set to Q.
mask_pins OutSig1 @ transition *->*;
In the above example, the signal OutSig1 is masked each time it changes state.
In each cycle in which a transition occurs on OutSig1 in the OVF,
its state is set to X (the default mask character) in the TVF.
mask_pins mask_character=Q OutData @
TRANSITION 0->1 -3, +2;
In the above example, the state of signal OutData is set to Q in the TVF,
each time its state changes from logic-0 to logic-1.
In addition, its state is set to Q for the 3 cycles preceding the transition
and for the 2 cycles following the transition.
mask_pins mask_character=Q OutData @
TRANSITION 0->1 2, 3;
In the above example,
each time the state of signal OutData changes from logic-0 to logic-1,
its state is set to Q in the TVF
for the second and third cycles following the transition.
mask_pins AD0.O, AD1.O, AD2.O, AD3.O
@ transition *->*;
The above example shows a comma-separated list of signals to be masked.
All the signals in the list represent the output data for
bidirectional signals.
For each cycle in which any of the signals changes state,
the state of that signal is set to X
(the default mask character). Each signal is examined individually and transitions on it only cause it to be masked, not the others in the list.
EXAMPLES: CONTROL_TRANSITION CONTROL TYPE
The following examples demonstrate the CONTROL_TRANSITION control type.
mask_pins mask_character=Q OutData @
NOT control_TRANSITION InData[1], 1->0 -1, 1;
The above example defines the conditions under which the signal OutData
should retain its state (not be masked),
in terms of transitions on the signal InData[1].
When InData[1] changes state from logic-1 to logic-0,
the state of OutData in that cycle, the previous cycle,
and the following cycle will be the value from the OVF.
In all other cycles, the state of OutData is set to Q.
mask_pins mask_character=Q OutData @
control_TRANSITION InData[1], 1->0 -5, -3;
In the above example,
each time the state of signal InData[1] changes from logic-1 to logic-0,
the state of OutData is set to Q in the TVF
for the fifth, fourth, and third cycles preceding the transition.
mask_pins AD0.O, AD1.O, AD2.O, AD3.O
@ control_transition OEN 1->0;
The above example shows a comma-separated list of signals to be masked.
All the signals in the list represent the output data for
bidirectional signals.
For each cycle the signal OEN changes state from logic-1 to logic-0,
the state of all the signals in the list is set to X
(the default mask character).
This masks the output data when the bidirectional signal transitions from
Z to driving.
EXAMPLES: CONDITION CONTROL TYPE
The following examples demonstrate the use of compound logic expressions to
define the masking condition.
MASK_PINS bidir1.O @ CONDITION ~(out1 = H);
In the above example,
the signal bidir1.O is the output data for bidirectional signal bidir1.
Its state is set to X (the default mask character) for each vector in which
the state of signal out1 is anything other than H.
mask_pins mask_character=R InSig1 @
NOT CONDITION (InData[1]=1)&(InData[0]=0);
In the above example, the signal InSig1 retains its state from the OVF
for all vectors in which the state of signal InData[1] is logic-1 and
the state of signal InData[0] is logic-0.
For all other vectors, the state of InSig1 is set to R.
mask_pins mask_character=R InSig1 @
CONDITION (InData[1](-2)=1)&(InData[0](4)=0);
In the above example, the state of signal InSig1 is set to R for all vectors
in which the state of signal InData[1] is logic-1 two vectors earlier
and the state of signal InData[0] is logic-0 four vectors later.
mask_pins MASK_CHARACTER='1' ClkA @
condition ClkA=0;
In the above example, the state of signal ClkA is set to 1
for all vectors in which its state from the OVF is logic-0.
EXAMPLES: SEQUENCE CONTROL TYPE
The following example demonstrates the SEQUENCE control type.
mask_pins InData[1] @
SEQUENCE "HHHLLL", "HHXXLL";
mask_pins InData[0] @
SEQUENCE "1111100000", "1111100110";
In the above example, the state values of signal InData[1] are modified
for each set of 5 consecutive vectors in which the states from the OVF
are HHHLLL states.
The HHHLLL sequence of states is replaced with HHXXLL.
The state values of signal InData[0] are modified
for each set of 10 consecutive vectors in which the states from the OVF
are 1111100000 states.
This sequence of states is replaced with 1111100110.
Return to Application Notes Index
|