HAL  v4.5.0-299-g9ee015483
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::cte Namespace Reference

Classes

struct  Diagnostic
 
struct  VoidPtrHash
 
struct  PairPtrEq
 
class  ClockTree
 

Typedefs

using Branch = std::vector< std::pair< const void *, PtrType > >
 

Enumerations

enum  PtrType { UNKNOWN , GATE , NET }
 
enum class  Severity { warning , error }
 
enum class  DiagnosticCode {
  invalid_clock_pin_count , unconnected_clock_pin , invalid_clock_net_sources , unrouted_clock_net ,
  multi_driven_clock_net
}
 

Functions

Result< std::vector< Branch > > recover_branches (const ClockTree &clock_tree)
 
Result< std::monostate > export_dot (const ClockTree &clock_tree, const std::string &pathname, const std::optional< std::string > &x_key=std::nullopt, const std::optional< std::string > &y_key=std::nullopt)
 
bool is_ff (const Gate *gate)
 
bool is_latch (const Gate *gate)
 
bool is_buffer (const Gate *gate)
 
bool is_inverter (const Gate *gate)
 
bool is_delay (const Gate *gate)
 
bool is_mux (const Gate *gate)
 
bool is_oscillator (const Gate *gate)
 
bool is_pll (const Gate *gate)
 
bool is_control_pin (PinType pin_type)
 
bool is_connected_to_control_pin (const Endpoint *endpoint)
 
std::optional< double > read_parameter_coordinate (const Gate *gate, const std::string &name)
 

Typedef Documentation

◆ Branch

using hal::cte::Branch = typedef std::vector<std::pair<const void *, PtrType> >

Definition at line 71 of file clock_tree.h.

Enumeration Type Documentation

◆ DiagnosticCode

Enumerator
invalid_clock_pin_count 
unconnected_clock_pin 
invalid_clock_net_sources 
unrouted_clock_net 
multi_driven_clock_net 

Definition at line 52 of file clock_tree.h.

◆ PtrType

Enumerator
UNKNOWN 
GATE 
NET 

Definition at line 48 of file clock_tree.h.

◆ Severity

enum hal::cte::Severity
strong
Enumerator
warning 
error 

Definition at line 50 of file clock_tree.h.

Function Documentation

◆ export_dot()

Result< std::monostate > hal::cte::export_dot ( const ClockTree &  clock_tree,
const std::string &  pathname,
const std::optional< std::string > &  x_key = std::nullopt,
const std::optional< std::string > &  y_key = std::nullopt 
)

Write a clock tree to a DOT file.

Gates get the coordinates of their location in the layout, unless the keys of both coordinates are given: then they are read from the gate parameters of these names, e.g., from Verilog instance parameters, which unlike a location can be negative.

Parameters
[in]clock_tree- The clock tree.
[in]pathname- The path of the file to write.
[in]x_key- The name of the parameter that holds the x-coordinate, or std::nullopt to use the location.
[in]y_key- The name of the parameter that holds the y-coordinate, or std::nullopt to use the location.
Returns
OK() on success, an error otherwise.

Definition at line 93 of file dot_export.cpp.

References ERR, ERR_APPEND, hal::Gate::get_id(), hal::cte::ClockTree::get_igraph(), hal::Gate::get_location_x(), hal::Gate::get_location_y(), hal::Gate::get_name(), hal::GateType::get_name(), hal::cte::ClockTree::get_ptr_from_vertex(), hal::Gate::get_type(), hal::Gate::has_location(), is_delay(), is_inverter(), log_warning, NET, net, OK, read_parameter_coordinate(), hal::core_strings::to(), type, x, and y.

Referenced by hal::PYBIND11_PLUGIN().

◆ is_buffer()

bool hal::cte::is_buffer ( const Gate *  gate)

◆ is_connected_to_control_pin()

bool hal::cte::is_connected_to_control_pin ( const Endpoint *  endpoint)

◆ is_control_pin()

bool hal::cte::is_control_pin ( PinType  pin_type)

Definition at line 83 of file utils.cpp.

References hal::clock, hal::enable, hal::reset, hal::select, and hal::set.

Referenced by is_connected_to_control_pin().

◆ is_delay()

bool hal::cte::is_delay ( const Gate *  gate)

◆ is_ff()

bool hal::cte::is_ff ( const Gate *  gate)

◆ is_inverter()

bool hal::cte::is_inverter ( const Gate *  gate)

◆ is_latch()

bool hal::cte::is_latch ( const Gate *  gate)

◆ is_mux()

bool hal::cte::is_mux ( const Gate *  gate)

Definition at line 68 of file utils.cpp.

References hal::c_mux, hal::Gate::get_type(), and hal::GateType::has_property().

◆ is_oscillator()

bool hal::cte::is_oscillator ( const Gate *  gate)

Definition at line 73 of file utils.cpp.

References hal::Gate::get_type(), hal::GateType::has_property(), and hal::oscillator.

◆ is_pll()

bool hal::cte::is_pll ( const Gate *  gate)

Definition at line 78 of file utils.cpp.

References hal::Gate::get_type(), hal::GateType::has_property(), and hal::pll.

◆ read_parameter_coordinate()

std::optional< double > hal::cte::read_parameter_coordinate ( const Gate *  gate,
const std::string &  name 
)

Read a coordinate from a gate parameter, e.g., a Verilog instance parameter.

The parameter must hold a finite number and nothing else apart from surrounding white space, e.g., "-600", "12.5" or "0x10", which is how HAL stores bit vectors.

Parameters
[in]gate- The gate.
[in]name- The name of the parameter.
Returns
The coordinate, or std::nullopt if the parameter is missing or holds no number.

Definition at line 94 of file utils.cpp.

References hal::error, hal::Result< T >::get(), hal::DataContainer::get_parameter_value(), hal::Result< T >::is_error(), and name.

Referenced by hal::ctv::build_layout(), and export_dot().

◆ recover_branches()

Result< std::vector< Branch > > hal::cte::recover_branches ( const ClockTree &  clock_tree)

Recover all branches of a clock tree.

Runs a depth-first search from every root and collects each root-to-sink path. A sink is a vertex without successors. Vertices reachable over several paths show up in several branches.

Parameters
[in]clock_tree- The clock tree.
Returns
The branches, each ordered from root to sink, or an error.

Definition at line 78 of file branches.cpp.

References ERR, hal::cte::ClockTree::get_ptr_from_vertex(), hal::cte::ClockTree::get_roots(), and OK.

Referenced by hal::PYBIND11_PLUGIN().