|
4 | 4 | #include "vtr_log.h" |
5 | 5 |
|
6 | 6 | #include "arch_util.h" |
| 7 | +#include "arch_types.h" |
7 | 8 |
|
8 | 9 | static bool switch_type_is_buffered(SwitchType type); |
9 | 10 | static bool switch_type_is_configurable(SwitchType type); |
@@ -194,6 +195,131 @@ std::string t_pb_graph_node::hierarchical_type_name() const { |
194 | 195 | return vtr::join(names.rbegin(), names.rend(), "/"); |
195 | 196 | } |
196 | 197 |
|
| 198 | +void t_pb_graph_node::update_pins() { |
| 199 | + int i, j, i_input = 0, i_output = 0, i_clockport = 0; |
| 200 | + t_port* pb_type_ports = pb_type->ports_sec; |
| 201 | + |
| 202 | + VTR_ASSERT(this->has_secondary == false); |
| 203 | + this->has_secondary = true; |
| 204 | + |
| 205 | + int pin_count_in_cluster; |
| 206 | + for (i = 0; i < this->pb_type->num_ports; i++) { |
| 207 | + if (pb_type_ports[i].model_port) { |
| 208 | + VTR_ASSERT(this->pb_type->num_modes == 0); |
| 209 | + } else { |
| 210 | + VTR_ASSERT(this->pb_type->num_modes != 0 || pb_type_ports[i].is_clock); |
| 211 | + } |
| 212 | + if (pb_type_ports[i].type == IN_PORT && !pb_type_ports[i].is_clock) { |
| 213 | + this->input_pins_sec = new t_pb_graph_pin* [this->num_input_ports] { nullptr }; |
| 214 | + this->input_pins_sec[i_input] = new t_pb_graph_pin[pb_type_ports[i].num_pins]; |
| 215 | + for (j = 0; j < pb_type_ports[i].num_pins; j++) { |
| 216 | + this->input_pins_sec[i_input][j].pin_number = j; |
| 217 | + this->input_pins_sec[i_input][j].port = &pb_type_ports[i]; |
| 218 | + this->input_pins_sec[i_input][j].parent_node = this; |
| 219 | + this->input_pins_sec[i_input][j].pin_count_in_cluster = this->input_pins[i_input][j].pin_count_in_cluster; |
| 220 | + this->input_pins_sec[i_input][j].parent_pin_class = this->input_pins[i_input][j].parent_pin_class; |
| 221 | + if (this->pb_type->blif_model != nullptr) { |
| 222 | + if (strcmp(this->pb_type->blif_model, MODEL_OUTPUT) == 0) { |
| 223 | + this->input_pins_sec[i_input][j].type = PB_PIN_OUTPAD; |
| 224 | + } else if (this->num_clock_ports != 0) { |
| 225 | + this->input_pins_sec[i_input][j].type = PB_PIN_SEQUENTIAL; |
| 226 | + } else { |
| 227 | + this->input_pins_sec[i_input][j].type = PB_PIN_TERMINAL; |
| 228 | + } |
| 229 | + } |
| 230 | + pin_count_in_cluster++; |
| 231 | + |
| 232 | + //Copy timings from primary pins |
| 233 | + // sequential timing information |
| 234 | + this->input_pins_sec[i_input][j].tsu = this->input_pins[i_input][j].tsu; |
| 235 | + this->input_pins_sec[i_input][j].thld = this->input_pins[i_input][j].thld; |
| 236 | + this->input_pins_sec[i_input][j].tco_min = this->input_pins[i_input][j].tco_min; |
| 237 | + this->input_pins_sec[i_input][j].tco_max = this->input_pins[i_input][j].tco_max; |
| 238 | + //this->input_pins_sec[i_input][j].t_pb_graph_pin* associated_clock_pin = nullptr; /* For sequentail elements, the associated clock */ |
| 239 | + |
| 240 | + // combinational timing information |
| 241 | + this->input_pins_sec[i_input][j].num_pin_timing = this->input_pins[i_input][j].num_pin_timing; |
| 242 | + this->input_pins_sec[i_input][j].pin_timing_del_max = this->input_pins[i_input][j].pin_timing_del_max; |
| 243 | + this->input_pins_sec[i_input][j].pin_timing_del_min = this->input_pins[i_input][j].pin_timing_del_min; |
| 244 | + this->input_pins_sec[i_input][j].num_pin_timing_del_max_annotated = this->input_pins[i_input][j].num_pin_timing_del_max_annotated; |
| 245 | + this->input_pins_sec[i_input][j].num_pin_timing_del_min_annotated = this->input_pins[i_input][j].num_pin_timing_del_min_annotated; |
| 246 | + //this->input_pins_sec[i_input][j].std::vector<t_pb_graph_pin*> pin_timing; /* timing edge sink pins [0..num_pin_timing-1]*/ |
| 247 | + } |
| 248 | + i_input++; |
| 249 | + } else if (pb_type_ports[i].type == OUT_PORT) { |
| 250 | + this->output_pins_sec = new t_pb_graph_pin* [this->num_input_ports] { nullptr }; |
| 251 | + this->output_pins_sec[i_output] = new t_pb_graph_pin[pb_type_ports[i].num_pins]; |
| 252 | + for (j = 0; j < pb_type_ports[i].num_pins; j++) { |
| 253 | + this->output_pins_sec[i_output][j].pin_number = j; |
| 254 | + this->output_pins_sec[i_output][j].port = &pb_type_ports[i]; |
| 255 | + this->output_pins_sec[i_output][j].parent_node = this; |
| 256 | + this->output_pins_sec[i_output][j].pin_count_in_cluster = this->output_pins[i_output][j].pin_count_in_cluster; |
| 257 | + this->output_pins_sec[i_output][j].parent_pin_class = this->output_pins[i_output][j].parent_pin_class; |
| 258 | + this->output_pins_sec[i_output][j].list_of_connectable_input_pin_ptrs = this->output_pins[i_output][j].list_of_connectable_input_pin_ptrs; |
| 259 | + this->output_pins_sec[i_output][j].num_connectable_primitive_input_pins = this->output_pins[i_output][j].num_connectable_primitive_input_pins; |
| 260 | + if (this->pb_type->blif_model != nullptr) { |
| 261 | + if (strcmp(this->pb_type->blif_model, MODEL_INPUT) == 0) { |
| 262 | + this->output_pins_sec[i_output][j].type = PB_PIN_INPAD; |
| 263 | + } else if (this->num_clock_ports != 0) { |
| 264 | + this->output_pins_sec[i_output][j].type = PB_PIN_SEQUENTIAL; |
| 265 | + } else { |
| 266 | + this->output_pins_sec[i_output][j].type = PB_PIN_TERMINAL; |
| 267 | + } |
| 268 | + } |
| 269 | + pin_count_in_cluster++; |
| 270 | + |
| 271 | + //Copy timings from primary pins |
| 272 | + // sequential timing information |
| 273 | + this->output_pins_sec[i_output][j].tsu = this->output_pins[i_output][j].tsu; |
| 274 | + this->output_pins_sec[i_output][j].thld = this->output_pins[i_output][j].thld; |
| 275 | + this->output_pins_sec[i_output][j].tco_min = this->output_pins[i_output][j].tco_min; |
| 276 | + this->output_pins_sec[i_output][j].tco_max = this->output_pins[i_output][j].tco_max; |
| 277 | + //this->output_pins_sec[i_input][j].t_pb_graph_pin* associated_clock_pin = nullptr; /* For sequentail elements, the associated clock */ |
| 278 | + |
| 279 | + // combinational timing information |
| 280 | + this->output_pins_sec[i_output][j].num_pin_timing = this->output_pins[i_output][j].num_pin_timing; |
| 281 | + this->output_pins_sec[i_output][j].pin_timing_del_max = this->output_pins[i_output][j].pin_timing_del_max; |
| 282 | + this->output_pins_sec[i_output][j].pin_timing_del_min = this->output_pins[i_output][j].pin_timing_del_min; |
| 283 | + this->output_pins_sec[i_output][j].num_pin_timing_del_max_annotated = this->output_pins[i_output][j].num_pin_timing_del_max_annotated; |
| 284 | + this->output_pins_sec[i_output][j].num_pin_timing_del_min_annotated = this->output_pins[i_output][j].num_pin_timing_del_min_annotated; |
| 285 | + //this->output_pins_sec[i_input][j].std::vector<t_pb_graph_pin*> pin_timing; /* timing edge sink pins [0..num_pin_timing-1]*/ |
| 286 | + } |
| 287 | + i_output++; |
| 288 | + } else { |
| 289 | + VTR_ASSERT(pb_type_ports[i].is_clock && pb_type_ports[i].type == IN_PORT); |
| 290 | + this->clock_pins_sec = new t_pb_graph_pin* [this->num_input_ports] { nullptr }; |
| 291 | + this->clock_pins_sec[i_clockport] = new t_pb_graph_pin[pb_type_ports[i].num_pins]; |
| 292 | + for (j = 0; j < pb_type_ports[i].num_pins; j++) { |
| 293 | + this->clock_pins_sec[i_clockport][j].pin_number = j; |
| 294 | + this->clock_pins_sec[i_clockport][j].port = &pb_type_ports[i]; |
| 295 | + this->clock_pins_sec[i_clockport][j].parent_node = this; |
| 296 | + this->clock_pins_sec[i_clockport][j].pin_count_in_cluster = this->clock_pins[i_clockport][j].pin_count_in_cluster; |
| 297 | + this->clock_pins_sec[i_clockport][j].parent_pin_class = this->clock_pins[i_clockport][j].parent_pin_class; |
| 298 | + if (this->pb_type->blif_model != nullptr) { |
| 299 | + this->clock_pins_sec[i_clockport][j].type = PB_PIN_CLOCK; |
| 300 | + } |
| 301 | + pin_count_in_cluster++; |
| 302 | + |
| 303 | + //Copy timings from primary pins |
| 304 | + // sequential timing information |
| 305 | + this->clock_pins_sec[i_clockport][j].tsu = this->clock_pins[i_clockport][j].tsu; |
| 306 | + this->clock_pins_sec[i_clockport][j].thld = this->clock_pins[i_clockport][j].thld; |
| 307 | + this->clock_pins_sec[i_clockport][j].tco_min = this->clock_pins[i_clockport][j].tco_min; |
| 308 | + this->clock_pins_sec[i_clockport][j].tco_max = this->clock_pins[i_clockport][j].tco_max; |
| 309 | + //this->clock_pins_sec[i_clockport][j].t_pb_graph_pin* associated_clock_pin = nullptr; /* For sequentail elements, the associated clock */ |
| 310 | + |
| 311 | + // combinational timing information |
| 312 | + this->clock_pins_sec[i_clockport][j].num_pin_timing = this->clock_pins[i_clockport][j].num_pin_timing; |
| 313 | + this->clock_pins_sec[i_clockport][j].pin_timing_del_max = this->clock_pins[i_clockport][j].pin_timing_del_max; |
| 314 | + this->clock_pins_sec[i_clockport][j].pin_timing_del_min = this->clock_pins[i_clockport][j].pin_timing_del_min; |
| 315 | + this->clock_pins_sec[i_clockport][j].num_pin_timing_del_max_annotated = this->clock_pins[i_clockport][j].num_pin_timing_del_max_annotated; |
| 316 | + this->clock_pins_sec[i_clockport][j].num_pin_timing_del_min_annotated = this->clock_pins[i_clockport][j].num_pin_timing_del_min_annotated; |
| 317 | + //this->clock_pins_sec[i_clockport][j].std::vector<t_pb_graph_pin*> pin_timing; /* timing edge sink pins [0..num_pin_timing-1]*/ |
| 318 | + } |
| 319 | + i_clockport++; |
| 320 | + } |
| 321 | + } |
| 322 | +} |
197 | 323 | /** |
198 | 324 | * t_pb_graph_pin |
199 | 325 | */ |
|
0 commit comments