HAL  v4.5.0-283-g3f42a39fa
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::ctv Namespace Reference

Classes

struct  Node
 
struct  Edge
 
struct  Layout
 
struct  StyleOverrides
 
struct  Style
 

Functions

Result< Layout > build_layout (const cte::ClockTree &tree, const std::optional< std::string > &x_key=std::nullopt, const std::optional< std::string > &y_key=std::nullopt)
 
Result< Style > resolve_style (const Layout &layout, const StyleOverrides &overrides)
 

Variables

constexpr double MAX_PICTURE_SIDE_PIXELS = 10000.0
 
const std::string DEFAULT_X_KEY = "X"
 
const std::string DEFAULT_Y_KEY = "Y"
 

Detailed Description

Everything the clock tree viewer works out from a clock tree before anything is drawn: where the gates are, how they are connected and how large the drawing is. It does not depend on Qt, so it can be tested without a GUI.

Function Documentation

◆ build_layout()

Result< Layout > hal::ctv::build_layout ( const cte::ClockTree &  tree,
const std::optional< std::string > &  x_key = std::nullopt,
const std::optional< std::string > &  y_key = std::nullopt 
)

Place the gates of a clock tree at their coordinates.

The coordinates of a gate are its 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. Nets have no coordinates; the only nets in a clock tree are the global inputs at its roots, which are not drawn.

Parameters
[in]tree- The clock tree.
[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
The layout on success. An error if only one key is given, the clock tree has no gates or none of them has coordinates. Gates that are only missing some of the coordinates are listed in the layout instead.

Definition at line 114 of file clock_tree_layout.cpp.

References hal::ctv::Layout::edges, ERR, hal::cte::GATE, hal::ctv::Layout::gates_without_coordinates, hal::cte::ClockTree::get_gates(), hal::cte::ClockTree::get_neighbors(), hal::ctv::Layout::nodes, OK, hal::ctv::Layout::omitted_edges, hal::cte::read_parameter_coordinate(), hal::core_strings::to(), type, x, and y.

◆ resolve_style()

Result< Style > hal::ctv::resolve_style ( const Layout &  layout,
const StyleOverrides &  overrides 
)

Settle the sizes of the drawing.

Every size the user did not provide is derived from the length of a typical connection, the median over all connections of the layout: with a typical connection of 25 units, a node has a radius of 1 unit, a line is 0.5 units wide, a picture has a margin of 20 units and 2 pixels per unit. For a layout without connections, a tenth of its extent takes the place of the typical connection.

The resolution is not limited here: only the scene knows how large the drawing really is, including the width of its lines, so it lowers a derived resolution itself when a picture would be too large.

Parameters
[in]layout- The layout that is drawn.
[in]overrides- The sizes provided by the user.
Returns
The sizes on success, an error if a provided size is not a number or out of range.

Definition at line 203 of file clock_tree_layout.cpp.

References hal::ctv::StyleOverrides::edge_width, hal::ctv::Style::edge_width, ERR, hal::ctv::StyleOverrides::node_radius, hal::ctv::Style::node_radius, hal::ctv::Layout::nodes, OK, hal::ctv::StyleOverrides::picture_margin, hal::ctv::Style::picture_margin, hal::ctv::StyleOverrides::pixels_per_unit, hal::ctv::Style::pixels_per_unit, and hal::ctv::Style::pixels_per_unit_is_fixed.

Variable Documentation

◆ DEFAULT_X_KEY

const std::string hal::ctv::DEFAULT_X_KEY = "X"
inline

The gate parameters the viewer reads the coordinates from unless it is given other keys.

Definition at line 54 of file clock_tree_layout.h.

Referenced by hal::PYBIND11_PLUGIN().

◆ DEFAULT_Y_KEY

const std::string hal::ctv::DEFAULT_Y_KEY = "Y"
inline

Definition at line 55 of file clock_tree_layout.h.

Referenced by hal::PYBIND11_PLUGIN().

◆ MAX_PICTURE_SIDE_PIXELS

constexpr double hal::ctv::MAX_PICTURE_SIDE_PIXELS = 10000.0
constexpr

The longest side a picture of the clock tree may have in pixels, which keeps its memory in check.

Definition at line 51 of file clock_tree_layout.h.

Referenced by hal::ClockTreeScene::renderPicture().