![]() |
HAL
|
#include <module.h>
Public Member Functions | |
bool | operator== (const Module &other) const |
bool | operator!= (const Module &other) const |
ssize_t | get_hash () const |
u32 | get_id () const |
std::string | get_name () const |
void | set_name (const std::string &name) |
std::string | get_type () const |
void | set_type (const std::string &type) |
Grouping * | get_grouping () const |
int | get_submodule_depth () const |
Module * | get_parent_module () const |
std::vector< Module * > | get_parent_modules (const std::function< bool(Module *)> &filter=nullptr, bool recursive=true) const |
bool | set_parent_module (Module *new_parent) |
bool | is_parent_module_of (const Module *module, bool recursive=false) const |
std::vector< Module * > | get_submodules (const std::function< bool(Module *)> &filter=nullptr, bool recursive=false) const |
bool | is_submodule_of (const Module *module, bool recursive=false) const |
bool | contains_module (const Module *other, bool recursive=false) const |
bool | is_top_module () const |
Netlist * | get_netlist () const |
void | update_nets () |
bool | contains_net (Net *net, bool recursive=false) const |
const std::unordered_set< Net * > & | get_nets () const |
std::unordered_set< Net * > | get_nets (const std::function< bool(Net *)> &filter, bool recursive=false) const |
const std::unordered_set< Net * > & | get_input_nets () const |
const std::unordered_set< Net * > & | get_output_nets () const |
const std::unordered_set< Net * > & | get_internal_nets () const |
bool | is_input_net (Net *net) const |
bool | is_output_net (Net *net) const |
bool | is_internal_net (Net *net) const |
u32 | get_unique_pin_id () |
u32 | get_unique_pin_group_id () |
Result< ModulePin * > | create_pin (const u32 id, const std::string &name, Net *net, PinType type=PinType::none, bool create_group=true, bool force_name=false) |
Result< ModulePin * > | create_pin (const std::string &name, Net *net, PinType type=PinType::none, bool create_group=true, bool force_name=false) |
std::vector< ModulePin * > | get_pins (const std::function< bool(ModulePin *)> &filter=nullptr) const |
std::vector< std::string > | get_pin_names (const std::function< bool(ModulePin *)> &filter=nullptr) const |
std::vector< ModulePin * > | get_input_pins () const |
std::vector< std::string > | get_input_pin_names () const |
std::vector< ModulePin * > | get_output_pins () const |
std::vector< std::string > | get_output_pin_names () const |
std::vector< PinGroup< ModulePin > * > | get_pin_groups (const std::function< bool(PinGroup< ModulePin > *)> &filter=nullptr) const |
ModulePin * | get_pin_by_id (const u32 id) const |
ModulePin * | get_pin_by_name (const std::string &name) const |
ModulePin * | get_pin_by_net (Net *net) const |
PinGroup< ModulePin > * | get_pin_group_by_id (const u32 id) const |
PinGroup< ModulePin > * | get_pin_group_by_name (const std::string &name) const |
bool | set_pin_name (ModulePin *pin, const std::string &new_name, bool force_name=false) |
bool | set_pin_type (ModulePin *pin, PinType new_type) |
Result< PinGroup< ModulePin > * > | create_pin_group (const u32 id, const std::string &name, const std::vector< ModulePin * > pins={}, PinDirection direction=PinDirection::none, PinType type=PinType::none, bool ascending=true, u32 start_index=0, bool delete_empty_groups=true, bool force_name=false) |
Result< PinGroup< ModulePin > * > | create_pin_group (const std::string &name, const std::vector< ModulePin * > pins={}, PinDirection direction=PinDirection::none, PinType type=PinType::none, bool ascending=true, u32 start_index=0, bool delete_empty_groups=true, bool force_name=false) |
bool | delete_pin_group (PinGroup< ModulePin > *pin_group) |
bool | move_pin_group (PinGroup< ModulePin > *pin_group, u32 new_index) |
bool | set_pin_group_name (PinGroup< ModulePin > *pin_group, const std::string &new_name, bool force_name=false) |
bool | set_pin_group_type (PinGroup< ModulePin > *pin_group, PinType new_type) |
bool | set_pin_group_direction (PinGroup< ModulePin > *pin_group, PinDirection new_direction) |
bool | assign_pin_to_group (PinGroup< ModulePin > *pin_group, ModulePin *pin, bool delete_empty_groups=true) |
bool | move_pin_within_group (PinGroup< ModulePin > *pin_group, ModulePin *pin, u32 new_index) |
bool | remove_pin_from_group (PinGroup< ModulePin > *pin_group, ModulePin *pin, bool delete_empty_groups=true) |
bool | assign_gate (Gate *gate) |
bool | assign_gates (const std::vector< Gate * > &gates) |
bool | remove_gate (Gate *gate) |
bool | remove_gates (const std::vector< Gate * > &gates) |
bool | contains_gate (Gate *gate, bool recursive=false) const |
Gate * | get_gate_by_id (const u32 id, bool recursive=false) const |
const std::vector< Gate * > & | get_gates () const |
std::vector< Gate * > | get_gates (const std::function< bool(Gate *)> &filter, bool recursive=false) const |
EventHandler * | get_event_handler () const |
![]() | |
DataContainer ()=default | |
virtual | ~DataContainer ()=default |
bool | operator== (const DataContainer &other) const |
bool | operator!= (const DataContainer &other) const |
bool | set_data (const std::string &category, const std::string &key, const std::string &data_type, const std::string &value, const bool log_with_info_level=false) |
bool | has_data (const std::string &category, const std::string &key) const |
std::tuple< std::string, std::string > | get_data (const std::string &category, const std::string &key) const |
bool | delete_data (const std::string &category, const std::string &key, const bool log_with_info_level=false) |
const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > & | get_data_map () const |
void | set_data_map (const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string >> &map) |
Friends | |
class | NetlistInternalManager |
Additional Inherited Members | |
![]() | |
std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > | m_data |
A module is a container for gates and their associated nets that enables hierarchization within the netlist.
Each gate can only be in one module at a time. Nets are only loosely associated with modules.
bool hal::Module::assign_gate | ( | Gate * | gate | ) |
Assign a gate to the module.
The gate is removed from its previous module in the process.
[in] | gate | - The gate to assign. |
true
on success, false
otherwise. Definition at line 322 of file module.cpp.
Referenced by hal::module_init(), and hal::NetlistModificationDecorator::replace_gate().
bool hal::Module::assign_gates | ( | const std::vector< Gate * > & | gates | ) |
Assign a vector of gates to the module.
The gates are removed from their previous module in the process.
[in] | gates | - The gates to assign. |
true
on success, false
otherwise. Definition at line 327 of file module.cpp.
Referenced by hal::Netlist::create_module(), hal::ActionAddItemsToObject::exec(), and hal::module_init().
bool hal::Module::assign_pin_to_group | ( | PinGroup< ModulePin > * | pin_group, |
ModulePin * | pin, | ||
bool | delete_empty_groups = true |
||
) |
Assign a pin to a pin group.
[in] | pin_group | - The new pin group. |
[in] | pin | - The pin to be added. |
[in] | delete_empty_groups | - Set true to delete groups that are empty after the pin has been assigned to the new group, false to keep empty groups. Defaults to true . |
true
on success, false
otherwise. Definition at line 1402 of file module.cpp.
References hal::PinGroup< T >::assign_pin(), hal::PinGroup< T >::contains_pin(), hal::BasePin< T >::get_group(), hal::BasePin< T >::get_id(), hal::PinGroup< T >::get_id(), hal::BasePin< T >::get_name(), hal::PinGroup< T >::get_name(), hal::GroupDelete, log_warning, hal::PinAssignToGroup, hal::PinChangedEvent::send(), and hal::PinChangedEventScope::send_events().
Referenced by create_pin_group(), and hal::ActionPingroup::exec().
bool hal::Module::contains_gate | ( | Gate * | gate, |
bool | recursive = false |
||
) | const |
Check whether a gate is contained in the module.
If recursive
is true
, gates in submodules are considered as well.
[in] | gate | - The gate to check for. |
[in] | recursive | - Set to true to also consider gates in submodules, false otherwise. |
true
if the gate is contained in the module, false
otherwise. Definition at line 350 of file module.cpp.
Referenced by hal::module_init(), and remove_gates().
bool hal::Module::contains_module | ( | const Module * | other, |
bool | recursive = false |
||
) | const |
Checks whether another module is a submodule of this module.
If recursive
is set to true, all indirect submodules are also included.
[in] | other | - Other module to check for. |
[in] | recursive | - Set true to include indirect submodules as well, false otherwise. |
true
if the other module is a submodule, false
otherwise. Definition at line 307 of file module.cpp.
References is_parent_module_of().
Referenced by hal::module_init().
bool hal::Module::contains_net | ( | Net * | net, |
bool | recursive = false |
||
) | const |
Check whether a net is contained in the module.
If recursive
is set to true
, nets in submodules are considered as well.
[in] | net | - The net to check for. |
[in] | recursive | - True to also consider nets in submodules, false otherwise. |
true
if the net is contained in the module, false
otherwise. Definition at line 483 of file module.cpp.
References net.
Referenced by hal::module_init().
Result< ModulePin * > hal::Module::create_pin | ( | const std::string & | name, |
Net * | net, | ||
PinType | type = PinType::none , |
||
bool | create_group = true , |
||
bool | force_name = false |
||
) |
Manually create a module pin and assign it to a net. The ID of the pin is set automatically. Checks whether the given direction matches the actual properties of the net, i.e., checks whether the net actually is an input and/or output to the module. Hence, make sure to update the module nets beforehand using Module::update_nets
. If create_group
is set to false
, the pin will not be added to a pin group.
Netlist::enable_automatic_net_checks
.}[in] | name | - The name of the pin. |
[in] | net | - The net that the pin is being assigned to. |
[in] | type | - The type of the pin. Defaults to PinType::none . |
[in] | create_group | - Set true to automatically create a pin group and assign the pin, false otherwise. Defaults to true . |
[in] | force_name | - Set true to enforce the name, false otherwise. If a pin with the same name already exists, the existing pin will be renamed. Defaults to false . |
Definition at line 866 of file module.cpp.
References create_pin(), get_unique_pin_id(), name, net, and type.
Result< ModulePin * > hal::Module::create_pin | ( | const u32 | id, |
const std::string & | name, | ||
Net * | net, | ||
PinType | type = PinType::none , |
||
bool | create_group = true , |
||
bool | force_name = false |
||
) |
Manually create a module pin and assign it to a net. Checks whether the given direction matches the actual properties of the net, i.e., checks whether the net actually is an input and/or output to the module. Hence, make sure to update the module nets beforehand using Module::update_nets
. If create_group
is set to false
, the pin will not be added to a pin group.
Netlist::enable_automatic_net_checks
.}[in] | id | - The ID of the pin. |
[in] | name | - The name of the pin. |
[in] | net | - The net that the pin is being assigned to. |
[in] | type | - The type of the pin. Defaults to PinType::none . |
[in] | create_group | - Set true to automatically create a pin group and assign the pin, false otherwise. Defaults to true . |
[in] | force_name | - Set true to enforce the name, false otherwise. If a pin with the same name already exists, the existing pin will be renamed. Defaults to false . |
Definition at line 787 of file module.cpp.
References direction, ERR, ERR_APPEND, get_unique_pin_group_id(), hal::GroupCreate, hal::inout, hal::input, is_input_net(), is_output_net(), name, net, hal::output, hal::PinCreate, hal::PinChangedEvent::send(), and type.
Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and create_pin().
Result< PinGroup< ModulePin > * > hal::Module::create_pin_group | ( | const std::string & | name, |
const std::vector< ModulePin * > | pins = {} , |
||
PinDirection | direction = PinDirection::none , |
||
PinType | type = PinType::none , |
||
bool | ascending = true , |
||
u32 | start_index = 0 , |
||
bool | delete_empty_groups = true , |
||
bool | force_name = false |
||
) |
Create a new pin group with the given name. The ID of the pin group is set automatically.
[in] | name | - The name of the pin group. |
[in] | pins | - The pins to be assigned to the pin group. Defaults to an empty vector. |
[in] | direction | - The direction of the pin group, if any. Defaults to PinDirection::none . |
[in] | type | - The type of the pin group, if any. Defaults to PinType::none . |
[in] | ascending | - Set true for ascending pin order (from 0 to n-1), false otherwise (from n-1 to 0). Defaults to true . |
[in] | start_index | - The start index of the pin group. Defaults to 0 . |
[in] | delete_empty_groups | - Set true to delete groups that are empty after the pins have been assigned to the new group, false to keep empty groups. Defaults to true . |
[in] | force_name | - Set true to enforce the name, false otherwise. If a pin group with the same name already exists, the existing pin group will be renamed. Defaults to false . |
Definition at line 1308 of file module.cpp.
References ascending, create_pin_group(), direction, get_unique_pin_group_id(), name, pins, start_index, and type.
Result< PinGroup< ModulePin > * > hal::Module::create_pin_group | ( | const u32 | id, |
const std::string & | name, | ||
const std::vector< ModulePin * > | pins = {} , |
||
PinDirection | direction = PinDirection::none , |
||
PinType | type = PinType::none , |
||
bool | ascending = true , |
||
u32 | start_index = 0 , |
||
bool | delete_empty_groups = true , |
||
bool | force_name = false |
||
) |
Create a new pin group with the given name.
[in] | id | - The ID of the pin group. |
[in] | name | - The name of the pin group. |
[in] | pins | - The pins to be assigned to the pin group. Defaults to an empty vector. |
[in] | direction | - The direction of the pin group, if any. Defaults to PinDirection::none . |
[in] | type | - The type of the pin group, if any. Defaults to PinType::none . |
[in] | ascending | - Set true for ascending pin order (from 0 to n-1), false otherwise (from n-1 to 0). Defaults to true . |
[in] | start_index | - The start index of the pin group. Defaults to 0 . |
[in] | delete_empty_groups | - Set true to delete groups that are empty after the pins have been assigned to the new group, false to keep empty groups. Defaults to true . |
[in] | force_name | - Set true to enforce the name, false otherwise. If a pin group with the same name already exists, the existing pin group will be renamed. Defaults to false . |
Definition at line 1251 of file module.cpp.
References ascending, assign_pin_to_group(), delete_pin_group(), direction, ERR, ERR_APPEND, hal::PinGroup< T >::get_id(), hal::GroupCreate, name, OK, pins, hal::PinChangedEvent::send(), hal::PinChangedEventScope::send_events(), start_index, and type.
Referenced by create_pin_group(), delete_pin_group(), hal::ActionPingroup::exec(), and remove_pin_from_group().
Delete the given pin group.
[in] | pin_group | - The pin group to be deleted. |
Definition at line 1320 of file module.cpp.
References create_pin_group(), hal::PinGroup< T >::get_id(), hal::PinGroup< T >::get_name(), hal::PinGroup< T >::get_pins(), hal::GroupCreate, hal::GroupDelete, log_warning, hal::PinAssignToGroup, hal::PinChangedEvent::send(), and hal::PinChangedEventScope::send_events().
Referenced by create_pin_group(), and hal::ActionPingroup::exec().
EventHandler * hal::Module::get_event_handler | ( | ) | const |
Get the event handler connected to module
Definition at line 1899 of file module.cpp.
Referenced by hal::PinChangedEvent::send().
Get a gate specified by the given ID.
If recursive
is true
, gates in submodules are considered as well.
[in] | id | - The unique ID of the gate. |
[in] | recursive | - Set to true to also consider gates in submodules, false otherwise. |
Definition at line 370 of file module.cpp.
Referenced by hal::module_init().
const std::vector< Gate * > & hal::Module::get_gates | ( | ) | const |
Get all gates contained within the module.
Definition at line 391 of file module.cpp.
Referenced by hal::WaitToBeSeatedList::add(), hal::NodeBoxes::addBox(), hal::ModuleModel::addRecursively(), hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::ActionDeleteObject::exec(), hal::ActionFoldModule::exec(), hal::ActionUnfoldModule::exec(), hal::GuiApiClasses::View::foldModule(), hal::SubgraphNetlistDecorator::get_subgraph_function(), hal::SubgraphNetlistDecorator::get_subgraph_function_inputs(), hal::GraphContext::getModuleChildrenRecursively(), hal::GraphContextManager::handleModuleColorChanged(), hal::GraphContextManager::handleModuleGateRemoved(), hal::module_init(), operator==(), hal::TEST_F(), and update_nets().
std::vector< Gate * > hal::Module::get_gates | ( | const std::function< bool(Gate *)> & | filter, |
bool | recursive = false |
||
) | const |
Get all gates contained within the module. The filter is evaluated on every candidate such that the result only contains those matching the specified condition. If recursive
is true
, gates in submodules are considered as well.
[in] | filter | - Filter function to be evaluated on each gate. |
[in] | recursive | - Set to true to also consider gates in submodules, false otherwise. Defaults to false . |
Definition at line 396 of file module.cpp.
References test_plugin::g.
Grouping * hal::Module::get_grouping | ( | ) | const |
Get the grouping in which this module is contained.
Definition at line 120 of file module.cpp.
Referenced by hal::ModuleContextMenu::addModuleSubmenu(), hal::GroupingTableModel::colorForItem(), hal::SelectionDetailsWidget::groupingUnassignActionFactory(), hal::module_init(), hal::GroupingManagerWidget::removeElementsFromGrouping(), and hal::GroupingsOfItemModel::setModule().
ssize_t hal::Module::get_hash | ( | ) | const |
Hash function for python binding
Definition at line 77 of file module.cpp.
Referenced by hal::module_init().
u32 hal::Module::get_id | ( | ) | const |
Get the unique ID of the module.
Definition at line 82 of file module.cpp.
Referenced by hal::ActionPingroup::addPinsToExistingGroup(), hal::ActionPingroup::addPinsToNewGroup(), hal::ModuleModel::addRecursively(), hal::GuiApiClasses::View::addTo(), hal::NetlistRelay::addToModuleDialog(), hal::ModuleSelectModel::appendEntries(), hal::Grouping::contains_module(), hal::NetlistRelay::debugHandleFileOpened(), hal::NetlistModificationDecorator::delete_modules(), hal::ActionPingroup::deletePinGroup(), hal::GuiApi::deselectModule(), hal::dumpPingroups(), hal::ActionAddItemsToObject::exec(), hal::ActionCreateObject::exec(), hal::ActionDeleteObject::exec(), hal::gui_utility::firstCommonAncestor(), hal::GuiApiClasses::View::foldModule(), hal::Grouping::get_module_ids(), hal::GuiApiClasses::View::getIds(), hal::ModulePinsTreeModel::getNetFromItem(), hal::ModulePinsTreeModel::getRepresentedModuleId(), hal::GuiApiClasses::View::getValidObjects(), hal::SelectionDetailsWidget::groupingUnassignActionFactory(), hal::event_log::handle_grouping_event(), hal::event_log::handle_module_event(), hal::GraphContextManager::handleModuleColorChanged(), hal::GraphContextManager::handleModuleCreated(), hal::GraphContextManager::handleModuleGateAssigned(), hal::GraphContextManager::handleModuleGateRemoved(), hal::GraphContextManager::handleModuleNameChanged(), hal::GraphContextManager::handleModulePortsChanged(), hal::ModuleTableModel::handleModulePortsChanged(), hal::GraphContextManager::handleModuleRemoved(), hal::ModuleTableModel::handleModuleRemoved(), hal::GraphContextManager::handleModuleSubmoduleAdded(), hal::GraphContextManager::handleModuleSubmoduleRemoved(), hal::GraphContextManager::handleModuleTypeChanged(), hal::ModuleSelectPicker::handleSelectionChanged(), hal::GraphGraphicsView::handleShortestPath(), hal::ModulePinsTreeModel::mimeData(), hal::ShortestPath::module(), hal::module_init(), hal::ModuleSelectEntry::ModuleSelectEntry(), hal::GraphContext::nodeForGate(), hal::GraphContextManager::openModuleInView(), operator==(), hal::gui_utility::parentModules(), hal::ModuleModel::populateFromGatelist(), hal::GuiApiClasses::View::removeFrom(), hal::ActionPingroup::removePinsFromGroup(), hal::ModuleSelectExclude::selectionToString(), hal::GuiApi::selectModule(), set_parent_module(), hal::ModuleElementsTree::setModule(), hal::ModulePinsTree::setModule(), hal::DataTableWidget::setModule(), hal::GroupingsOfItemModel::setModule(), hal::GroupingsOfItemWidget::setModule(), hal::ModuleDetailsTabWidget::setModule(), hal::GraphNavigationWidget::setup(), hal::GuiApiClasses::View::unfoldModule(), hal::ModuleShader::update(), hal::ModuleModel::updateModuleParent(), and hal::ModuleModel::updateNetParent().
const std::unordered_set< Net * > & hal::Module::get_input_nets | ( | ) | const |
Get all nets that are either a global input to the netlist or have at least one source outside of the module.
Definition at line 540 of file module.cpp.
Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::ModuleTableModel::handleModulePortsChanged(), hal::module_init(), hal::SelectionRelay::navigateDown(), hal::SelectionRelay::navigateUp(), and hal::GraphContext::updateNets().
std::vector< std::string > hal::Module::get_input_pin_names | ( | ) | const |
Get an ordered vector of the names of all input pins of the module (including inout pins).
Definition at line 938 of file module.cpp.
References direction, hal::BasePin< T >::get_direction(), get_pin_names(), hal::inout, and hal::input.
Referenced by hal::module_init().
std::vector< ModulePin * > hal::Module::get_input_pins | ( | ) | const |
Get an ordered vector of all input pins of the module (including inout pins).
Definition at line 930 of file module.cpp.
References direction, hal::BasePin< T >::get_direction(), get_pins(), hal::inout, and hal::input.
Referenced by hal::module_init().
const std::unordered_set< Net * > & hal::Module::get_internal_nets | ( | ) | const |
Get all nets that have at least one source and one destination within the module, including its submodules. The result may contain nets that are also regarded as input or output nets.
Definition at line 550 of file module.cpp.
Referenced by hal::module_init().
std::string hal::Module::get_name | ( | ) | const |
Get the name of the module.
Definition at line 87 of file module.cpp.
Referenced by hal::ModuleContextMenu::addModuleSubmenu(), hal::NetlistRelay::addToModuleDialog(), hal::NetlistRelay::changeElementNameDialog(), hal::NetlistModificationDecorator::delete_modules(), hal::dumpPingroups(), hal::ActionDeleteObject::exec(), hal::ActionRenameObject::exec(), hal::event_log::handle_grouping_event(), hal::event_log::handle_module_event(), hal::AddToModuleReceiver::handleModulesPicked(), hal::ModuleSelectPicker::handleSelectionChanged(), hal::module_init(), hal::ModuleItem::ModuleItem(), hal::ModuleSelectEntry::ModuleSelectEntry(), hal::GraphContextManager::openModuleInView(), operator==(), hal::ModuleSelectExclude::selectionToString(), set_parent_module(), hal::TEST_F(), and hal::ModuleModel::updateModuleName().
Netlist * hal::Module::get_netlist | ( | ) | const |
Get the netlist this module is associated with.
Definition at line 317 of file module.cpp.
Referenced by hal::event_log::handle_module_event(), hal::module_init(), and set_parent_module().
const std::unordered_set< Net * > & hal::Module::get_nets | ( | ) | const |
Get all nets that have at least one source or one destination within the module.
Definition at line 503 of file module.cpp.
Referenced by hal::module_init(), and set_parent_module().
std::unordered_set< Net * > hal::Module::get_nets | ( | const std::function< bool(Net *)> & | filter, |
bool | recursive = false |
||
) | const |
Get all nets that have at least one source or one destination within the module. The filter is evaluated on every candidate such that the result only contains those matching the specified condition. If recursive
is true
, nets in submodules are considered as well.
[in] | filter | - Filter function to be evaluated on each net. |
[in] | recursive | - true to also consider nets in submodules, false otherwise. |
Definition at line 508 of file module.cpp.
References test::n.
const std::unordered_set< Net * > & hal::Module::get_output_nets | ( | ) | const |
Get all nets that are either a global output to the netlist or have at least one destination outside of the module.
Definition at line 545 of file module.cpp.
Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::ModuleTableModel::handleModulePortsChanged(), hal::module_init(), hal::SelectionRelay::navigateDown(), hal::SelectionRelay::navigateUp(), hal::TEST_F(), and hal::GraphContext::updateNets().
std::vector< std::string > hal::Module::get_output_pin_names | ( | ) | const |
Get an ordered vector of the names of all output pins of the module (including inout pins).
Definition at line 954 of file module.cpp.
References direction, hal::BasePin< T >::get_direction(), get_pin_names(), hal::inout, and hal::output.
Referenced by hal::module_init().
std::vector< ModulePin * > hal::Module::get_output_pins | ( | ) | const |
Get an ordered vector of all output pins of the module (including inout pins).
Definition at line 946 of file module.cpp.
References direction, hal::BasePin< T >::get_direction(), get_pins(), hal::inout, and hal::output.
Referenced by hal::module_init().
Module * hal::Module::get_parent_module | ( | ) | const |
Get the parent module of this module.
For the top module, a nullptr
is returned.
Definition at line 125 of file module.cpp.
Referenced by hal::ActionAddItemsToObject::exec(), hal::ActionDeleteObject::exec(), hal::gui_utility::firstCommonAncestor(), get_submodule_depth(), hal::GuiApiClasses::View::getValidObjects(), hal::event_log::handle_module_event(), hal::GraphContextManager::handleModuleGateAssigned(), hal::GraphContextManager::handleModuleSubmoduleAdded(), hal::ShortestPath::module(), hal::module_init(), hal::GraphContext::nodeForGate(), hal::gui_utility::parentModules(), hal::ModuleModel::populateFromGatelist(), and hal::ModuleModel::updateModuleParent().
std::vector< Module * > hal::Module::get_parent_modules | ( | const std::function< bool(Module *)> & | filter = nullptr , |
bool | recursive = true |
||
) | const |
Get all parents of this module.
If recursive
is set to true, all indirect parents are also included.
The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - An optional filter. |
[in] | recursive | - Set true to include indirect parents as well, false otherwise. |
Definition at line 130 of file module.cpp.
References get_parent_modules().
Referenced by hal::Gate::get_modules(), get_parent_modules(), and hal::module_init().
Get the pin corresponding to the given ID.
[in] | id | - The ID of the pin. |
nullptr
otherwise. Definition at line 983 of file module.cpp.
References log_warning.
Referenced by hal::ActionPingroup::addPinsToNewGroup(), hal::ActionPingroup::exec(), hal::ModulePinsTreeModel::getNetFromItem(), hal::ModulePinsTreeModel::handleModulePortsChanged(), hal::module_init(), and hal::ActionPingroup::removePinsFromGroup().
ModulePin * hal::Module::get_pin_by_name | ( | const std::string & | name | ) | const |
Get the pin corresponding to the given name.
[in] | name | - The name of the pin. |
nullptr
otherwise. Definition at line 1000 of file module.cpp.
References log_warning, and name.
Referenced by hal::module_init().
Get the pin that passes through the specified net.
[in] | net | - The net. |
nullptr
otherwise. Definition at line 1017 of file module.cpp.
References log_debug, log_warning, and net.
Referenced by hal::module_init(), and hal::TEST_F().
Get the pin group corresponding to the given ID.
[in] | id | - The ID of the pin group. |
nullptr
otherwise. Definition at line 1034 of file module.cpp.
References log_warning.
Referenced by hal::ActionPingroup::deletePinGroup(), hal::ActionPingroup::exec(), hal::ModulePinsTree::handleContextMenuRequested(), hal::ModulePinsTreeModel::handleModulePortsChanged(), hal::module_init(), and operator==().
Get the pin group corresponding to the given name.
[in] | name | - The name of the pin group. |
nullptr
otherwise. Definition at line 1051 of file module.cpp.
References log_warning, and name.
Referenced by hal::module_init().
std::vector< PinGroup< ModulePin > * > hal::Module::get_pin_groups | ( | const std::function< bool(PinGroup< ModulePin > *)> & | filter = nullptr | ) | const |
Get all pin groups of the module. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - An optional filter. |
Definition at line 962 of file module.cpp.
Referenced by hal::ActionPingroup::deletePinGroup(), hal::dumpPingroups(), hal::generateGroupName(), hal::module_init(), operator==(), hal::pinGroupIndex(), hal::PingroupSelectorDialog::PingroupSelectorDialog(), hal::ActionPingroup::removePinsFromGroup(), and hal::ModulePinsTreeModel::setModule().
std::vector< std::string > hal::Module::get_pin_names | ( | const std::function< bool(ModulePin *)> & | filter = nullptr | ) | const |
Get an ordered vector of the names of all pins of the module. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - An optional filter. |
Definition at line 899 of file module.cpp.
References pins.
Referenced by get_input_pin_names(), get_output_pin_names(), and hal::module_init().
std::vector< ModulePin * > hal::Module::get_pins | ( | const std::function< bool(ModulePin *)> & | filter = nullptr | ) | const |
Get an ordered vector of all pins of the module. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - An optional filter. |
Definition at line 871 of file module.cpp.
References pins.
Referenced by get_input_pins(), get_output_pins(), hal::GraphicsModule::GraphicsModule(), hal::module_init(), hal::ModulePinsTreeModel::setModule(), and hal::TEST_F().
int hal::Module::get_submodule_depth | ( | ) | const |
Get the depth of the module within the module hierarchie (0 = top module, 1 = direct child of top module, ...).
Definition at line 159 of file module.cpp.
References get_parent_module().
Referenced by hal::module_init().
std::vector< Module * > hal::Module::get_submodules | ( | const std::function< bool(Module *)> & | filter = nullptr , |
bool | recursive = false |
||
) | const |
Get all direct submodules of this module.
If recursive
is set to true, all indirect submodules are also included.
The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
[in] | filter | - An optional filter. |
[in] | recursive | - Set true to include indirect submodules as well, false otherwise. |
Definition at line 259 of file module.cpp.
Referenced by hal::ModuleModel::addRecursively(), hal::ModuleItem::appendExistingChildIfAny(), hal::dumpPingroups(), hal::ActionDeleteObject::exec(), hal::ActionFoldModule::exec(), hal::ActionUnfoldModule::exec(), hal::GuiApiClasses::View::foldModule(), hal::GraphContext::getModuleChildrenRecursively(), hal::GraphContextManager::handleModuleGateRemoved(), hal::GraphContext::isModuleUnfolded(), hal::module_init(), operator==(), set_parent_module(), hal::TEST_F(), and hal::GraphContext::unfoldModule().
std::string hal::Module::get_type | ( | ) | const |
Get the type of the module.
Definition at line 106 of file module.cpp.
Referenced by hal::ModuleContextMenu::addModuleSubmenu(), hal::NetlistRelay::changeModuleTypeDialog(), hal::ActionDeleteObject::exec(), hal::ActionSetObjectType::exec(), hal::GraphicsModule::GraphicsModule(), hal::event_log::handle_module_event(), hal::module_init(), hal::ModuleItem::ModuleItem(), hal::ModuleSelectEntry::ModuleSelectEntry(), operator==(), and hal::TEST_F().
u32 hal::Module::get_unique_pin_group_id | ( | ) |
Get a spare pin group ID.
The value of 0 is reserved and represents an invalid ID.
Definition at line 774 of file module.cpp.
Referenced by create_pin(), create_pin_group(), hal::module_init(), and remove_pin_from_group().
u32 hal::Module::get_unique_pin_id | ( | ) |
Get a spare pin ID.
The value of 0 is reserved and represents an invalid ID.
Definition at line 761 of file module.cpp.
Referenced by create_pin(), and hal::module_init().
bool hal::Module::is_input_net | ( | Net * | net | ) | const |
Check whether the given net is an input of the module, i.e., whether the net is a global input to the netlist or has at least one source outside of the module.
[in] | net | - The net. |
true
if the net is an input net, false
otherwise. Definition at line 555 of file module.cpp.
References net.
Referenced by create_pin(), hal::module_init(), and hal::TEST_F().
bool hal::Module::is_internal_net | ( | Net * | net | ) | const |
Check whether the given net is an internal net of the module, i.e. whether the net has at least one source and one destination within the module.
[in] | net | - The net. |
true
if the net is an internal net, false
otherwise. Definition at line 575 of file module.cpp.
References net.
Referenced by hal::module_init().
bool hal::Module::is_output_net | ( | Net * | net | ) | const |
Check whether the given net is an output of the module, i.e., whether the net is a global output to the netlist or has at least one destination outside of the module.
[in] | net | - The net. |
true
if the net is an ouput net, false
otherwise. Definition at line 565 of file module.cpp.
References net.
Referenced by create_pin(), hal::module_init(), and hal::TEST_F().
bool hal::Module::is_parent_module_of | ( | const Module * | module, |
bool | recursive = false |
||
) | const |
Check if the module is a parent of the specified module.
[in] | module | - The module. |
[in] | recursive | - Set true to check recursively, false otherwise. |
true
if the module is a parent of the specified module, false
otherwise. Definition at line 238 of file module.cpp.
References hal::ShortestPath::module().
Referenced by contains_module(), and hal::module_init().
bool hal::Module::is_submodule_of | ( | const Module * | module, |
bool | recursive = false |
||
) | const |
Check if the module is a submodule of the specified module.
[in] | module | - The module. |
[in] | recursive | - Set true to check recursively, false otherwise. |
true
if the module is a submodule of the specified module, false
otherwise. Definition at line 289 of file module.cpp.
References is_submodule_of(), and hal::ShortestPath::module().
Referenced by is_submodule_of(), and hal::module_init().
bool hal::Module::is_top_module | ( | ) | const |
Returns true only if the module is the top module of the netlist.
true
if the module is the top module, false
otherwise. Definition at line 312 of file module.cpp.
Referenced by hal::NetlistModificationDecorator::delete_modules(), hal::module_init(), hal::NetlistModificationDecorator::replace_gate(), hal::ModuleInfoTable::setModule(), and hal::TEST_F().
Move a pin group to another index within the module. The indices of some other pin groups will be incremented or decremented to make room for the moved pin group to be inserted at the desired position.
[in] | pin_group | - The pin group to be moved. |
[in] | new_index | - The index to which the pin group is moved. |
Definition at line 1360 of file module.cpp.
References hal::PinGroup< T >::get_id(), hal::PinGroup< T >::get_name(), hal::GroupReorder, log_warning, and hal::PinChangedEvent::send().
Referenced by hal::ActionPingroup::exec().
bool hal::Module::move_pin_within_group | ( | PinGroup< ModulePin > * | pin_group, |
ModulePin * | pin, | ||
u32 | new_index | ||
) |
Move a pin to another index within the given pin group. The indices of some other pins within the group will be incremented or decremented to make room for the moved pin to be inserted at the desired position.
[in] | pin_group | - The pin group. |
[in] | pin | - The pin to be moved. |
[in] | new_index | - The index to which the pin is moved. |
true
on success, false
otherwise. Definition at line 1506 of file module.cpp.
References hal::BasePin< T >::get_id(), hal::PinGroup< T >::get_id(), hal::BasePin< T >::get_name(), hal::PinGroup< T >::get_name(), log_warning, hal::PinGroup< T >::move_pin(), hal::PinReorder, and hal::PinChangedEvent::send().
Referenced by hal::ActionPingroup::exec().
bool hal::Module::operator!= | ( | const Module & | other | ) | const |
Check whether two modules are unequal. Does not check for parent module.
[in] | other | - The module to compare against. |
Definition at line 72 of file module.cpp.
References operator==().
bool hal::Module::operator== | ( | const Module & | other | ) | const |
Check whether two modules are equal. Does not check for parent module.
[in] | other | - The module to compare against. |
Definition at line 26 of file module.cpp.
References get_gates(), get_id(), get_name(), get_pin_group_by_id(), get_pin_groups(), get_submodules(), get_type(), and log_debug.
Referenced by operator!=().
bool hal::Module::remove_gate | ( | Gate * | gate | ) |
Remove a gate from the module.
Automatically moves the gate to the top module of the netlist.
[in] | gate | - The gate to remove. |
true
on success, false
otherwise. Definition at line 332 of file module.cpp.
References remove_gates().
Referenced by hal::module_init().
bool hal::Module::remove_gates | ( | const std::vector< Gate * > & | gates | ) |
Remove a vector of gates from the module.
Automatically moves the gates to the top module of the netlist.
[in] | gates | - The gates to remove. |
true
on success, false
otherwise. Definition at line 337 of file module.cpp.
References contains_gate(), and hal::Netlist::get_top_module().
Referenced by hal::module_init(), and remove_gate().
bool hal::Module::remove_pin_from_group | ( | PinGroup< ModulePin > * | pin_group, |
ModulePin * | pin, | ||
bool | delete_empty_groups = true |
||
) |
Remove a pin from a pin group. The pin will be moved to a new group that goes by the pin's name.
[in] | pin_group | - The old pin group. |
[in] | pin | - The pin to be removed. |
[in] | delete_empty_groups | - Set true to delete the group of it is empty after the pin has been removed, false to keep the empty group. Defaults to true . |
true
on success, false
otherwise. Definition at line 1563 of file module.cpp.
References create_pin_group(), hal::BasePin< T >::get_direction(), hal::BasePin< T >::get_id(), hal::PinGroup< T >::get_id(), hal::BasePin< T >::get_name(), hal::PinGroup< T >::get_name(), hal::BasePin< T >::get_type(), get_unique_pin_group_id(), and log_warning.
void hal::Module::set_name | ( | const std::string & | name | ) |
Set the name of the module.
[in] | name | - The new name. |
Definition at line 92 of file module.cpp.
References log_warning, name, hal::ModuleEvent::name_changed, hal::EventHandler::notify(), and hal::utils::trim().
Referenced by hal::ActionRenameObject::exec(), and hal::module_init().
bool hal::Module::set_parent_module | ( | Module * | new_parent | ) |
Set a new parent for this module.
If the new parent is a submodule of this module, the new parent is added as a direct submodule to the old parent first.
[in] | new_parent | - The new parent module. |
true
if the parent was changed, false
otherwise. Definition at line 168 of file module.cpp.
References get_id(), hal::Netlist::get_id(), get_name(), get_netlist(), get_nets(), get_submodules(), log_error, net, hal::EventHandler::notify(), hal::ModuleEvent::parent_changed, set_parent_module(), hal::ModuleEvent::submodule_added, and hal::ModuleEvent::submodule_removed.
Referenced by hal::ActionAddItemsToObject::exec(), hal::module_init(), and set_parent_module().
bool hal::Module::set_pin_group_direction | ( | PinGroup< ModulePin > * | pin_group, |
PinDirection | new_direction | ||
) |
Set the direction of the given pin group.
[in] | pin_group | - The pin group. |
[in] | new_direction | - The direction to be assigned to the pin group. |
true
on success, false
otherwise. Definition at line 1224 of file module.cpp.
References hal::PinGroup< T >::get_direction(), hal::PinGroup< T >::get_id(), hal::PinGroup< T >::get_name(), hal::GroupTypeChange, log_warning, hal::PinChangedEvent::send(), and hal::PinGroup< T >::set_direction().
Referenced by hal::ActionPingroup::exec(), and hal::module_init().
bool hal::Module::set_pin_group_name | ( | PinGroup< ModulePin > * | pin_group, |
const std::string & | new_name, | ||
bool | force_name = false |
||
) |
Set the name of the given pin group.
[in] | pin_group | - The pin group. |
[in] | new_name | - The name to be assigned to the pin group. |
[in] | force_name | - Set true to enforce the name, false otherwise. If a pin group with the same name already exists, the existing pin group will be renamed. Defaults to false . |
true
on success, false
otherwise. Definition at line 1145 of file module.cpp.
References hal::PinGroup< T >::get_id(), hal::PinGroup< T >::get_name(), hal::GroupRename, log_warning, hal::PinChangedEvent::send(), and hal::PinGroup< T >::set_name().
Referenced by hal::ActionPingroup::exec(), hal::module_init(), and hal::TEST_F().
Set the type of the given pin group.
[in] | pin_group | - The pin group. |
[in] | new_type | - The type to be assigned to the pin group. |
true
on success, false
otherwise. Definition at line 1201 of file module.cpp.
References hal::PinGroup< T >::get_id(), hal::PinGroup< T >::get_name(), hal::PinGroup< T >::get_type(), hal::GroupTypeChange, log_warning, hal::PinChangedEvent::send(), and hal::PinGroup< T >::set_type().
Referenced by hal::ActionPingroup::exec(), and hal::module_init().
bool hal::Module::set_pin_name | ( | ModulePin * | pin, |
const std::string & | new_name, | ||
bool | force_name = false |
||
) |
Set the name of the given pin.
[in] | pin | - The pin. |
[in] | new_name | - The name to be assigned to the pin. |
[in] | force_name | - Set true to enforce the name, false otherwise. If a pin with the same name already exists, that existing pin will be renamed. Defaults to false . |
true
on success, false
otherwise. Definition at line 1068 of file module.cpp.
References hal::BasePin< T >::get_id(), hal::BasePin< T >::get_name(), log_warning, hal::PinRename, hal::PinChangedEvent::send(), and hal::BasePin< T >::set_name().
Referenced by hal::ActionPingroup::exec(), hal::module_init(), and hal::TEST_F().
Set the type of the given pin.
[in] | pin | - The pin. |
[in] | new_type | - The type to be assigned to the pin. |
true
on success, false
otherwise. Definition at line 1122 of file module.cpp.
References hal::BasePin< T >::get_id(), hal::BasePin< T >::get_name(), hal::BasePin< T >::get_type(), log_warning, hal::PinTypeChange, hal::PinChangedEvent::send(), and hal::BasePin< T >::set_type().
Referenced by hal::ActionPingroup::exec(), and hal::module_init().
void hal::Module::set_type | ( | const std::string & | type | ) |
Set the type of the module.
[in] | type | - The new type. |
Definition at line 111 of file module.cpp.
References hal::EventHandler::notify(), type, and hal::ModuleEvent::type_changed.
Referenced by hal::ActionSetObjectType::exec(), hal::module_init(), hal::ModuleItem::setModuleType(), and hal::TEST_F().
void hal::Module::update_nets | ( | ) |
Iterates over all nets connected to at least one gate of the module to update the nets, internal nets, input nets, and output nets of the module. Has no effect on module pins.
Netlist::enable_automatic_net_checks
.} Definition at line 434 of file module.cpp.
References get_gates(), and net.
Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::module_init().
|
friend |