Subversion Repositories Vertical

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
/*
2
 * $Id: print_ports.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $
3
 *
4
 * $Log: print_ports.c,v $
5
 * Revision 1.1.1.1  2003/11/04 23:34:57  mjames
6
 * Imported into local repositrory
7
 *
8
 * Revision 1.11  2002/09/09 10:12:13  mjames
9
 * Moved pin remapping function to pin ident editing function from
10
 * sorting pin name routine.
11
 *
12
 * Revision 1.10  2002/01/03 16:36:10  mjames
13
 * Method of accessing Vertical version changed to avoid
14
 * global variable
15
 *
16
 * Revision 1.9  2001/12/13 22:16:51  mjames
17
 * Using #ident with header to identify file
18
 *
19
 * fixed missing return code on function
20
 *
21
 * Revision 1.8  2001/10/31 22:20:11  mjames
22
 * Tidying up problematical comments caused by CVS
23
 * 'intelligent' comment guessing
24
 *
25
 * Revision 1.7  2001/10/31 16:20:39  mjames
26
 * Added a datastructure to hide regular expression information from programs.
27
 * Changed call to regexec to indicate 0 subexpressions to be matched
28
 * rather than a number dependent on strlen(string) which was wrong.
29
 *
30
 * Revision 1.6  2001/10/23 21:11:08  mjames
31
 * Refined the printout to make the generated HTML indicate
32
 * bundle information in the cross reference list.
33
 *
34
 * Revision 1.5  2001/10/10 20:18:23  mjames
35
 * Added a vert_regcomp function to compile regular expressions
36
 * with '^' (match start string) and  '$' (match end string) bracketing
37
 * this => wildcard must match entire string not just a part of it.
38
 *
39
 * Revision 1.4  2001/10/07 20:50:52  mjames
40
 * Added wildcard checking (warn user about
41
 * using wildcard '*' on the end of a string in stead of wildcard '.*')
42
 *
43
 * Revision 1.3  2001/09/28 10:17:14  mjames
44
 * Removed coredump caused by trying to free() an auto variable in the
45
 * regular expression handler
46
 *
47
 * Revision 1.2  2001/09/25 23:15:23  mjames
48
 * Converted wildcards to use proper regexp pattern match library
49
 *
50
 * Revision 1.1  2001/09/21 14:19:52  mjames
51
 * Implemented Write Pin command : fixed up HTML output
52
 *
11 mjames 53
*/
54
#include <stdio.h>
55
#include <string.h>
56
#include <stdlib.h>
57
#include <ctype.h>
58
#include <time.h>
59
#include <sys/types.h>
60
#include <regex.h>
2 mjames 61
 
11 mjames 62
#include "vertcl_main.h"
2 mjames 63
#include "expression.h"
64
#include "generic.h"
11 mjames 65
#include "database.h"
66
#include "printout.h"
2 mjames 67
#include "print_vhdl.h"
68
#include "print_vlog.h"
11 mjames 69
#include "print_ports.h"
2 mjames 70
#include "sorting.h"
11 mjames 71
#include "cmdparse.h"
72
#include "cmdlog.h"
73
#include "equivalent.h"
2 mjames 74
#include "version.h"
11 mjames 75
#include "chck_names.h"
2 mjames 76
 
11 mjames 77
#ident  "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/print_ports.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $"
2 mjames 78
 
79
 
80
/* for each pin on the connector, list out all of the information */
11 mjames 81
int list_intersection(FILE * f,char * con_id, char * fpga_id)
82
  {
83
  socket_t * connector = socket_head;
84
  int found = 0;
2 mjames 85
 
11 mjames 86
  int rc;
2 mjames 87
 
11 mjames 88
  socket_t * fpga;
89
  noderef_t * bnode;
90
  node_t * node;
91
  unsigned int sockets = 0;
92
  unsigned int printed = 0;
93
  /* compile regular expression */
94
  vert_regex_t * preg;
2 mjames 95
 
11 mjames 96
  fpga      =  find_socket(Ident,fpga_id,  Search,&socket_head);
2 mjames 97
 
11 mjames 98
  if(!fpga)
99
    {
100
    Log(LOG_ERROR,"-- write pin cannot find fpga '%s'\n",
101
       fpga_id);
102
    return TCL_ERROR;
103
    }
2 mjames 104
 
11 mjames 105
  rc = vert_regcomp(&preg,con_id);
2 mjames 106
 
11 mjames 107
  if (rc != 0 )
108
    {
109
    char errbuff[100];
110
    regerror(rc,preg->preg,errbuff,100);
111
    Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,con_id);
112
 
113
    return TCL_ERROR;
114
    }
