$search
Glue logic must implement:
if (debug command queue is not empty) execute debug command else if (executing a thread) run VM else if (event queue is not empty) fetch event run VM else sleep until something happens
#define ASEBA_NATIVES_STD_COUNT 21 |
#define ASEBA_NATIVES_STD_DESCRIPTIONS |
&AsebaNativeDescription_veccopy, \ &AsebaNativeDescription_vecfill, \ &AsebaNativeDescription_vecaddscalar, \ &AsebaNativeDescription_vecadd, \ &AsebaNativeDescription_vecsub, \ &AsebaNativeDescription_vecmul, \ &AsebaNativeDescription_vecdiv, \ &AsebaNativeDescription_vecmin, \ &AsebaNativeDescription_vecmax, \ &AsebaNativeDescription_vecdot, \ &AsebaNativeDescription_vecstat, \ &AsebaNativeDescription_vecargbounds, \ &AsebaNativeDescription_vecsort, \ &AsebaNativeDescription_mathmuldiv, \ &AsebaNativeDescription_mathatan2, \ &AsebaNativeDescription_mathsin, \ &AsebaNativeDescription_mathcos, \ &AsebaNativeDescription_mathrot2, \ &AsebaNativeDescription_mathsqrt, \ &AsebaNativeDescription_vecnonzerosequence, \ &AsebaNativeDescription_rand
snippet to include descriptions of standard native functions
#define ASEBA_NATIVES_STD_FUNCTIONS |
AsebaNative_veccopy, \ AsebaNative_vecfill, \ AsebaNative_vecaddscalar, \ AsebaNative_vecadd, \ AsebaNative_vecsub, \ AsebaNative_vecmul, \ AsebaNative_vecdiv, \ AsebaNative_vecmin, \ AsebaNative_vecmax, \ AsebaNative_vecdot, \ AsebaNative_vecstat, \ AsebaNative_vecargbounds, \ AsebaNative_vecsort, \ AsebaNative_mathmuldiv, \ AsebaNative_mathatan2, \ AsebaNative_mathsin, \ AsebaNative_mathcos, \ AsebaNative_mathrot2, \ AsebaNative_mathsqrt, \ AsebaNative_vecnonzerosequence, \ AsebaNative_rand
snippet to include standard native functions
#define AsebaMaskClear | ( | v, | |||
m | ) | ((v) &= (~(m))) |
#define AsebaMaskIsClear | ( | v, | |||
m | ) | (((v) & (m)) == 0) |
#define AsebaMaskIsSet | ( | v, | |||
m | ) | (((v) & (m)) != 0) |
#define AsebaMaskSet | ( | v, | |||
m | ) | ((v) |= (m)) |
#define AsebaSendMessageWords | ( | vm, | |||
type, | |||||
data, | |||||
size | ) | AsebaSendMessage(vm,type,data,(size)*2) |
#define BIT_CLR | ( | v, | |||
b | ) | ((v) &= (~(1 << (b)))) |
#define BIT_SET | ( | v, | |||
b | ) | ((v) |= (1 << (b))) |
#define GET_BIT | ( | v, | |||
b | ) | (((v) >> (b)) & 0x1) |
typedef void(* AsebaNativeFunctionPointer)(AsebaVMState *vm) |
anonymous enum |
void __attribute__ | ( | (weak) | ) |
Called by AsebaVMDebugMessage when VM is going to be run
Called by AsebaVMEmitNodeSpecificError to be notified when VM hit an execution error Is also called for wrong array access or division by 0 with message == NULL
void AsebaDebugBareRun | ( | AsebaVMState * | vm, | |
uint16 | stepsLimit | |||
) |
void AsebaDebugBreakpointRun | ( | AsebaVMState * | vm, | |
uint16 | stepsLimit | |||
) |
uint16 AsebaGetRandom | ( | ) |
Functon to get a random number
void AsebaNative_mathatan2 | ( | AsebaVMState * | vm | ) |
Function to perform atan2
void AsebaNative_mathcos | ( | AsebaVMState * | vm | ) |
Function to perform cos
void AsebaNative_mathmuldiv | ( | AsebaVMState * | vm | ) |
Function to perform dest = (a*b)/c in 32 bits
void AsebaNative_mathrot2 | ( | AsebaVMState * | vm | ) |
Function to perform the rotation of a vector
void AsebaNative_mathsin | ( | AsebaVMState * | vm | ) |
Function to perform sin
void AsebaNative_mathsqrt | ( | AsebaVMState * | vm | ) |
Function to perform sqrt
void AsebaNative_rand | ( | AsebaVMState * | vm | ) |
Function to get a 16-bit signed random number
void AsebaNative_vecadd | ( | AsebaVMState * | vm | ) |
Function to add two vectors
void AsebaNative_vecaddscalar | ( | AsebaVMState * | vm | ) |
Function to add a scalar to each element of a vector
void AsebaNative_vecargbounds | ( | AsebaVMState * | vm | ) |
Function to get indices of the bounds of a vector
void AsebaNative_veccopy | ( | AsebaVMState * | vm | ) |
Function to copy a vector
void AsebaNative_vecdiv | ( | AsebaVMState * | vm | ) |
Function to divide two vectors elements by elements
void AsebaNative_vecdot | ( | AsebaVMState * | vm | ) |
Function to perform a dot product on a vector
void AsebaNative_vecfill | ( | AsebaVMState * | vm | ) |
Function to fill all the elements of a vector to a specific value
void AsebaNative_vecmax | ( | AsebaVMState * | vm | ) |
Function to take the element by element maximum
void AsebaNative_vecmin | ( | AsebaVMState * | vm | ) |
Function to take the element by element minimum
void AsebaNative_vecmul | ( | AsebaVMState * | vm | ) |
Function to multiply two vectors elements by elements
void AsebaNative_vecnonzerosequence | ( | AsebaVMState * | vm | ) |
Function to get the middle index of the largest sequence of non-zero elements
void AsebaNative_vecsort | ( | AsebaVMState * | vm | ) |
Function to sort a vector
void AsebaNative_vecstat | ( | AsebaVMState * | vm | ) |
Function to perform statistics on a vector
void AsebaNative_vecsub | ( | AsebaVMState * | vm | ) |
Function to substract two vectors
void AsebaNativeFunction | ( | AsebaVMState * | vm, | |
uint16 | id | |||
) |
Called by AsebaStep to perform a native function call.
Definition at line 35 of file LocalVirtualMachine.cpp.
static sint16 AsebaNativePopArg | ( | AsebaVMState * | vm | ) | [inline, static] |
void AsebaPutVmToSleep | ( | AsebaVMState * | vm | ) |
Called by AsebaVMDebugMessage when VM must put to node in deep sleep. Write an empty function to leave feature unsupported
Definition at line 965 of file challenge.cpp.
void AsebaResetIntoBootloader | ( | AsebaVMState * | vm | ) |
Called by AsebaVMDebugMessage when VM must restart the node and enter to the bootloader, write an empty function to leave feature unsupported
Definition at line 1029 of file challenge.cpp.
void AsebaSendDescription | ( | AsebaVMState * | vm | ) |
Called by AsebaVMDebugMessage when VM must send its description on the network.
Definition at line 81 of file asebatest.cpp.
void AsebaSendMessage | ( | AsebaVMState * | vm, | |
uint16 | id, | |||
const void * | data, | |||
uint16 | size | |||
) |
Called by AsebaStep if there is a message (not an user event) to send. size is given in number of bytes.
Definition at line 4 of file aseba-test-natives-count.cpp.
void AsebaSendVariables | ( | AsebaVMState * | vm, | |
uint16 | start, | |||
uint16 | length | |||
) |
Called by AsebaVMDebugMessage when some variables must be sent efficiently
Definition at line 76 of file asebatest.cpp.
void AsebaSetRandomSeed | ( | uint16 | seed | ) |
Functon to set the seed of random generator
uint16 AsebaVMCheckBreakpoint | ( | AsebaVMState * | vm | ) |
uint16 AsebaVMClearBreakpoint | ( | AsebaVMState * | vm, | |
uint16 | pc | |||
) |
void AsebaVMClearBreakpoints | ( | AsebaVMState * | vm | ) |
void AsebaVMDebugMessage | ( | AsebaVMState * | vm, | |
uint16 | id, | |||
uint16 * | data, | |||
uint16 | dataLength | |||
) |
Execute a debug action from a debug message. dataLength is given in number of uint16.
static sint16 AsebaVMDoBinaryOperation | ( | AsebaVMState * | vm, | |
sint16 | valueOne, | |||
sint16 | valueTwo, | |||
uint16 | op | |||
) | [static] |
static sint16 AsebaVMDoUnaryOperation | ( | AsebaVMState * | vm, | |
sint16 | value, | |||
uint16 | op | |||
) | [static] |
void AsebaVMEmitNodeSpecificError | ( | AsebaVMState * | vm, | |
const char * | message | |||
) |
Can be called by glue code (including native functions), to stop vm and emit a node specific error
uint16 AsebaVMGetEventAddress | ( | AsebaVMState * | vm, | |
uint16 | event | |||
) |
Return the starting address of an event, or 0 if the event is not handled.
void AsebaVMInit | ( | AsebaVMState * | vm | ) |
Setup the execution status of the VM. This is not sufficient to have a working VM. nodeId and bytecode, variables, and stack along with their sizes must be set outside this function. The content of the variable array is zeroed by this function.
uint16 AsebaVMRun | ( | AsebaVMState * | vm, | |
uint16 | stepsLimit | |||
) |
Run the VM depending on the current execution mode. Either run or step, depending of the current mode. If stepsLimit > 0, execute at maximim stepsLimit Return 1 if anything was executed, 0 otherwise.
void AsebaVMSendExecutionStateChanged | ( | AsebaVMState * | vm | ) |
uint8 AsebaVMSetBreakpoint | ( | AsebaVMState * | vm, | |
uint16 | pc | |||
) |
uint16 AsebaVMSetupEvent | ( | AsebaVMState * | vm, | |
uint16 | event | |||
) |
Setup VM to execute an event. If event is not handled, VM is not ready for run. Return the starting address of the event, or 0 if the event is not handled.
uint16 AsebaVMShouldDropPacket | ( | AsebaVMState * | vm, | |
uint16 | source, | |||
const uint8 * | data | |||
) |
Return non-zero if VM will ignore the packet, 0 otherwise
void AsebaVMStep | ( | AsebaVMState * | vm | ) |
void AsebaWriteBytecode | ( | AsebaVMState * | vm | ) |
Called by AsebaVMDebugMessage when VM must write its bytecode to flash, write an empty function to leave feature unsupported
Definition at line 1025 of file challenge.cpp.
const sint16 aseba_atan_table[20 *8+1] = { 652, 735, 816, 896, 977, 1058, 1139, 1218, 1300, 1459, 1620, 1777, 1935, 2093, 2250, 2403, 2556, 2868, 3164, 3458, 3748, 4029, 4307, 4578, 4839, 5359, 5836, 6290, 6720, 7126, 7507, 7861, 8203, 8825, 9357, 9839, 10260, 10640, 10976, 11281, 11557, 12037, 12425, 12755, 13036, 13277, 13486, 13671, 13837, 14112, 14331, 14514, 14666, 14796, 14907, 15003, 15091, 15235, 15348, 15441, 15519, 15585, 15642, 15691, 15736, 15808, 15865, 15912, 15951, 15984, 16013, 16037, 16060, 16096, 16125, 16148, 16168, 16184, 16199, 16211, 16222, 16240, 16255, 16266, 16276, 16284, 16292, 16298, 16303, 16312, 16320, 16325, 16331, 16334, 16338, 16341, 16344, 16348, 16352, 16355, 16357, 16360, 16361, 16363, 16364, 16366, 16369, 16369, 16371, 16372, 16373, 16373, 16375, 16375, 16377, 16376, 16378, 16378, 16378, 16379, 16379, 16380, 16380, 16380, 16382, 16381, 16381, 16381, 16382, 16382, 16382, 16382, 16382, 16382, 16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384 } [static] |
const sint16 aseba_sin_table[128+1] = {0, 403, 804, 1207, 1608, 2010, 2411, 2812, 3212, 3612, 4011, 4411, 4808, 5206, 5603, 5998, 6393, 6787, 7180, 7572, 7962, 8352, 8740, 9127, 9513, 9896, 10279, 10660, 11040, 11417, 11794, 12167, 12540, 12911, 13279, 13646, 14010, 14373, 14733, 15091, 15447, 15801, 16151, 16500, 16846, 17190, 17531, 17869, 18205, 18538, 18868, 19196, 19520, 19842, 20160, 20476, 20788, 21097, 21403, 21706, 22006, 22302, 22595, 22884, 23171, 23453, 23732, 24008, 24279, 24548, 24812, 25073, 25330, 25583, 25833, 26078, 26320, 26557, 26791, 27020, 27246, 27467, 27684, 27897, 28106, 28311, 28511, 28707, 28899, 29086, 29269, 29448, 29622, 29792, 29957, 30117, 30274, 30425, 30572, 30715, 30852, 30985, 31114, 31238, 31357, 31471, 31581, 31686, 31786, 31881, 31972, 32057, 32138, 32215, 32285, 32352, 32413, 32470, 32521, 32569, 32610, 32647, 32679, 32706, 32728, 32746, 32758, 32766, 32767, } [static] |
{ "math.nzseq", "write to dest the middle index of the largest sequence of non-zero elements from src, -1 if not found or if smaller than minLength", { { 1, "dest" }, { -1, "src" }, { 1, "minLength" }, { 0, 0 } } }
Description of AsebaNative_vecnonzerosequence