![]() |
Kactus2
Kactus2 reference guide
|
Interface for accessing Kactus2 data using Python. More...
#include <PythonAPI.h>
Public Types | |
enum | StdRev { Std14 , Std22 } |
Public Member Functions | |
PythonAPI () | |
~PythonAPI ()=default | |
bool | addComponentInstance (std::string const &vlnvString, std::string const &instanceName) |
void | addLibraryPath (std::string const &path, bool isActive=true) |
void | closeOpenComponent () |
void | closeOpenDesign () |
bool | createAdHocConnection (std::string const &startInstanceName, std::string const &startPort, std::string const &endInstanceName, std::string const &endPort) |
bool | createComponent (std::string const &vendor, std::string const &library, std::string const &name, std::string const &version, StdRev revision=StdRev::Std22) |
bool | createConnection (std::string const &startInstanceName, std::string const &startBus, std::string const &endInstanceName, std::string const &endBus) |
bool | createDesign (std::string const &vendor, std::string const &library, std::string const &name, std::string const &version, StdRev revision=StdRev::Std22) |
bool | createHierarchicalAdHocConnection (std::string const &instanceName, std::string const &instancePort, std::string const &topPort) |
bool | createHierarchicalConnection (std::string const &instanceName, std::string const &instanceBus, std::string const &topBus) |
void | generate (std::string const &format, std::string const &vlnv, std::string const &viewName, std::string const &outputDirectory) const |
std::vector< std::string > | getActiveLibraryPaths () const |
std::vector< std::string > | getAllLibraryPaths () const |
BusInterfaceInterface * | getBusInterface () |
std::string | getComponentDescription () const |
std::string | getComponentName () const |
ParametersInterface * | getComponentParameterInterface () const |
std::string | getComponentStdRevision () const |
std::string | getDefaultLibraryPath () const |
std::string | getDesignStdRevision () const |
int | getFileCount () const |
FileSetInterface * | getFileSetInterface () |
std::string | getFirstViewName () const |
MemoryMapInterface * | getMapInterface () |
PortsInterface * | getPortsInterface () const |
std::string | getVersion () const |
std::string | getVLNVDirectory (std::string const &vendor, std::string const &library, std::string const &name, std::string const &version) const |
int | importFile (std::string const &path, std::string const &vlnv, bool overwrite=false) const |
std::vector< std::string > | listComponentVLNVs () const |
std::vector< std::string > | listVLNVs (std::string const &vendor=std::string()) const |
bool | openComponent (std::string const &vlnvString) |
bool | openDesign (std::string const &vlnvString) |
bool | removeComponentInstance (std::string const &instanceName) |
bool | removeHierarchicalAdHocConnection (std::string const &instanceName, std::string const &instancePort, std::string const &topPort) |
bool | removeHierarchicalConnection (std::string const &instanceName, std::string const &instanceBus, std::string const &topBus) |
bool | removeInstanceAdHocConnection (std::string const &startInstanceName, std::string const &startPort, std::string const &endInstanceName, std::string const &endPort) |
bool | removeInstanceAdHocConnections (std::string const &instanceName) |
bool | removeInstanceConnection (std::string const &startInstanceName, std::string const &startBus, std::string const &endInstanceName, std::string const &endBus) |
bool | removeInstanceConnections (std::string const &instanceName) |
void | removeLibraryPath (std::string const &path) |
bool | renameAdHocConnection (std::string const ¤tName, std::string const &newName) |
bool | renameConnection (std::string const ¤tName, std::string const &newName) |
bool | renameInstance (std::string const ¤tName, std::string const &newName) |
void | saveComponent () |
void | saveDesign () |
void | setBlocksForInterface (std::string const &mapName) |
void | setDefaultLibraryPath (std::string const &path) const |
void | setFieldsForInterface (std::string const &mapName, std::string const &blockName, std::string const ®isterName) |
void | setFileBuildersForInterface (std::string const &setName) |
void | setFilesForInterface (std::string const &setName) |
void | setLibraryPathActive (std::string const &path, bool isActive) |
void | setLibraryPaths (std::vector< std::string > const &paths) const |
void | setRegistersForInterface (std::string const &mapName, std::string const &blockName) |
void | setResetsForInterface (std::string const &mapName, std::string const &blockName, std::string const ®isterName, std::string const &fieldName) |
void | setupLibrary (std::string const &settingsFileString) |
bool | vlnvExistsInLibrary (std::string const &vendor, std::string const &library, std::string const &name, std::string const &version) const |
Interface for accessing Kactus2 data using Python.
Definition at line 65 of file PythonAPI.h.
enum PythonAPI::StdRev |
IP-XACT std revision for use in python.
Enumerator | |
---|---|
Std14 | |
Std22 |
Definition at line 72 of file PythonAPI.h.
PythonAPI::PythonAPI | ( | ) |
The constructor.
Definition at line 68 of file PythonAPI.cpp.
|
default |
The destructor.
bool PythonAPI::addComponentInstance | ( | std::string const & | vlnvString, |
std::string const & | instanceName ) |
Add the selected component instance to the active design.
[in] | vlnvString | VLNV of the component within the selected component instance. |
[in] | instanceName | Name for the new component instance. |
Definition at line 1098 of file PythonAPI.cpp.
void PythonAPI::addLibraryPath | ( | std::string const & | path, |
bool | isActive = true ) |
Add a new library path and set as active by default.
[in] | path | The path to add. |
[in] | isActive | Indicates if the new path should be set active or not. |
Definition at line 118 of file PythonAPI.cpp.
void PythonAPI::closeOpenComponent | ( | ) |
Remove the active component.
Definition at line 483 of file PythonAPI.cpp.
void PythonAPI::closeOpenDesign | ( | ) |
Remove the active design.
Definition at line 1065 of file PythonAPI.cpp.
bool PythonAPI::createAdHocConnection | ( | std::string const & | startInstanceName, |
std::string const & | startPort, | ||
std::string const & | endInstanceName, | ||
std::string const & | endPort ) |
Create an ad hoc connection between two ports.
[in] | startInstanceName | Name of the component instance containing the first port. |
[in] | startPort | Name of the first port. |
[in] | endInstanceName | Name of the component instance containing the second port. |
[in] | endPort | Name of the second port. |
Definition at line 1460 of file PythonAPI.cpp.
bool PythonAPI::createComponent | ( | std::string const & | vendor, |
std::string const & | library, | ||
std::string const & | name, | ||
std::string const & | version, | ||
StdRev | revision = StdRev::Std22 ) |
Create a new component with the selected VLNV. Defaults to IP-XACT 2022.
[in] | vendor | Vendor of the selected VLNV. |
[in] | library | Library of the selected VLNV. |
[in] | name | Name of the selected VLNV. |
[in] | version | Version of the selected VLNV. |
[in] | revision | IP-XACT standard revision to use. |
Definition at line 334 of file PythonAPI.cpp.
bool PythonAPI::createConnection | ( | std::string const & | startInstanceName, |
std::string const & | startBus, | ||
std::string const & | endInstanceName, | ||
std::string const & | endBus ) |
Create an interconnection between two bus interfaces.
[in] | startInstanceName | Name of the component instance containing the first bus interface. |
[in] | startBus | Name of the first bus interface. |
[in] | endInstanceName | Name of the component instance containing the second bus interface. |
[in] | endBus | Name of the second bus interface. |
Definition at line 1178 of file PythonAPI.cpp.
bool PythonAPI::createDesign | ( | std::string const & | vendor, |
std::string const & | library, | ||
std::string const & | name, | ||
std::string const & | version, | ||
StdRev | revision = StdRev::Std22 ) |
Create a new design with the selected VLNV. Defaults to IP-XACT 2022.
[in] | vendor | Vendor of the selected VLNV. |
[in] | library | Library of the selected VLNV. |
[in] | name | Name of the selected VLNV. |
[in] | version | Version of the selected VLNV. |
[in] | revision | IP-XACT standard revision to use. |
Definition at line 899 of file PythonAPI.cpp.
bool PythonAPI::createHierarchicalAdHocConnection | ( | std::string const & | instanceName, |
std::string const & | instancePort, | ||
std::string const & | topPort ) |
Create a hierarchical ad hoc connection between two ports.
[in] | instanceName | Name of the component instance containing the selected port. |
[in] | instancePort | Name of the component instance port. |
[in] | topPort | Name of the top component port. |
Definition at line 1482 of file PythonAPI.cpp.
bool PythonAPI::createHierarchicalConnection | ( | std::string const & | instanceName, |
std::string const & | instanceBus, | ||
std::string const & | topBus ) |
Create a hierarchical interconnection between two bus interfaces.
[in] | instanceName | Name of the component instance containing the selected bus interface. |
[in] | instanceBus | Name of the component instance bus interface. |
[in] | topBus | Name of the top component bus interface. |
Definition at line 1200 of file PythonAPI.cpp.
void PythonAPI::generate | ( | std::string const & | format, |
std::string const & | vlnv, | ||
std::string const & | viewName, | ||
std::string const & | outputDirectory ) const |
Run a file generation for a component.
[in] | format | The requested output format. |
[in] | vlnv | The component VLNV to run the generation for. |
[in] | viewName | The component view to run the generation for. |
[in] | outputDirectory | The output directory for the generation results. |
Definition at line 233 of file PythonAPI.cpp.
std::vector< std::string > PythonAPI::getActiveLibraryPaths | ( | ) | const |
Get configured active library paths.
Definition at line 137 of file PythonAPI.cpp.
std::vector< std::string > PythonAPI::getAllLibraryPaths | ( | ) | const |
Get all configured active and inactive library paths.
Definition at line 94 of file PythonAPI.cpp.
BusInterfaceInterface * PythonAPI::getBusInterface | ( | ) |
Get the interface for accessing bus interfaces.
Definition at line 185 of file PythonAPI.cpp.
std::string PythonAPI::getComponentDescription | ( | ) | const |
Get the description of the active component.
Definition at line 511 of file PythonAPI.cpp.
std::string PythonAPI::getComponentName | ( | ) | const |
Get the name of the active component.
Definition at line 496 of file PythonAPI.cpp.
ParametersInterface * PythonAPI::getComponentParameterInterface | ( | ) | const |
Get the interface for accessing the component parameters.
Definition at line 161 of file PythonAPI.cpp.
std::string PythonAPI::getComponentStdRevision | ( | ) | const |
Get the IP-XACT standard revision of the active component
Definition at line 526 of file PythonAPI.cpp.
std::string PythonAPI::getDefaultLibraryPath | ( | ) | const |
Get the default library path for IP-XACT files.
Definition at line 207 of file PythonAPI.cpp.
std::string PythonAPI::getDesignStdRevision | ( | ) | const |
Get the IP-XACT standard revision of the active design.
Definition at line 969 of file PythonAPI.cpp.
int PythonAPI::getFileCount | ( | ) | const |
Get the number of files in the library.
Definition at line 274 of file PythonAPI.cpp.
FileSetInterface * PythonAPI::getFileSetInterface | ( | ) |
Get the interface for accessing file sets.
Definition at line 177 of file PythonAPI.cpp.
std::string PythonAPI::getFirstViewName | ( | ) | const |
Get the name of the first view contained within the active component.
Definition at line 400 of file PythonAPI.cpp.
MemoryMapInterface * PythonAPI::getMapInterface | ( | ) |
Get the interface for accessing component memory maps.
Definition at line 169 of file PythonAPI.cpp.
PortsInterface * PythonAPI::getPortsInterface | ( | ) | const |
Get the interface for accessing the component ports.
Definition at line 153 of file PythonAPI.cpp.
std::string PythonAPI::getVersion | ( | ) | const |
Get Kactus2 version.
Definition at line 86 of file PythonAPI.cpp.
std::string PythonAPI::getVLNVDirectory | ( | std::string const & | vendor, |
std::string const & | library, | ||
std::string const & | name, | ||
std::string const & | version ) const |
Get the directory path of the selected VLNV document.
[in] | vendor | Vendor of the selected VLNV. |
[in] | library | Library of the selected VLNV. |
[in] | name | Name of the selected VLNV. |
[in] | version | Version of the selected VLNV. |
Definition at line 385 of file PythonAPI.cpp.
int PythonAPI::importFile | ( | std::string const & | path, |
std::string const & | vlnv, | ||
bool | overwrite = false ) const |
Import a source file (RTL) into the library as a component.
[in] | filePath | The path to the file to import. |
[in] | targetVLNV | The VLNV to use for the imported component. |
[in] | overwrite | Overwrite the component in the library, if it already exists. |
Definition at line 223 of file PythonAPI.cpp.
std::vector< std::string > PythonAPI::listComponentVLNVs | ( | ) | const |
List all the component VLNVs in the library.
Definition at line 297 of file PythonAPI.cpp.
std::vector< std::string > PythonAPI::listVLNVs | ( | std::string const & | vendor = std::string() | ) | const |
List all the VLNVs in the library.
[in] | vendor | The desired vendor. |
Definition at line 282 of file PythonAPI.cpp.
bool PythonAPI::openComponent | ( | std::string const & | vlnvString | ) |
Set the selected component as active component.
[in] | componentVLNV | VLNV of the selected component. |
Definition at line 423 of file PythonAPI.cpp.
bool PythonAPI::openDesign | ( | std::string const & | vlnvString | ) |
Set the selected design as active design.
[in] | vlnvString | VLNV of the selected design. |
Definition at line 1031 of file PythonAPI.cpp.
bool PythonAPI::removeComponentInstance | ( | std::string const & | instanceName | ) |
Remove the selected component instance from the active design.
[in] | instanceName | Name of the selected component instance. |
Definition at line 1140 of file PythonAPI.cpp.
bool PythonAPI::removeHierarchicalAdHocConnection | ( | std::string const & | instanceName, |
std::string const & | instancePort, | ||
std::string const & | topPort ) |
Remove a hierarchical ad hoc connection between two ports.
[in] | instanceName | Name of the component instance containing the selected port. |
[in] | instancePort | Name of the component instance port. |
[in] | topPort | Name of the top component port. |
Definition at line 1529 of file PythonAPI.cpp.
bool PythonAPI::removeHierarchicalConnection | ( | std::string const & | instanceName, |
std::string const & | instanceBus, | ||
std::string const & | topBus ) |
Remove an interconnection between two bus interfaces.
[in] | instanceName | Name of the component instance containing the selected bus interface. |
[in] | instanceBus | Name of the component instance bus interface. |
[in] | topBus | Name of the top component bus interface. |
Definition at line 1424 of file PythonAPI.cpp.
bool PythonAPI::removeInstanceAdHocConnection | ( | std::string const & | startInstanceName, |
std::string const & | startPort, | ||
std::string const & | endInstanceName, | ||
std::string const & | endPort ) |
Remove an ad hoc connection between two ports.
[in] | startInstanceName | Name of the component instance containing the first port. |
[in] | startPort | Name of the first port. |
[in] | endInstanceName | Name of the component instance containing the second port. |
[in] | endPort | Name of the second port. |
Definition at line 1502 of file PythonAPI.cpp.
bool PythonAPI::removeInstanceAdHocConnections | ( | std::string const & | instanceName | ) |
Remove ad hoc connections from the selected component instance.
[in] | instanceName | Name of the selected component instance. |
Definition at line 1162 of file PythonAPI.cpp.
bool PythonAPI::removeInstanceConnection | ( | std::string const & | startInstanceName, |
std::string const & | startBus, | ||
std::string const & | endInstanceName, | ||
std::string const & | endBus ) |
Remove an interconnection between two bus interfaces.
[in] | startInstanceName | Name of the component instance containing the first bus interface. |
[in] | startBus | Name of the first bus interface. |
[in] | endInstanceName | Name of the component instance containing the second bus interface. |
[in] | endBus | Name of the second bus interface. |
Definition at line 1412 of file PythonAPI.cpp.
bool PythonAPI::removeInstanceConnections | ( | std::string const & | instanceName | ) |
Remove connections from the selected component instance.
[in] | instanceName | Name of the selected component instance. |
Definition at line 1154 of file PythonAPI.cpp.
void PythonAPI::removeLibraryPath | ( | std::string const & | path | ) |
Remove a library path. Prints error if trying to remove default path.
[in] | path | The path to remove. |
Definition at line 126 of file PythonAPI.cpp.
bool PythonAPI::renameAdHocConnection | ( | std::string const & | currentName, |
std::string const & | newName ) |
Set a new name for the selected ad hoc connection.
[in] | currentName | Name of the selected ad hoc connection. |
[in] | newName | New name for the ad hoc connection. |
Definition at line 1541 of file PythonAPI.cpp.
bool PythonAPI::renameConnection | ( | std::string const & | currentName, |
std::string const & | newName ) |
Set a new name for the selected interconnection.
[in] | currentName | Name of the selected interconnection. |
[in] | newName | New name for the interconnection. |
Definition at line 1452 of file PythonAPI.cpp.
bool PythonAPI::renameInstance | ( | std::string const & | currentName, |
std::string const & | newName ) |
Set a new name for the selected component instance.
[in] | currentName | Name of the selected component instance. |
[in] | newName | New name for the component instance. |
Definition at line 1170 of file PythonAPI.cpp.
void PythonAPI::saveComponent | ( | ) |
Save the component to the library.
Definition at line 539 of file PythonAPI.cpp.
void PythonAPI::saveDesign | ( | ) |
Save the design to the library.
Definition at line 1078 of file PythonAPI.cpp.
void PythonAPI::setBlocksForInterface | ( | std::string const & | mapName | ) |
Set the available address blocks for the address block interface.
[in] | mapName | Name of the memory map containing the desired address blocks. |
Definition at line 622 of file PythonAPI.cpp.
void PythonAPI::setDefaultLibraryPath | ( | std::string const & | path | ) | const |
Set the default library path for IP-XACT files.
[in] | path | The default path to set for IP-XACT files. |
Definition at line 215 of file PythonAPI.cpp.
void PythonAPI::setFieldsForInterface | ( | std::string const & | mapName, |
std::string const & | blockName, | ||
std::string const & | registerName ) |
Set the available fields for the field interface.
[in] | mapName | Name of the memory map containing the desired address blocks. |
[in] | blockName | Name of the address block containing the desired registers. |
[in] | registerName | Name of the register containing the desired fields. |
Definition at line 672 of file PythonAPI.cpp.
void PythonAPI::setFileBuildersForInterface | ( | std::string const & | setName | ) |
Set the available file builders for the file interface.
[in] | setName | Name of the file set containing the available file builders. |
Definition at line 881 of file PythonAPI.cpp.
void PythonAPI::setFilesForInterface | ( | std::string const & | setName | ) |
Set the available files for the file interface.
[in] | setName | Name of the file set containing the available files. |
Definition at line 847 of file PythonAPI.cpp.
void PythonAPI::setLibraryPathActive | ( | std::string const & | path, |
bool | isActive ) |
Set a given library path as active or inactive. If set as active, also add the path if not found.
[in] | path | The path to set active. |
[in] | isActive | Indicates if the path should be set active or inactive. |
Definition at line 110 of file PythonAPI.cpp.
void PythonAPI::setLibraryPaths | ( | std::vector< std::string > const & | paths | ) | const |
Sets new active library paths. First path is set as default.
[in] | paths | The new locations that are currently available to store the files. |
Definition at line 193 of file PythonAPI.cpp.
void PythonAPI::setRegistersForInterface | ( | std::string const & | mapName, |
std::string const & | blockName ) |
Set the available registers for the register interface.
[in] | mapName | Name of the memory map containing the desired address blocks. |
[in] | blockName | Name of the address block containing the desired registers. |
Definition at line 641 of file PythonAPI.cpp.
void PythonAPI::setResetsForInterface | ( | std::string const & | mapName, |
std::string const & | blockName, | ||
std::string const & | registerName, | ||
std::string const & | fieldName ) |
Set the available resets for the reset interface.
[in] | mapName | Name of the memory map containing the desired address blocks. |
[in] | blockName | Name of the address block containing the desired registers. |
[in] | registerName | Name of the register containing the desired fields. |
[in] | fieldName | Name of the field containing the desired resets. |
Definition at line 712 of file PythonAPI.cpp.
void PythonAPI::setupLibrary | ( | std::string const & | settingsFileString | ) |
Gets the paths where IP-XACT files are stored.
Definition at line 78 of file PythonAPI.cpp.
bool PythonAPI::vlnvExistsInLibrary | ( | std::string const & | vendor, |
std::string const & | library, | ||
std::string const & | name, | ||
std::string const & | version ) const |
Check if the selected VLNV exists in the library.
[in] | vendor | Vendor of the selected VLNV. |
[in] | library | Library of the selected VLNV. |
[in] | name | Name of the selected VLNV. |
[in] | version | Version of the selected VLNV. |
Definition at line 315 of file PythonAPI.cpp.