Empirical
|
A linear GP (inspired by AvidaGP) virtual hardware CPU that supports an event-driven programming paradigm. More...
#include <EventDrivenGP.h>
Classes | |
struct | Block |
struct | Event |
struct | Function |
struct | Instruction |
struct | Program |
struct | State |
Public Types | |
enum | BlockType { BlockType::NONE =0, BlockType::BASIC, BlockType::LOOP } |
using | EventDrivenGP_t = EventDrivenGP_AW< AFFINITY_WIDTH > |
using | mem_key_t = int |
using | mem_val_t = double |
using | memory_t = std::unordered_map< mem_key_t, mem_val_t > |
using | arg_t = int |
using | arg_set_t = emp::array< arg_t, MAX_INST_ARGS > |
using | affinity_t = BitSet< AFFINITY_WIDTH > |
using | properties_t = std::unordered_set< std::string > |
using | inst_t = Instruction |
using | inst_seq_t = emp::vector< inst_t > |
using | event_t = Event |
using | inst_lib_t = InstLib< EventDrivenGP_t > |
using | event_lib_t = EventLib< EventDrivenGP_t > |
using | program_t = Program |
using | exec_stk_t = emp::vector< State > |
using | fun_event_handler_t = std::function< void(EventDrivenGP_t &, const event_t &)> |
Event handler function type alias. More... | |
Public Member Functions | |
EventDrivenGP_AW (Ptr< const inst_lib_t > _ilib, Ptr< const event_lib_t > _elib, Ptr< Random > rnd=nullptr) | |
EventDrivenGP_AW (inst_lib_t &_ilib, event_lib_t &_elib, Ptr< Random > rnd=nullptr) | |
EventDrivenGP_AW (Ptr< const event_lib_t > _elib, Ptr< Random > rnd=nullptr) | |
EventDrivenGP_AW (Ptr< Random > rnd=nullptr) | |
EventDrivenGP_AW (EventDrivenGP_t &&in) | |
EventDrivenGP_AW (const EventDrivenGP_t &in) | |
~EventDrivenGP_AW () | |
void | Reset () |
void | ResetHardware () |
void | SpawnCore (const affinity_t &affinity, double threshold, const memory_t &input_mem=memory_t(), bool is_main=false) |
void | SpawnCore (size_t fID, const memory_t &input_mem=memory_t(), bool is_main=false) |
Ptr< const inst_lib_t > | GetInstLib () const |
Get instruction library associated with hardware's program. More... | |
Ptr< const event_lib_t > | GetEventLib () const |
Get event library associated with hardware. More... | |
Random & | GetRandom () |
Get reference to random number generator used by this hardware. More... | |
Ptr< Random > | GetRandomPtr () |
Get pointer to random number generator used by this hardware. More... | |
const program_t & | GetConstProgram () const |
Get program loaded on this hardware. More... | |
program_t & | GetProgram () |
const Function & | GetFunction (size_t fID) const |
Get reference to a particular function in hardware's program. More... | |
const inst_t & | GetInst (size_t fID, size_t pos) const |
Get reference to particular instruction in hardware's program given function ID and instruction position. More... | |
double | GetTrait (size_t id) const |
Get a particular trait given its ID. More... | |
size_t | GetNumErrors () const |
Get current number of errors committed by this hardware. More... | |
double | GetMinBindThresh () const |
size_t | GetMaxCores () const |
Get the maximum number of cores allowed to run simultaneously on this hardware object. More... | |
size_t | GetMaxCallDepth () const |
Get the maximum call depth allowed on this hardware object (max call states allowed on a single core's call stack at a time). More... | |
mem_val_t | GetDefaultMemValue () const |
Get the default memory value for local/shared/input/output memory maps. More... | |
bool | IsStochasticFunCall () const |
emp::vector< exec_stk_t > & | GetCores () |
size_t | GetCurCoreID () |
exec_stk_t & | GetCurCore () |
Get a reference to the current core/execution stack. More... | |
State & | GetCurState () |
Get a reference to the current local call state. More... | |
memory_t & | GetSharedMem () |
Get a reference to hardware's shared memory map. More... | |
mem_val_t | GetShared (mem_key_t key) const |
mem_val_t & | AccessShared (mem_key_t key) |
void | SetMinBindThresh (double val) |
void | SetMaxCores (size_t val) |
void | SetMaxCallDepth (size_t val) |
void | SetDefaultMemValue (mem_val_t val) |
Configure the default memory value. More... | |
void | SetStochasticFunCall (bool val) |
void | SetTrait (size_t id, double val) |
void | IncTrait (size_t id, double inc=1.0) |
void | DecTrait (size_t id, double dec=1.0) |
void | PushTrait (double val) |
Push a trait onto end of traits vector. More... | |
void | SetInst (size_t fID, size_t pos, const inst_t &inst) |
Shortcut to this hardware object's program's SetInst function of the same signature. More... | |
void | SetInst (size_t fID, size_t pos, size_t id, arg_t a0=0, arg_t a1=0, arg_t a2=0, const affinity_t &aff=affinity_t()) |
Shortcut to this hardware object's program's SetInst function of the same signature. More... | |
void | SetProgram (const program_t &_program) |
Set program for this hardware object. More... | |
void | PushFunction (const Function &_function) |
Shortcut to this hardware object's program's PushFunction operation of the same signature. More... | |
void | PushFunction (const affinity_t &_aff=affinity_t(), const inst_seq_t &_seq=inst_seq_t()) |
Shortcut to this hardware object's program's PushFunction operation of the same signature. More... | |
void | PushInst (size_t id, arg_t a0=0, arg_t a1=0, arg_t a2=0, const affinity_t &aff=affinity_t(), int fID=-1) |
void | PushInst (const std::string &name, arg_t a0=0, arg_t a1=0, arg_t a2=0, const affinity_t &aff=affinity_t(), int fID=-1) |
void | PushInst (const inst_t &inst, int fID=-1) |
void | Load (std::istream &input) |
void | NewRandom (int seed=-1) |
Generate new random number generator for this hardware object with the given seed value. More... | |
bool | ValidPosition (size_t fID, size_t pos) const |
bool | ValidFunction (size_t fID) const |
Is the function given by function ID (fID) a valid function in this hardware object's program? More... | |
void | SetShared (mem_key_t key, mem_val_t value) |
Set given shared memory map location (key) to given value. More... | |
size_t | FindEndOfBlock (size_t fp, size_t ip) |
void | CloseBlock () |
void | OpenBlock (size_t begin, size_t end, BlockType type) |
Open a block in the current local program state as specified by begin, end, and type. More... | |
void | BreakBlock () |
emp::vector< size_t > | FindBestFuncMatch (const affinity_t &affinity, double threshold) |
Find best matching functions (by ID) given affinity. More... | |
void | CallFunction (const affinity_t &affinity, double threshold) |
void | CallFunction (size_t fID) |
void | ReturnFunction () |
void | ProcessInst (const inst_t &inst) |
Process a single instruction, provided by the caller. More... | |
void | HandleEvent (const event_t &event) |
Handle an event (on this hardware). More... | |
void | TriggerEvent (const event_t &event) |
Trigger an event (from this hardware). More... | |
void | TriggerEvent (const std::string &name, const affinity_t &affinity=affinity_t(), const memory_t &msg=memory_t(), const properties_t &properties=properties_t()) |
Trigger an event (from this hardware). More... | |
void | TriggerEvent (size_t id, const affinity_t &affinity=affinity_t(), const memory_t &msg=memory_t(), const properties_t &properties=properties_t()) |
Trigger an event (from this hardware). More... | |
void | QueueEvent (const event_t &event) |
Queue an event (to be handled by this hardware). More... | |
void | QueueEvent (const std::string &name, const affinity_t &affinity=affinity_t(), const memory_t &msg=memory_t(), const properties_t &properties=properties_t()) |
Queue event by name. More... | |
void | QueueEvent (size_t id, const affinity_t &affinity=affinity_t(), const memory_t &msg=memory_t(), const properties_t &properties=properties_t()) |
Queue event by id. More... | |
void | SingleProcess () |
Advance hardware by single instruction. More... | |
void | Process (size_t num_inst) |
Advance hardware by some arbitrary number instructions. More... | |
void | PrintEvent (const event_t &event, std::ostream &os=std::cout) |
Print given event using given output stream (default = std::cout). More... | |
void | PrintInst (const inst_t &inst, std::ostream &os=std::cout) |
Print given instruction using given output stream (default = std::cout). More... | |
void | PrintTraits (std::ostream &os=std::cout) |
Print hardware traits using given output stream (default = std::cout). More... | |
void | PrintProgram (std::ostream &os=std::cout) |
Print out entire program using given output stream (default = std::cout). More... | |
void | PrintProgramFull (std::ostream &os=std::cout) |
Print out entire program using given output stream (default = std::cout). More... | |
void | PrintState (std::ostream &os=std::cout) |
Print out current state (full) of virtual hardware using given output stream (default = std::cout). More... | |
Static Public Member Functions | |
static void | Inst_Inc (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Dec (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Not (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Add (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Sub (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Mult (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Div (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Mod (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_TestEqu (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_TestNEqu (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_TestLess (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_If (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_While (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Countdown (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Break (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Close (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Call (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Return (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_SetMem (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_CopyMem (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_SwapMem (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Input (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Output (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Commit (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Pull (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_Nop (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_BroadcastMsg (EventDrivenGP_t &hw, const inst_t &inst) |
static void | Inst_SendMsg (EventDrivenGP_t &hw, const inst_t &inst) |
static Ptr< const InstLib< EventDrivenGP_t > > | DefaultInstLib () |
Get a pointer to const default instruction library. Will only construct the default instruction library once. More... | |
static void | HandleEvent_Message (EventDrivenGP_t &hw, const event_t &event) |
static Ptr< const EventLib< EventDrivenGP_t > > | DefaultEventLib () |
Static Public Attributes | |
static constexpr size_t | MAX_INST_ARGS = 3 |
Maximum number of instruction arguments. Currently hardcoded. At some point, will make flexible. More... | |
static constexpr size_t | DEFAULT_MAX_CORES = 8 |
static constexpr size_t | DEFAULT_MAX_CALL_DEPTH = 128 |
static constexpr mem_val_t | DEFAULT_MEM_VALUE = 0.0 |
static constexpr double | DEFAULT_MIN_BIND_THRESH = 0.5 |
Protected Attributes | |
Ptr< const event_lib_t > | event_lib |
Ptr< Random > | random_ptr |
bool | random_owner |
program_t | program |
memory_t | shared_mem |
std::deque< event_t > | event_queue |
emp::vector< double > | traits |
size_t | errors |
size_t | max_cores |
size_t | max_call_depth |
double | default_mem_value |
double | min_bind_thresh |
bool | stochastic_fun_call |
emp::vector< exec_stk_t > | cores |
emp::vector< size_t > | active_cores |
emp::vector< size_t > | inactive_cores |
std::deque< size_t > | pending_cores |
size_t | exec_core_id |
bool | is_executing |
A linear GP (inspired by AvidaGP) virtual hardware CPU that supports an event-driven programming paradigm.
The EventDrivenGP virtual hardware runs programs where each program is a set of named functions. Function names are mutable bit strings, or affinities, and each function consists of a sequence of instructions. Functions are called by name, and can be called from within the hardware (via Call instructions) or from outside the hardware (via Events).
The EventDrivenGP virtual hardware CPU is capable of multi-core/parallel processing. This hardware maintains a (bounded) set of cores. Each core maintains its own program call stack that stores information about the active functions on that core. Cores execute in simulated parallel. For every single CPU cycle (see SingleProcess function) given to the virtual hardware, each core is given the opportunity to advance by a single cycle.
When functions are called from within the hardware (via Call instructions), a new call state is pushed onto the program call stack on the core from which the function was called. No new core is spawned (unless using a non-standard Call instruction). When functions are called from outside the hardware (via Events), if there is an available inactive core, an inactive core will be made active with the called function.
Affinity matching/binding is used to determine which functions should be called by events or by Call instructions. The hardware looks at the event/instruction's associated affinity and finds the best match (using a simple matching coefficient) among function affinities in the hardware's program. The best match must be better than a given minimum threshold (min_bind_thresh) for that function to be called. If there are not functions that meet the minimum threshold, no function is called. If two or more functions are tied for best match and are above the minimum threshold, one is selected randomly to be called; otherwise, if there is no tie, the best matching function is called.
Terminology:
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::affinity_t = BitSet<AFFINITY_WIDTH> |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::arg_set_t = emp::array<arg_t, MAX_INST_ARGS> |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::arg_t = int |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::event_lib_t = EventLib<EventDrivenGP_t> |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::event_t = Event |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::EventDrivenGP_t = EventDrivenGP_AW<AFFINITY_WIDTH> |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::exec_stk_t = emp::vector<State> |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::fun_event_handler_t = std::function<void(EventDrivenGP_t &, const event_t &)> |
Event handler function type alias.
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::inst_lib_t = InstLib<EventDrivenGP_t> |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::inst_seq_t = emp::vector<inst_t> |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::inst_t = Instruction |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::mem_key_t = int |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::mem_val_t = double |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::memory_t = std::unordered_map<mem_key_t, mem_val_t> |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::program_t = Program |
using emp::EventDrivenGP_AW< AFFINITY_WIDTH >::properties_t = std::unordered_set<std::string> |
|
strong |
Currently only 3 Block types:
Enumerator | |
---|---|
NONE | |
BASIC | |
LOOP |
|
inline |
EventDrivenGP constructor. Give instance variables reasonable defaults. Allow for configuration post-construction.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get a reference to a location in the shared memory map as indicated by key. If key cannot be found, add key:default_mem_value to map and return newly added location.
|
inline |
If there's a block to break out of in current local program state, break out (to eob). Otherwise, do nothing.
|
inline |
Call function with best affinity match above threshold. If not candidate functions found, do nothing.
|
inline |
Call function specified by fID. REQ: core must be active (must have a local state on execution stack).
|
inline |
Close current block in the current local program state if there is one to close. If not, do nothing. Handles closure of known, special block types appropriately:
|
inline |
Utility function to decrement trait id by value given by dec. Will resize traits vector if given id is greater than current traits vector size.
|
inlinestatic |
Get a pointer to const default event library. Will only construct the default event library once. Note: the default event library does not construct any default dispatch functions. This is the responsibility of whatever is using the EventDrivenGP hardware.
|
inlinestatic |
Get a pointer to const default instruction library. Will only construct the default instruction library once.
|
inline |
Find best matching functions (by ID) given affinity.
|
inline |
Given valid function pointer and instruction pointer, find next end of block (at current block level). This is not guaranteed to return a valid IP. At worst, it'll return an IP == function.inst_seq.size().
|
inline |
Get program loaded on this hardware.
|
inline |
Get all hardware cores. NOTE: use responsibly!
|
inline |
Get a reference to the current core/execution stack.
|
inline |
Get the currently executing core ID. If hardware is not in the middle of an execution cycle (the SingleProcess function), this will return the first core ID in active_cores, which will typically be the core on which main is running.
|
inline |
Get a reference to the current local call state.
|
inline |
Get the default memory value for local/shared/input/output memory maps.
|
inline |
Get event library associated with hardware.
|
inline |
Get reference to a particular function in hardware's program.
|
inline |
Get reference to particular instruction in hardware's program given function ID and instruction position.
|
inline |
Get instruction library associated with hardware's program.
|
inline |
Get the maximum call depth allowed on this hardware object (max call states allowed on a single core's call stack at a time).
|
inline |
Get the maximum number of cores allowed to run simultaneously on this hardware object.
|
inline |
Get hardware's minimum binding threshold (threshold used to determine if two affinities are close enough to bind).
|
inline |
Get current number of errors committed by this hardware.
|
inline |
|
inline |
Get reference to random number generator used by this hardware.
|
inline |
Get pointer to random number generator used by this hardware.
|
inline |
Get a particular value in shared memory map stored @ location indicated by key. If key cannot be found, return the default memory value.
|
inline |
Get a reference to hardware's shared memory map.
|
inline |
Get a particular trait given its ID.
|
inline |
Handle an event (on this hardware).
|
inlinestatic |
Default event handler: Message Description: Handle a message by spawning a new core (if we're not already maxed out) with the function that best matches the messages affinity. Set the function's input buffer to be equal to the contents of the message event's message contents.
|
inline |
Utility function to increment trait id by value given by inc. Will resize traits vector if given id is greater than current traits vector size.
|
inlinestatic |
Default instruction: Add Number of arguments: 3 Description: Local[Arg3] = Local[Arg1] + Local[Arg2]
|
inlinestatic |
Default instruction: Break Number of arguments: 0 Description: Break out of current block if there's a block to close.
|
inlinestatic |
Default instruction: BroadcastMsg Number of arguments: 0 Description: Trigger a Message event where the event's affinity is equal to this instructions affinity and the event's message payload is equal to the current local program state output buffer. Event properties will indicate that this is a broadcast.
|
inlinestatic |
Default instruction: Call Number of arguments: 0 Description: Call function with the strongest affinity match to call affinity.
|
inlinestatic |
Default instruction: Close Number of arguments: 0 Description: Marks the end of a block.
|
inlinestatic |
Default instruction: Commit Number of arguments: 2 Description: Shared[Arg2] = Local[Arg1]
|
inlinestatic |
Default instruction: CopyMem Number of arguments: 2 Description: Local[Arg2] = Local[Arg1]
|
inlinestatic |
Default instruction: Countdown Number of arguments: 1 Description: While (Local[Arg1] != 0) { Local[Arg1]– then execute block }
|
inlinestatic |
Default instruction: Dec Number of arguments: 1 Description: Decrement value in local memory[Arg1].
|
inlinestatic |
Default instruction: Div Number of arguments: 3 Description: Local[Arg3] = Local[Arg1] / Local[Arg2] If Local[Arg2] == 0, division fails and increment hardware errors.
|
inlinestatic |
Default instruction: If Number of arguments: 1 Description: If (Local[Arg1] != 0) { execute block } else { skip block }
|
inlinestatic |
Default instruction: Inc Number arguments: 1 Description: Increment value in local memory[Arg1].
|
inlinestatic |
Default instruction: Input Number of arguments: 2 Description: Local[Arg2] = Input[Arg1]
|
inlinestatic |
Default instruction: Mod Number of arguments: 3 Description: Local[Arg3] = Local[Arg1] % Local[Arg2] If Local[Arg2] == 0, modulus fails and increment hardware errors.
|
inlinestatic |
Default instruction: Mult Number of arguments: 3 Description: Local[Arg3] = Local[Arg1] * Local[Arg2]
|
inlinestatic |
Default instruction: Nop Number of arguments: 0 Description: No operation.
|
inlinestatic |
Default instruction: Not Number of arguments: 1 Description: Logically toggle value in Local[Arg1].
|
inlinestatic |
Default instruction: Output Number of arguments: 2 Description: Output[Arg2] = Local[Arg1]
|
inlinestatic |
Default instruction: Pull Number of arguments: 2 Description: Local[Arg2] = Shared[Arg1]
|
inlinestatic |
Default instruction: Return Number of arguments: 0 Description: Return from current function call unless in main function call.
|
inlinestatic |
Default instruction: SendMsg Number of arguments: 0 Description: Trigger a Message event where the event's affinity is equal to this instructions affinity and the event's message payload is equal to the current local program state output buffer. Event properties will indicate that this is a send.
|
inlinestatic |
Default instruction: SetMem Number of arguments: 2 Description: Local[Arg1] = ValueOf(Arg2)
|
inlinestatic |
Default instruction: Sub Number of arguments: 3 Description: Local[Arg3] = Local[Arg1] - Local[Arg2]
|
inlinestatic |
Default instruction: SwapMem Number of arguments: 2 Description: Swap(Local[Arg1], Local[Arg2])
|
inlinestatic |
Default instruction: TestEqu Number of arguments: 3 Description: Local[Arg3] = Local[Arg1] == Local[Arg2]
|
inlinestatic |
Default instruction: TestLess Number of arguments: 3 Description: Local[Arg3] = Local[Arg1] < Local[Arg2]
|
inlinestatic |
Default instruction: TestNEqu Number of arguments: 3 Description: Local[Arg3] = Local[Arg1] != Local[Arg2]
|
inlinestatic |
Default instruction: While Number of arguments: 1 Description: While (Local[Arg1] != 0) { execute block }
|
inline |
Is this hardware object configured to allow stochasticity in function calling? Hardware is only stochastic when calling/event affinity is equidistant from two or more functions.
|
inline |
Load entire program from input stream. Warning: This function accepts a slightly different than what the Program's PrintProgram function prints out (for now, will add a PrintProgram variant that prints in this load function's accepted format). Program format: Fn-AFFINITY: INST_NAMEAFFINITY ... Fn-AFFINITY: ...
|
inline |
Generate new random number generator for this hardware object with the given seed value.
|
inline |
Open a block in the current local program state as specified by begin, end, and type.
|
inline |
Print given event using given output stream (default = std::cout).
|
inline |
Print given instruction using given output stream (default = std::cout).
|
inline |
Print out entire program using given output stream (default = std::cout).
|
inline |
Print out entire program using given output stream (default = std::cout).
|
inline |
Print out current state (full) of virtual hardware using given output stream (default = std::cout).
|
inline |
Print hardware traits using given output stream (default = std::cout).
|
inline |
Advance hardware by some arbitrary number instructions.
|
inline |
Process a single instruction, provided by the caller.
|
inline |
Shortcut to this hardware object's program's PushFunction operation of the same signature.
|
inline |
Shortcut to this hardware object's program's PushFunction operation of the same signature.
|
inline |
Push new instruction to program. If no function pointer is provided and no functions exist yet, add new function to program and push to that. If no function pointer is provided and functions exist, push to last function in program. If function pointer is provided, push to that function.
|
inline |
Push new instruction to program. If no function pointer is provided and no functions exist yet, add new function to program and push to that. If no function pointer is provided and functions exist, push to last function in program. If function pointer is provided, push to that function.
|
inline |
Push new instruction to program. If no function pointer is provided and no functions exist yet, add new function to program and push to that. If no function pointer is provided and functions exist, push to last function in program. If function pointer is provided, push to that function.
|
inline |
Push a trait onto end of traits vector.
|
inline |
Queue an event (to be handled by this hardware).
|
inline |
Queue event by name.
|
inline |
Queue event by id.
|
inline |
Reset everything, including program. Not allowed to Reset during execution.
|
inline |
Reset only hardware, not program. Not allowed to reset hardware during execution.
|
inline |
Return from current function call (cur_state) in current core (cur_core). Upon returning, put values in output memory of returning state into local memory of caller state.
|
inline |
Configure the default memory value.
|
inline |
Shortcut to this hardware object's program's SetInst function of the same signature.
|
inline |
Shortcut to this hardware object's program's SetInst function of the same signature.
|
inline |
Configure max call depth. Warning: will not retroactively enforce new max call depth. Requirement: max call depth must be > 0.
|
inline |
Set the maximum number of cores that are allowed to be running/active simultaneously on this hardware object. Warning: If you decrease max cores, you may kill actively running cores. Warning: If you decrease max cores, we make no guarantees about which particular cores are killed. This could have adverse effects. Requirement: Must have max cores > 0 and cannot set max cores while executing (while in SingleProcess function). To sum up, be careful if you're going to decreasing max cores after you've run the hardware.
|
inline |
Set minimum binding threshold. Requirement: minimum binding threshold >= 0.0
|
inline |
Set program for this hardware object.
|
inline |
Set given shared memory map location (key) to given value.
|
inline |
Configure whether or not function calls should be stochastic if we have two or more matches that are equidistant from caller/event affinity.
|
inline |
Set trait in traints vector given by id to value given by val. Will resize traits vector if given id is greater than current traits vector size.
|
inline |
Advance hardware by single instruction.
|
inline |
Spawn core with function that has best match to provided affinity. Do nothing if no functions match above the provided threshold. Initialize function state with provided input memory. Will fail if no inactive cores to claim.
|
inline |
Spawn core with function specified by fID. Initialize function state with provided input memory. Will fail if no inactive cores to claim.
|
inline |
Trigger an event (from this hardware).
|
inline |
Trigger an event (from this hardware).
|
inline |
Trigger an event (from this hardware).
|
inline |
Is the function given by function ID (fID) a valid function in this hardware object's program?
|
inline |
Is program position defined by the given function ID (fID) and instruction position (pos) a valid position in this hardware object's program?
|
protected |
|
protected |
|
static |
|
static |
|
static |
|
protected |
|
static |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
Maximum number of instruction arguments. Currently hardcoded. At some point, will make flexible.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |