CASP Python Libraries
This documentation primarily focuses on the usage of functions from 'casp', 'casp_be', 'casp_gpio' and 'casp_udio' namespaces.
Loading...
Searching...
No Matches
casp_be Namespace Reference

This module defines all necessary functions to. More...

Functions

 Init (str casp_file="BlockEditor")
 Initializes CASP Block Editor subprocess.
 HelpPython ()
 Opens CASP Python Libraries documentation.
 Close ()
 Terminates CASP Block Editor subprocess and releases the resources.
bool Open (str blk_name, str visible_title, str parent_dir_path="", bool overwrite_existing=True)
 Creates new block and opens it for further configuration.
bool AddPort (str port_name, str visible_text, bool output_port=False, str data_type=defs.DATA_TYPE_INT32, int data_size=1)
 Adds new port to the block.
bool AddPara (str para_name, str var_name, str data_type=defs.DATA_TYPE_INT32, list[str] para_values=["None"])
 Adds new parameter to the block.
bool SetOtherLangSupport (int lang_type=defs.LANG_PYTHON)
 Set support for other languages such as Python, Fortran and Verilog.
bool Save ()
 Save block data to disk.
 Folder ()
 Show block folder.

Detailed Description

This module defines all necessary functions to.

  • start CASP Block Editor process
  • create a new block as a project
  • modify block internal parameters
  • add block user parameters
  • add block ports
  • save the block to the disk
  • and finally when every thing is done, close the Block Editor process

All functions in this module uses global object _casp_process.casp_be_proc from _casp_process.py module.

Function Documentation

◆ Init()

casp_be.Init ( str casp_file = "BlockEditor")

Initializes CASP Block Editor subprocess.

This is the first function to be called before using any other function in this module.

Arguments:

casp_file: Set executable file to be invoked. Set this argument only if the executable file version is different from 'BlockEditor'.

Definition at line 24 of file casp_be.py.

◆ HelpPython()

casp_be.HelpPython ( )

Opens CASP Python Libraries documentation.

Definition at line 33 of file casp_be.py.

◆ Close()

casp_be.Close ( )

Terminates CASP Block Editor subprocess and releases the resources.

Definition at line 38 of file casp_be.py.

◆ Open()

bool casp_be.Open ( str blk_name,
str visible_title,
str parent_dir_path = "",
bool overwrite_existing = True )

Creates new block and opens it for further configuration.

Arguments:

blk_name: Block name to be created. The block name should follow standard file naming conventions.

visible_title: Block visible title text.

parent_dir_path: Block location/arent directory path. If empty, the new block will be created in 'casp_user_data/blocks' folder.

overwrite_existing: True to overwrite existing block if path matches.

Return Value:

Returns True if successful or else False.

Definition at line 43 of file casp_be.py.

◆ AddPort()

bool casp_be.AddPort ( str port_name,
str visible_text,
bool output_port = False,
str data_type = defs.DATA_TYPE_INT32,
int data_size = 1 )

Adds new port to the block.

Arguments:

port_name: Block port name to be added. The port name should follow standard file naming conventions.

visible_text: Block port visible text.

output_port: True for output port or False for input port

data_type: Port data type. Set one of the data type constants from \ref casp_defs.py module.

data_size: Port data size. Value should be > 0.

Return Value:

Returns True if successful or else False.

Definition at line 66 of file casp_be.py.

◆ AddPara()

bool casp_be.AddPara ( str para_name,
str var_name,
str data_type = defs.DATA_TYPE_INT32,
list[str] para_values = ["None"] )

Adds new parameter to the block.

Arguments:

para_name: Block parameter name to be added. The parameter name should follow standard file naming conventions.

var_name: Internal variable name of the block parameter. It should be as per C/C++ variable naming conventions.

data_type: Parameter value data type. Set one of the data type constants from \ref casp_defs.py module.

para_values: Set Parameter values as a string list.

Return Value:

Returns True if successful or else False.

Definition at line 91 of file casp_be.py.

◆ SetOtherLangSupport()

bool casp_be.SetOtherLangSupport ( int lang_type = defs.LANG_PYTHON)

Set support for other languages such as Python, Fortran and Verilog.

Arguments:

lang_type: Set additional languages supported (if any). Set one of the constants from \ref casp_defs.py module.

Return Value:

Returns True if successful or else False.

Definition at line 115 of file casp_be.py.

◆ Save()

bool casp_be.Save ( )

Save block data to disk.

This function actually creates the block folder on disk. Should be called only once and at the end of your script.

Returns True if successful or else False

Definition at line 132 of file casp_be.py.

◆ Folder()

casp_be.Folder ( )

Show block folder.

Definition at line 143 of file casp_be.py.