VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
pb_type_graph.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void alloc_and_load_all_pb_graphs (boolean load_power_structures)
 
void echo_pb_graph (char *filename)
 
void free_all_pb_graph_nodes (void)
 
t_pb_graph_pin *** alloc_and_load_port_pin_ptrs_from_string (INP int line_num, INP const t_pb_graph_node *pb_graph_parent_node, INP t_pb_graph_node **pb_graph_children_nodes, INP const char *port_string, OUTP int **num_ptrs, OUTP int *num_sets, INP boolean is_input_to_interc, INP boolean interconnect_error_check)
 

Function Documentation

void alloc_and_load_all_pb_graphs ( boolean  load_power_structures)

Allocate memory into types and load the pb graph with interconnect edges

Definition at line 89 of file pb_type_graph.c.

89  {
90  int i, errors;
91  edges_head = NULL;
92  num_edges_head = NULL;
93  for (i = 0; i < num_types; i++) {
94  if (type_descriptors[i].pb_type) {
97  sizeof(t_pb_graph_node));
98  alloc_and_load_pb_graph(type_descriptors[i].pb_graph_head, NULL,
99  type_descriptors[i].pb_type, 0, load_power_structures);
104  type_descriptors[i].pb_graph_head);
105  } else {
107  assert(&type_descriptors[i] == EMPTY_TYPE);
108  }
109  }
110 
111  errors = check_pb_graph();
112  if (errors > 0) {
113  vpr_printf(TIO_MESSAGE_ERROR, "in pb graph");
114  exit(1);
115  }
116  for (i = 0; i < num_types; i++) {
117  if (type_descriptors[i].pb_type) {
119  type_descriptors[i].pb_graph_head);
120  }
121  }
122 }
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 load_pb_graph_pin_to_pin_annotations(INOUTP t_pb_graph_node *pb_graph_node)
static struct s_linked_vptr * num_edges_head
Definition: pb_type_graph.c:26
t_type_ptr EMPTY_TYPE
Definition: globals.c:41
static struct s_linked_vptr * edges_head
Definition: pb_type_graph.c:25
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
static int pin_count_in_cluster
Definition: pb_type_graph.c:24
static void alloc_and_load_pin_locations_from_pb_graph(t_type_descriptor *type)
static int check_pb_graph(void)
void load_pin_classes_in_pb_graph_head(INOUTP t_pb_graph_node *pb_graph_node)
int num_types
Definition: globals.c:37
t_pb_graph_node * pb_graph_head
struct s_type_descriptor * type_descriptors
Definition: globals.c:38
messagelogger vpr_printf
Definition: util.c:17

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

t_pb_graph_pin*** alloc_and_load_port_pin_ptrs_from_string ( INP int  line_num,
INP const t_pb_graph_node pb_graph_parent_node,
INP t_pb_graph_node **  pb_graph_children_nodes,
INP const char *  port_string,
OUTP int **  num_ptrs,
OUTP int *  num_sets,
INP boolean  is_input_to_interc,
INP boolean  interconnect_error_check 
)

creates an array of pointers to the pb graph node pins in order from the port string returns t_pb_graph_pin ptr indexed by [0..num_sets_in_port - 1][0..num_ptrs - 1]

Definition at line 732 of file pb_type_graph.c.

