181 int i, j, k, i_input, i_output, i_clockport;
183 pb_graph_node->placement_index = index;
184 pb_graph_node->pb_type = pb_type;
185 pb_graph_node->parent_pb_graph_node = parent_pb_graph_node;
187 pb_graph_node->num_input_ports = 0;
188 pb_graph_node->num_output_ports = 0;
189 pb_graph_node->num_clock_ports = 0;
192 for (i = 0; i < pb_type->num_ports; i++) {
193 if (pb_type->ports[i].type ==
IN_PORT && !pb_type->ports[i].is_clock) {
194 pb_graph_node->num_input_ports++;
195 }
else if (pb_type->ports[i].type ==
OUT_PORT) {
196 assert(!pb_type->ports[i].is_clock);
197 pb_graph_node->num_output_ports++;
200 pb_type->ports[i].is_clock && pb_type->ports[i].type ==
IN_PORT);
201 pb_graph_node->num_clock_ports++;
205 pb_graph_node->num_input_pins = (
int*)
my_calloc(
206 pb_graph_node->num_input_ports,
sizeof(
int));
207 pb_graph_node->num_output_pins = (
int*)
my_calloc(
208 pb_graph_node->num_output_ports,
sizeof(
int));
209 pb_graph_node->num_clock_pins = (
int*)
my_calloc(
210 pb_graph_node->num_clock_ports,
sizeof(
int));
219 i_input = i_output = i_clockport = 0;
220 for (i = 0; i < pb_type->num_ports; i++) {
221 if (pb_type->ports[i].model_port) {
222 assert(pb_type->num_modes == 0);
224 assert(pb_type->num_modes != 0 || pb_type->ports[i].is_clock);
226 if (pb_type->ports[i].type ==
IN_PORT && !pb_type->ports[i].is_clock) {
229 pb_graph_node->num_input_pins[i_input] = pb_type->ports[i].num_pins;
230 for (j = 0; j < pb_type->ports[i].num_pins; j++) {
231 pb_graph_node->input_pins[i_input][j].input_edges = NULL;
232 pb_graph_node->input_pins[i_input][j].num_input_edges = 0;
233 pb_graph_node->input_pins[i_input][j].output_edges = NULL;
234 pb_graph_node->input_pins[i_input][j].num_output_edges = 0;
235 pb_graph_node->input_pins[i_input][j].pin_number = j;
236 pb_graph_node->input_pins[i_input][j].port = &pb_type->ports[i];
237 pb_graph_node->input_pins[i_input][j].parent_node =
239 pb_graph_node->input_pins[i_input][j].pin_count_in_cluster =
242 if (pb_graph_node->pb_type->blif_model != NULL ) {
243 if (strcmp(pb_graph_node->pb_type->blif_model,
".output")
245 pb_graph_node->input_pins[i_input][j].type =
247 }
else if (pb_graph_node->num_clock_ports != 0) {
248 pb_graph_node->input_pins[i_input][j].type =
251 pb_graph_node->input_pins[i_input][j].type =
258 }
else if (pb_type->ports[i].type ==
OUT_PORT) {
261 pb_graph_node->num_output_pins[i_output] =
262 pb_type->ports[i].num_pins;
263 for (j = 0; j < pb_type->ports[i].num_pins; j++) {
264 pb_graph_node->output_pins[i_output][j].input_edges = NULL;
265 pb_graph_node->output_pins[i_output][j].num_input_edges = 0;
266 pb_graph_node->output_pins[i_output][j].output_edges = NULL;
267 pb_graph_node->output_pins[i_output][j].num_output_edges = 0;
268 pb_graph_node->output_pins[i_output][j].pin_number = j;
269 pb_graph_node->output_pins[i_output][j].port =
271 pb_graph_node->output_pins[i_output][j].parent_node =
273 pb_graph_node->output_pins[i_output][j].pin_count_in_cluster =
275 pb_graph_node->output_pins[i_output][j].type =
PB_PIN_NORMAL;
276 if (pb_graph_node->pb_type->blif_model != NULL ) {
277 if (strcmp(pb_graph_node->pb_type->blif_model,
".input")
279 pb_graph_node->output_pins[i_output][j].type =
281 }
else if (pb_graph_node->num_clock_ports != 0) {
282 pb_graph_node->output_pins[i_output][j].type =
285 pb_graph_node->output_pins[i_output][j].type =
294 pb_type->ports[i].is_clock && pb_type->ports[i].type ==
IN_PORT);
295 pb_graph_node->clock_pins[i_clockport] =
298 pb_graph_node->num_clock_pins[i_clockport] =
299 pb_type->ports[i].num_pins;
300 for (j = 0; j < pb_type->ports[i].num_pins; j++) {
301 pb_graph_node->clock_pins[i_clockport][j].input_edges = NULL;
302 pb_graph_node->clock_pins[i_clockport][j].num_input_edges = 0;
303 pb_graph_node->clock_pins[i_clockport][j].output_edges = NULL;
304 pb_graph_node->clock_pins[i_clockport][j].num_output_edges = 0;
305 pb_graph_node->clock_pins[i_clockport][j].pin_number = j;
306 pb_graph_node->clock_pins[i_clockport][j].port =
308 pb_graph_node->clock_pins[i_clockport][j].parent_node =
310 pb_graph_node->clock_pins[i_clockport][j].pin_count_in_cluster =
312 pb_graph_node->clock_pins[i_clockport][j].type =
PB_PIN_NORMAL;
313 if (pb_graph_node->pb_type->blif_model != NULL ) {
314 pb_graph_node->clock_pins[i_clockport][j].type =
324 if (load_power_structures) {
327 pb_graph_node->pb_node_power->transistor_cnt_buffers = 0.;
328 pb_graph_node->pb_node_power->transistor_cnt_interc = 0.;
329 pb_graph_node->pb_node_power->transistor_cnt_pb_children = 0.;
335 for (i = 0; i < pb_type->num_modes; i++) {
337 pb_type->modes[i].num_pb_type_children,
339 for (j = 0; j < pb_type->modes[i].num_pb_type_children; j++) {
340 pb_graph_node->child_pb_graph_nodes[i][j] =
342 pb_type->modes[i].pb_type_children[j].num_pb,
344 for (k = 0; k < pb_type->modes[i].pb_type_children[j].num_pb; k++) {
346 &pb_graph_node->child_pb_graph_nodes[i][j][k],
347 pb_graph_node, &pb_type->modes[i].pb_type_children[j],
348 k, load_power_structures);
355 for (i = 0; i < pb_type->num_modes; i++) {
358 pb_graph_node->child_pb_graph_nodes[i], &pb_type->modes[i],
359 load_power_structures);
static void alloc_and_load_pb_graph(INOUTP t_pb_graph_node *pb_graph_node, INP t_pb_graph_node *parent_pb_graph_node, INP t_pb_type *pb_type, INP int index, boolean load_power_structures)
void * my_calloc(size_t nelem, size_t size)
static int pin_count_in_cluster
static void alloc_and_load_mode_interconnect(INOUTP t_pb_graph_node *pb_graph_parent_node, INOUTP t_pb_graph_node **pb_graph_children_nodes, INP const t_mode *mode, boolean load_power_structures)