File gpi_embed.c

Initialize the Python interpreter

Create and initialize 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)

Simulator cleanup

Called by the simulator on shutdown.

GILState before calling: Not held

GILState after calling: Not held

Makes one call to PyGILState_Ensure and one call to Py_Finalize.

Cleans up reference counts for Python objects and calls Py_Finalize function.

void embed_sim_cleanup(void)

Initialization

Called by the simulator on initialization.

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

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)

Functions

static void set_program_name_in_venv(void)

Variables

PyThreadState *gtstate = NULL
char progname[] = "cocotb"
char *argv[] = {progname}
const char *PYTHON_INTERPRETER_PATH = "/bin/python"
PyObject *pEventFn = NULL