Pre-defined Primitive Instructions

ticktalkpython.Instructions.ABS(a)

Absolute value

Parameters:

a (TTToken) – numerically-valued token

Returns:

token whose value is the absolute value of the input; TTTime copied from input

Return type:

TTToken

ticktalkpython.Instructions.ADD(a, b)

Addition (commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose value is the sum of the inputs; TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.ADD_TIME_DELAY(token, delay=0, TTExecuteOnFullToken=True)

Modifies the start and end tick of the tine interval of the token to be delayed by parameter delay.

Parameters:
  • value_token – The token carrying the desired value for the output token.

  • delay (int) – the specified delay

Returns:

A TTToken with time interval [x, y] as [x + delay, y + delay]

Return type:

TTToken

ticktalkpython.Instructions.CONST(trigger, const=None)

Generate a TTToken with the given constant value. Copy the timestamp from the trigger.

Parameters:
  • trigger (TTToken) – any token; value is ignored but time is copied to the output

  • const (any) – the constant value

Returns:

constant-valued token with the trigger’s TTTime

Return type:

TTToken

ticktalkpython.Instructions.COPY_TTTIME(value_token, time_token, TTExecuteOnFullToken=True)

SQ that creates a new token with the value of one and the time tag of another. This may be challenging to work with when trying to synchronize the two together, at least if the value_token did not originate from the root of the graph, as the tokens will obviously not synchronize. This will also be problematic if they use different clocks

NB: This function operates on the tokens themselves. The optional argument ‘TTExecuteOnFullToken’ is not used; it is metasyntax telling the runtime to supply the full tokens instead of just the values.

Parameters:
  • value_token (TTToken) – The token carrying the desired value for the output token.

  • time_token – The token carrying the desired TTTime for the output token

Returns:

A TTToken carrying the value of the first input and time of the second

Return type:

TTToken

ticktalkpython.Instructions.DEADLINE(x, TTTimeDeadline=None)

Building block in implementing TTFinishByOtherwise. Programmer direct use is highly discouraged.

Parameters:
  • x (TTToken) – data token; this SQ will act as a no-op if the arrives before the deadline and matches the deadline’s context

  • TTTimeDeadline (TTToken) – token used during this SQs firing rule to enforce the deadline

Returns:

signal to either run Plan B or an identity of the data token

Return type:

Tuple[TTToken, TTToken]

ticktalkpython.Instructions.DIV(a, b)

Division (NOT commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose value is the quotient of the inputs (a/b); TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.EQ(a, b)

Equality (commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose boolean value is if (a == b); TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.GET_INFINITY(trigger, TTClock=None)

Return the maxiumum timestamp supported by the system. Note that the trigger value is unused.

Parameters:

trigger (Not used) – Not used

Returns:

A TTToken carrying the value of the maximum timestamp.

Return type:

TTToken

ticktalkpython.Instructions.GET_NEG_INFINITY(trigger, TTClock=None)

Return the minimum timestamp supported by the system. Note that the trigger value is unused.

Parameters:

trigger (Not used) – Not used

Returns:

A TTToken carrying the value of the minimum timestamp.

Return type:

TTToken

ticktalkpython.Instructions.GT(a, b)

Greater Than (commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose boolean value is if (a > b); TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.GTE(a, b)

Greater Than Equal (commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose boolean value is if (a >= b); TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.LT(a, b)

Less Than (commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose boolean value is if (a < b); TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.LTE(a, b)

Less Than Equal (commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose boolean value is if (a <= b); TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.MAX(a, b)

Maximum (commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose value is the maximum of the inputs; TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.MERGE(then_exp, else_exp)

Acts as an identity node. Coupled with the Immediate firing rule. Programmer direct use is highly discouraged.

Parameters:
  • then_exp (TTToken) – takes one branch of execution

  • else_exp (TTToken) – takes other branch of execution

Returns:

token of the identity of either then_exp or else_exp

Return type:

TTToken

ticktalkpython.Instructions.MIN(a, b)

Minimum (commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose value is the minimum of the inputs; TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.MULT(a, b)

Multiplication (commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose value is the product of the inputs; TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.NEG(a)

Arithmetic negation

Parameters:

a (TTToken) – numerically-valued token

Returns:

token whose value is the aritmetic negation of the input; TTTime copied from input

Return type:

TTToken

ticktalkpython.Instructions.NEQ(a, b)

Inequality (commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose boolean value is if (a != b); TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.NOT(a)

Logical negation

Parameters:

a (TTToken) – comparable boolean value

Returns:

token whose value is the boolean negation of the input; TTTime copied from input

Return type:

TTToken

ticktalkpython.Instructions.READ_TTCLOCK(trigger, TTClock=None, TTExecuteOnFullToken=True)

Read a clock that is supplied as an input argument. The clock is supplied be the runtime environment, but the start and stop tick will be unchanged.

NB: This function operates on the tokens themselves. The optional argument ‘TTExecuteOnFullToken’ is not used; it is metasyntax telling the runtime to supply the full tokens instead of just the values.

Parameters:

trigger (TTToken) – A token whose arrival will cause this SQ to run and record the current time in the ‘value’ field

Returns:

A token whose value is the current time according to the provided TTClock

Return type:

TTToken

ticktalkpython.Instructions.SET_TIMEOUT(token, TTClock=None, TTExecuteOnFullToken=True)

Modifies the start and end tick of the tine interval of the token to be end tick and Time.Infinity respectively.

Parameters:

value_token – The token carrying the desired value for the output token.

Returns:

A TTToken with time interval [x, y] as [x + delay, y + delay]

Return type:

TTToken

ticktalkpython.Instructions.SQRT(a)

Square root

Parameters:

a (TTToken) – numerically-valued token

Returns:

token whose value is the square root of the input; TTTime copied from input

Return type:

TTToken

ticktalkpython.Instructions.SUB(a, b)

Subtraction (NOT commutative)

Parameters:
  • a (TTToken) – numerically-valued token

  • b (TTToken) – numerically-valued token

Returns:

token whose value is the difference of the inputs (a-b); TTTime derived from inputs

Return type:

TTToken

ticktalkpython.Instructions.SYSLOG(a)

Print the argument as a debug message to the system log (debug only)

Parameters:

a (TTToken) – any token

Returns:

True-valued token; TTTime copied from input

Return type:

TTToken

ticktalkpython.Instructions.TIME_TOKEN(trigger)

Generate a TTToken with the given time value. Copy the value from the trigger.

Parameters:
  • trigger (TTToken) – any token; value is ignored but time is copied to the output

  • time – a TTTime

Returns:

passthrough value with the trigger’s TTTime

Return type:

TTToken

ticktalkpython.Instructions.TTTIME_TO_VALUES(token, TTExecuteOnFullToken=True)

Move the upper and lower bounds of the TTTime interval into the value field as a tuple (start, stop) ticks. The TTClock is not provided; the clock is not mutable, and should remain untouched. If it is modified, a runtime error is thrown since this has far reaching side effects

NB: This function operates on the tokens themselves. The optional argument is not used; it is metasyntax telling the runtime to supply the full tokens instead of just the values.

This instruction can only be used within a graph that is compiled and run in the graph interpetation runtime environment

Parameters:

token (TTToken) – The token whose timestamps must be moved to the value field. The time and tag are unchanged

Returns:

token whose value is a tuple containing two integers; the start and stop tick on TTTime part of the token.

Return type:

TTToken

ticktalkpython.Instructions.TUPLE_2(a, b)

Return a tuple of the two arguments (debug only)

ticktalkpython.Instructions.TUPLE_3(a, b, c)

Return a tuple of the two arguments (debug only)

ticktalkpython.Instructions.VALUES_TO_TTTIME(start_tick_token, stop_tick_token, TTExecuteOnFullToken=True)

Set the start and stop ticks of the output token’s time field to be the values from the two inputs tokens; one is the start tick, the other is the stop tick. If the values are not integers or start >= stop, a ValueError is thrown.

NB: This function operates on the tokens themselves. The optional argument is not used; it is metasyntax telling the runtime to supply the full tokens instead of just the values.

Parameters:
  • start_tick_token (TTToken) – A tokcn whose value field contains the start tick (in terms of the attached clock)

  • stop_tick_token (TTToken) – A tokcn whose value field contains the stop tick (in terms of the attached clock)

Returns:

A token with no value (None) and a TTTime whose start tick is the value of the first input and whose stop tick is the value of the second.

Return type:

TTToken