@@ -22,4 +22,160 @@ typedef std::vector<vtr::NdMatrix<std::vector<int>, 5>> t_pin_to_track_lookup;
22
22
23
23
typedef std::vector<vtr::NdMatrix<std::vector<int >, 5 >> t_track_to_pin_lookup;
24
24
25
+ /* *
26
+ * @brief Lists detailed information about wire segments. [0 .. W-1].
27
+ */
28
+ struct t_seg_details {
29
+ /* * @brief Length (in clbs) of the segment. */
30
+ int length = 0 ;
31
+
32
+ /* * @brief Index at which a segment starts in channel 0. */
33
+ int start = 0 ;
34
+
35
+ /* * @brief True if this segment spans the entire channel. */
36
+ bool longline = false ;
37
+
38
+ /* * @brief [0..length]: true for every channel intersection, relative to the
39
+ * segment start, at which there is a switch box.
40
+ */
41
+ std::unique_ptr<bool []> sb;
42
+
43
+ /* * @brief [0..length-1]: true for every logic block along the segment at
44
+ * which there is a connection box.
45
+ */
46
+ std::unique_ptr<bool []> cb;
47
+
48
+ /* * @brief Index of the switch type that connects other wires to this segment.
49
+ * Note that this index is in relation to the switches from the architecture
50
+ * file, not the expanded list of switches that is built at the end of build_rr_graph.
51
+ */
52
+ short arch_wire_switch = 0 ;
53
+
54
+ /* * @brief Index of the switch type that connects output pins (OPINs) *to* this segment.
55
+ * Note that this index is in relation to the switches from the architecture
56
+ * file, not the expanded list of switches that is built at the end of build_rr_graph.
57
+ */
58
+ short arch_opin_switch = 0 ;
59
+
60
+ /* * @brief Index of the switch type that connects output pins (OPINs) *to* this segment
61
+ * from *another dice*. Note that this index is in relation to the switches from the
62
+ * architecture file, not the expanded list of switches that is built at the end of
63
+ * build_rr_graph.
64
+ */
65
+ short arch_inter_die_switch = 0 ;
66
+
67
+ /* * @brief Resistance of a routing track, per unit logic block length. */
68
+ float Rmetal = 0 ;
69
+
70
+ /* * @brief Capacitance of a routing track, per unit logic block length. */
71
+ float Cmetal = 0 ;
72
+
73
+ /* * @brief Whether the segment is twisted. */
74
+ bool twisted = false ;
75
+
76
+ /* * @brief Direction of the segment. */
77
+ enum Direction direction = Direction::NONE;
78
+
79
+ /* * @brief Index of the first logic block in the group. */
80
+ int group_start = 0 ;
81
+
82
+ /* * @brief Size of the group. */
83
+ int group_size = 0 ;
84
+
85
+ /* * @brief index of the segment type used for this track.
86
+ * Note that this index will store the index of the segment
87
+ * relative to its **parallel** segment types, not all segments
88
+ * as stored in device_ctx. Look in rr_graph.cpp: build_rr_graph
89
+ * for details but here is an example: say our segment_inf_vec in
90
+ * device_ctx is as follows: [seg_a_x, seg_b_x, seg_a_y, seg_b_y]
91
+ * when building the rr_graph, static segment_inf_vectors will be
92
+ * created for each direction, thus you will have the following
93
+ * 2 vectors: X_vec =[seg_a_x,seg_b_x] and Y_vec = [seg_a_y,seg_b_y].
94
+ * As a result, e.g. seg_b_y::index == 1 (index in Y_vec)
95
+ * and != 3 (index in device_ctx segment_inf_vec).
96
+ */
97
+ int index = 0 ;
98
+
99
+ /* * @brief index is relative to the segment_inf vec as stored in device_ctx.
100
+ * Note that the above vector is **unifies** both x-parallel and
101
+ * y-parallel segments and is loaded up originally in read_xml_arch_file.cpp
102
+ */
103
+ int abs_index = 0 ;
104
+
105
+ /* * @brief Used for power */
106
+ float Cmetal_per_m = 0 ;
107
+
108
+ /* * @brief Name of the segment type. */
109
+ std::string type_name;
110
+ };
111
+
112
+ class t_chan_seg_details {
113
+ public:
114
+ t_chan_seg_details () = default ;
115
+ t_chan_seg_details (const t_seg_details* init_seg_details)
116
+ : length_(init_seg_details->length)
117
+ , seg_detail_(init_seg_details) {}
118
+
119
+ public:
120
+ int length () const { return length_; }
121
+ int seg_start () const { return seg_start_; }
122
+ int seg_end () const { return seg_end_; }
123
+
124
+ int start () const { return seg_detail_->start ; }
125
+ bool longline () const { return seg_detail_->longline ; }
126
+
127
+ int group_start () const { return seg_detail_->group_start ; }
128
+ int group_size () const { return seg_detail_->group_size ; }
129
+
130
+ bool cb (int pos) const { return seg_detail_->cb [pos]; }
131
+ bool sb (int pos) const { return seg_detail_->sb [pos]; }
132
+
133
+ float Rmetal () const { return seg_detail_->Rmetal ; }
134
+ float Cmetal () const { return seg_detail_->Cmetal ; }
135
+ float Cmetal_per_m () const { return seg_detail_->Cmetal_per_m ; }
136
+
137
+ short arch_wire_switch () const { return seg_detail_->arch_wire_switch ; }
138
+ short arch_opin_switch () const { return seg_detail_->arch_opin_switch ; }
139
+ short arch_inter_die_switch () const { return seg_detail_->arch_inter_die_switch ; }
140
+
141
+ Direction direction () const { return seg_detail_->direction ; }
142
+
143
+ int index () const { return seg_detail_->index ; }
144
+ int abs_index () const { return seg_detail_->abs_index ; }
145
+
146
+ const vtr::string_view type_name () const {
147
+ return vtr::string_view (
148
+ seg_detail_->type_name .data (),
149
+ seg_detail_->type_name .size ());
150
+ }
151
+
152
+ public: // Modifiers
153
+ void set_length (int new_len) { length_ = new_len; }
154
+ void set_seg_start (int new_start) { seg_start_ = new_start; }
155
+ void set_seg_end (int new_end) { seg_end_ = new_end; }
156
+
157
+ private:
158
+ // The only unique information about a channel segment is it's start/end
159
+ // and length. All other information is shared across segment types,
160
+ // so we use a flyweight to the t_seg_details which defines that info.
161
+ //
162
+ // To preserve the illusion of uniqueness we wrap all t_seg_details members
163
+ // so it appears transparent -- client code of this class doesn't need to
164
+ // know about t_seg_details.
165
+ int length_ = -1 ;
166
+ int seg_start_ = -1 ;
167
+ int seg_end_ = -1 ;
168
+ const t_seg_details* seg_detail_ = nullptr ;
169
+ };
170
+
171
+ /* *
172
+ * @typedef t_chan_details
173
+ * @brief Defines a 3-D array of t_chan_seg_details structures (one for each horizontal and vertical channel).
174
+ *
175
+ * Once allocated in rr_graph2.cpp, it can be accessed as:
176
+ * [0..grid.width()][0..grid.height()][0..num_tracks-1]
177
+ */
178
+ typedef vtr::NdMatrix<t_chan_seg_details, 3 > t_chan_details;
179
+
180
+
25
181
#endif
0 commit comments