![]() |
HAL
|
#include <grouping.h>
Public Member Functions | |
u32 | get_id () const |
void | set_name (std::string name) |
std::string | get_name () const |
void | set_color (utils::Color c) |
utils::Color | get_color () const |
utils::Color | next_color () |
Netlist * | get_netlist () const |
bool | assign_gate (Gate *gate, bool force=false) |
bool | assign_gate_by_id (const u32 gate_id, bool force=false) |
const std::vector< Gate * > & | get_gates () const |
std::vector< Gate * > | get_gates (const std::function< bool(Gate *)> &filter) const |
std::vector< u32 > | get_gate_ids (const std::function< bool(Gate *)> &filter=nullptr) const |
bool | remove_gate (Gate *gate) |
bool | remove_gate_by_id (const u32 gate_id) |
bool | contains_gate (Gate *gate) const |
bool | contains_gate_by_id (const u32 gate_id) const |
bool | assign_net (Net *net, bool force=false) |
bool | assign_net_by_id (const u32 net_id, bool force=false) |
const std::vector< Net * > & | get_nets () const |
std::vector< Net * > | get_nets (const std::function< bool(Net *)> &filter) const |
std::vector< u32 > | get_net_ids (const std::function< bool(Net *)> &filter=nullptr) const |
bool | remove_net (Net *net) |
bool | remove_net_by_id (const u32 net_id) |
bool | contains_net (Net *net) const |
bool | contains_net_by_id (const u32 net_id) const |
bool | assign_module (Module *module, bool force=false) |
bool | assign_module_by_id (const u32 module_id, bool force=false) |
const std::vector< Module * > & | get_modules () const |
std::vector< Module * > | get_modules (const std::function< bool(Module *)> &filter) const |
std::vector< u32 > | get_module_ids (const std::function< bool(Module *)> &filter=nullptr) const |
bool | remove_module (Module *module) |
bool | remove_module_by_id (const u32 module_id) |
bool | contains_module (Module *module) const |
bool | contains_module_by_id (const u32 module_id) const |
Friends | |
class | NetlistInternalManager |
A grouping is an unstructured collection of gates, nets, and modules that do not need to be connected in any way.
It is designed to act as a container to temporarily store related entities during netlist exploration.
In contrast to a module, it does not allow for hierarchization.
Each gate, net, or module within the netlist may only be assigned to a single grouping.
Definition at line 50 of file grouping.h.
bool hal::Grouping::assign_gate | ( | Gate * | gate, |
bool | force = false |
||
) |
Assign a gate to the grouping.
Fails if the gate is already contained within another grouping.
If force
is set and the gate is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
[in] | gate | - The gate to assign. |
[in] | force | - Overwrite previous assignment. |
Definition at line 69 of file grouping.cpp.
Referenced by assign_gate_by_id(), hal::GroupingSerializer::deserialize(), hal::grouping_init(), and hal::NetlistModificationDecorator::replace_gate().
bool hal::Grouping::assign_gate_by_id | ( | const u32 | gate_id, |
bool | force = false |
||
) |
Assign a gate to the grouping by ID.
Fails if the gate is already contained within another grouping.
If force
is set and the gate is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
[in] | gate_id | - The ID of the gate to assign. |
[in] | force | - Overwrite previous assignment. |
Definition at line 74 of file grouping.cpp.
References assign_gate(), and hal::Netlist::get_gate_by_id().
Referenced by hal::ActionAddItemsToObject::exec(), and hal::grouping_init().
bool hal::Grouping::assign_module | ( | Module * | module, |
bool | force = false |
||
) |
Assign a module to the grouping.
Fails if the module is already contained within another grouping.
If force
is set and the module is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
[in] | module | - The module to assign. |
[in] | force | - Overwrite previous assignment. |
Definition at line 243 of file grouping.cpp.
References hal::ShortestPath::module().
Referenced by assign_module_by_id(), hal::GroupingSerializer::deserialize(), and hal::grouping_init().
bool hal::Grouping::assign_module_by_id | ( | const u32 | module_id, |
bool | force = false |
||
) |
Assign a module to the grouping by ID.
Fails if the module is already contained within another grouping.
If force
is set and the module is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
[in] | module_id | - The ID of the module to assign. |
[in] | force | - Overwrite previous assignment. |
Definition at line 248 of file grouping.cpp.
References assign_module(), hal::Netlist::get_module_by_id(), and hal::ShortestPath::module().
Referenced by hal::ActionAddItemsToObject::exec(), and hal::grouping_init().
bool hal::Grouping::assign_net | ( | Net * | net, |
bool | force = false |
||
) |
Assign a net to the grouping.
Fails if the net is already contained within another grouping.
If force
is set and the net is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
[in] | net | - The net to assign. |
[in] | force | - Overwrite previous assignment. |
Definition at line 156 of file grouping.cpp.
References net.
Referenced by assign_net_by_id(), hal::GroupingSerializer::deserialize(), and hal::grouping_init().
bool hal::Grouping::assign_net_by_id | ( | const u32 | net_id, |
bool | force = false |
||
) |
Assign a net to the grouping by ID.
Fails if the net is already contained within another grouping.
If force
is set and the net is contained in another grouping, it is removed from the previous grouping to be assigned to this one.
[in] | net_id | - The ID of the net to assign. |
[in] | force | - Overwrite previous assignment. |
Definition at line 161 of file grouping.cpp.
References assign_net(), hal::Netlist::get_net_by_id(), and net.
Referenced by hal::ActionAddItemsToObject::exec(), and hal::grouping_init().
bool hal::Grouping::contains_gate | ( | Gate * | gate | ) | const |
Check whether a gate is in the grouping.
[in] | gate | - The gate to check for. |
Definition at line 141 of file grouping.cpp.
References contains_gate_by_id(), and hal::Gate::get_id().
Referenced by hal::grouping_init().
bool hal::Grouping::contains_gate_by_id | ( | const u32 | gate_id | ) | const |
Check whether a gate is in the grouping by ID.
[in] | gate_id | - The ID of the gate to check for. |
Definition at line 151 of file grouping.cpp.
Referenced by contains_gate(), and hal::grouping_init().
bool hal::Grouping::contains_module | ( | Module * | module | ) | const |
Check whether a module is in the grouping.
[in] | module | - The module to check for. |
Definition at line 315 of file grouping.cpp.
References contains_module_by_id(), hal::Module::get_id(), and hal::ShortestPath::module().
Referenced by hal::grouping_init().
bool hal::Grouping::contains_module_by_id | ( | const u32 | module_id | ) | const |
Check whether a module is in the grouping by ID.
[in] | module_id | - The ID of the module to check for. |
Definition at line 325 of file grouping.cpp.
Referenced by contains_module(), and hal::grouping_init().
bool hal::Grouping::contains_net | ( | Net * | net | ) | const |
Check whether a net is in the grouping.
[in] | net | - The net to check for. |
Definition at line 228 of file grouping.cpp.
References contains_net_by_id(), and net.
Referenced by hal::grouping_init().
bool hal::Grouping::contains_net_by_id | ( | const u32 | net_id | ) | const |
Check whether a net is in the grouping by ID.
[in] | net_id | - The ID of the net to check for. |
Definition at line 238 of file grouping.cpp.
Referenced by contains_net(), and hal::grouping_init().
utils::Color hal::Grouping::get_color | ( | ) | const |
Get the color of the grouping.
Definition at line 47 of file grouping.cpp.
Referenced by hal::GroupingTableEntry::color(), hal::GroupingTableModel::groupingColorChangedEvent(), and hal::event_log::handle_grouping_event().
std::vector< u32 > hal::Grouping::get_gate_ids | ( | const std::function< bool(Gate *)> & | filter = nullptr | ) | const |
Get the IDs of all gates contained within the grouping. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - Filter function to be evaluated on each gate. |
Definition at line 113 of file grouping.cpp.
References get_gates().
Referenced by hal::ActionDeleteObject::exec(), hal::grouping_init(), and hal::SelectionTreeView::populate().
const std::vector< Gate * > & hal::Grouping::get_gates | ( | ) | const |
Get all gates contained within the grouping.
Definition at line 85 of file grouping.cpp.
Referenced by get_gate_ids(), hal::grouping_init(), and hal::GroupingTableModel::removeRows().
Get all gates contained within the grouping. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - Filter function to be evaluated on each gate. |
Definition at line 90 of file grouping.cpp.
u32 hal::Grouping::get_id | ( | ) | const |
Get the unique ID of the grouping.
Definition at line 22 of file grouping.cpp.
Referenced by hal::ActionCreateObject::exec(), hal::grouping_init(), hal::SelectionDetailsWidget::groupingUnassignActionFactory(), hal::event_log::handle_grouping_event(), hal::GroupingTableEntry::id(), next_color(), and hal::SelectionDetailsWidget::selectionToGroupingAction().
std::vector< u32 > hal::Grouping::get_module_ids | ( | const std::function< bool(Module *)> & | filter = nullptr | ) | const |
Get the IDs of all modules contained within the grouping. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - Filter function to be evaluated on each module. |
Definition at line 287 of file grouping.cpp.
References hal::Module::get_id(), get_modules(), and hal::ShortestPath::module().
Referenced by hal::ActionDeleteObject::exec(), hal::grouping_init(), and hal::SelectionTreeView::populate().
const std::vector< Module * > & hal::Grouping::get_modules | ( | ) | const |
Get all modules contained within the grouping.
Definition at line 259 of file grouping.cpp.
Referenced by get_module_ids(), hal::grouping_init(), and hal::GroupingTableModel::removeRows().
std::vector< Module * > hal::Grouping::get_modules | ( | const std::function< bool(Module *)> & | filter | ) | const |
Get all modules contained within the grouping. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - Filter function to be evaluated on each module. |
Definition at line 264 of file grouping.cpp.
References hal::ShortestPath::module().
std::string hal::Grouping::get_name | ( | ) | const |
Get the name of the grouping.
Definition at line 42 of file grouping.cpp.
Referenced by hal::grouping_init(), hal::GroupingTableModel::groupingNameChangedEvent(), hal::event_log::handle_grouping_event(), and hal::GroupingTableEntry::name().
std::vector< u32 > hal::Grouping::get_net_ids | ( | const std::function< bool(Net *)> & | filter = nullptr | ) | const |
Get the IDs of all nets contained within the grouping. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - Filter function to be evaluated on each net. |
Definition at line 200 of file grouping.cpp.
References get_nets(), and net.
Referenced by hal::ActionDeleteObject::exec(), hal::grouping_init(), and hal::SelectionTreeView::populate().
Netlist * hal::Grouping::get_netlist | ( | ) | const |
Get the netlist this grouping is associated with.
Definition at line 64 of file grouping.cpp.
Referenced by hal::grouping_init(), and hal::event_log::handle_grouping_event().
const std::vector< Net * > & hal::Grouping::get_nets | ( | ) | const |
Get all nets contained within the grouping.
Definition at line 172 of file grouping.cpp.
Referenced by get_net_ids(), hal::grouping_init(), and hal::GroupingTableModel::removeRows().
Get all nets contained within the grouping. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - Filter function to be evaluated on each net. |
Definition at line 177 of file grouping.cpp.
References net.
utils::Color hal::Grouping::next_color | ( | ) |
Generates a new color distinct from previous colors. Called for each new grouping.
Definition at line 58 of file grouping.cpp.
References get_id().
bool hal::Grouping::remove_gate | ( | Gate * | gate | ) |
Remove a gate from the grouping.
Fails if the gate is not contained within the grouping.
[in] | gate | - The gate to remove. |
Definition at line 125 of file grouping.cpp.
Referenced by hal::grouping_init(), remove_gate_by_id(), and hal::GroupingTableModel::removeRows().
bool hal::Grouping::remove_gate_by_id | ( | const u32 | gate_id | ) |
Remove a gate from the grouping by ID.
Fails if the gate is not contained within the grouping.
[in] | gate_id | - The ID of the gate to remove. |
Definition at line 130 of file grouping.cpp.
References hal::Netlist::get_gate_by_id(), and remove_gate().
Referenced by hal::ActionRemoveItemsFromObject::exec(), and hal::grouping_init().
bool hal::Grouping::remove_module | ( | Module * | module | ) |
Remove a module from the grouping.
Fails if the module is not contained within the grouping.
[in] | module | - The module to remove. |
Definition at line 299 of file grouping.cpp.
References hal::ShortestPath::module().
Referenced by hal::grouping_init(), remove_module_by_id(), and hal::GroupingTableModel::removeRows().
bool hal::Grouping::remove_module_by_id | ( | const u32 | module_id | ) |
Remove a module from the grouping by ID.
Fails if the module is not contained within the grouping.
[in] | module_id | - The ID of the module to remove. |
Definition at line 304 of file grouping.cpp.
References hal::Netlist::get_module_by_id(), hal::ShortestPath::module(), and remove_module().
Referenced by hal::ActionRemoveItemsFromObject::exec().
bool hal::Grouping::remove_net | ( | Net * | net | ) |
Remove a net from the grouping.
Fails if the net is not contained within the grouping.
[in] | net | - The net to remove. |
Definition at line 212 of file grouping.cpp.
References net.
Referenced by hal::grouping_init(), remove_net_by_id(), and hal::GroupingTableModel::removeRows().
bool hal::Grouping::remove_net_by_id | ( | const u32 | net_id | ) |
Remove a net from the grouping by ID.
Fails if the net is not contained within the grouping.
[in] | net_id | - The ID of the net to remove. |
Definition at line 217 of file grouping.cpp.
References hal::Netlist::get_net_by_id(), net, and remove_net().
Referenced by hal::ActionRemoveItemsFromObject::exec(), and hal::grouping_init().
void hal::Grouping::set_color | ( | utils::Color | c | ) |
Set the color of the grouping.
[in] | c | - The new color. |
Definition at line 52 of file grouping.cpp.
References hal::GroupingEvent::color_changed, and hal::EventHandler::notify().
Referenced by hal::GroupingTableEntry::setColor().
void hal::Grouping::set_name | ( | std::string | name | ) |
Set the name of the grouping.
[in] | name | - The new name. |
Definition at line 27 of file grouping.cpp.
References log_error, name, hal::GroupingEvent::name_changed, hal::EventHandler::notify(), and hal::utils::trim().
Referenced by hal::grouping_init(), and hal::GroupingTableEntry::setName().
|
friend |
Definition at line 364 of file grouping.h.