Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | %{ |
| 2 | /* |
||
| 3 | * $Id: mentor_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ |
||
| 4 | * |
||
| 5 | * $Log: mentor_yacc.y,v $ |
||
| 6 | * Revision 1.1.1.1 2003/11/04 23:34:57 mjames |
||
| 7 | * Imported into local repositrory |
||
| 8 | * |
||
| 9 | * Revision 1.3 2002/10/02 19:37:28 MJAMES |
||
| 10 | * Moved dummy functions to a separate support file. |
||
| 11 | * |
||
| 12 | * Used correct number of arguments to define_pin |
||
| 13 | * |
||
| 14 | * Revision 1.2 2002/09/09 10:36:20 mjames |
||
| 15 | * Checkpoint checkin |
||
| 16 | * |
||
| 17 | * Revision 1.1 2002/08/14 12:13:01 mjames |
||
| 18 | * Mentor Board Station reader modified to work with latest .nets file format |
||
| 19 | * |
||
| 20 | * Revision 1.1 2002/04/04 14:53:07 mjames |
||
| 21 | * Added mentor board station reader to the portfolio |
||
| 22 | * |
||
| 23 | * Revision 1.6 2001/10/31 22:20:09 mjames |
||
| 24 | * Tidying up problematical comments caused by CVS |
||
| 25 | * 'intelligent' comment guessing |
||
| 26 | * |
||
| 27 | * Revision 1.5 2001/10/02 20:53:27 mjames |
||
| 28 | * Moved documentation about code to main program module. |
||
| 29 | * |
||
| 30 | * Revision 1.4 2001/09/16 19:55:42 mjames |
||
| 31 | * tidying |
||
| 32 | * |
||
| 33 | * Revision 1.3 2001/06/06 12:10:20 mjames |
||
| 34 | * Move from HPUX |
||
| 35 | * |
||
| 36 | * Revision 1.2 2000/12/04 13:14:03 mjames |
||
| 37 | * Imported all of the PCB syntax readers. |
||
| 38 | * |
||
| 39 | * Converted "a/b" to mean "a" divided by "b" insted of a single string |
||
| 40 | * "a/b" in Verilog |
||
| 41 | * |
||
| 42 | * Revision 1.1.1.1 2000/10/19 21:58:38 mjames |
||
| 43 | * Mike put it here |
||
| 44 | * |
||
| 45 | * |
||
| 46 | * Revision 1.27 2000/10/04 10:37:07 10:37:07 mjames (Mike James) |
||
| 47 | * Modified for Vertical2 : support COMPONENTS and SIGNALS |
||
| 48 | * |
||
| 49 | * Revision 1.24 2000/09/27 10:58:04 10:58:04 mjames (Mike James) |
||
| 50 | * Using correct return code from yyparse() |
||
| 51 | * |
||
| 52 | * Revision 1.13 2000/03/08 16:19:19 16:19:19 mjames (Mike James) |
||
| 53 | * New version including PC |
||
| 54 | * |
||
| 55 | * Revision 1.10 2000/01/20 15:58:46 15:58:46 mjames (Mike James) |
||
| 56 | * Part of Release R22 |
||
| 57 | * |
||
| 58 | * Revision 1.9 99/12/22 11:15:27 11:15:27 mjames (Mike James) |
||
| 59 | * Part of Release Dec_22_1999 |
||
| 60 | * |
||
| 61 | * Revision 1.8 99/06/25 14:35:45 14:35:45 mjames (Mike James) |
||
| 62 | * Added in reference to expression.h, but no changes made |
||
| 63 | * to the function of acfread yet. |
||
| 64 | * |
||
| 65 | * Revision 1.7 99/05/04 09:52:32 09:52:32 mjames (Mike James) |
||
| 66 | * General checkin |
||
| 67 | * |
||
| 68 | * Revision 1.5 98/07/14 13:24:51 13:24:51 mjames (Mike James) |
||
| 69 | * Altered calling of some database functions |
||
| 70 | * |
||
| 71 | * Revision 1.4 98/02/11 11:26:46 11:26:46 mjames (Mike James) |
||
| 72 | * Checked in for version 6.2a |
||
| 73 | * |
||
| 74 | * Revision 1.3 97/04/23 08:45:10 08:45:10 mjames (Mike James) |
||
| 75 | * CHecked in for release rel23041997 |
||
| 76 | * |
||
| 77 | * Revision 1.2 96/12/23 15:16:50 15:16:50 mjames (Mike James) |
||
| 78 | * Altered because find_socket takes a reference |
||
| 79 | * to the head-of-list-pointer noth the pointer itself. |
||
| 80 | * |
||
| 81 | * Revision 1.1 96/12/13 08:43:46 08:43:46 mjames (Mike James) |
||
| 82 | * Initial revision |
||
| 83 | * |
||
| 84 | * |
||
| 85 | * */ |
||
| 86 | |||
| 87 | |||
| 88 | |||
| 89 | |||
| 90 | #include <stdio.h> |
||
| 91 | #include <stdlib.h> |
||
| 92 | #include <string.h> |
||
| 93 | #include "expression.h" |
||
| 94 | #include "generic.h" |
||
| 95 | #include "database.h" |
||
| 96 | #include "routing.h" |
||
| 97 | |||
| 98 | |||
| 99 | #ident "@(#)$Header: C:/cvsroot/Vert03/mentor_src/mentor_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $"; |
||
| 100 | |||
| 101 | |||
| 102 | static socket_t * current_chip; |
||
| 103 | static char curr_net_nam[MAXIDLEN]; |
||
| 104 | int inside_block; |
||
| 105 | |||
| 106 | |||
| 107 | static char illegal[]="#$:|/.\\ +-"; |
||
| 108 | static char replace[]="Hsxxnxx_PN"; |
||
| 109 | |||
| 110 | char * fix_name(char * str) |
||
| 111 | { |
||
| 112 | int i,j,l; |
||
| 113 | l=strlen(str); |
||
| 114 | /* edit out illegal strings from the net name */ |
||
| 115 | for(i=0;i<l;i++) |
||
| 116 | { |
||
| 117 | for(j=0;j<sizeof(illegal);j++) |
||
| 118 | { |
||
| 119 | if (str[i]==illegal[j]) |
||
| 120 | { |
||
| 121 | str[i] = replace[j]; |
||
| 122 | } |
||
| 123 | } |
||
| 124 | } |
||
| 125 | return str; |
||
| 126 | } |
||
| 127 | |||
| 128 | |||
| 129 | |||
| 130 | |||
| 131 | %} |
||
| 132 | %union { char * string; } |
||
| 133 | %token NET NET_TYPE NL QUOTE ENDFILE |
||
| 134 | %token <string> ASTRING |
||
| 135 | %token <string> POWERS |
||
| 136 | |||
| 137 | %% |
||
| 138 | |||
| 139 | file : objects ENDFILE; |
||
| 140 | |||
| 141 | objects : objects object |
||
| 142 | | object |
||
| 143 | ; |
||
| 144 | |||
| 145 | |||
| 146 | object : net_list |
||
| 147 | | gap |
||
| 148 | ; |
||
| 149 | |||
| 150 | |||
| 151 | net_list : NET net_name net_items gap ; |
||
| 152 | |||
| 153 | net_items : net_items net_item |
||
| 154 | | net_item |
||
| 155 | ; |
||
| 156 | |||
| 157 | |||
| 158 | net_item : net_attribute |
||
| 159 | | pin |
||
| 160 | ; |
||
| 161 | |||
| 162 | |||
| 163 | |||
| 164 | net_name : QUOTE ASTRING QUOTE { strcpy(curr_net_nam,$2); }; |
||
| 165 | |||
| 166 | |||
| 167 | pin : ASTRING '-' ASTRING { define_pin(&routed_list, |
||
| 168 | find_socket(Ident,$1,Create,&socket_head), |
||
| 169 | curr_net_nam,BIDIR,0,fix_name($3), |
||
| 170 | default_vhdl_datatype,NULL); } |
||
| 171 | | QUOTE ASTRING '-' ASTRING QUOTE { define_pin(&routed_list, |
||
| 172 | find_socket(Ident,$2,Create,&socket_head), |
||
| 173 | curr_net_nam,BIDIR,0,fix_name($4), |
||
| 174 | default_vhdl_datatype,NULL); } |
||
| 175 | |||
| 176 | ; |
||
| 177 | |||
| 178 | |||
| 179 | |||
| 180 | gap : NL gap |
||
| 181 | | NL |
||
| 182 | ; |
||
| 183 | |||
| 184 | |||
| 185 | |||
| 186 | |||
| 187 | |||
| 188 | net_attribute : '(' ASTRING ',' |
||
| 189 | QUOTE ASTRING QUOTE ')' |
||
| 190 | { net_t * thisnet; |
||
| 191 | printf("--Net %s has attribute %s,%s (GUESS NOT ROUTABLE!!)\n",curr_net_nam,$2,$5); |
||
| 192 | thisnet = find_net(&routed_list, |
||
| 193 | Ident, |
||
| 194 | curr_net_nam, |
||
| 195 | Create); |
||
| 196 | if(thisnet) |
||
| 197 | { |
||
| 198 | thisnet->how_routed = Not_Routable; |
||
| 199 | } |
||
| 200 | } |
||
| 201 | | '(' ASTRING ',' QUOTE POWERS QUOTE ')' |
||
| 202 | { net_t * thisnet; |
||
| 203 | printf("--Net %s has attribute %s,%s (GUESS NOT ROUTABLE!!)\n",curr_net_nam,$2,$5); |
||
| 204 | thisnet = find_net(&routed_list, |
||
| 205 | Ident, |
||
| 206 | curr_net_nam, |
||
| 207 | Create); |
||
| 208 | if(thisnet) |
||
| 209 | { |
||
| 210 | thisnet->how_routed = Not_Routable; |
||
| 211 | } |
||
| 212 | }; |
||
| 213 | |||
| 214 | |||
| 215 | |||
| 216 | |||
| 217 | %% |
||
| 218 | |||
| 219 | /* defining lineno here */ |
||
| 220 | |||
| 221 | int lineno; |
||
| 222 | extern char * yytext; |
||
| 223 | |||
| 224 | int yyerror(char * x) |
||
| 225 | { |
||
| 226 | int token; |
||
| 227 | printf("-- Error --> %s near string (%s) at line %d\n",x,yytext,lineno); |
||
| 228 | /* for(token = yylex();token >= 0 && token!=NL;token = yylex()); */ |
||
| 229 | return 1; |
||
| 230 | } |
||
| 231 | |||
| 232 | int yywrap(void) |
||
| 233 | { |
||
| 234 | return 1; |
||
| 235 | } |
||
| 236 | |||
| 237 | |||
| 238 |