HAL  v4.5.0-283-g3f42a39fa
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
clock_tree_layout.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4 // Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6 // Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7 // Copyright (c) 2025-2026 Sascha Tommasone. All rights reserved.
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included in all
17 // copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 // SOFTWARE.
26 
27 #pragma once
28 
29 #include "hal_core/defines.h"
31 
32 #include <cstddef>
33 #include <optional>
34 #include <string>
35 #include <vector>
36 
37 namespace hal
38 {
39  namespace cte
40  {
41  class ClockTree;
42  }
43 
48  namespace ctv
49  {
51  constexpr double MAX_PICTURE_SIDE_PIXELS = 10000.0;
52 
54  inline const std::string DEFAULT_X_KEY = "X";
55  inline const std::string DEFAULT_Y_KEY = "Y";
56 
58  struct Node
59  {
61  double x;
62  double y;
63  };
64 
66  struct Edge
67  {
68  std::size_t from;
69  std::size_t to;
70  };
71 
73  struct Layout
74  {
76  std::vector<Node> nodes;
77 
79  std::vector<Edge> edges;
80 
82  std::vector<u32> gates_without_coordinates;
83 
85  std::size_t omitted_edges = 0;
86  };
87 
93  {
94  std::optional<double> node_radius;
95  std::optional<double> edge_width;
96  std::optional<double> picture_margin;
97  std::optional<double> pixels_per_unit;
98  };
99 
101  struct Style
102  {
104  double node_radius;
105 
107  double edge_width;
108 
111 
117 
120  };
121 
137  const std::optional<std::string> &x_key = std::nullopt,
138  const std::optional<std::string> &y_key = std::nullopt );
139 
155  Result<Style> resolve_style( const Layout &layout, const StyleOverrides &overrides );
156  } // namespace ctv
157 } // namespace hal
uint32_t u32
Definition: defines.h:41
constexpr double MAX_PICTURE_SIDE_PIXELS
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)
const std::string DEFAULT_Y_KEY
Result< Style > resolve_style(const Layout &layout, const StyleOverrides &overrides)
const std::string DEFAULT_X_KEY
Definition: defines.h:45
std::size_t from
std::vector< u32 > gates_without_coordinates
std::size_t omitted_edges
std::vector< Node > nodes
std::vector< Edge > edges
std::optional< double > edge_width
std::optional< double > pixels_per_unit
std::optional< double > node_radius
std::optional< double > picture_margin