736  {
737  t_token * tokens;
738  int num_tokens, curr_set;
739  int i;
740  boolean in_squig_bracket, success;
741 
742  t_pb_graph_pin ***pb_graph_pins;
743 
744  num_tokens = 0;
745  tokens = GetTokensFromString(port_string, &num_tokens);
746  *num_sets = 0;
747  in_squig_bracket = FALSE;
748 
749  /* count the number of sets available */
750  for (i = 0; i < num_tokens; i++) {
751  assert(tokens[i].type != TOKEN_NULL);
752  if (tokens[i].type == TOKEN_OPEN_SQUIG_BRACKET) {
753  if (in_squig_bracket) {
754  vpr_printf(TIO_MESSAGE_ERROR,
755  "[LINE %d] { inside { in port %s\n", line_num,
756  port_string);
757  exit(1);
758  }
759  in_squig_bracket = TRUE;
760  } else if (tokens[i].type == TOKEN_CLOSE_SQUIG_BRACKET) {
761  if (!in_squig_bracket) {
762  (*num_sets)++;
763  vpr_printf(TIO_MESSAGE_ERROR,
764  "[LINE %d] No matching '{' for '}' in port %s\n",
765  line_num, port_string);
766  exit(1);
767  }
768  in_squig_bracket = FALSE;
769  } else if (tokens[i].type == TOKEN_DOT) {
770  if (!in_squig_bracket) {
771  (*num_sets)++;
772  }
773  }
774  }
775 
776  if (in_squig_bracket) {
777  (*num_sets)++;
778  vpr_printf(TIO_MESSAGE_ERROR,
779  "[LINE %d] No matching '{' for '}' in port %s\n", line_num,
780  port_string);
781  exit(1);
782  }
783 
784  pb_graph_pins = (t_pb_graph_pin***) my_calloc(*num_sets,
785  sizeof(t_pb_graph_pin**));
786  *num_ptrs = (int*) my_calloc(*num_sets, sizeof(int));
787 
788  curr_set = 0;
789  for (i = 0; i < num_tokens; i++) {
790  assert(tokens[i].type != TOKEN_NULL);
791  if (tokens[i].type == TOKEN_OPEN_SQUIG_BRACKET) {
792  if (in_squig_bracket) {
793  vpr_printf(TIO_MESSAGE_ERROR,
794  "[LINE %d] { inside { in port %s\n", line_num,
795  port_string);
796  exit(1);
797  }
798  in_squig_bracket = TRUE;
799  } else if (tokens[i].type == TOKEN_CLOSE_SQUIG_BRACKET) {
800  if ((*num_ptrs)[curr_set] == 0) {
801  vpr_printf(TIO_MESSAGE_ERROR,
802  "[LINE %d] No data contained in {} in port %s\n",
803  line_num, port_string);
804  exit(1);
805  }
806  if (!in_squig_bracket) {
807  curr_set++;
808  vpr_printf(TIO_MESSAGE_ERROR,
809  "[LINE %d] No matching '{' for '}' in port %s\n",
810  line_num, port_string);
811  exit(1);
812  }
813  in_squig_bracket = FALSE;
814  } else if (tokens[i].type == TOKEN_STRING) {
815 
817  pb_graph_parent_node, pb_graph_children_nodes,
818  interconnect_error_check, is_input_to_interc, tokens, &i,
819  &((*num_ptrs)[curr_set]), &pb_graph_pins[curr_set]);
820 
821  if (!success) {
822  vpr_printf(TIO_MESSAGE_ERROR,
823  "[LINE %d] syntax error processing port string %s\n",
824  line_num, port_string);
825  exit(1);
826  }
827 
828  if (!in_squig_bracket) {
829  curr_set++;
830  }
831  }
832  }
833  assert(curr_set == *num_sets);
834  freeTokens(tokens, num_tokens);
835  return pb_graph_pins;
836 }
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
t_token * GetTokensFromString(INP const char *inString, OUTP int *num_tokens)
Definition: token.c:18
Definition: util.h:12
Definition: token.h:22
void freeTokens(INP t_token *tokens, INP int num_tokens)
Definition: token.c:93
messagelogger vpr_printf
Definition: util.c:17
static boolean realloc_and_load_pb_graph_pin_ptrs_at_var(INP int line_num, INP const t_pb_graph_node *pb_graph_parent_node, INP t_pb_graph_node **pb_graph_children_nodes, INP boolean interconnect_error_check, INP boolean is_input_to_interc, INP const t_token *tokens, INOUTP int *token_index, INOUTP int *num_pins, OUTP t_pb_graph_pin ***pb_graph_pins)
Definition: util.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void echo_pb_graph ( char *  filename)

Print out the pb_type graph

Definition at line 143 of file pb_type_graph.c.

143  {
144  FILE *fp;
145  int i;
146 
147  fp = my_fopen(filename, "w", 0);
148 
149  fprintf(fp, "Physical Blocks Graph\n");
150  fprintf(fp, "--------------------------------------------\n\n");
151 
152  for (i = 0; i < num_types; i++) {
153  fprintf(fp, "type %s\n", type_descriptors[i].name);
154  if (type_descriptors[i].pb_graph_head)
155  echo_pb_rec(type_descriptors[i].pb_graph_head, 1, fp);
156  }
157 
158  fclose(fp);
159 }
FILE * my_fopen(const char *fname, const char *flag, int prompt)
Definition: util.c:54
int num_types
Definition: globals.c:37
struct s_type_descriptor * type_descriptors
Definition: globals.c:38
static void echo_pb_rec(INP const t_pb_graph_node *pb, INP int level, INP FILE *fp)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void free_all_pb_graph_nodes ( void  )

Free pb graph

Definition at line 127 of file pb_type_graph.c.

127  {
128  int i;
129  for (i = 0; i < num_types; i++) {
130  if (type_descriptors[i].pb_type) {
132  if (type_descriptors[i].pb_graph_head) {
133  free_pb_graph(type_descriptors[i].pb_graph_head);
134  free(type_descriptors[i].pb_graph_head);
135  }
136  }
137  }
138 }
static int pin_count_in_cluster
Definition: pb_type_graph.c:24
static void free_pb_graph(INOUTP t_pb_graph_node *pb_graph_node)
int num_types
Definition: globals.c:37
struct s_type_descriptor * type_descriptors
Definition: globals.c:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function: