SRC/print_netlist.c File Reference

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "util.h"
#include "vpr_types.h"
#include "globals.h"
#include "print_netlist.h"
Include dependency graph for print_netlist.c:

Go to the source code of this file.

Functions

static void print_pinnum (FILE *fp, int pinnum)
void print_netlist (char *foutput, char *net_file, t_subblock_data subblock_data)

Function Documentation

void print_netlist ( char *  foutput,
char *  net_file,
t_subblock_data  subblock_data 
)

Definition at line 19 of file print_netlist.c.

00022 {
00023 
00024 /* Prints out the netlist related data structures into the file    *
00025  * fname.                                                          */
00026 
00027     int i, j, ipin, max_pin;
00028     int num_global_nets;
00029     int num_p_inputs, num_p_outputs;
00030     FILE *fp;
00031     t_subblock **subblock_inf;
00032     int *num_subblocks_per_block;
00033 
00034     num_global_nets = 0;
00035     num_p_inputs = 0;
00036     num_p_outputs = 0;
00037 
00038     /* Count number of global nets */
00039     for(i = 0; i < num_nets; i++)
00040         {
00041             if(!net[i].is_global)
00042                 {
00043                     num_global_nets++;
00044                 }
00045         }
00046 
00047     /* Count I/O input and output pads */
00048     for(i = 0; i < num_blocks; i++)
00049         {
00050             if(block[i].type == IO_TYPE)
00051                 {
00052                     for(j = 0; j < IO_TYPE->num_pins; j++)
00053                         {
00054                             if(block[i].nets[j] != OPEN)
00055                                 {
00056                                     if(IO_TYPE->
00057                                        class_inf[IO_TYPE->pin_class[j]].
00058                                        type == DRIVER)
00059                                         {
00060                                             num_p_inputs++;
00061                                         }
00062                                     else
00063                                         {
00064                                             assert(IO_TYPE->
00065                                                    class_inf[IO_TYPE->
00066                                                              pin_class[j]].
00067                                                    type == RECEIVER);
00068                                             num_p_outputs++;
00069                                         }
00070                                 }
00071                         }
00072                 }
00073         }
00074 
00075 
00076     fp = my_fopen(foutput, "w");
00077 
00078     fprintf(fp, "Input netlist file: %s\n", net_file);
00079     fprintf(fp, "num_p_inputs: %d, num_p_outputs: %d, num_clbs: %d\n",
00080             num_p_inputs, num_p_outputs, num_blocks);
00081     fprintf(fp, "num_blocks: %d, num_nets: %d, num_globals: %d\n",
00082             num_blocks, num_nets, num_global_nets);
00083     fprintf(fp, "\nNet\tName\t\t#Pins\tDriver\t\tRecvs. (block, pin)\n");
00084 
00085     for(i = 0; i < num_nets; i++)
00086         {
00087             fprintf(fp, "\n%d\t%s\t", i, net[i].name);
00088             if(strlen(net[i].name) < 8)
00089                 fprintf(fp, "\t");      /* Name field is 16 chars wide */
00090             fprintf(fp, "%d", net[i].num_sinks + 1);
00091             for(j = 0; j <= net[i].num_sinks; j++)
00092                 fprintf(fp, "\t(%4d,%4d)", net[i].node_block[j],
00093                         net[i].node_block_pin[j]);
00094         }
00095 
00096     fprintf(fp, "\nBlock\tName\t\tType\tPin Connections\n\n");
00097 
00098     for(i = 0; i < num_blocks; i++)
00099         {
00100             fprintf(fp, "\n%d\t%s\t", i, block[i].name);
00101             if(strlen(block[i].name) < 8)
00102                 fprintf(fp, "\t");      /* Name field is 16 chars wide */
00103             fprintf(fp, "%s", block[i].type->name);
00104 
00105             max_pin = block[i].type->num_pins;
00106 
00107             for(j = 0; j < max_pin; j++)
00108                 print_pinnum(fp, block[i].nets[j]);
00109         }
00110 
00111     fprintf(fp, "\n");
00112 
00113 /* Now print out subblock info. */
00114 
00115     subblock_inf = subblock_data.subblock_inf;
00116     num_subblocks_per_block = subblock_data.num_subblocks_per_block;
00117 
00118 
00119     fprintf(fp, "\n\nSubblock List:\n\n");
00120 
00121     for(i = 0; i < num_blocks; i++)
00122         {
00123             fprintf(fp, "\nBlock: %d (%s)\tNum_subblocks: %d\n", i,
00124                     block[i].name, num_subblocks_per_block[i]);
00125 
00126             /* Print header. */
00127 
00128             fprintf(fp, "Index\tName\t\tInputs");
00129             for(j = 0; j < block[i].type->max_subblock_inputs; j++)
00130                 fprintf(fp, "\t");
00131             fprintf(fp, "Outputs");
00132             for(j = 0; j < block[i].type->max_subblock_outputs; j++)
00133                 fprintf(fp, "\t");
00134             fprintf(fp, "Clock\n");
00135 
00136             /* Print subblock info for block i. */
00137 
00138             for(j = 0; j < num_subblocks_per_block[i]; j++)
00139                 {
00140                     fprintf(fp, "%d\t%s", j, subblock_inf[i][j].name);
00141                     if(strlen(subblock_inf[i][j].name) < 8)
00142                         fprintf(fp, "\t");      /* Name field is 16 characters */
00143                     for(ipin = 0; ipin < block[i].type->max_subblock_inputs;
00144                         ipin++)
00145                         print_pinnum(fp, subblock_inf[i][j].inputs[ipin]);
00146                     for(ipin = 0; ipin < block[i].type->max_subblock_outputs;
00147                         ipin++)
00148                         print_pinnum(fp, subblock_inf[i][j].outputs[ipin]);
00149                     print_pinnum(fp, subblock_inf[i][j].clock);
00150                     fprintf(fp, "\n");
00151                 }
00152         }
00153 
00154     fclose(fp);
00155 }

Here is the call graph for this function:

static void print_pinnum ( FILE *  fp,
int  pinnum 
) [static]

Definition at line 159 of file print_netlist.c.

00161 {
00162 
00163 /* This routine prints out either OPEN or the pin number, to file fp. */
00164 
00165     if(pinnum == OPEN)
00166         fprintf(fp, "\tOPEN");
00167     else
00168         fprintf(fp, "\t%d", pinnum);
00169 }

Here is the caller graph for this function:


Generated on Tue Jan 5 15:26:01 2010 for VPR5.0 by  doxygen 1.6.1