File gpi_embed.c

Initialisation

Called by the simulator on initialisation.

Load cocotb python module

GILState before calling: Not held

GILState after calling: Not held

Makes one call to PyGILState_Ensure and one call to PyGILState_Release

Loads the Python module called cocotb and calls the _initialise_testbench function

COCOTB_MODULE “cocotb”
int get_module_ref(const char *modname, PyObject **mod)
int embed_sim_init(gpi_sim_info_t *info)
void embed_sim_event(gpi_event_t level, const char *msg)

Initialise the python interpreter

Create and initialise the python interpreter

GILState before calling: N/A

GILState after calling: released

Stores the thread state for cocotb in static variable gtstate

void embed_init_python(void)

Variables

PyThreadState *gtstate = NULL
char progname[] = "cocotb"
char *argv[] = {progname}
PyObject *pEventFn = NULL