This chapter describes the functions that are globally available in all scripts written in the Antares DSL programming language.

Arithmetic Functions

/**
 * Computes the binary logarithm (base 2) of a given value.
 *
 * The result is rounded up to the next bigger integer value in order to
 * provide enough bits when used to calculate the number of necessary bits that
 * represent a number whose number of bits is given by [value].
 *
 * Examples:
 * - log2(8) = 3
 * - log2(10) = 4
 * - log2(16) = 4
 */
private fun log2(value: Long): Long

Digital Signal Functions

/**
 * Extracts [size] bits at position [pos] from [signal], where bit positions start with 0.
 *
 * Example: bits(31, 3, 2) = 3.
 */
private fun bits(signal: DigitalSignal, pos: Long, size: Long): Long

/**
 * Treats [signal] like an input signal to a logic gate, thereby possibly converting
 * undefined (floating) bits according to the current system preference
 * "Undefined Gate Input Behaviour".
 *
 * Example: gated(I) returns 0 if I is 0x?8 and "Undefined Gate Input Behaviour"
 * is "Read as O"
 */
private fun gated(signal: DigitalSignal): DigitalSignal = effectiveGateInputWord(signal)