Link Group¶
A link group object holds a set of link objects. This container makes it easy to group and interact with multiple links at the same time.
Create link group¶
To create a link group, use the factory function create_link_groups()
.
Here’s an example of creating a link group
"""
Other imports
"""
from chipscopy.api.ibert import create_links, create_link_groups
"""
Boilerplate stuff - Create a session, get the IBERT core etc etc
"""
# Create a single link group
link_group_0 = create_link_groups(descriptions="This is a test link group")
# Create multiple link groups in one shot
three_link_groups create_link_group(descriptions=["Group 1", "Group 3", "Group 3"])
Attributes of LinkGroup object¶
The attributes of the LinkGroup
class instance are listed here and are accessible
via the python .
operator i.e. <link_group_obj>.<attribute>
.
Attribute |
Description |
---|---|
Name of the link group |
|
Description of the link group |
|
All |
Add link¶
To add link(s) to the link group use the add()
method.
"""
Other imports
"""
from chipscopy.api.ibert import create_links, create_link_groups
"""
Boilerplate stuff - Create a session, get the IBERT core etc etc
"""
# Create single link
link_0 = one(create_links(rxs=ch_0.rx, txs=ch_0.tx))
# Create multiple links in one shot
remaining_3_links = create_links(rxs=[ch_1.rx, ch_2.rx, ch_3.rx], txs=[ch_1.tx, ch_2.tx, ch_3.tx])
# Assume we created 'link_group_0'
.
.
.
# Add single link
link_group_0.add(link_0)
# Add multiple links
link_group_0.add(remaining_3_links)
len(link_group_0.links)
>>> 4
Remove link¶
To remove link(s) from the link group use the remove()
method.
# Assume we created 'link_group_0', added 'link_0' and 'remaining_3_links' to it
.
.
.
len(link_group_0.links)
>>> 4
# Remove single link
link_group_0.remove(link_0)
# Remove multiple links
link_group_0.remove(remaining_3_links)
len(link_group_0.links)
>>> 0
Get all link groups¶
To get all the link groups, use the function get_all_link_groups()
.
Delete link group¶
To delete a link, use the factory function delete_link_groups()
.
"""
Other imports
"""
from chipscopy.api.ibert import delete_link_groups, get_all_links, get_all_link_groups
"""
Boilerplate stuff - Create a session, get the IBERT core etc etc
"""
# Assume we created 'link_group_0' and added 'link_0'
# Also assume that we created 'link_group_1' and added 'remaining_3_links' to it
# This will delete only the link group and not the links
delete_link_groups(link_group_0)
len(get_all_links())
>>> 4
len(get_all_link_groups())
>>> 1
# This will delete the link group + the links in it
delete_link_groups(link_group_1, delete_links_in_group=True)
len(get_all_links())
>>> 1
len(get_all_link_groups())
>>> 0
Warning
Once the link group is deleted, any references to the deleted link group instance will be stale and unsafe to use.