All of the functions and data structures described in this document are declared in the smx_dll.h header file made available in the SIMPLIS Digital Development Kit. A copy of that header file is also included in every project created by the auto-code generation tool available in the GUI. The Tutorial walks the user through the process of creating a DLL-defined Digital Device project definition, creating the source, customizing and compiling it using Visual studio and running the device in a test schematic. Once the initial definition is created via the tool, the following documentation will help customize the behavior of the device.
context_p->funcs->fatal_error(device_p, "Fatal error has occurred.");
provided the device pointer as passed into the calling function, the name of the bus to be retrieved and the bus direction (either SMX_DLL_DIRECTION_INPUT or SMX_DLL_DIRECTION_OUTPUT), the pointer to a bus pointer result will be populated with the address of the requested bus. If the bus is found, the function will return SMX_DLL_NO_ERROR, otherwise, the result should not be treated as valid.
provided a pointer to the bus in question, the value at the address of the integer pointer result will be set to the bus width. On success, the function will return SMX_DLL_NO_ERROR, otherwise, the result should not be treated as valid.
provided the device pointer as passed into the calling function, the name of the pin to be retrieved and the pin direction (either SMX_DLL_DIRECTION_INPUT or SMX_DLL_DIRECTION_OUTPUT), the pointer to a pin pointer result will be populated with the address of the requested pin. If the pin is found, the function will return SMX_DLL_NO_ERROR, otherwise, the result should not be treated as valid.
provided the device pointer as passed into the calling function, the name of the bus containing the pin to be retrieved, the index of the pin in the bus, the bus direction (either SMX_DLL_DIRECTION_INPUT or SMX_DLL_DIRECTION_OUTPUT), the pointer to a pin pointer result will be populated with the address of the requested pin. If the pin is found, the function will return SMX_DLL_NO_ERROR, otherwise, the result should not be treated as valid.
provided a pointer to the bus in question and the index of the pin in the bus, the pointer to a pin pointer result will be populated with the address of the requested pin. If the pin is found, the function will return SMX_DLL_NO_ERROR, otherwise, the result should not be treated as valid.
provided the device pointer as passed into the calling function and the name of the parameter to be retrieved, the pointer to a parameter pointer result will be populated with the address of the requested parameter. If the parameter is found, the function will return SMX_DLL_NO_ERROR, otherwise, the result should not be treated as valid.
sets the logic value of all of the output pins in the specified bus to logic level SMX_DLL_LOGIC_X after the provided delay. On success, the function will return SMX_DLL_NO_ERROR, otherwise, the output change should not be expected to occur.
reads the value of the bus according to the specification defined by the bus conversion. On success, returns SMX_DLL_NO_ERROR, otherwise, the result should not be treated as valid. The read value will be assigned to the appropriate member of the bus conversion union.
based on the conversion type and the encoding type of the bus conversion, the appropriate value from the union will be written to the output bus after the provided delay. On success, the function will return SMX_DLL_NO_ERROR, otherwise, the output change should not be expected to occur.
Returns SMX_DLL_TRUE if the pin is low. Returns SMX_DLL_FALSE if the pin is high, unknown (X), or if an error occurs. If a non-NULL error pointer is provided, any error value will be assigned, with SMX_DLL_NO_ERROR being the value assigned on success.
Returns SMX_DLL_TRUE if the pin is high. Returns SMX_DLL_FALSE if the pin is low, unknown (X), or if an error occurs. If a non-NULL error pointer is provided, any error value will be assigned, with SMX_DLL_NO_ERROR being the value assigned on success.
Returns SMX_DLL_TRUE if the pin is at an unknown logic level (X). Returns SMX_DLL_FALSE if the pin is high, low, or if an error occurs. If a non-NULL error pointer is provided, any error value will be assigned, with SMX_DLL_NO_ERROR being the value assigned on success.
Returns SMX_DLL_TRUE if an edge event (SMX_DLL_LOGIC_0 to SMX_DLL_LOGIC_1 or SMX_DLL_LOGIC_1 to SMX_DLL_LOGIC_0) has been detected on the associated pin. Returns SMX_DLL_FALSE if no edge event was detected or if an error occurs. If a non-NULL error pointer is provided, any error value will be assigned, with SMX_DLL_NO_ERROR being the value assigned on success.
Returns SMX_DLL_TRUE if a positive edge event (SMX_DLL_LOGIC_0 to SMX_DLL_LOGIC_1) has been detected on the associated pin. Returns SMX_DLL_FALSE if no positive edge event was detected or if an error occurs. If a non-NULL error pointer is provided, any error value will be assigned, with SMX_DLL_NO_ERROR being the value assigned on success.
Returns SMX_DLL_TRUE if a negative edge event (SMX_DLL_LOGIC_1 to SMX_DLL_LOGIC_0) has been detected on the associated pin. Returns SMX_DLL_FALSE if no negative edge event was detected or if an error occurs. If a non-NULL error pointer is provided, any error value will be assigned, with SMX_DLL_NO_ERROR being the value assigned on success.
Causes the SIMPLIS simulation to abort and displays the provided error message to the user. This function directly calls the process termination mechanism and should not be expected to return a value.
When called during the setup routine, allocates and assigns a block of memory (of the size requested) to the device's user_storage member. This function should only be called once per device, and only data that changes during simulation will benefit from being placed in managed user storage.
Requests that the device be awoken after the provided relative delay time. When awoken, the type of the wake reason will be set to SMX_DLL_WAKE_TYPE_WAKE_REQUESTED. If the identifier is not a NULL pointer and the dereferenced value is non-zero, the provided identifier will be provided with the wake reason. If the identifier is not a NULL pointer and the dereferenced value is zero, the value will be set to a unique identifier that will be provided with the wake reason.