Transaction-Level Modeling Framework for Space Applications
Files | |
file | cci.cpp |
file | cci.h |
file | systemc.cpp |
file | api.cpp |
file | api.h |
file | module.cpp |
file | module.h |
file | registry.cpp |
file | registry.h |
file | usi.h |
Namespaces | |
pysc | |
blas | |
Classes | |
class | PythonModule |
class | PyScModule |
class | PyScObjectGenerator |
Macros | |
#define | PyString_FromString(x) PyUnicode_FromStringAndSize(x, strlen(x)) |
#define | PYSC_REGISTER_MODULE(name) |
#define | PYSC_THIS_MODULE() (__pysc_module) |
#define | PyScThisModule() (__pysc_module) |
#define | PYSC_INIT_MODULES() PyScModule::registerEmbedded(); |
#define | PYSC_PREPARE_MODULES() PyScModule::prepareEmbedded(); |
#define | PYSC_HAS_MODULE(name) |
#define | PYSC_REGISTER_OBJECT_GENERATOR(funct) |
#define | PYSC_REGISTER_OBJECT(type) |
#define | usi_init pysc_init |
#define | usi_load pysc_load |
#define | usi_start_of_initialization pysc_start_of_initialization |
#define | usi_end_of_initialization pysc_end_of_initialization |
#define | usi_start pysc_start |
#define | USI_INIT_MODULES PYSC_INIT_MODULES |
#define | USI_HAS_MODULE(module) PYSC_HAS_MODULE(module) |
#define | USI_REGISTER_MODULE(module) PYSC_REGISTER_MODULE(module) |
#define | USI_REGISTER_OBJECT_GENERATOR(if) PYSC_REGISTER_OBJECT_GENERATOR(if) |
#define | USI_REGISTER_OBJECT(if) PYSC_REGISTER_OBJECT(if) |
Typedefs | |
typedef PyObject * | PyScObject |
typedef struct _object | PyObject |
typedef struct _ts | PyThreadState |
typedef PyScObject | USIObject |
Variables | |
void(* | cpp_sigint )(int) = NULL |
void(* | cpp_sigterm )(int) = NULL |
static PythonModule * | PythonModule::globalInstance = NULL |
Global PythonModule Instance (The last created one) More... | |
#define PYSC_HAS_MODULE | ( | name | ) |
#define PYSC_INIT_MODULES | ( | ) | PyScModule::registerEmbedded(); |
Referenced by PythonModule::PythonModule().
#define PYSC_PREPARE_MODULES | ( | ) | PyScModule::prepareEmbedded(); |
Referenced by PythonModule::PythonModule().
#define PYSC_REGISTER_MODULE | ( | name | ) |
#define PYSC_REGISTER_OBJECT | ( | type | ) |
#define PYSC_REGISTER_OBJECT_GENERATOR | ( | funct | ) |
#define PYSC_THIS_MODULE | ( | ) | (__pysc_module) |
#define PyScThisModule | ( | ) | (__pysc_module) |
Referenced by PythonModule::add_to_pythonpath(), and PythonModule::PythonModule().
#define usi_end_of_initialization pysc_end_of_initialization |
#define USI_HAS_MODULE | ( | module | ) | PYSC_HAS_MODULE(module) |
Referenced by sc_main().
#define USI_INIT_MODULES PYSC_INIT_MODULES |
#define USI_REGISTER_MODULE | ( | module | ) | PYSC_REGISTER_MODULE(module) |
#define USI_REGISTER_OBJECT | ( | if | ) | PYSC_REGISTER_OBJECT(if) |
#define USI_REGISTER_OBJECT_GENERATOR | ( | if | ) | PYSC_REGISTER_OBJECT_GENERATOR(if) |
#define usi_start pysc_start |
Referenced by sc_main().
#define usi_start_of_initialization pysc_start_of_initialization |
Referenced by sc_main().
typedef struct _object PyObject |
typedef PyObject* PyScObject |
typedef struct _ts PyThreadState |
typedef PyScObject USIObject |
void PythonModule::add_to_pythonpath | ( | std::string | path | ) |
Adds a path to the load/import search path.
References PythonModule::block_threads(), PyString_FromString, and PythonModule::unblock_threads().
Referenced by PythonModule::PythonModule().
|
static |
Block out singleton thread This should not be neccesarry but who knows
Referenced by PythonModule::add_to_pythonpath(), pysc::api::cci::CallbackAdapter::call(), PythonModule::exec(), PythonModule::load(), and PythonModule::PythonModule().
void PythonModule::end_of_elaboration | ( | ) |
void PythonModule::end_of_evaluation | ( | ) |
Referenced by pysc_start().
void PythonModule::end_of_initialization | ( | ) |
Referenced by pysc_end_of_initialization(), and pysc_start().
void PythonModule::end_of_simulation | ( | ) |
void PythonModule::exec | ( | std::string | statement | ) |
runs a Python command in a module-specific namespace
References PythonModule::block_threads(), and PythonModule::unblock_threads().
Referenced by PythonModule::PythonModule().
|
static |
References sc_find_by_name().
Referenced by USIDelegate::USIDelegate().
|
static |
Referenced by USIDelegate::USIDelegate().
void PythonModule::load | ( | std::string | script | ) |
References PythonModule::block_threads(), setup::name, s, and PythonModule::unblock_threads().
Referenced by pysc_load(), and PythonModule::PythonModule().
void PythonModule::pause_of_simulation | ( | ) |
Referenced by pysc_start().
|
static |
void pysc_end_of_initialization | ( | ) |
This function marks the end of the initialization. It will call all python dunctions registered to this phase.
References PythonModule::end_of_initialization().
Initialize the USI Python environment. Take the application argc argv arguments to provide them to the python script. Therefore the scripting environment can be used to initialize the simulation.
argc | Number of arguments |
argv | List of arguments |
Load a python script by file path or module name. This function instructs the USI Pythn environment to execute a python script. The script can be either provided as a file path ending with the file extension .py. Or it can be a hierachial python module path rooted in the SoCRocket top level directory or linked into the site-packages of the venv of SoCRocket.
module | Module name or path. |
References PythonModule::load().
void pysc_signal_handler | ( | int | sig | ) |
The signal handler for the python environment. It should be registered in order to use system signals with the simulation.
sig | the signal sent to the process. |
References cpp_sigint, cpp_sigterm, and pysc::api::systemc::wait().
Referenced by pysc_start().
void pysc_start | ( | ) |
Starts the simulation. This is a wrapper for sc_start. It extens the simulation environment with the capapbility to react on simulation interruptions. Therefore if the user presses Ctrl-c during simulation or sc_pause() is executed during simulation all scripts registered to the phase pause_of_simulation are executed until the simulation will be started again.
References cpp_sigint, cpp_sigterm, PythonModule::end_of_evaluation(), PythonModule::end_of_initialization(), PythonModule::pause_of_simulation(), pysc_signal_handler(), PythonModule::signal, and PythonModule::start_of_evaluation().
void pysc_start_of_initialization | ( | ) |
This function marks the begin of the initialization. It will call all python functions registered to this phase.
References PythonModule::start_of_initialization().
PyScModule::PyScModule | ( | const char * | name, |
PyScModule::init_f | funct = NULL |
||
) |
PyScObjectGenerator::PyScObjectGenerator | ( | PyScObjectGenerator::generator_f | funct = NULL | ) |
PythonModule::PythonModule | ( | sc_core::sc_module_name | name, |
const char * | script_filename = 0 , |
||
int | argc = 0 , |
||
char ** | argv = NULL |
||
) |
References PythonModule::add_to_pythonpath(), usi.shell::args(), PythonModule::block_threads(), PythonModule::exec(), getWafConfig(), i, PythonModule::load(), setup::name, PYSC_INIT_MODULES, PYSC_PREPARE_MODULES, PyString_FromString, and PythonModule::unblock_threads().
|
static |
void PythonModule::start_of_elaboration | ( | ) |
void PythonModule::start_of_evaluation | ( | ) |
Referenced by pysc_start().
void PythonModule::start_of_initialization | ( | ) |
Referenced by pysc_start_of_initialization().
void PythonModule::start_of_simulation | ( | ) |
|
static |
Unblock our singleton thread.
Referenced by PythonModule::add_to_pythonpath(), pysc::api::cci::CallbackAdapter::call(), PythonModule::exec(), PythonModule::load(), and PythonModule::PythonModule().
USI_REGISTER_MODULE | ( | systemc | ) |
USI_REGISTER_MODULE | ( | cci | ) |
|
virtual |
void(* cpp_sigint)(int) = NULL |
Referenced by pysc_signal_handler(), and pysc_start().
void(* cpp_sigterm)(int) = NULL |
Referenced by pysc_signal_handler(), and pysc_start().
|
static |
Global PythonModule Instance (The last created one)