HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::bitorder_propagation Namespace Reference

Functions

Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 > > > propagate_module_pingroup_bitorder (const std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 >> &src, const std::set< std::pair< Module *, PinGroup< ModulePin > * >> &dst, const bool enforce_continuous_bitorders=true)
 Propagate known bit-order information from the given module pin groups to module pin groups of unknown bit order. More...
 
Result< std::monostate > reorder_module_pin_groups (const std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 >> &ordered_module_pin_groups)
 Reorder and rename the pins of the pin groups according to the provided bit-order information. More...
 
Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 > > > propagate_bitorder (Netlist *nl, const std::pair< u32, std::string > &src, const std::pair< u32, std::string > &dst)
 Propagate known bit-order information from one module pin group to another module pin group of unknown bit order. More...
 
Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 > > > propagate_bitorder (const std::pair< Module *, PinGroup< ModulePin > * > &src, const std::pair< Module *, PinGroup< ModulePin > * > &dst)
 Propagate known bit-order information from one module pin group to another module pin group of unknown bit order. More...
 
Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 > > > propagate_bitorder (Netlist *nl, const std::vector< std::pair< u32, std::string >> &src, const std::vector< std::pair< u32, std::string >> &dst)
 Propagate known bit-order information from the given module pin groups to module pin groups of unknown bit order. More...
 
Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 > > > propagate_bitorder (const std::vector< std::pair< Module *, PinGroup< ModulePin > * >> &src, const std::vector< std::pair< Module *, PinGroup< ModulePin > * >> &dst)
 Propagate known bit-order information from the given module pin groups to module pin groups of unknown bit order. More...
 
Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, u32 > > export_bitorder_propagation_information (const std::vector< std::pair< Module *, PinGroup< ModulePin > * >> &src, const std::vector< std::pair< Module *, PinGroup< ModulePin > * >> &dst, const std::string &export_filepath)
 Export word composition, known bitorder and connectivity in .json format to solve with external tools. More...
 
Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, u32 > > export_bitorder_propagation_information (const std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 >> &src, const std::set< std::pair< Module *, PinGroup< ModulePin > * >> &dst, const std::string &export_filepath)
 Export word composition, known bitorder and connectivity in .json format to solve with external tools. More...
 
Result< std::map< MPG, std::map< Net *, u32 > > > propagate_module_pingroup_bitorder (const std::map< MPG, std::map< Net *, u32 >> &known_bitorders, const std::set< MPG > &unknown_bitorders, const bool enforce_continuous_bitorders)
 
Result< std::monostate > reorder_module_pin_groups (const std::map< MPG, std::map< Net *, u32 >> &ordered_module_pin_groups)
 

Detailed Description

Propagates a known bit order from one module pin group to the pin groups that are connected to it.

Function Documentation

◆ export_bitorder_propagation_information() [1/2]

Result< std::map< MPG, u32 > > hal::bitorder_propagation::export_bitorder_propagation_information ( const std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 >> &  src,
const std::set< std::pair< Module *, PinGroup< ModulePin > * >> &  dst,
const std::string &  export_filepath 
)

Export word composition, known bitorder and connectivity in .json format to solve with external tools.

Parameters
[in]src- The known indices for the nets belonging to the given module pin groups.
[in]dst- The pairs of module ID and pin group name with unknown bit order.
[in]export_filepath- The filepath where the .json file should be written to.
Returns
OK and the mapping from each mdoule/pingroup pair to its index on success, an error otherwise.

Definition at line 1485 of file bitorder_propagation.cpp.

References ERR, ERR_APPEND, hal::BooleanFunctionNetDecorator::get_boolean_variable_name(), identifier, and OK.

◆ export_bitorder_propagation_information() [2/2]

Result< std::map< MPG, u32 > > hal::bitorder_propagation::export_bitorder_propagation_information ( const std::vector< std::pair< Module *, PinGroup< ModulePin > * >> &  src,
const std::vector< std::pair< Module *, PinGroup< ModulePin > * >> &  dst,
const std::string &  export_filepath 
)

Export word composition, known bitorder and connectivity in .json format to solve with external tools.

Parameters
[in]src- The pairs of module and pin group with known bit order.
[in]dst- The pairs of module and pin group with unknown bit order.
[in]export_filepath- The filepath where the .json file should be written to.
Returns
OK and a map containing all known bit orders (including new and already known ones) on success, an error otherwise.

Definition at line 1454 of file bitorder_propagation.cpp.

References ERR_APPEND, hal::ModulePin::get_net(), index, and size.

Referenced by hal::PYBIND11_PLUGIN().

◆ propagate_bitorder() [1/4]

Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 > > > hal::bitorder_propagation::propagate_bitorder ( const std::pair< Module *, PinGroup< ModulePin > * > &  src,
const std::pair< Module *, PinGroup< ModulePin > * > &  dst 
)

Propagate known bit-order information from one module pin group to another module pin group of unknown bit order.

The known bit-order information is taken from the order of pins in the pin group of src. After propagation, the algorithm tries to reconstruct a valid bit order from the propagated information. The valid bit order is then annotated to the module pin group, i.e., the pins of the respective pin group are renamed and reordered.

Parameters
[in]src- The pair of module and pin group with known bit order.
[in]dst- The pair of module and pin group with unknown bit order.
Returns
OK and a map containing all known bit orders (including new and already known ones) on success, an error otherwise.

Definition at line 1294 of file bitorder_propagation.cpp.

