@@ -159,20 +159,18 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
159
159
// Check from the pb_type's delay annotations match the model
160
160
//
161
161
// This ensures that the pb_types' delay annotations are consistent with the model
162
- for (int i = 0 ; i < pb_type->num_annotations ; ++i) {
163
- const t_pin_to_pin_annotation* annot = &pb_type->annotations [i];
164
-
165
- if (annot->type == E_ANNOT_PIN_TO_PIN_DELAY) {
162
+ for (const t_pin_to_pin_annotation& annotation : pb_type->annotations ) {
163
+ if (annotation.type == E_ANNOT_PIN_TO_PIN_DELAY) {
166
164
// Check that any combinational delays specified match the 'combinational_sinks_ports' in the model
167
165
168
- if (annot-> clock ) {
166
+ if (annotation. clock ) {
169
167
// Sequential annotation, check that the clock on the specified port matches the model
170
168
171
169
// Annotations always put the pin in the input_pins field
172
- VTR_ASSERT (annot-> input_pins );
173
- for (const std::string& input_pin : vtr::split (annot-> input_pins )) {
170
+ VTR_ASSERT (annotation. input_pins );
171
+ for (const std::string& input_pin : vtr::split (annotation. input_pins )) {
174
172
InstPort annot_port (input_pin);
175
- for (const std::string& clock : vtr::split (annot-> clock )) {
173
+ for (const std::string& clock : vtr::split (annotation. clock )) {
176
174
InstPort annot_clock (clock);
177
175
178
176
// Find the model port
@@ -187,34 +185,34 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
187
185
if (model_port != nullptr ) break ;
188
186
}
189
187
if (model_port == nullptr ) {
190
- archfpga_throw (get_arch_file_name (), annot-> line_num ,
188
+ archfpga_throw (get_arch_file_name (), annotation. line_num ,
191
189
" Failed to find port '%s' on '%s' for sequential delay annotation" ,
192
190
annot_port.port_name ().c_str (), annot_port.instance_name ().c_str ());
193
191
}
194
192
195
193
// Check that the clock matches the model definition
196
194
std::string model_clock = model_port->clock ;
197
195
if (model_clock.empty ()) {
198
- archfpga_throw (get_arch_file_name (), annot-> line_num ,
196
+ archfpga_throw (get_arch_file_name (), annotation. line_num ,
199
197
" <pb_type> timing-annotation/<model> mismatch on port '%s' of model '%s', model specifies"
200
198
" no clock but timing annotation specifies '%s'" ,
201
199
annot_port.port_name ().c_str (), model.name , annot_clock.port_name ().c_str ());
202
200
}
203
201
if (model_port->clock != annot_clock.port_name ()) {
204
- archfpga_throw (get_arch_file_name (), annot-> line_num ,
202
+ archfpga_throw (get_arch_file_name (), annotation. line_num ,
205
203
" <pb_type> timing-annotation/<model> mismatch on port '%s' of model '%s', model specifies"
206
204
" clock as '%s' but timing annotation specifies '%s'" ,
207
205
annot_port.port_name ().c_str (), model.name , model_clock.c_str (), annot_clock.port_name ().c_str ());
208
206
}
209
207
}
210
208
}
211
209
212
- } else if (annot-> input_pins && annot-> output_pins ) {
210
+ } else if (annotation. input_pins && annotation. output_pins ) {
213
211
// Combinational annotation
214
- VTR_ASSERT_MSG (!annot-> clock , " Combinational annotations should have no clock" );
215
- for (const std::string& input_pin : vtr::split (annot-> input_pins )) {
212
+ VTR_ASSERT_MSG (!annotation. clock , " Combinational annotations should have no clock" );
213
+ for (const std::string& input_pin : vtr::split (annotation. input_pins )) {
216
214
InstPort annot_in (input_pin);
217
- for (const std::string& output_pin : vtr::split (annot-> output_pins )) {
215
+ for (const std::string& output_pin : vtr::split (annotation. output_pins )) {
218
216
InstPort annot_out (output_pin);
219
217
220
218
// Find the input model port
@@ -227,7 +225,7 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
227
225
}
228
226
229
227
if (model_port == nullptr ) {
230
- archfpga_throw (get_arch_file_name (), annot-> line_num ,
228
+ archfpga_throw (get_arch_file_name (), annotation. line_num ,
231
229
" Failed to find port '%s' on '%s' for combinational delay annotation" ,
232
230
annot_in.port_name ().c_str (), annot_in.instance_name ().c_str ());
233
231
}
@@ -237,7 +235,7 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
237
235
auto e = model_port->combinational_sink_ports .end ();
238
236
auto iter = std::find (b, e, annot_out.port_name ());
239
237
if (iter == e) {
240
- archfpga_throw (get_arch_file_name (), annot-> line_num ,
238
+ archfpga_throw (get_arch_file_name (), annotation. line_num ,
241
239
" <pb_type> timing-annotation/<model> mismatch on port '%s' of model '%s', timing annotation"
242
240
" specifies combinational connection to port '%s' but the connection does not exist in the model" ,
243
241
model_port->name , model.name , annot_out.port_name ().c_str ());
@@ -276,8 +274,8 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
276
274
277
275
if (model_port->dir == IN_PORT) {
278
276
// Sequential inputs must have a T_setup or T_hold
279
- if (find_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_TSETUP) == nullptr
280
- && find_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_THOLD) == nullptr ) {
277
+ if (! has_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_TSETUP)
278
+ && ! has_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_THOLD)) {
281
279
std::stringstream msg;
282
280
msg << " <pb_type> '" << pb_type->name << " ' timing-annotation/<model> mismatch on" ;
283
281
msg << " port '" << model_port->name << " ' of model '" << model.name << " '," ;
@@ -293,8 +291,8 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
293
291
294
292
if (!model_port->combinational_sink_ports .empty ()) {
295
293
// Sequential input with internal combinational connectsion it must also have T_clock_to_Q
296
- if (find_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_CLOCK_TO_Q_MAX) == nullptr
297
- && find_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_CLOCK_TO_Q_MIN) == nullptr ) {
294
+ if (! has_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_CLOCK_TO_Q_MAX)
295
+ && ! has_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_CLOCK_TO_Q_MIN)) {
298
296
std::stringstream msg;
299
297
msg << " <pb_type> '" << pb_type->name << " ' timing-annotation/<model> mismatch on" ;
300
298
msg << " port '" << model_port->name << " ' of model '" << model.name << " '," ;
@@ -313,8 +311,8 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
313
311
} else {
314
312
VTR_ASSERT (model_port->dir == OUT_PORT);
315
313
// Sequential outputs must have T_clock_to_Q
316
- if (find_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_CLOCK_TO_Q_MAX) == nullptr
317
- && find_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_CLOCK_TO_Q_MIN) == nullptr ) {
314
+ if (! has_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_CLOCK_TO_Q_MAX)
315
+ && ! has_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_CLOCK_TO_Q_MIN)) {
318
316
std::stringstream msg;
319
317
msg << " <pb_type> '" << pb_type->name << " ' timing-annotation/<model> mismatch on" ;
320
318
msg << " port '" << model_port->name << " ' of model '" << model.name << " '," ;
@@ -330,8 +328,8 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
330
328
331
329
if (comb_connected_outputs.count (model_port->name )) {
332
330
// Sequential output with internal combinational connectison must have T_setup/T_hold
333
- if (find_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_TSETUP) == nullptr
334
- && find_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_THOLD) == nullptr ) {
331
+ if (! has_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_TSETUP)
332
+ && ! has_sequential_annotation (pb_type, model_port, E_ANNOT_PIN_TO_PIN_DELAY_THOLD)) {
335
333
std::stringstream msg;
336
334
msg << " <pb_type> '" << pb_type->name << " ' timing-annotation/<model> mismatch on" ;
337
335
msg << " port '" << model_port->name << " ' of model '" << model.name << " '," ;
@@ -352,7 +350,7 @@ bool check_leaf_pb_model_timing_consistency(const t_pb_type* pb_type, const t_ar
352
350
// Check that combinationally connected inputs/outputs have combinational delays between them
353
351
if (model_port->dir == IN_PORT) {
354
352
for (const auto & sink_port : model_port->combinational_sink_ports ) {
355
- if (find_combinational_annotation (pb_type, model_port->name , sink_port) == nullptr ) {
353
+ if (! has_combinational_annotation (pb_type, model_port->name , sink_port)) {
356
354
std::stringstream msg;
357
355
msg << " <pb_type> '" << pb_type->name << " ' timing-annotation/<model> mismatch on" ;
358
356
msg << " port '" << model_port->name << " ' of model '" << model.name << " '," ;
0 commit comments