User`s guide

Stack
5-414
When two or more of the control input ports are triggered at the same time
step, the operations are executed in the following order:
1 Clr
2 Push
3 Pop
The triggering event for the
Push, Pop, and Clr ports is specified by the Trigger
type
pop-up menu, and can be one of the following:
Rising edge triggers execution of the block when the trigger input rises from
a negative value to zero or a positive value, or from zero to a positive value.
Falling edge triggers execution of the block when the trigger input falls from
a positive value to zero or a negative value, or from zero to a negative value.
Either edge triggers execution of the block when either a rising or falling
edge (as described above) occurs.
The
Push full stack parameter specifies the block’s behavior when a trigger is
received at the
Push port but the register is full. The Pop empty stack
parameter specifies the block’s behavior when a trigger is received at the
Pop
port but the register is empty. The following options are available for both
cases:
Ignore – Ignore the trigger event, and continue the simulation.
Warning – Ignore the trigger event, but display a warning message in the
MATLAB command window.
Error – Display an error dialog box and terminate the simulation.
The
Push full stack parameter additionally offers the Dynamic reallocation
option, which dynamically resizes the register to accept as many additional
inputs as memory permits. To find out how many elements are on the stack at
a given time, enable the
Num output port by selecting the Output number of
stack entries
option.
Examples Example 1
The table below illustrates the Stack block’s operation for a Stack depth of 4,
Trigger type of Either edge, and Clear output port on reset enabled.
Because the block triggers on both rising and falling edges in this example,
each transition from
1 to 0 or 0 to 1 in the Push, Pop, and Clr columns below