Recti 1.2.4
Loading...
Searching...
No Matches
visualize_clock_tree.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <functional>
8#include <string>
9#include <vector>
10
11#include "dme_algorithm.hpp"
12
13namespace recti {
14
19 private:
20 int margin;
21 int node_radius;
22 int wire_width;
23 std::string sink_color;
24 std::string internal_color;
25 std::string root_color;
26 std::string wire_color;
27 std::string text_color;
28
29 public:
30 ClockTreeVisualizer(int margin = 50, int node_radius = 8, int wire_width = 2,
31 const std::string& sink_color = "#4CAF50",
32 const std::string& internal_color = "#2196F3",
33 const std::string& root_color = "#F44336",
34 const std::string& wire_color = "#666666",
35 const std::string& text_color = "#333333")
36 : margin(margin),
37 node_radius(node_radius),
38 wire_width(wire_width),
39 sink_color(sink_color),
40 internal_color(internal_color),
41 root_color(root_color),
42 wire_color(wire_color),
43 text_color(text_color) {}
44
45 std::string visualize_tree(const Tree& tree, NodeIdx root, const std::vector<Sink>& sinks,
46 const std::string& filename = "clock_tree.svg", int width = 800,
47 int height = 600, const SkewAnalysis* analysis = nullptr);
48
49 private:
50 std::vector<NodeIdx> collect_all_nodes(const Tree& tree, NodeIdx root);
51
52 std::tuple<double, double, double, double> calculate_bounds(
53 const std::vector<NodeIdx>& node_indices, const std::vector<Sink>& sinks,
54 const Tree& tree);
55
56 std::vector<std::string> draw_wires(
57 NodeIdx root, const Tree& tree,
58 const std::function<std::pair<double, double>(double, double)>& scale_coord);
59
60 std::vector<std::string> draw_nodes(
61 NodeIdx root, const Tree& tree, const std::vector<Sink>& sinks,
62 const std::function<std::pair<double, double>(double, double)>& scale_coord);
63
64 std::vector<std::string> create_analysis_box(const SkewAnalysis& analysis, int width);
65 };
66
67 std::string create_interactive_svg(const Tree& tree, NodeIdx root,
68 const std::vector<Sink>& sinks,
69 const SkewAnalysis* analysis = nullptr,
70 const std::string& filename = "clock_tree_interactive.svg",
71 int width = 1000, int height = 700);
72
74 const Tree* tree;
76 std::vector<Sink> sinks;
78 std::string title;
79 };
80
81 std::string create_comparison_visualization(const std::vector<TreeComparisonData>& trees_data,
82 const std::string& filename
83 = "clock_tree_comparison.svg",
84 int width = 1200, int height = 800);
85
86 std::string create_delay_model_comparison(const TreeComparisonData& linear_tree_data,
87 const TreeComparisonData& elmore_tree_data,
88 const std::string& filename
89 = "delay_model_comparison.svg");
90
92
93} // namespace recti
Visualizes clock trees in SVG format.
Definition visualize_clock_tree.hpp:18
std::string visualize_tree(const Tree &tree, NodeIdx root, const std::vector< Sink > &sinks, const std::string &filename="clock_tree.svg", int width=800, int height=600, const SkewAnalysis *analysis=nullptr)
ClockTreeVisualizer(int margin=50, int node_radius=8, int wire_width=2, const std::string &sink_color="#4CAF50", const std::string &internal_color="#2196F3", const std::string &root_color="#F44336", const std::string &wire_color="#666666", const std::string &text_color="#333333")
Definition visualize_clock_tree.hpp:30
Arena-allocated tree of TreeNodes.
Definition dme_algorithm.hpp:102
Deferred Merge Embedding (DME) algorithm for clock tree synthesis.
Definition svg_utils.hpp:12
std::string create_interactive_svg(const Tree &tree, NodeIdx root, const std::vector< Sink > &sinks, const SkewAnalysis *analysis=nullptr, const std::string &filename="clock_tree_interactive.svg", int width=1000, int height=700)
std::size_t NodeIdx
Node index type used throughout the DME algorithm.
Definition dme_algorithm.hpp:31
std::string create_delay_model_comparison(const TreeComparisonData &linear_tree_data, const TreeComparisonData &elmore_tree_data, const std::string &filename="delay_model_comparison.svg")
std::string create_comparison_visualization(const std::vector< TreeComparisonData > &trees_data, const std::string &filename="clock_tree_comparison.svg", int width=1200, int height=800)
void visualize_example_tree()
Stores the results of the clock skew analysis for a clock tree.
Definition dme_algorithm.hpp:334
Definition visualize_clock_tree.hpp:73
std::vector< Sink > sinks
Definition visualize_clock_tree.hpp:76
NodeIdx root
Definition visualize_clock_tree.hpp:75
SkewAnalysis analysis
Definition visualize_clock_tree.hpp:77
const Tree * tree
Definition visualize_clock_tree.hpp:74
std::string title
Definition visualize_clock_tree.hpp:78