HAL
hal::GateLibrary Class Reference

#include <gate_library.h>

Collaboration diagram for hal::GateLibrary:
Collaboration graph

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
 
GateTypecreate_gate_type (const std::string &name, std::set< GateTypeProperty > properties={GateTypeProperty::combinational}, std::unique_ptr< GateTypeComponent > component=nullptr)
 
GateTypereplace_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
 
GateTypeget_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)
 

Detailed Description

A gate library is a collection of gate types including their pins and Boolean functions.

Definition at line 43 of file gate_library.h.

Constructor & Destructor Documentation

◆ GateLibrary()

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.

Parameters
[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.

◆ ~GateLibrary()

hal::GateLibrary::~GateLibrary ( )
default

Member Function Documentation

◆ add_include()

void hal::GateLibrary::add_include ( const std::string &  inc)

Add an include required for parsing a corresponding netlist, e.g., VHDL libraries.

Parameters
[in]inc- The include to add.

Definition at line 206 of file gate_library.cpp.

Referenced by hal::gate_library_init().

◆ contains_gate_type()

bool hal::GateLibrary::contains_gate_type ( GateType gate_type) const

Check whether the given gate type is contained in this library.

Parameters
[in]gate_type- The gate type.
Returns
True if the gate type is part of this library, false otherwise.

Definition at line 103 of file gate_library.cpp.

References hal::GateType::get_name().

Referenced by hal::gate_library_init().

◆ contains_gate_type_by_name()

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.

Parameters
[in]name- The name of the gate type.
Returns
True if the gate type is part of this library, false otherwise.

Definition at line 118 of file gate_library.cpp.

References name.

Referenced by hal::gate_library_init().

◆ create_gate_type()

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.

Parameters
[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.
Returns
The new gate type instance on success, a nullptr otherwise.

Definition at line 53 of file gate_library.cpp.

References log_error, and name.

Referenced by hal::GateLibraryWizard::accept().

◆ get_gate_location_data_category()

const std::string & hal::GateLibrary::get_gate_location_data_category ( ) const

Get the data category of the gate location information.

Returns
The data category.

Definition at line 38 of file gate_library.cpp.

Referenced by hal::gate_library_init(), and hal::Netlist::load_gate_locations_from_data().

◆ get_gate_location_data_identifiers()

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.

Returns
A pair of data identifiers.

Definition at line 48 of file gate_library.cpp.

Referenced by hal::Netlist::load_gate_locations_from_data().

◆ get_gate_type_by_name()

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.

Parameters
[in]name- The name of the gate type.
Returns
The gate type on success, a nullptr otherwise.

Definition at line 128 of file gate_library.cpp.

References log_error, and name.

Referenced by hal::gate_library_init().

◆ get_gate_types()

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.

Parameters
[in]filter- The user-defined filter function.
Returns
A map from gate type names to gate types.

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().

◆ get_gnd_gate_types()

std::unordered_map< std::string, GateType * > hal::GateLibrary::get_gnd_gate_types ( ) const

Get all GND gate types of the library.

Returns
A map from GND gate type names to gate type objects.

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().

◆ get_includes()

std::vector< std::string > hal::GateLibrary::get_includes ( ) const

Get a vector of includes required for parsing a corresponding netlist, e.g., VHDL libraries.

Returns
A vector of includes.

Definition at line 201 of file gate_library.cpp.

Referenced by hal::gate_library_init().

◆ get_name()

std::string hal::GateLibrary::get_name ( ) const

◆ get_path()

std::filesystem::path hal::GateLibrary::get_path ( ) const

Get the path to the file describing the gate library.

Returns
The path to the gate library file.

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().

◆ get_vcc_gate_types()

std::unordered_map< std::string, GateType * > hal::GateLibrary::get_vcc_gate_types ( ) const

Get all VCC gate types of the library.

Returns
A map from VCC gate type names to gate type objects.

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().

◆ mark_gnd_gate_type()

bool hal::GateLibrary::mark_gnd_gate_type ( GateType gate_type)

Mark a gate type as a GND gate type.

Parameters
[in]gate_type- The gate type.
Returns
True on success, false otherwise.

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().

◆ mark_vcc_gate_type()

bool hal::GateLibrary::mark_vcc_gate_type ( GateType gate_type)

Mark a gate type as a VCC gate type.

Parameters
[in]gate_type- The gate type.
Returns
True on success, false otherwise.

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().

◆ remove_gate_type()

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().

◆ replace_gate_type()

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.

Parameters
[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.
Returns
The new gate type instance on success, a nullptr otherwise.

Definition at line 69 of file gate_library.cpp.

References log_error, and name.

Referenced by hal::GateLibraryWizard::accept().

◆ set_gate_location_data_category()

void hal::GateLibrary::set_gate_location_data_category ( const std::string &  category)

Set the data category of the gate location information.

Parameters
[in]category- The data category.

Definition at line 33 of file gate_library.cpp.

Referenced by hal::gate_library_init().

◆ set_gate_location_data_identifiers()

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.

Parameters
[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().

◆ set_name()

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

Parameters
[in]modified_name- The new name.

Definition at line 28 of file gate_library.cpp.

Referenced by hal::GatelibraryContentWidget::handleSaveAsAction().

◆ set_path()

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

Parameters
[in]modified_path- The path to the new location.

Definition at line 23 of file gate_library.cpp.

Referenced by hal::GatelibraryContentWidget::handleSaveAsAction().


The documentation for this class was generated from the following files: