File simulatormodule.c¶
Python extension to provide access to the simulator.
Uses GPI calls to interface to the simulator.
Callback Handling
Handle a callback coming from GPI
GILState before calling: Unknown
GILState after calling: Unknown
Makes one call to TAKE_GIL and one call to DROP_GIL
Returns 0 on success or 1 on a failure.
Handles a callback from the simulator, all of which call this function.
We extract the associated context and find the Python function (usually cocotb.scheduler.react) calling it with a reference to the trigger that fired. The scheduler can then call next() on all the coroutines that are waiting on that particular trigger.
TODO:
Tidy up return values
Ensure cleanup correctly in exception cases
-
int
handle_gpi_callback(void *user_data)¶
-
static PyObject *
log_msg(PyObject *self, PyObject *args)¶
-
static PyObject *
register_readonly_callback(PyObject *self, PyObject *args)¶
-
static PyObject *
register_rwsynch_callback(PyObject *self, PyObject *args)¶
-
static PyObject *
register_nextstep_callback(PyObject *self, PyObject *args)¶
-
static PyObject *
register_timed_callback(PyObject *self, PyObject *args)¶
-
static PyObject *
register_value_change_callback(PyObject *self, PyObject *args)¶
-
static PyObject *
iterate(PyObject *self, PyObject *args)¶
-
static PyObject *
next(PyObject *self, PyObject *args)¶
-
static PyObject *
get_signal_val_binstr(PyObject *self, PyObject *args)¶
-
static PyObject *
get_signal_val_str(PyObject *self, PyObject *args)¶
-
static PyObject *
get_signal_val_real(PyObject *self, PyObject *args)¶
-
static PyObject *
get_signal_val_long(PyObject *self, PyObject *args)¶
-
static PyObject *
set_signal_val_str(PyObject *self, PyObject *args)¶
-
static PyObject *
set_signal_val_real(PyObject *self, PyObject *args)¶
-
static PyObject *
set_signal_val_long(PyObject *self, PyObject *args)¶
-
static PyObject *
get_definition_name(PyObject *self, PyObject *args)¶
-
static PyObject *
get_definition_file(PyObject *self, PyObject *args)¶
-
static PyObject *
get_handle_by_name(PyObject *self, PyObject *args)¶
-
static PyObject *
get_handle_by_index(PyObject *self, PyObject *args)¶
-
static PyObject *
get_root_handle(PyObject *self, PyObject *args)¶
-
static PyObject *
get_name_string(PyObject *self, PyObject *args)¶
-
static PyObject *
get_type(PyObject *self, PyObject *args)¶
-
static PyObject *
get_const(PyObject *self, PyObject *args)¶
-
static PyObject *
get_type_string(PyObject *self, PyObject *args)¶
-
static PyObject *
get_sim_time(PyObject *self, PyObject *args)¶
-
static PyObject *
get_precision(PyObject *self, PyObject *args)¶
-
static PyObject *
get_num_elems(PyObject *self, PyObject *args)¶
-
static PyObject *
get_range(PyObject *self, PyObject *args)¶
-
static PyObject *
stop_simulator(PyObject *self, PyObject *args)¶
-
static PyObject *
deregister_callback(PyObject *self, PyObject *args)¶
-
static PyObject *
log_level(PyObject *self, PyObject *args)¶
-
static void
add_module_constants(PyObject *simulator)¶
Typedefs
-
typedef int (*
gpi_function_t)(const void *)¶
Functions
-
PyGILState_STATE
TAKE_GIL(void)¶
-
void
DROP_GIL(PyGILState_STATE state)¶
-
static int
gpi_sim_hdl_converter(PyObject *o, gpi_sim_hdl *data)¶
-
static int
gpi_iterator_hdl_converter(PyObject *o, gpi_iterator_hdl *data)¶
-
struct
sim_time¶