#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "types.h"
#include "globals.h"
#include "netlist_utils.h"
#include "odin_util.h"
Go to the source code of this file.
Functions | |
void | depth_first_traverse_graphcrunch (FILE *out, short marker_value, netlist_t *netlist) |
void | depth_first_traversal_graphcrunch_display (nnode_t *node, FILE *fp, int traverse_mark_number) |
void | graphcrunch_output (char *path, char *name, short marker_value, netlist_t *netlist) |
void depth_first_traversal_graphcrunch_display | ( | nnode_t * | node, | |
FILE * | fp, | |||
int | traverse_mark_number | |||
) |
Definition at line 79 of file output_graphcrunch_format.c.
00080 { 00081 int i, j; 00082 nnode_t *next_node; 00083 nnet_t *next_net; 00084 00085 if (node->traverse_visited == traverse_mark_number) 00086 { 00087 return; 00088 } 00089 else 00090 { 00091 /* ELSE - this is a new node so depth visit it */ 00092 char *temp_string; 00093 char *temp_string2; 00094 00095 /* mark that we have visitied this node now */ 00096 node->traverse_visited = traverse_mark_number; 00097 00098 for (i = 0; i < node->num_output_pins; i++) 00099 { 00100 if (node->output_pins[i]->net == NULL) 00101 continue; 00102 00103 next_net = node->output_pins[i]->net; 00104 for (j = 0; j < next_net->num_fanout_pins; j++) 00105 { 00106 if (next_net->fanout_pins[j] == NULL) 00107 continue; 00108 00109 next_node = next_net->fanout_pins[j]->node; 00110 if (next_node == NULL) 00111 continue; 00112 00113 //temp_string = make_string_based_on_id(node); 00114 //temp_string2 = make_string_based_on_id(next_node); 00115 temp_string = make_simple_name(node->name, "^-+.", '_'); 00116 temp_string2 = make_simple_name(next_node->name, "^-+.", '_'); 00117 00118 if (node->type == OUTPUT_NODE) 00119 { 00120 /* renaming for output nodes */ 00121 temp_string = (char*)realloc(temp_string, sizeof(char)*strlen(temp_string)+1+2); 00122 sprintf(temp_string, "%s_O", temp_string); 00123 } 00124 if (next_node->type == OUTPUT_NODE) 00125 { 00126 /* renaming for output nodes */ 00127 temp_string2 = (char*)realloc(temp_string2, sizeof(char)*strlen(temp_string2)+1+2); 00128 sprintf(temp_string2, "%s_O", temp_string2); 00129 } 00130 00131 fprintf(fp, "%s\t%s\n", temp_string, temp_string2); 00132 00133 free(temp_string); 00134 free(temp_string2); 00135 00136 /* recursive call point */ 00137 depth_first_traversal_graphcrunch_display(next_node, fp, traverse_mark_number); 00138 } 00139 } 00140 } 00141 }
void depth_first_traverse_graphcrunch | ( | FILE * | out, | |
short | marker_value, | |||
netlist_t * | netlist | |||
) |
Definition at line 57 of file output_graphcrunch_format.c.
00058 { 00059 int i; 00060 00061 /* start with the primary input list */ 00062 for (i = 0; i < netlist->num_top_input_nodes; i++) 00063 { 00064 if (netlist->top_input_nodes[i] != NULL) 00065 { 00066 depth_first_traversal_graphcrunch_display(netlist->top_input_nodes[i], out, marker_value); 00067 } 00068 } 00069 /* now traverse the ground and vcc pins */ 00070 if (netlist->gnd_node != NULL) 00071 depth_first_traversal_graphcrunch_display(netlist->gnd_node, out, marker_value); 00072 if (netlist->vcc_node != NULL) 00073 depth_first_traversal_graphcrunch_display(netlist->vcc_node, out, marker_value); 00074 }
void graphcrunch_output | ( | char * | path, | |
char * | name, | |||
short | marker_value, | |||
netlist_t * | netlist | |||
) |
Definition at line 39 of file output_graphcrunch_format.c.
00040 { 00041 char path_and_file[4096]; 00042 FILE *fp; 00043 00044 /* open the file */ 00045 sprintf(path_and_file, "%s/%s", path, name); 00046 fp = fopen(path_and_file, "w"); 00047 00048 depth_first_traverse_graphcrunch(fp, marker_value, netlist); 00049 00050 /* close graph */ 00051 fclose(fp); 00052 }