![]() |
HAL
|
#include <gate_library.h>
Public Member Functions | |
GateLibrary (const std::filesystem::path &path, const std::string &name) | |
~GateLibrary ()=default | |
std::string | get_name () const |
std::filesystem::path | get_path () const |
void | set_path (const std::filesystem::path &modified_path) |
void | set_name (const std::string &modified_name) |
void | set_gate_location_data_category (const std::string &category) |
const std::string & | get_gate_location_data_category () const |
void | set_gate_location_data_identifiers (const std::string &x_coordinate, const std::string &y_coordinate) |
const std::pair< std::string, std::string > & | get_gate_location_data_identifiers () const |
GateType * | create_gate_type (const std::string &name, std::set< GateTypeProperty > properties={GateTypeProperty::combinational}, std::unique_ptr< GateTypeComponent > component=nullptr) |
GateType * | replace_gate_type (u32 id, const std::string &name, std::set< GateTypeProperty > properties={GateTypeProperty::combinational}, std::unique_ptr< GateTypeComponent > component=nullptr) |
bool | contains_gate_type (GateType *gate_type) const |
bool | contains_gate_type_by_name (const std::string &name) const |
GateType * | get_gate_type_by_name (const std::string &name) const |
std::unordered_map< std::string, GateType * > | get_gate_types (const std::function< bool(const GateType *)> &filter=nullptr) const |
bool | mark_vcc_gate_type (GateType *gate_type) |
std::unordered_map< std::string, GateType * > | get_vcc_gate_types () const |
bool | mark_gnd_gate_type (GateType *gate_type) |
std::unordered_map< std::string, GateType * > | get_gnd_gate_types () const |
void | add_include (const std::string &inc) |
std::vector< std::string > | get_includes () const |
void | remove_gate_type (const std::string &name) |
A gate library is a collection of gate types including their pins and Boolean functions.
Definition at line 43 of file gate_library.h.
hal::GateLibrary::GateLibrary | ( | const std::filesystem::path & | path, |
const std::string & | name | ||
) |
Construct a gate library by specifying its name and the path to the file that describes the library.
[in] | path | - The path to the gate library file. |
[in] | name | - The name of the gate library. |
Definition at line 8 of file gate_library.cpp.
|
default |
void hal::GateLibrary::add_include | ( | const std::string & | inc | ) |
Add an include required for parsing a corresponding netlist, e.g., VHDL libraries.
[in] | inc | - The include to add. |
Definition at line 206 of file gate_library.cpp.
Referenced by hal::gate_library_init().
bool hal::GateLibrary::contains_gate_type | ( | GateType * | gate_type | ) | const |
Check whether the given gate type is contained in this library.
[in] | gate_type | - The gate type. |
Definition at line 103 of file gate_library.cpp.
References hal::GateType::get_name().
Referenced by hal::gate_library_init().
bool hal::GateLibrary::contains_gate_type_by_name | ( | const std::string & | name | ) | const |
Check by name whether the given gate type is contained in this library.
[in] | name | - The name of the gate type. |
Definition at line 118 of file gate_library.cpp.
References name.
Referenced by hal::gate_library_init().
GateType * hal::GateLibrary::create_gate_type | ( | const std::string & | name, |
std::set< GateTypeProperty > | properties = {GateTypeProperty::combinational} , |
||
std::unique_ptr< GateTypeComponent > | component = nullptr |
||
) |
TODO pybind Create a new gate type, add it to the gate library, and return it.
[in] | name | - The name of the gate type. |
[in] | properties | - The properties of the gate type. |
[in] | component | - A component adding additional functionality to the gate type. |
Definition at line 53 of file gate_library.cpp.
References log_error, and name.
Referenced by hal::GateLibraryWizard::accept().
const std::string & hal::GateLibrary::get_gate_location_data_category | ( | ) | const |
Get the data category of the gate location information.
Definition at line 38 of file gate_library.cpp.
Referenced by hal::gate_library_init(), and hal::Netlist::load_gate_locations_from_data().
const std::pair< std::string, std::string > & hal::GateLibrary::get_gate_location_data_identifiers | ( | ) | const |
Get the data identifiers of the gate location information for both the x- and y-coordinates.
Definition at line 48 of file gate_library.cpp.
Referenced by hal::Netlist::load_gate_locations_from_data().
GateType * hal::GateLibrary::get_gate_type_by_name | ( | const std::string & | name | ) | const |
Get the gate type corresponding to the given name if contained within the library. In case there is no gate type with that name, a nullptr is returned.
[in] | name | - The name of the gate type. |
Definition at line 128 of file gate_library.cpp.
References log_error, and name.
Referenced by hal::gate_library_init().
std::unordered_map< std::string, GateType * > hal::GateLibrary::get_gate_types | ( | const std::function< bool(const GateType *)> & | filter = nullptr | ) | const |
Get all gate types of the library. In case a filter is applied, only the gate types matching the filter condition are returned.
[in] | filter | - The user-defined filter function. |
Definition at line 139 of file gate_library.cpp.
References type.
Referenced by hal::gate_library_init(), hal::GateLibraryManager::getNextGateId(), hal::VerilogParser::instantiate(), hal::VHDLParser::instantiate(), hal::GeneralInfoWizardPage::isComplete(), and hal::dataflow::Configuration::with_gate_types().
std::unordered_map< std::string, GateType * > hal::GateLibrary::get_gnd_gate_types | ( | ) | const |
Get all GND gate types of the library.
Definition at line 196 of file gate_library.cpp.
Referenced by hal::NetlistModificationDecorator::create_gnd_net(), hal::gate_library_init(), hal::VerilogParser::instantiate(), and hal::VHDLParser::instantiate().
std::vector< std::string > hal::GateLibrary::get_includes | ( | ) | const |
Get a vector of includes required for parsing a corresponding netlist, e.g., VHDL libraries.
Definition at line 201 of file gate_library.cpp.
Referenced by hal::gate_library_init().
std::string hal::GateLibrary::get_name | ( | ) | const |
Get the name of the gate library.
Definition at line 13 of file gate_library.cpp.
Referenced by hal::NetlistModificationDecorator::create_gnd_net(), hal::NetlistModificationDecorator::create_vcc_net(), hal::gate_library_init(), hal::VerilogParser::instantiate(), hal::VHDLParser::instantiate(), and hal::gate_library_writer_manager::write().
std::filesystem::path hal::GateLibrary::get_path | ( | ) | const |
Get the path to the file describing the gate library.
Definition at line 18 of file gate_library.cpp.
Referenced by hal::GateLibraryManager::callUnsavedChangesWindow(), hal::GatelibraryContentWidget::handleSaveAsAction(), hal::GateLibraryManager::initialize(), and hal::ProjectManager::serialize_project().
std::unordered_map< std::string, GateType * > hal::GateLibrary::get_vcc_gate_types | ( | ) | const |
Get all VCC gate types of the library.
Definition at line 174 of file gate_library.cpp.
Referenced by hal::NetlistModificationDecorator::create_vcc_net(), hal::gate_library_init(), hal::VerilogParser::instantiate(), and hal::VHDLParser::instantiate().
bool hal::GateLibrary::mark_gnd_gate_type | ( | GateType * | gate_type | ) |
Mark a gate type as a GND gate type.
[in] | gate_type | - The gate type. |
Definition at line 179 of file gate_library.cpp.
References hal::GateType::get_boolean_function(), hal::GateType::get_input_pins(), hal::GateType::get_name(), and hal::GateType::get_output_pins().
Referenced by hal::gate_library_init().
bool hal::GateLibrary::mark_vcc_gate_type | ( | GateType * | gate_type | ) |
Mark a gate type as a VCC gate type.
[in] | gate_type | - The gate type. |
Definition at line 157 of file gate_library.cpp.
References hal::GateType::get_boolean_function(), hal::GateType::get_input_pins(), hal::GateType::get_name(), and hal::GateType::get_output_pins().
Referenced by hal::gate_library_init().
void hal::GateLibrary::remove_gate_type | ( | const std::string & | name | ) |
Definition at line 216 of file gate_library.cpp.
References log_error, and name.
Referenced by hal::GateLibraryManager::handleDeleteType().
GateType * hal::GateLibrary::replace_gate_type | ( | u32 | id, |
const std::string & | name, | ||
std::set< GateTypeProperty > | properties = {GateTypeProperty::combinational} , |
||
std::unique_ptr< GateTypeComponent > | component = nullptr |
||
) |
TODO pybind Replace gate type with given ID, might change name, properties, component, and return it.
[in] | id | - The ID of gate type |
[in] | name | - The name of the gate type. |
[in] | properties | - The properties of the gate type. |
[in] | component | - A component adding additional functionality to the gate type. |
Definition at line 69 of file gate_library.cpp.
References log_error, and name.
Referenced by hal::GateLibraryWizard::accept().
void hal::GateLibrary::set_gate_location_data_category | ( | const std::string & | category | ) |
Set the data category of the gate location information.
[in] | category | - The data category. |
Definition at line 33 of file gate_library.cpp.
Referenced by hal::gate_library_init().
void hal::GateLibrary::set_gate_location_data_identifiers | ( | const std::string & | x_coordinate, |
const std::string & | y_coordinate | ||
) |
Set the data identifiers of the gate location information for both the x- and y-coordinates.
[in] | x_coordinate | - The data identifier for the x-coordinate. |
[in] | y_coordinate | - The data identifier for the y-coordinate. |
Definition at line 43 of file gate_library.cpp.
Referenced by hal::gate_library_init().
void hal::GateLibrary::set_name | ( | const std::string & | modified_name | ) |
Hack to alter the name if gate library gets modified and written to a new location. Use this function only if you know exactly what you are doing
[in] | modified_name | - The new name. |
Definition at line 28 of file gate_library.cpp.
Referenced by hal::GatelibraryContentWidget::handleSaveAsAction().
void hal::GateLibrary::set_path | ( | const std::filesystem::path & | modified_path | ) |
Hack to alter the path if gate library gets modified and written to a new location. Use this function only if you know exactly what you are doing
[in] | modified_path | - The path to the new location. |
Definition at line 23 of file gate_library.cpp.
Referenced by hal::GatelibraryContentWidget::handleSaveAsAction().