References ERR, and propagate_bitorder().

◆ propagate_bitorder() [2/4]

Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 > > > hal::bitorder_propagation::propagate_bitorder ( const std::vector< std::pair< Module *, PinGroup< ModulePin > * >> &  src,
const std::vector< std::pair< Module *, PinGroup< ModulePin > * >> &  dst 
)

Propagate known bit-order information from the given module pin groups to module pin groups of unknown bit order.

The known bit-order information is taken from the order of pins in the pin groups of src. After propagation, the algorithm tries to reconstruct valid bit orders from the propagated information. The valid bit orders are then annotated to the module pin groups, i.e., the pins of the respective pin groups are renamed and reordered.

Parameters
[in]src- The pairs of module and pin group with known bit order.
[in]dst- The pairs of module and pin group with unknown bit order.
Returns
OK and a map containing all known bit orders (including new and already known ones) on success, an error otherwise.

Definition at line 1384 of file bitorder_propagation.cpp.

References ERR_APPEND, hal::ModulePin::get_net(), index, log_info, net, OK, propagate_module_pingroup_bitorder(), reorder_module_pin_groups(), and size.

◆ propagate_bitorder() [3/4]

Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 > > > hal::bitorder_propagation::propagate_bitorder ( Netlist nl,
const std::pair< u32, std::string > &  src,
const std::pair< u32, std::string > &  dst 
)

Propagate known bit-order information from one module pin group to another module pin group of unknown bit order.

The known bit-order information is taken from the order of pins in the pin group of src. After propagation, the algorithm tries to reconstruct a valid bit order from the propagated information. The valid bit order is then annotated to the module pin group, i.e., the pins of the respective pin group are renamed and reordered.

Parameters
[in]nl- The netlist containing the module.
[in]src- The pair of module ID and pin group name with known bit order.
[in]dst- The pair of module ID and pin group name with unknown bit order.
Returns
OK and a map containing all known bit orders (including new and already known ones) on success, an error otherwise.

Definition at line 1287 of file bitorder_propagation.cpp.

Referenced by propagate_bitorder(), and hal::PYBIND11_PLUGIN().

◆ propagate_bitorder() [4/4]

Result< std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 > > > hal::bitorder_propagation::propagate_bitorder ( Netlist nl,
const std::vector< std::pair< u32, std::string >> &  src,
const std::vector< std::pair< u32, std::string >> &  dst 
)

Propagate known bit-order information from the given module pin groups to module pin groups of unknown bit order.

The known bit-order information is taken from the order of pins in the pin groups of src. After propagation, the algorithm tries to reconstruct valid bit orders from the propagated information. The valid bit orders are then annotated to the module pin groups, i.e., the pins of the respective pin groups are renamed and reordered.

Parameters
[in]nl- The netlist containing the modules.
[in]src- The pairs of module ID and pin group name with known bit order.
[in]dst- The pairs of module ID and pin group name with unknown bit order.
Returns
OK and a map containing all known bit orders (including new and already known ones) on success, an error otherwise.

Definition at line 1311 of file bitorder_propagation.cpp.

References ERR, hal::Netlist::get_module_by_id(), and propagate_bitorder().

◆ propagate_module_pingroup_bitorder() [1/2]

Result<std::map<MPG, std::map<Net*, u32> > > hal::bitorder_propagation::propagate_module_pingroup_bitorder ( const std::map< MPG, std::map< Net *, u32 >> &  known_bitorders,
const std::set< MPG > &  unknown_bitorders,
const bool  enforce_continuous_bitorders 
)

◆ propagate_module_pingroup_bitorder() [2/2]

Result<std::map<std::pair<Module*, PinGroup<ModulePin>*>, std::map<Net*, u32> > > hal::bitorder_propagation::propagate_module_pingroup_bitorder ( const std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 >> &  src,
const std::set< std::pair< Module *, PinGroup< ModulePin > * >> &  dst,
const bool  enforce_continuous_bitorders = true 
)

Propagate known bit-order information from the given module pin groups to module pin groups of unknown bit order.

The known bit-order information is taken from the map from net to index given for each pair of module and pin group in src. After propagation, the algorithm tries to reconstruct valid bit orders from the propagated information.

Parameters
[in]src- The known indices for the nets belonging to the given module pin groups.
[in]dst- The pairs of module ID and pin group name with unknown bit order.
[in]enforce_continuous_bitorders- Set true to only allow for continuous bit orders, false to also allow bit orders that are not continuous. Defaults to true.
Returns
OK and a map containing all known bit orders (including new and already known ones) on success, an error otherwise.

Referenced by hal::PYBIND11_PLUGIN().

◆ reorder_module_pin_groups() [1/2]

Result<std::monostate> hal::bitorder_propagation::reorder_module_pin_groups ( const std::map< MPG, std::map< Net *, u32 >> &  ordered_module_pin_groups)

◆ reorder_module_pin_groups() [2/2]

Result<std::monostate> hal::bitorder_propagation::reorder_module_pin_groups ( const std::map< std::pair< Module *, PinGroup< ModulePin > * >, std::map< Net *, u32 >> &  ordered_module_pin_groups)

Reorder and rename the pins of the pin groups according to the provided bit-order information.

Parameters
[in]ordered_module_pin_groups- A mapping from pairs of modules and their pin groups to known bit-order information given as a mapping from nets to their index.
Returns
OK on success, an error otherwise.

Referenced by hal::PYBIND11_PLUGIN().