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

Classes

class  BitOrder
 
class  BitOrderResult
 

Typedefs

using WordIndex = u32
 

Functions

Result< BitOrderResultpropagate_module_pingroup_bitorder (const BitOrderResult &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 BitOrderResult &ordered_module_pin_groups)
 Reorder and rename the pins of the pin groups according to the provided bit-order information. More...
 
Result< BitOrderResultpropagate_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< BitOrderResultpropagate_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< BitOrderResultpropagate_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< BitOrderResultpropagate_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 > * >, WordIndex > > 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 > * >, WordIndex > > export_bitorder_propagation_information (const BitOrderResult &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< BitOrderResultpropagate_module_pingroup_bitorder (const BitOrderResult &src, const std::set< MPG > &unknown_bitorders, const bool enforce_continuous_bitorders)
 

Detailed Description

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

Typedef Documentation

◆ WordIndex

The index of a module pin group among the words that export_bitorder_propagation_information writes.

It identifies a word within the exported file and has nothing to do with the index of a bit.

Definition at line 52 of file bit_order.h.

Function Documentation

◆ export_bitorder_propagation_information() [1/2]

Result< std::map< MPG, WordIndex > > hal::bitorder_propagation::export_bitorder_propagation_information ( const BitOrderResult 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 1521 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, WordIndex > > 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 1490 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< BitOrderResult > 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 1330 of file bitorder_propagation.cpp.

References ERR, and propagate_bitorder().

◆ propagate_bitorder() [2/4]

Result< BitOrderResult > 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 1420 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< BitOrderResult > 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 1323 of file bitorder_propagation.cpp.

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

◆ propagate_bitorder() [4/4]

Result< BitOrderResult > 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 1347 of file bitorder_propagation.cpp.

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

◆ propagate_module_pingroup_bitorder() [1/2]

Result<BitOrderResult> hal::bitorder_propagation::propagate_module_pingroup_bitorder ( const BitOrderResult src,
const std::set< MPG > &  unknown_bitorders,
const bool  enforce_continuous_bitorders 
)

◆ propagate_module_pingroup_bitorder() [2/2]

Result<BitOrderResult> hal::bitorder_propagation::propagate_module_pingroup_bitorder ( const BitOrderResult 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()

Result< std::monostate > hal::bitorder_propagation::reorder_module_pin_groups ( const BitOrderResult 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.

Definition at line 1270 of file bitorder_propagation.cpp.

References ERR, hal::BasePin< T >::get_group(), hal::BasePin< T >::get_name(), index, net, and OK.

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