Triggering

To trigger on the nth recursive call of a recursive function

To trigger on the nth recursive call of a recursive function

1Select the state analyzer Trigger menu.

2Define the terms CALL_ADD, F_START, and F_END to represent the called address of the recursive function, and the start and end addresses of the function. Define F_EXIT to represent the address of the first program statement executed after the original recursive call has terminated.

Typically, CALL_ADD is the address of the code that sets up the activation record on the stack, F_START is the address of the first statement in the function, and F_END is the address of the last instruction of the function, which does not necessarily correspond to the address of the last statement. If the start of the function and the address called by recursive calls are the same, or you are not interested in the function initialization code, you can use F_START for both CALL_ADD and F_START.

3Under State Sequence Levels, enter the following sequence specification:

While storing “no state” Find “F_END” 1 time

While storing “anystate” Then find “F_START” 1 time

While storing “anystate” TRIGGER on “CALL_ADD” 20 times Else on “F_EXIT” go to level 1

Store “anystate”

As with the trigger specification for “To trigger on the nth iteration of a loop,” this specification helps avoid potential problems on pipelined processors by requiring that the processor already be in the first recursive call before advancing the sequencer. Because it is already in the first recursive call, this example triggers on the 21st recursive call, which is the 22nd entrance to the function. Depending on the exact code used for the calls, you may need to experiment with different trigger sequences to find one that captures only the data you wish to view.

1–6

Page 16
Image 16
HP 16501A LOGIC, 16500C manual To trigger on the nth recursive call of a recursive function