115
  else
116
    {
117
    Log(LOG_GENERAL,"-- Using '%s' as match pattern\n",con_id);
118
    }
2 mjames 119
 
11 mjames 120
  fprintf(f,"<html>\n");
121
  fprintf(f,"<title>Cross ref for socket(s) '%s' and (FPGA) socket '%s'</title>\n",
122
              con_id,fpga_id);
123
  fprintf(f,"<h2>Column names:</h2>\n"
2 mjames 124
            "<dl>\n"
125
            "<dt><b>socket pin</b><dd>The pin of the relevant socket.\n"
126
            "<dt><b>index</b><dd>The Certify pin bundle index(if assigned)\n"
127
            "<dt><b>net ident.</b><dd>The PCB netlist name (or jumper name)\n"
128
            "<dt><b>sig. name</b><dd>The name of any signal routed through this net\n"
129
            "</dl>\n"
11 mjames 130
            "Please note only one fpga pin is given out of many if a multiple connection exists\n");
2 mjames 131
 
11 mjames 132
  while(connector)
133
    {
134
 
135
    found  = regexec(preg->preg,connector->identifier,0,preg->regpatt,0);
136
 
137
    if(!found)
138
      {
139
      int first_print = 1; /* suppress tables until needed */
140
      sockets ++;
141
      sort_nodes(connector,NO_EXTRACT_XY); /* sort the pins on the connector */
142
      node = connector->nodes;
143
/*
144
      printf("completed sort\n");
145
*/
146
      while(node)
2 mjames 147
        {
11 mjames 148
        if (node->net)
149
          {
150
          int found_node = 0;
2 mjames 151
 
11 mjames 152
          bnode = node->net->nodes;
153
          while(bnode && !found_node)
154
            {
155
            char * msg;
156
            char bundle_msg[20];
157
            if (bnode->node && bnode->node->socket==fpga)
158
              {
159
              if(first_print)
2 mjames 160
                {
11 mjames 161
                fprintf(f,"<h2>crossref</h2>\n"
162
                          "<h3>connector id=%s name=%s and fpga id=%s name=%s</h3>\n",
163
                            connector->identifier,
164
                            connector->name?connector->name:"",
165
                            fpga->identifier,
166
                            fpga->name?fpga->name:"");
167
                fprintf(f,"<table border=1>\n");
168
                fprintf(f,"<tr><td> socket pin</td> <td>index</td> <td>fpga pin</td> <td>net ident.</td><td>sig. name</td></tr>\n");
169
                first_print = 0;
170
                }
171
              if (node->bundle_index==0)
172
                {
173
                msg = "-";
174
                }
175
              else if (node->bundle_index < 0)
176
                {
177
                msg = "NC";
178
                }
179
              else
180
                {
181
                sprintf(bundle_msg,"%d",node->bundle_index);
182
                msg = bundle_msg;
183
                }
2 mjames 184
 
11 mjames 185
              fprintf(f,"<tr><td>%s(%s)</td><td>%s</td> <td>%s(%s)</td> <td>%s</td><td>%s</td></tr>\n",
186
                      connector->identifier,node->identifier,
187
                      msg,
188
                      fpga->identifier,bnode->node->identifier,
189
                      bnode->net->name?bnode->net->identifier:"",
190
                      bnode->net->name?bnode->net->name:"" );  
191
              found_node = 1 ;  /* force loop termination */
192
 
193
              }
194
            bnode = bnode->next;
195
            }
196
          }
197
        node = node->sktnext;
198
 
2 mjames 199
        }
11 mjames 200
      if(!first_print)
201
        {
202
        printed++;
203
        fprintf(f,"</table>\n<hr>\n");
204
        }
205
      }
206
    connector= connector->next;
207
    }
208
 
2 mjames 209
 
11 mjames 210
  fprintf(f,"Tables generated by Vertical %s\n"
211
            "<br>&copy; Philips Semiconductors SLS. "__DATE__
212
            "<a href=mailto:Mike.D.James@philips.com><address>mailto:Mike.D.James@philips.com</address></a>\n"
213
            "</html>\n",Vertical_Version);
214
 
2 mjames 215
 
11 mjames 216
  vert_regfree(&preg);
217
  Log(LOG_GENERAL,"-- located %d sockets matching pattern\n",sockets);
218
  Log(LOG_GENERAL,"--  of which %d actually connect to '%s'\n",printed,fpga_id);
219
  return TCL_OK;
220
  }