Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | /* |
| 2 | * $id: c:\\cygwin\\cvsroot/vertical/cmdexec2.c,v 1.26 2001/10/31 16:23:22 mjames Exp $ |
||
| 3 | * |
||
| 4 | * $Log: cmdexec2.c,v $ |
||
| 5 | * Revision 1.1.1.1 2003/11/04 23:34:57 mjames |
||
| 6 | * Imported into local repositrory |
||
| 7 | * |
||
| 8 | * Revision 1.40 2003/01/02 21:37:14 mjames |
||
| 9 | * Experiment on creating NOT_ROUTABLE_H and NOT_ROUTABLE_L |
||
| 10 | * properties on the nets so that pin jumpers can be made without a problem. |
||
| 11 | * |
||
| 12 | * Still need to sort out pin assignments made to these not_routable nets |
||
| 13 | * which will become legal in some cases so that pullups and pulldown |
||
| 14 | * pins can be used on the FPGA. |
||
| 15 | * |
||
| 16 | * Revision 1.39 2002/09/30 13:23:53 MJAMES |
||
| 17 | * Tidied up the set par , set all_par and del par commands to make them |
||
| 18 | * all consistent with each other. |
||
| 19 | * |
||
| 20 | * Revision 1.38 2002/09/09 10:20:31 mjames |
||
| 21 | * Removed set generic range and replaced it with a set generic value command |
||
| 22 | * that takes both integers and ranges. |
||
| 23 | * |
||
| 24 | * Revision 1.37 2002/08/23 14:20:09 mjames |
||
| 25 | * Added Require command, |
||
| 26 | * modified edit ident and edit type commands comments to be more |
||
| 27 | * helpful. |
||
| 28 | * |
||
| 29 | * Revision 1.36 2002/08/06 12:53:03 mjames |
||
| 30 | * Merge in from latest version |
||
| 31 | * |
||
| 32 | * Revision 1.36 2002/03/08 14:56:14 mjames |
||
| 33 | * Edited all of the commands in the cmdexec1.c and cmdexec2.c files |
||
| 34 | * so that they can be read by doc2.pl |
||
| 35 | * |
||
| 36 | * Revision 1.35 2001/12/24 21:13:59 mjames |
||
| 37 | * Added header includes to get correct declarations for all functions |
||
| 38 | * called from command handlers |
||
| 39 | * |
||
| 40 | * Revision 1.34 2001/12/24 20:08:11 mjames |
||
| 41 | * Added more information about ensure template command to help message |
||
| 42 | * |
||
| 43 | * Revision 1.33 2001/12/11 20:32:45 mjames |
||
| 44 | * Implemented regular expression pin name editing |
||
| 45 | * |
||
| 46 | * Revision 1.32 2001/11/19 10:41:53 mjames |
||
| 47 | * Merged back DTC release |
||
| 48 | * |
||
| 49 | * Revision 1.31 2001/11/19 10:39:47 mjames |
||
| 50 | * Merge conflict resolution |
||
| 51 | * |
||
| 52 | * Revision 1.30 2001/11/09 22:14:44 mjames |
||
| 53 | * Added in delete chip node connection command |
||
| 54 | * In order to remove small number of chip pins in a large board |
||
| 55 | * which have been damaged. |
||
| 56 | * |
||
| 57 | * Revision 1.29.2.1 2001/11/16 15:12:23 mjames |
||
| 58 | * Altered modify_names command in response to TH request. |
||
| 59 | * |
||
| 60 | * Revision 1.29 2001/11/01 11:08:05 mjames |
||
| 61 | * Changed help message on extract_templates call |
||
| 62 | * |
||
| 63 | * Revision 1.28 2001/10/31 22:28:27 mjames |
||
| 64 | * Problems with regular expression argument lists. |
||
| 65 | * |
||
| 66 | * Revision 1.27 2001/10/31 22:20:00 mjames |
||
| 67 | * Tidying up problematical comments caused by CVS |
||
| 68 | * 'intelligent' comment guessing |
||
| 69 | * |
||
| 70 | * Revision 1.26 2001/10/31 16:23:22 mjames |
||
| 71 | * Added a datastructure to hide regular expression information from programs. |
||
| 72 | * Changed call to regexec to indicate 0 subexpressions to be matched |
||
| 73 | * rather than a number dependent on strlen(string) which was wrong. |
||
| 11 | mjames | 74 | * |
| 2 | mjames | 75 | * Revision 1.25 2001/10/23 21:14:28 mjames |
| 76 | * Added match_template command : purpose to remove connections |
||
| 77 | * to device pins which do not exist in the template of that device. |
||
| 11 | mjames | 78 | * |
| 2 | mjames | 79 | * Modified set type_id to use wildcards (the only case where this applies) |
| 11 | mjames | 80 | * |
| 2 | mjames | 81 | * Revision 1.24 2001/10/18 21:36:01 mjames |
| 11 | mjames | 82 | * Added modify pins command : nets inherit identifier from selected socket and pin on that socket to ease cross referencing. |
| 83 | * |
||
| 2 | mjames | 84 | * Revision 1.23 2001/10/11 16:10:17 mjames |
| 85 | * Corrections to the SWAP command, and printout so that |
||
| 86 | * WRITE net now outputs all chips in the design so that their generics |
||
| 87 | * can be passed forward to the next phase. |
||
| 11 | mjames | 88 | * |
| 2 | mjames | 89 | * Revision 1.22 2001/10/10 20:19:19 mjames |
| 90 | * added echoq command to give quoted arguments for checking |
||
| 11 | mjames | 91 | * |
| 2 | mjames | 92 | * Revision 1.21 2001/10/07 20:50:54 mjames |
| 93 | * Added wildcard checking (warn user about |
||
| 94 | * using wildcard '*' on the end of a string in stead of wildcard '.*') |
||
| 11 | mjames | 95 | * |
| 2 | mjames | 96 | * Revision 1.20 2001/10/02 20:55:18 mjames |
| 97 | * Edited help files to try and get them more up to date. |
||
| 11 | mjames | 98 | * |
| 2 | mjames | 99 | * Revision 1.19 2001/09/25 23:15:24 mjames |
| 100 | * Converted wildcards to use proper regexp pattern match library |
||
| 11 | mjames | 101 | * |
| 2 | mjames | 102 | * Revision 1.18 2001/09/13 21:08:54 mjames |
| 103 | * Added initial bundle/unbundle commands. |
||
| 11 | mjames | 104 | * |
| 2 | mjames | 105 | * Revision 1.17 2001/08/23 21:34:27 mjames |
| 106 | * Added version command to list out all of the tags |
||
| 11 | mjames | 107 | * |
| 2 | mjames | 108 | * Revision 1.16 2001/08/23 20:34:12 mjames |
| 11 | mjames | 109 | * Made sure that attempts to create duplicate socket identifiers or names fails with the set id and set name commands. |
| 110 | * |
||
| 2 | mjames | 111 | * Revision 1.15 2001/08/23 20:06:30 mjames |
| 112 | * Added 'reserve' command for use with preroute commands. |
||
| 113 | * This command provides the 'correct' documented pin reservation |
||
| 114 | * behaviour. |
||
| 11 | mjames | 115 | * |
| 2 | mjames | 116 | * Revision 1.14 2001/07/20 10:47:43 mjames |
| 117 | * Allowed setting of pin routing group properties on pins on nets |
||
| 118 | * by the "set pin" command |
||
| 11 | mjames | 119 | * |
| 2 | mjames | 120 | * Revision 1.13 2001/07/02 21:21:31 mjames |
| 121 | * Added logging to standard output as well as standard error |
||
| 122 | * in the 'echoe' command |
||
| 11 | mjames | 123 | * |
| 2 | mjames | 124 | * Revision 1.12 2001/06/21 10:52:43 mjames |
| 125 | * Added "echoe" command which echos an error string to the output file. |
||
| 126 | * Also added command documentation for some more of the command line commands. |
||
| 11 | mjames | 127 | * |
| 2 | mjames | 128 | * Revision 1.11 2001/06/19 05:24:34 mjames |
| 129 | * Created a trap_fopen to overcome trying to write to read only files. |
||
| 130 | * If this attempted in NT the file can be opened but not written to. |
||
| 11 | mjames | 131 | * |
| 2 | mjames | 132 | * Revision 1.10 2001/06/06 12:10:25 mjames |
| 133 | * Move from HPUX |
||
| 11 | mjames | 134 | * |
| 2 | mjames | 135 | * Revision 1.9 2001/04/09 14:58:29 mjames |
| 136 | * Added capability to delete generics from specific sockets. |
||
| 11 | mjames | 137 | * |
| 2 | mjames | 138 | * Revision 1.8 2001/04/06 22:47:01 mjames |
| 139 | * Added doc2, the creator of documentation to Vertical scripts uses PERL |
||
| 11 | mjames | 140 | * |
| 141 | * |
||
| 2 | mjames | 142 | * Also correcting generic behaviour and the printing of Verilog. |
| 11 | mjames | 143 | * |
| 2 | mjames | 144 | * Revision 1.7 2001/04/04 22:12:31 mjames |
| 145 | * Added some online documentation to the C program command handler |
||
| 146 | * THis is scanned by a utility called 'doc' that currently creates |
||
| 147 | * simple HTML from part formatted C comments |
||
| 11 | mjames | 148 | * |
| 2 | mjames | 149 | * Also working well on printing VERILOG |
| 11 | mjames | 150 | * |
| 2 | mjames | 151 | * still have problems with C comments and VERTICAL pragmas. |
| 11 | mjames | 152 | * |
| 2 | mjames | 153 | * Revision 1.6 2001/03/29 22:08:55 mjames |
| 154 | * Modified to define the scope of set generic commands : now can be global |
||
| 155 | * or defined for a socket or a simple wildcarded list of sockets. |
||
| 11 | mjames | 156 | * |
| 2 | mjames | 157 | * In addition the is_FPGA property has been activated so that FPGA components |
| 158 | * are not listed out when used in a Verilog (.vb) file. |
||
| 11 | mjames | 159 | * |
| 2 | mjames | 160 | * Version raised to 11.02 |
| 11 | mjames | 161 | * |
| 2 | mjames | 162 | * Revision 1.5 2001/01/26 21:50:10 mjames |
| 163 | * Managed to get vertical non TCL to compile again |
||
| 11 | mjames | 164 | * |
| 2 | mjames | 165 | * Conversion to argv, argc[] mode of operation continues |
| 11 | mjames | 166 | * |
| 2 | mjames | 167 | * Revision 1.4 2001/01/04 21:26:54 mjames |
| 168 | * Modifications to add in the TCL style |
||
| 169 | * argument list to all of the functions |
||
| 170 | * . |
||
| 11 | mjames | 171 | * |
| 2 | mjames | 172 | * Revision 1.3 2001/01/02 07:53:51 mjames |
| 173 | * Made changes to allow for interface with TCL/Tk |
||
| 11 | mjames | 174 | * |
| 2 | mjames | 175 | * Revision 1.2 2000/11/29 23:25:39 mjames |
| 176 | * Corrected a failure to cope with integer type ports on entities |
||
| 177 | * in acf_yacc.y |
||
| 11 | mjames | 178 | * |
| 2 | mjames | 179 | * Altered the elaborate command to call up the template command aw well |
| 11 | mjames | 180 | * |
| 2 | mjames | 181 | * Altered equivalent pins handler to cope with the absence of any templates |
| 11 | mjames | 182 | * |
| 2 | mjames | 183 | * Altered printout routines to use correct datatype for expansion of |
| 184 | * VHDL constants |
||
| 11 | mjames | 185 | * |
| 2 | mjames | 186 | * Revision 1.1.1.1 2000/10/19 21:58:35 mjames |
| 187 | * Mike put it here |
||
| 11 | mjames | 188 | * |
| 189 | * |
||
| 190 | * |
||
| 191 | *****************************************************************************/ |
||
| 2 | mjames | 192 | |
| 11 | mjames | 193 | #include <stdio.h> |
| 194 | #include <stdlib.h> |
||
| 195 | #include <string.h> |
||
| 196 | #include <ctype.h> |
||
| 197 | #include <sys/types.h> |
||
| 198 | #include <regex.h> |
||
| 199 | |||
| 200 | #include "vertcl_main.h" |
||
| 2 | mjames | 201 | #include "expression.h" |
| 202 | #include "generic.h" |
||
| 11 | mjames | 203 | #include "database.h" |
| 204 | #include "printout.h" |
||
| 205 | #include "routing.h" |
||
| 2 | mjames | 206 | #include "jumpering.h" |
| 11 | mjames | 207 | #include "ext_nets.h" |
| 208 | #include "statistics.h" |
||
| 2 | mjames | 209 | #include "partition.h" |
| 11 | mjames | 210 | #include "cmdparse.h" |
| 211 | #include "cmdexec.h" |
||
| 212 | #include "cmdutil.h" |
||
| 213 | #include "cmdlog.h" |
||
| 2 | mjames | 214 | #include "rename.h" |
| 11 | mjames | 215 | #include "template.h" |
| 216 | #include "chck_names.h" |
||
| 217 | #include "acf_yacc.h" |
||
| 2 | mjames | 218 | #include "sorting.h" |
| 11 | mjames | 219 | #include "bundle.h" |
| 220 | #include "equivalent.h" |
||
| 2 | mjames | 221 | #include "unrouted.h" |
| 11 | mjames | 222 | #include "acf_lex_ext.h" |
| 2 | mjames | 223 | |
| 11 | mjames | 224 | #ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/cmdexec2.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
| 2 | mjames | 225 | |
| 226 | |||
| 11 | mjames | 227 | |
| 2 | mjames | 228 | /************************************************************************/ |
| 229 | /* Command handling code */ |
||
| 230 | /************************************************************************/ |
||
| 231 | |||
| 11 | mjames | 232 | |
| 2 | mjames | 233 | /*********************** Set id (of) <name> (to) <id>Command ***************************/ |
| 234 | /* |
||
| 235 | @title |
||
| 236 | set ID_of_name <device_name> <new_id> |
||
| 237 | @application vertical_pin |
||
| 238 | @application vertical_pcb |
||
| 239 | @text |
||
| 240 | Set Identifier for Name. Change the identifier for a named |
||
| 241 | socket. This is used when VERTICAL invents identifiers e.g. |
||
| 242 | 'ID1', and you would rather call it e.g. 'U101'. |
||
| 243 | Assuming chip 'multiplier' is in socket 'ID1' |
||
| 244 | @listing |
||
| 245 | set id multiplier U101 |
||
| 246 | @text |
||
| 247 | Command will fail if there is already a device with the new |
||
| 248 | identifier. |
||
| 249 | @end |
||
| 250 | */ |
||
| 11 | mjames | 251 | int SetIdOfNameHandler(ET_TCLARGS) |
| 2 | mjames | 252 | { |
| 11 | mjames | 253 | socket_t * chip; |
| 254 | if (argc < 2) |
||
| 255 | return(TCL_ERROR); |
||
| 2 | mjames | 256 | |
| 11 | mjames | 257 | /* safety catch code added : is the ident already in use ? */ |
| 258 | chip = find_socket(Ident,argv[1],Search,&socket_head); |
||
| 259 | if(chip) { |
||
| 260 | Log(LOG_ERROR,"Changing socket id for name='%s' fails : id '%s' in use already\n",argv[0],argv[1]); |
||
| 261 | return (TCL_ERROR); |
||
| 262 | }; |
||
| 263 | |||
| 264 | chip = find_socket(Name,argv[0],Search,&socket_head); |
||
| 265 | if(!chip) { |
||
| 266 | Log(LOG_ERROR,"Changing ID: Cannot find socket with name='%s'\n",argv[0]); |
||
| 267 | return (TCL_ERROR); |
||
| 268 | }; |
||
| 269 | set_socket(chip,Ident,argv[1]); |
||
| 270 | Log(LOG_GENERAL,"# Set ident of socket name='%s' to be '%s'\n",argv[0],argv[1]); |
||
| 271 | return(TCL_OK); |
||
| 2 | mjames | 272 | |
| 273 | } |
||
| 274 | /*********************** Set type (of) <name> (to) <type> Command ***************************/ |
||
| 275 | /* |
||
| 276 | @title |
||
| 277 | set TYpe_name <device_name> <new_type> |
||
| 278 | @text |
||
| 279 | @application vertical_pin |
||
| 280 | @application vertical_hdl |
||
| 281 | @application vertical_pcb |
||
| 282 | Provides a means of assigning a device type to a socket where |
||
| 283 | the socket contains a design e.g. an FPGA. This can then be |
||
| 284 | used to tag sockets for the application of pin templates. |
||
| 285 | @end |
||
| 286 | */ |
||
| 11 | mjames | 287 | int SetTypeOfNameHandler(ET_TCLARGS) |
| 2 | mjames | 288 | { |
| 11 | mjames | 289 | socket_t * chip; |
| 290 | if (argc < 2) |
||
| 291 | return(TCL_ERROR); |
||
| 292 | chip = find_socket(Name,argv[0],Search,&socket_head); |
||
| 293 | if(!chip) { |
||
| 294 | Log(LOG_GENERAL,"Cannot find socket with name='%s'\n",argv[0]); |
||
| 295 | return (TCL_ERROR); |
||
| 296 | }; |
||
| 297 | set_socket(chip,Type,argv[1]); |
||
| 298 | Log(LOG_GENERAL,"# Set type of socket name='%s' to be '%s'\n",argv[0],argv[1]); |
||
| 299 | return(TCL_OK); |
||
| 300 | |||
| 2 | mjames | 301 | } |
| 11 | mjames | 302 | /*********************** Set type (of) <ident> (to) <type> Command ***************************/ |
| 2 | mjames | 303 | /* |
| 304 | @title |
||
| 305 | set TYPE_Id <device_id> <new_type> |
||
| 306 | @application vertical_pin |
||
| 307 | @application vertical_hdl |
||
| 308 | @application vertical_pcb |
||
| 309 | @text |
||
| 310 | Provides a means of assigning a device type to a socket where |
||
| 311 | the socket does not necessarily contain a design e.g. a |
||
| 312 | resistor pack. This can then be used to tag sockets for the |
||
| 11 | mjames | 313 | application of pin templates. This has been converted to wildcard usage, as this means |
| 2 | mjames | 314 | all Rxxx can be made type 'resistor'. |
| 315 | |||
| 316 | @end |
||
| 317 | */ |
||
| 11 | mjames | 318 | int SetTypeOfIDHandler(ET_TCLARGS) |
| 2 | mjames | 319 | { |
| 11 | mjames | 320 | socket_t * skt; |
| 321 | int rc; |
||
| 322 | /* compile regular expression */ |
||
| 323 | vert_regex_t * preg; |
||
| 324 | char * pattern; |
||
| 2 | mjames | 325 | |
| 11 | mjames | 326 | if(argc < 2 ) |
| 327 | { |
||
| 328 | Log(LOG_ERROR,"-- Need a device ID and a type\n"); |
||
| 329 | return(TCL_ERROR); |
||
| 330 | } |
||
| 331 | |||
| 332 | pattern = argv[0]; |
||
| 333 | Log(LOG_GENERAL,"-- Beginning setting pin template: prefix '%s' --\n",pattern); |
||
| 2 | mjames | 334 | |
| 11 | mjames | 335 | rc = vert_regcomp(&preg,pattern); |
| 2 | mjames | 336 | |
| 11 | mjames | 337 | if (rc != 0 ) |
| 338 | { |
||
| 339 | char errbuff[100]; |
||
| 340 | regerror(rc,preg->preg,errbuff,100); |
||
| 341 | Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,pattern); |
||
| 342 | |||
| 343 | return TCL_ERROR; |
||
| 344 | } |
||
| 345 | else |
||
| 346 | { |
||
| 347 | Log(LOG_GENERAL,"-- Using '%s' as match pattern\n",pattern); |
||
| 348 | } |
||
| 2 | mjames | 349 | |
| 11 | mjames | 350 | skt = socket_head; |
| 351 | while(skt) |
||
| 352 | { |
||
| 353 | int found; |
||
| 354 | found = regexec(preg->preg,skt->identifier,0,preg->regpatt,0); |
||
| 2 | mjames | 355 | |
| 11 | mjames | 356 | |
| 357 | if(!found) |
||
| 358 | { |
||
| 359 | set_socket(skt,Type,argv[1]); |
||
| 360 | if(level & 1) |
||
| 2 | mjames | 361 | { |
| 11 | mjames | 362 | Log(LOG_GENERAL,"# Set type of socket Ident='%s' to be '%s'\n",skt->identifier,argv[1]); |
| 2 | mjames | 363 | } |
| 11 | mjames | 364 | } |
| 365 | skt = skt->next; |
||
| 366 | } |
||
| 367 | vert_regfree(&preg); |
||
| 368 | return(TCL_OK); |
||
| 2 | mjames | 369 | |
| 11 | mjames | 370 | } |
| 2 | mjames | 371 | /*********************** Set Partition Command ***************************/ |
| 372 | /* |
||
| 373 | @title |
||
| 374 | set PARtition <socket_name> <socket_name> ...... |
||
| 375 | @application vertical_pin |
||
| 376 | @application vertical_hdl |
||
| 377 | @application vertical_pcb |
||
| 378 | @text |
||
| 379 | Sets partition list to be the following named chip sockets, |
||
| 380 | the names being those used in the CHIP declarations in the |
||
| 381 | acfp file. Wildcarding can be used to select related groups of |
||
| 382 | sockets. All this does is select a socket/entity as being a member of the |
||
| 383 | set of socket/entities that will be selected in this partition. |
||
| 384 | @break |
||
| 11 | mjames | 385 | @If no arguments are given this is the same as the set all_par command, in that |
| 2 | mjames | 386 | It routes the design before selecting the partition |
| 387 | @end |
||
| 388 | */ |
||
| 11 | mjames | 389 | int SetPartHandler(ET_TCLARGS) { |
| 390 | int i = 0; |
||
| 391 | int Status = TCL_OK; |
||
| 392 | if(argc == 0) |
||
| 393 | { |
||
| 394 | name_routed_nets(); |
||
| 395 | Status = set_clear_partition(".*",1); |
||
| 396 | } |
||
| 397 | else |
||
| 398 | { |
||
| 399 | for(i=0;i<argc && Status == TCL_OK;i++) |
||
| 400 | { |
||
| 401 | Status = set_clear_partition(argv[i],1); |
||
| 402 | } |
||
| 403 | } |
||
| 404 | if(Status != TCL_OK) |
||
| 405 | { |
||
| 406 | Log(LOG_ERROR,"-- ERROR with pattern '%s'\n",argv[i]); |
||
| 407 | } |
||
| 408 | return(TCL_OK); |
||
| 409 | } |
||
| 2 | mjames | 410 | |
| 411 | /*********************** Set Partition Command ***************************/ |
||
| 412 | /* |
||
| 413 | @title |
||
| 414 | set all_par |
||
| 415 | @application vertical_hdl |
||
| 416 | @text |
||
| 417 | All sockets are selected for the partition. This can be used |
||
| 418 | as part of the process of creating a top level wrapper for the |
||
| 11 | mjames | 419 | entire design in VHDL. |
| 2 | mjames | 420 | @break |
| 11 | mjames | 421 | This is now no different from |
| 2 | mjames | 422 | @listing |
| 423 | set partition |
||
| 424 | @end |
||
| 425 | */ |
||
| 11 | mjames | 426 | int SetPartAllHandler(ET_TCLARGS) |
| 2 | mjames | 427 | { |
| 11 | mjames | 428 | name_routed_nets(); |
| 429 | return set_clear_partition(".*",1); |
||
| 2 | mjames | 430 | } |
| 431 | |||
| 432 | /*********************** Set name (of) <id> (to) <name> Command ***************************/ |
||
| 433 | /* |
||
| 434 | @title |
||
| 435 | set NAme_of_id <device_id> <new_name> |
||
| 436 | @application vertical_pin |
||
| 437 | @application vertical_hdl |
||
| 438 | @application vertical_pcb |
||
| 439 | @text |
||
| 440 | Sets name for socket identified by identifier e.g. 'U1' etc. |
||
| 441 | This is used as a means of assigning chip names given in CHIP |
||
| 442 | declarations in an ACF file to actual PCB socket positions. It |
||
| 443 | is usable as an alternative to the COMPONENTS block in the |
||
| 444 | ACFplus file. |
||
| 445 | @break |
||
| 446 | One an ACFplus file is written (write acf) then the COMPONENTS |
||
| 447 | block will be updated with the CHIP to socket assignment given |
||
| 448 | by this command. |
||
| 449 | @break |
||
| 450 | Fails if the name is already in use in the design. |
||
| 451 | @end |
||
| 452 | */ |
||
| 11 | mjames | 453 | int SetNameOfIdHandler(ET_TCLARGS) |
| 2 | mjames | 454 | { |
| 11 | mjames | 455 | socket_t * chip; |
| 456 | if (argc < 2) |
||
| 457 | return(TCL_ERROR); |
||
| 2 | mjames | 458 | |
| 11 | mjames | 459 | /* safety catch code added : is the name already in use ? */ |
| 460 | chip = find_socket(Name,argv[1],Search,&socket_head); |
||
| 461 | if(chip) { |
||
| 462 | Log(LOG_ERROR,"Renaming socket id='%s' fails : name '%s' in use already\n",argv[0],argv[1]); |
||
| 463 | return (TCL_ERROR); |
||
| 464 | }; |
||
| 465 | |||
| 2 | mjames | 466 | |
| 11 | mjames | 467 | |
| 468 | chip = find_socket(Ident,argv[0],Search,&socket_head); |
||
| 469 | if(!chip) { |
||
| 470 | Log(LOG_ERROR,"Cannot find socket with ident='%s' to rename\n",argv[0]); |
||
| 471 | return (TCL_ERROR); |
||
| 472 | }; |
||
| 473 | set_socket(chip,Name,argv[1]); |
||
| 474 | Log(LOG_GENERAL,"# Set name of socket ident='%s' to be '%s'\n",argv[0],argv[1]); |
||
| 475 | return(TCL_OK); |
||
| 476 | |||
| 477 | |||
| 2 | mjames | 478 | } |
| 479 | /*********************** Set Port Command ***************************/ |
||
| 480 | /* Forces the port to leave the partition */ |
||
| 481 | /* |
||
| 482 | @title |
||
| 483 | set PORt <net_name> |
||
| 484 | @application vertical_hdl |
||
| 485 | @text |
||
| 486 | Forces port on the exterior of a partition if the net is used |
||
| 487 | inside. This is used in VHDL partitioning. |
||
| 488 | @break |
||
| 489 | This is used when a net completes its connection from source |
||
| 490 | to all destinations entirely within the partition. Set port |
||
| 491 | ensures the net is observable via an output port on the |
||
| 492 | exterior of the partition. |
||
| 493 | @break |
||
| 494 | For example: to observe an internal clock signal at the top |
||
| 495 | level of the partition. Note this only works for nets which |
||
| 496 | are visible at the top level of a created entity representing |
||
| 497 | a partition of the design. |
||
| 498 | @listing |
||
| 499 | partition |
||
| 500 | set port divided_clock |
||
| 501 | @end |
||
| 502 | */ |
||
| 11 | mjames | 503 | int SetPortHandler(ET_TCLARGS) |
| 2 | mjames | 504 | { |
| 11 | mjames | 505 | int i; |
| 506 | |||
| 507 | for(i=0;i<argc;i++){ |
||
| 2 | mjames | 508 | |
| 11 | mjames | 509 | force_port(argv[i]); |
| 510 | } |
||
| 511 | return(TCL_OK); |
||
| 2 | mjames | 512 | |
| 11 | mjames | 513 | } |
| 514 | |||
| 2 | mjames | 515 | /*********************** Set Routable Command ***************************/ |
| 516 | /* Sets nets to be routable */ |
||
| 517 | /* |
||
| 518 | @title |
||
| 519 | set routable <net> <net> <net> |
||
| 520 | @application vertical_pin |
||
| 521 | @application vertical_pcb |
||
| 522 | @text |
||
| 523 | Sets the routable flags on wildcarded nets. |
||
| 524 | VERTICAL will see these nets as routable and therefore |
||
| 525 | use them for logic signal assignments. |
||
| 526 | @end |
||
| 527 | */ |
||
| 11 | mjames | 528 | int SetRouteHandler(ET_TCLARGS) |
| 2 | mjames | 529 | { |
| 11 | mjames | 530 | int i; |
| 531 | |||
| 532 | for(i=0;i<argc;i++){ |
||
| 533 | force_route(argv[i],Free); |
||
| 534 | } |
||
| 535 | return(TCL_OK); |
||
| 536 | } |
||
| 2 | mjames | 537 | /*********************** Set High Command ***************************/ |
| 538 | /* Sets nets to be not routable */ |
||
| 539 | /* |
||
| 540 | @title |
||
| 541 | set high <net> <net> <net> |
||
| 542 | @application vertical_pin |
||
| 543 | @application vertical_pcb |
||
| 544 | @text |
||
| 545 | Sets the routing flags on wildcarded nets as Not_Routable_H |
||
| 546 | VERTICAL will see these nets as generally not routable for signals |
||
| 11 | mjames | 547 | but pulled up to a logic '1'. |
| 2 | mjames | 548 | @end |
| 549 | */ |
||
| 11 | mjames | 550 | int SetHighHandler(ET_TCLARGS) |
| 2 | mjames | 551 | { |
| 11 | mjames | 552 | int i; |
| 553 | |||
| 554 | for(i=0;i<argc;i++){ |
||
| 555 | force_route(argv[i],Not_Routable_H); |
||
| 556 | } |
||
| 557 | return(TCL_OK); |
||
| 558 | } |
||
| 2 | mjames | 559 | |
| 560 | /*********************** Set Low Command ***************************/ |
||
| 561 | /* Sets nets to be routable */ |
||
| 562 | /* |
||
| 563 | @title |
||
| 564 | set low <net> <net> <net> |
||
| 565 | @application vertical_pin |
||
| 566 | @application vertical_pcb |
||
| 567 | @text |
||
| 568 | Sets the routing flags on wildcarded nets as Not_Routable_L |
||
| 569 | VERTICAL will see these nets as generally not routable for signals |
||
| 11 | mjames | 570 | but pulled up to a logic '0'. |
| 2 | mjames | 571 | @end |
| 572 | */ |
||
| 11 | mjames | 573 | int SetLowHandler(ET_TCLARGS) |
| 2 | mjames | 574 | { |
| 11 | mjames | 575 | int i; |
| 576 | |||
| 577 | for(i=0;i<argc;i++){ |
||
| 578 | force_route(argv[i],Not_Routable_L); |
||
| 579 | } |
||
| 580 | return(TCL_OK); |
||
| 581 | } |
||
| 2 | mjames | 582 | |
| 583 | |||
| 584 | /*********************** Set Group ***************************/ |
||
| 585 | /* Sets FastTrack routing flags */ |
||
| 11 | mjames | 586 | /* |
| 2 | mjames | 587 | @title |
| 588 | set group <control> <socket> [ <socket> * ] |
||
| 589 | @application vertical_hdl |
||
| 590 | @text |
||
| 591 | Control is an integer value. Socket is a wildcard |
||
| 592 | @break |
||
| 593 | Pin group control flags are setup for each socket: |
||
| 594 | for each pin on that socket , while routing , if |
||
| 595 | @listing |
||
| 596 | <pin group pin A> & <control> == <pin group pin B> & <control> |
||
| 597 | @text |
||
| 11 | mjames | 598 | Then the pins are seen to be interchangeable within their groups. This allows for the scrambling of |
| 599 | a databus for e.g. a RAM chip where data in and out are shared. Some address pins could also be shared |
||
| 600 | in this case. |
||
| 2 | mjames | 601 | @break |
| 602 | Quite often a pin would be given a pin group which is a power of 2: |
||
| 11 | mjames | 603 | interchangeable address pins might be placed in group 1, interchangeable data pins in group 2. |
| 2 | mjames | 604 | |
| 605 | @end |
||
| 606 | */ |
||
| 11 | mjames | 607 | int SetGroupHandler(ET_TCLARGS) { |
| 2 | mjames | 608 | |
| 11 | mjames | 609 | int i; |
| 610 | long num; |
||
| 611 | if (argc == 0) |
||
| 612 | return TCL_ERROR; |
||
| 613 | num = atoi(argv[0]); /* 16 bit number */ |
||
| 614 | for (i=1;i<argc;i++ ){ |
||
| 615 | set_group_route_flags(argv[i],(int)num); |
||
| 616 | } |
||
| 617 | return TCL_OK; |
||
| 618 | } |
||
| 619 | |||
| 2 | mjames | 620 | /*********************** Set Group ***************************/ |
| 621 | /* Sets FastTrack pin group membership on device pins */ |
||
| 11 | mjames | 622 | /* |
| 2 | mjames | 623 | @title |
| 11 | mjames | 624 | set pin_group <control> <socket_id>[(<pin_id>)] |
| 2 | mjames | 625 | @application vertical_pin |
| 626 | @text |
||
| 627 | Control is an integer value. |
||
| 628 | @break |
||
| 11 | mjames | 629 | Pin group memberships are setup for each pin on each socket. Socket identifier and pin identifiers can be wildcarded. |
| 630 | The pin identifier is wrapped by "()" brackets. |
||
| 2 | mjames | 631 | @listing |
| 632 | set pin_group 11 X.*(.*a) |
||
| 633 | @text |
||
| 634 | All pins on sockets with identifiers beginning with 'X' and whose pin identifier ends |
||
| 635 | in 'a' are to be made a member of group 11. |
||
| 636 | @listing |
||
| 637 | set pin_group 12 X12 |
||
| 638 | @text |
||
| 11 | mjames | 639 | All pins on X12 are members of group 12; If the pin identifier is omitted this is the same as 'all pins on the socket'. Otherwise pins with Id matching will be processed. |
| 2 | mjames | 640 | |
| 641 | @end |
||
| 642 | */ |
||
| 643 | |||
| 644 | |||
| 11 | mjames | 645 | |
| 646 | |||
| 647 | int SetPinGroupHandler(ET_TCLARGS) { |
||
| 648 | |||
| 649 | int i; |
||
| 650 | long num; |
||
| 651 | if (argc == 0) |
||
| 652 | return TCL_ERROR; |
||
| 653 | num = atoi(argv[0]); /* 16 bit number */ |
||
| 654 | for (i=1;i<argc;i++ ){ |
||
| 655 | set_pin_group_flags(argv[i],(int)num); |
||
| 656 | } |
||
| 657 | return TCL_OK; |
||
| 658 | } |
||
| 659 | |||
| 2 | mjames | 660 | /*********************** Set External Command ***************************/ |
| 661 | /* Sets sockets as external connections. Prevents 'rsvXXXXz' nets name |
||
| 662 | from appearing on connected nets */ |
||
| 663 | /* |
||
| 664 | @title |
||
| 665 | set EXTernal [<prefix> | <identifier> ] |
||
| 666 | @application vertical_pin |
||
| 667 | @application vertical_hdl |
||
| 668 | @application vertical_pcb |
||
| 669 | @text |
||
| 670 | The concept of internal and external sockets is used in |
||
| 671 | several situations. Imagine that an external socket is placed |
||
| 672 | in a position where it is visible and the other non-external |
||
| 673 | sockets are not visible. |
||
| 674 | @break |
||
| 675 | Once a socket has been declared as external, different parts |
||
| 676 | of VERTICAL use this information in different ways. If the |
||
| 677 | user wishes to set different sockets as 'external' at |
||
| 678 | different times then this can be achieved by the use of set |
||
| 679 | and del external commands. |
||
| 680 | @break |
||
| 681 | Wildcards using regexp pattern matching are allowed |
||
| 682 | @break |
||
| 683 | When routing, an internal socket will have pins that are |
||
| 684 | connected to nets but not required on the socket named as |
||
| 685 | 'rsvXXXXz'. An external socket will have these pins named |
||
| 686 | according to the name of the net. (see route and preroute command) |
||
| 687 | @break |
||
| 688 | When creating jumpers, only those sockets marked as external |
||
| 689 | will be considered for jumpering. (see jumper command) |
||
| 690 | @break |
||
| 691 | In addition, using the write external command will list only |
||
| 692 | those sockets which have the external attribute. |
||
| 693 | @listing |
||
| 694 | set external X.* |
||
| 695 | @text |
||
| 696 | Will flag all sockets with identifier prefixed by 'X' as |
||
| 697 | external. |
||
| 698 | So in this case e.g. X1, X2, X100, X101_a will all be labelled |
||
| 699 | as external. |
||
| 700 | Usage of set external is cumulative. |
||
| 701 | @break |
||
| 702 | Only external sockets are listed out in write vlog command |
||
| 11 | mjames | 703 | to filter out unwanted sockets by deleting the external |
| 2 | mjames | 704 | property. |
| 705 | @end |
||
| 706 | */ |
||
| 11 | mjames | 707 | int SetExternHandler(ET_TCLARGS) |
| 2 | mjames | 708 | { |
| 11 | mjames | 709 | int i; |
| 710 | for(i=0;i<argc;i++) { |
||
| 711 | set_external_flags(argv[i]); |
||
| 712 | } |
||
| 713 | return(TCL_OK); |
||
| 714 | } |
||
| 2 | mjames | 715 | |
| 11 | mjames | 716 | |
| 717 | |||
| 2 | mjames | 718 | /**************************************************************/ |
| 719 | /* wildcard setting of generics */ |
||
| 720 | /**************************************************************/ |
||
| 721 | |||
| 11 | mjames | 722 | static void set_wildcard_generic( char * template, |
| 723 | generic_info_t * info) |
||
| 724 | { |
||
| 725 | int rc; |
||
| 726 | socket_t * skt = socket_head; |
||
| 727 | int found = 0; |
||
| 2 | mjames | 728 | |
| 11 | mjames | 729 | /* compile regular expression */ |
| 730 | vert_regex_t * preg; |
||
| 2 | mjames | 731 | |
| 11 | mjames | 732 | /* pick out a wildcard if all sockets then scope is the global generics */ |
| 733 | if(ISNULLSTR(template)) |
||
| 734 | { |
||
| 735 | set_generic_value(&global_generics,info); |
||
| 736 | return; |
||
| 737 | } |
||
| 2 | mjames | 738 | |
| 739 | |||
| 740 | |||
| 11 | mjames | 741 | rc = vert_regcomp(&preg,template); |
| 2 | mjames | 742 | |
| 11 | mjames | 743 | if (rc != 0 ) |
| 744 | { |
||
| 745 | char errbuff[100]; |
||
| 746 | regerror(rc,preg->preg,errbuff,100); |
||
| 747 | Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,template); |
||
| 748 | |||
| 749 | return /*TCL_ERROR*/; |
||
| 750 | } |
||
| 751 | else |
||
| 752 | { |
||
| 753 | Log(LOG_GENERAL,"-- Using '%s' as match pattern\n",template); |
||
| 754 | } |
||
| 2 | mjames | 755 | |
| 11 | mjames | 756 | while(skt) { |
| 757 | found = regexec(preg->preg,skt->identifier,0,preg->regpatt,0); |
||
| 758 | if(!found) { |
||
| 759 | set_generic_value(&skt->generics,info); |
||
| 760 | } |
||
| 761 | skt = skt->next; |
||
| 762 | } |
||
| 2 | mjames | 763 | |
| 11 | mjames | 764 | vert_regfree(&preg); |
| 765 | } |
||
| 766 | |||
| 767 | |||
| 2 | mjames | 768 | /*********************** Set FPGA Command ***************************/ |
| 11 | mjames | 769 | /* Sets a socket as containing an FPGA : if set then a module declaration will not be made in |
| 2 | mjames | 770 | when writing VERILOG out */ |
| 771 | /* |
||
| 772 | @title |
||
| 11 | mjames | 773 | set fpga <socket> <line_replacing_declaration> |
| 2 | mjames | 774 | @application vertical_hdl |
| 775 | @text |
||
| 11 | mjames | 776 | Sets sockets as containing an FPGA : if set then a module declaration will not be made in |
| 2 | mjames | 777 | when writing VERILOG out |
| 778 | @end |
||
| 779 | */ |
||
| 11 | mjames | 780 | int SetFPGAHandler(ET_TCLARGS) |
| 2 | mjames | 781 | { |
| 11 | mjames | 782 | generic_info_t info; |
| 783 | if(argc<2) { |
||
| 784 | Log(LOG_ERROR,"-- need 2 arguments to Set FPGA\n"); |
||
| 785 | return TCL_ERROR; |
||
| 786 | } |
||
| 787 | info.name = "fpga_file"; |
||
| 788 | info.typename = "string"; |
||
| 789 | info.g_type = IS_ATTRIBUTE; |
||
| 790 | info.expr = compile_expression_from_string(argv[1]); |
||
| 791 | info.g_class = DEFINED; |
||
| 792 | set_wildcard_generic(argv[0],&info); |
||
| 793 | set_FPGA_flags(argv[0]); /* set flags */ |
||
| 794 | return(TCL_OK); |
||
| 795 | } |
||
| 2 | mjames | 796 | |
| 11 | mjames | 797 | |
| 2 | mjames | 798 | /*********************** Set Generic String ***************************/ |
| 799 | /* Sets a named generic to a value or string */ |
||
| 800 | /* |
||
| 11 | mjames | 801 | @title |
| 2 | mjames | 802 | set generic string <ident> <scope> <string> |
| 803 | @application vertical_hdl |
||
| 804 | @text |
||
| 805 | This command sets up a generic identified by name as <ident> |
||
| 806 | (variable) to be a string value. |
||
| 807 | @break |
||
| 11 | mjames | 808 | If <scope> is "" then the scope of the generic is global, applied to all sockets and signals within the design |
| 2 | mjames | 809 | @listing |
| 810 | set generic string vhdl_basetype "" "std_logic_vector" |
||
| 811 | @text |
||
| 812 | Will set up a global generic called vhdl_basetype with value "std_logic_vector" |
||
| 813 | @break |
||
| 11 | mjames | 814 | If <scope> is "*" then the generic is applied to all sockets. This is used to set a default value for all instances of that |
| 815 | generic to the string value given. Its scope is local to each socket. It can be overridden by |
||
| 816 | specific socket generic assignments. |
||
| 2 | mjames | 817 | @break |
| 11 | mjames | 818 | If <scope> is a wildcard (ends in "*") then all of the sockets matching will have their generic values set. |
| 2 | mjames | 819 | @end |
| 820 | */ |
||
| 11 | mjames | 821 | int SetGenericStringHandler(ET_TCLARGS) { |
| 822 | generic_info_t info; |
||
| 823 | if (argc < 3) |
||
| 824 | return TCL_ERROR; |
||
| 825 | info.name = argv[1]; |
||
| 826 | info.typename = "string"; |
||
| 827 | info.g_type = IS_STRING; |
||
| 828 | info.expr = compile_string(argv[2]); |
||
| 829 | set_wildcard_generic(argv[0],&info); |
||
| 830 | return(TCL_OK); |
||
| 831 | } |
||
| 2 | mjames | 832 | /*********************** Set Generic Declaration ***************************/ |
| 833 | /* Sets a named generic to a value or string */ |
||
| 834 | /* |
||
| 11 | mjames | 835 | @title |
| 2 | mjames | 836 | set generic declaration <ident> <scope> <string> |
| 837 | @application vertical_hdl |
||
| 838 | @text |
||
| 839 | This sets up generics which are string generics but which are used in Verilog declarations |
||
| 11 | mjames | 840 | for use with Certify. These are enclosed in verilog comments as pragmas when written out. |
| 2 | mjames | 841 | @break |
| 842 | See set generic string for more information. |
||
| 843 | @end |
||
| 844 | */ |
||
| 11 | mjames | 845 | int SetGenericDeclarationHandler(ET_TCLARGS) { |
| 846 | generic_info_t info; |
||
| 2 | mjames | 847 | |
| 11 | mjames | 848 | info.name = argv[1]; |
| 849 | info.typename = "string"; |
||
| 850 | info.g_class = DEFINED; |
||
| 851 | info.g_type = IS_DECLARATION_DIRECTIVE; |
||
| 852 | info.expr = compile_string(argv[2]); |
||
| 853 | set_wildcard_generic(argv[0],&info); |
||
| 854 | return(TCL_OK); |
||
| 855 | } |
||
| 2 | mjames | 856 | /*********************** Set Generic instance ***************************/ |
| 857 | /* Sets a named generic to a value or string */ |
||
| 858 | /* |
||
| 11 | mjames | 859 | @title |
| 2 | mjames | 860 | set generic instance <ident> <scope> <string> |
| 861 | @application vertical_hdl |
||
| 862 | @text |
||
| 863 | This sets up generics which are string generics but which are used in Verilog instances |
||
| 11 | mjames | 864 | for use with Certify. These are enclosed in verilog comments as pragmas when written out. |
| 2 | mjames | 865 | @break |
| 866 | See set generic string for more information. |
||
| 867 | @end |
||
| 868 | */ |
||
| 869 | |||
| 11 | mjames | 870 | int SetGenericInstanceHandler(ET_TCLARGS) { |
| 871 | generic_info_t info; |
||
| 872 | if (argc < 3) |
||
| 873 | return TCL_ERROR; |
||
| 874 | info.name = argv[1]; |
||
| 875 | info.typename = "string"; |
||
| 876 | info.g_class = DEFINED; |
||
| 877 | info.g_type = IS_INSTANCE_DIRECTIVE; |
||
| 878 | info.expr = compile_string(argv[2]); |
||
| 879 | set_wildcard_generic(argv[0],&info); |
||
| 2 | mjames | 880 | |
| 11 | mjames | 881 | return(TCL_OK); |
| 882 | |||
| 883 | } |
||
| 2 | mjames | 884 | /*********************** Set Generic Integer ***************************/ |
| 885 | /* Sets a named generic to an integer value*/ |
||
| 886 | /* |
||
| 11 | mjames | 887 | @title |
| 2 | mjames | 888 | set generic integer <ident> <scope> <expression> |
| 889 | @application vertical_hdl |
||
| 890 | @text |
||
| 11 | mjames | 891 | This sets up generics which are integer expressions, usable in place of VHDL constant declarations in .acfp files. |
| 2 | mjames | 892 | @break |
| 893 | See set generic string for more information. |
||
| 894 | @end |
||
| 895 | */ |
||
| 896 | |||
| 897 | |||
| 11 | mjames | 898 | int SetGenericIntegerHandler(ET_TCLARGS) { |
| 899 | generic_info_t info; |
||
| 900 | if (argc < 3) |
||
| 901 | return TCL_ERROR; |
||
| 902 | info.name = argv[1]; |
||
| 903 | info.typename = "integer"; |
||
| 904 | info.g_type = IS_INTEGER; |
||
| 905 | info.g_class = DEFINED; |
||
| 906 | info.expr = compile_expression_from_string(argv[2]); /* this needs to be altered */ |
||
| 2 | mjames | 907 | |
| 11 | mjames | 908 | |
| 909 | set_wildcard_generic(argv[0],&info); |
||
| 910 | return(TCL_OK); |
||
| 911 | |||
| 912 | |||
| 913 | |||
| 914 | |||
| 915 | } |
||
| 916 | |||
| 917 | |||
| 2 | mjames | 918 | /*********************** Set Generic Value ***************************/ |
| 11 | mjames | 919 | /* Sets a named generic to an integer range : workout from range whether this is TO or DOWNTO */ |
| 2 | mjames | 920 | /* |
| 11 | mjames | 921 | @title |
| 2 | mjames | 922 | set generic value <ident> <scope> <expression> |
| 923 | @application vertical_hdl |
||
| 924 | @text |
||
| 11 | mjames | 925 | Sets a named generic to an integer range : workout from range whether this is TO or DOWNTO, (TO has first expression less than second), usable in place of VHDL constant declarations in .acfp files. |
| 2 | mjames | 926 | @break |
| 927 | See set generic string for more information. |
||
| 928 | @end |
||
| 929 | */ |
||
| 930 | |||
| 11 | mjames | 931 | int SetGenericValueHandler(ET_TCLARGS) { |
| 2 | mjames | 932 | |
| 11 | mjames | 933 | expression_t * p; |
| 934 | generic_info_t info ; |
||
| 935 | if (argc<3) |
||
| 936 | return (TCL_ERROR); |
||
| 2 | mjames | 937 | |
| 11 | mjames | 938 | info.name = argv[1]; |
| 2 | mjames | 939 | |
| 11 | mjames | 940 | |
| 941 | p = compile_expression_from_string(argv[2]); |
||
| 942 | |||
| 943 | if(p) |
||
| 944 | { |
||
| 945 | switch(p->opcode) |
||
| 946 | { |
||
| 947 | case TO: |
||
| 948 | case DOWNTO: |
||
| 2 | mjames | 949 | { |
| 11 | mjames | 950 | info.g_type = p->opcode; |
| 951 | info.typename = "integer range"; |
||
| 952 | break; |
||
| 2 | mjames | 953 | } |
| 11 | mjames | 954 | case TXT_STRING: |
| 955 | { |
||
| 956 | info.g_type = IS_STRING; |
||
| 957 | info.typename = "string"; |
||
| 958 | break; |
||
| 959 | } |
||
| 960 | default: |
||
| 961 | { |
||
| 962 | info.g_type = IS_INTEGER; |
||
| 963 | info.typename = "integer"; |
||
| 964 | break; |
||
| 965 | } |
||
| 966 | } |
||
| 967 | } |
||
| 968 | |||
| 969 | info.g_class = DEFINED; |
||
| 970 | info.expr = p; |
||
| 971 | |||
| 972 | set_wildcard_generic(argv[0],&info); |
||
| 973 | return(TCL_OK); |
||
| 974 | } |
||
| 2 | mjames | 975 | |
| 976 | |||
| 977 | /*********************** Set Generic Attribute ***************************/ |
||
| 978 | /* Sets a named generic attribute to an integer value*/ |
||
| 979 | /* |
||
| 11 | mjames | 980 | @title |
| 2 | mjames | 981 | set generic attribute <ident> <scope> <expression> |
| 982 | @application vertical_hdl |
||
| 983 | @text |
||
| 11 | mjames | 984 | This sets up generics which are integer expressions, usable in place of VHDL constant declarations in .acfp files. |
| 2 | mjames | 985 | @break |
| 986 | See set generic string for more information. |
||
| 987 | @end |
||
| 988 | */ |
||
| 989 | |||
| 990 | |||
| 11 | mjames | 991 | int SetGenericAttributeHandler(ET_TCLARGS) { |
| 992 | generic_info_t info; |
||
| 993 | if (argc < 3) |
||
| 994 | return TCL_ERROR; |
||
| 995 | info.name = argv[1]; |
||
| 996 | info.typename = "attribute"; |
||
| 997 | info.g_type = IS_ATTRIBUTE; |
||
| 998 | info.expr = compile_expression_from_string(argv[2]); |
||
| 999 | info.g_class = DEFINED; |
||
| 1000 | set_wildcard_generic(argv[0],&info); |
||
| 1001 | return(TCL_OK); |
||
| 1002 | } |
||
| 1003 | |||
| 2 | mjames | 1004 | /*********************** Set Generic Boolean ***************************/ |
| 1005 | /* Sets a named generic to an integer value*/ |
||
| 1006 | /* |
||
| 11 | mjames | 1007 | @title |
| 2 | mjames | 1008 | set generic boolean <ident> <scope> <integer> |
| 1009 | @application vertical_hdl |
||
| 1010 | @text |
||
| 11 | mjames | 1011 | This sets up booleans containing the value of boolean expressions, usable in place of VHDL constant declarations in .acfp files. |
| 1012 | @break |
||
| 2 | mjames | 1013 | Any non-zero integer is TRUE, and zero is FALSE. |
| 1014 | @break |
||
| 1015 | See set generic string for more information. |
||
| 1016 | @end |
||
| 1017 | */ |
||
| 1018 | |||
| 1019 | |||
| 11 | mjames | 1020 | int SetGenericBooleanHandler(ET_TCLARGS) { |
| 1021 | generic_info_t info; |
||
| 1022 | if (argc < 3) |
||
| 1023 | return TCL_ERROR; |
||
| 1024 | info.name = argv[1]; |
||
| 1025 | info.typename = "integer"; |
||
| 1026 | info.g_type = IS_BOOLEAN; |
||
| 1027 | /* think about using : convert_num(char * string,int * value) */ |
||
| 1028 | info.expr = compile_expression_from_string(argv[2]); /* Can use true/false as well now ... */ |
||
| 1029 | set_wildcard_generic(argv[0],&info); |
||
| 1030 | return(TCL_OK); |
||
| 1031 | } |
||
| 1032 | |||
| 1033 | |||
| 1034 | |||
| 1035 | |||
| 2 | mjames | 1036 | /*********************** Set Generic Menu ***************************/ |
| 1037 | /* Sets a named generic to a value or string */ |
||
| 1038 | |||
| 11 | mjames | 1039 | CommandMenu SetGenericMenu= { |
| 1040 | {"attribute", 3, SetGenericAttributeHandler,NULL, |
||
| 1041 | "Integer instance attribute", |
||
| 1042 | "<socket*>|\"\" <name> <value>",NULL}, |
||
| 1043 | {"string", 3, SetGenericStringHandler,NULL, |
||
| 1044 | "String constant", |
||
| 1045 | "<socket*>|\"\" <name> <string text>",NULL}, |
||
| 1046 | {"integer", 3, SetGenericIntegerHandler,NULL, |
||
| 1047 | "Integer constant expression", |
||
| 1048 | "<socket*>|\"\" <name> <value>",NULL}, |
||
| 1049 | {"boolean", 3, SetGenericBooleanHandler,NULL, |
||
| 1050 | "Boolean constant", |
||
| 1051 | "<socket*>|\"\" <name> <value>",NULL}, |
||
| 1052 | {"value", 3, SetGenericValueHandler,NULL, |
||
| 1053 | "Generic expression", |
||
| 1054 | "<socket*>|\"\" <name> <expression>",NULL}, |
||
| 1055 | {"declaration", 3, SetGenericDeclarationHandler,NULL, |
||
| 1056 | "Certify .vb declaration directive", |
||
| 1057 | "<socket*>|\"\" <name> <value>",NULL}, |
||
| 1058 | {"instance", 3, SetGenericInstanceHandler,NULL, |
||
| 1059 | "Certify .vb instance directive", |
||
| 1060 | "<socket*>|\"\" <name> <value>",NULL}, |
||
| 1061 | { NULL,0,NULL,NULL,NULL} |
||
| 2 | mjames | 1062 | |
| 1063 | |||
| 11 | mjames | 1064 | }; |
| 1065 | |||
| 2 | mjames | 1066 | /*********************** Set Command ***************************/ |
| 1067 | |||
| 11 | mjames | 1068 | CommandMenu SetMenu = { |
| 1069 | {"id_of_name", 2, SetIdOfNameHandler,NULL, |
||
| 1070 | "Set Identifier for Name", |
||
| 1071 | "<device_name> <new_id>",NULL}, |
||
| 1072 | {"name_id", 2, SetNameOfIdHandler,NULL, |
||
| 1073 | "Sets name for socket identifier", |
||
| 1074 | "<device_id> <new_name>",NULL}, |
||
| 1075 | {"type_id", 6, SetTypeOfIDHandler,NULL, |
||
| 1076 | "Sets type for socket identifier", |
||
| 1077 | "<device_id> <new_type>",NULL}, |
||
| 1078 | {"type_name", 2, SetTypeOfNameHandler,NULL, |
||
| 1079 | "Sets type for device named", |
||
| 1080 | "<device_name> <new_type>",NULL}, |
||
| 1081 | {"partition", 3, SetPartHandler,NULL, |
||
| 1082 | "Sets partition list", |
||
| 1083 | "<socket_name>*",NULL}, |
||
| 1084 | {"all_partition",5, SetPartAllHandler,NULL, |
||
| 1085 | "Sets partition list to all sockets", |
||
| 1086 | "",NULL}, |
||
| 1087 | {"port", 3, SetPortHandler,NULL, |
||
| 1088 | "Forces port on partition if used inside", |
||
| 1089 | "<net_name_prefix>*",NULL}, |
||
| 1090 | {"routable", 3, SetRouteHandler,NULL, |
||
| 1091 | "Flags routed nets as routable", |
||
| 1092 | "<net_id>*",NULL}, |
||
| 1093 | {"high", 3, SetHighHandler,NULL, |
||
| 1094 | "Flags routed nets as not routable logic 1", |
||
| 1095 | "<net_id>*",NULL}, |
||
| 1096 | {"low", 3, SetLowHandler,NULL, |
||
| 1097 | "Flags routed nets as not routable logic 0", |
||
| 1098 | "<net_id>*",NULL}, |
||
| 1099 | {"external", 3, SetExternHandler,NULL, |
||
| 1100 | "Sets socket IDs prefixed by prefix as external", |
||
| 1101 | "<prefix>*",NULL}, |
||
| 1102 | {"fpga", 3, SetFPGAHandler,NULL, |
||
| 1103 | "Sets socket IDs prefixed by prefix as being FPGA: no Verilog declaration", |
||
| 1104 | "<prefix>*",NULL}, |
||
| 1105 | {"group", 3, SetGroupHandler,NULL, |
||
| 1106 | "Enables 'FastTrack group' routing: 1=row 2=col 3=both", |
||
| 1107 | "<mask_value> [<id_prefix>*]",NULL}, |
||
| 1108 | {"pin_group", 3, SetPinGroupHandler,NULL, |
||
| 1109 | "Sets pin group membership on pins of devices", |
||
| 1110 | "<group> <id_prefix>[(<pin_prefix>)]",NULL}, |
||
| 1111 | {"generic", 3, NULL,SetGenericMenu, |
||
| 1112 | "Sets generic value ", |
||
| 1113 | "more",NULL}, |
||
| 1114 | { NULL,0,NULL,NULL,NULL,NULL}, |
||
| 2 | mjames | 1115 | |
| 11 | mjames | 1116 | }; |
| 2 | mjames | 1117 | |
| 11 | mjames | 1118 | |
| 2 | mjames | 1119 | /*********************** Delete Port Command ***************************/ |
| 1120 | /* Deletes the ports from the partition */ |
||
| 1121 | /* |
||
| 1122 | @title |
||
| 1123 | delete port <port> [ <port> ]* |
||
| 1124 | @application vertical_hdl |
||
| 1125 | @text |
||
| 1126 | Remove port from partition. If a signal (port) of that name |
||
| 1127 | exists on the top level of a partition, it is made to be |
||
| 1128 | hidden inside. |
||
| 1129 | @break |
||
| 1130 | This is used e.g. when a local copy of a bus is used in all |
||
| 1131 | partitions on a multiple EPLD board. |
||
| 1132 | If the bus appears as a port on all of the EPLDs as it would |
||
| 1133 | by default, as there is a driver inside each EPLD and inputs |
||
| 1134 | in each EPLD, then there will be multiple driver conflicts on |
||
| 1135 | the breadboard. |
||
| 1136 | @end |
||
| 1137 | */ |
||
| 11 | mjames | 1138 | int DelPortHandler(ET_TCLARGS) |
| 2 | mjames | 1139 | { |
| 11 | mjames | 1140 | int i; |
| 1141 | for(i=0;i<argc;i++) { |
||
| 1142 | delete_port(argv[i]); |
||
| 1143 | } |
||
| 1144 | return(TCL_OK); |
||
| 2 | mjames | 1145 | } |
| 1146 | |||
| 11 | mjames | 1147 | |
| 2 | mjames | 1148 | /*********************** Set Not Routable Command ***************************/ |
| 1149 | /* Sets nets to be not routable */ |
||
| 1150 | /* |
||
| 1151 | @title |
||
| 1152 | delete route <net> [ <net> ] * |
||
| 1153 | @application vertical_pin |
||
| 1154 | @application vertical_hdl |
||
| 1155 | @application vertical_pcb |
||
| 1156 | @text |
||
| 11 | mjames | 1157 | Remove the routable property from the named nets. These nets will not be used in routing by vertical. |
| 2 | mjames | 1158 | @listing |
| 1159 | del route VCC.* GND.* NCONFIG CONF_DONE |
||
| 1160 | @text |
||
| 1161 | Will ensure that these nets are set as not routable. |
||
| 1162 | This is often seen in netlist import scripts. |
||
| 1163 | @end |
||
| 1164 | */ |
||
| 11 | mjames | 1165 | int DelRouteHandler(ET_TCLARGS) |
| 2 | mjames | 1166 | { |
| 11 | mjames | 1167 | int i; |
| 1168 | for(i=0;i<argc;i++) { |
||
| 1169 | force_route(argv[i],Not_Routable); |
||
| 1170 | } |
||
| 1171 | return(TCL_OK); |
||
| 2 | mjames | 1172 | } |
| 1173 | |||
| 11 | mjames | 1174 | |
| 1175 | |||
| 2 | mjames | 1176 | /*********************** Delete NetName Command ***************************/ |
| 1177 | /* Deletes the name fileds form nets by ID from the partition */ |
||
| 1178 | /* |
||
| 1179 | @title |
||
| 1180 | delete netname <net> [ <net> ] * |
||
| 1181 | @application vertical_pin |
||
| 1182 | @application vertical_hdl |
||
| 1183 | @application vertical_pcb |
||
| 1184 | @text |
||
| 11 | mjames | 1185 | The signal names assigned to the nets are removed, so that clean netlists are |
| 2 | mjames | 1186 | written out without any routing history. Use this if when importing netlists, |
| 1187 | where the net names used may match those in the as yet unrouted design that |
||
| 1188 | will use those nets. Routing that tries to reuse nets which were previously |
||
| 1189 | used will be confused by names appearing on the nets. |
||
| 1190 | @end |
||
| 1191 | */ |
||
| 1192 | |||
| 11 | mjames | 1193 | int DelNetNameHandler(ET_TCLARGS) |
| 2 | mjames | 1194 | { |
| 11 | mjames | 1195 | int i; |
| 1196 | for(i=0;i<argc;i++) { |
||
| 1197 | del_net_names(argv[i]); |
||
| 1198 | } |
||
| 1199 | return(TCL_OK); |
||
| 2 | mjames | 1200 | } |
| 1201 | /*********************** Delete Port Command ***************************/ |
||
| 1202 | /* Clears the is_external bits on all sockets */ |
||
| 1203 | /* |
||
| 1204 | @title |
||
| 1205 | delete EXTernal <socket> [ <socket ] * |
||
| 1206 | @application vertical_pin |
||
| 1207 | @application vertical_hdl |
||
| 1208 | @application vertical_pcb |
||
| 1209 | @text |
||
| 1210 | This clears the external attribute flags from all sockets. The |
||
| 1211 | name matching rules are the same as for set external command |
||
| 1212 | @end |
||
| 1213 | */ |
||
| 11 | mjames | 1214 | int DelExternHandler(ET_TCLARGS) |
| 2 | mjames | 1215 | { |
| 11 | mjames | 1216 | int i; |
| 1217 | for(i=0;i<argc;i++) { |
||
| 1218 | clear_external_flags(argv[i]); |
||
| 1219 | } |
||
| 1220 | return(TCL_OK); |
||
| 1221 | } |
||
| 2 | mjames | 1222 | |
| 1223 | /*********************** Delete Port Command ***************************/ |
||
| 1224 | /* Clears the is_FPGA bits on all sockets */ |
||
| 1225 | /* |
||
| 1226 | @title |
||
| 1227 | delete FPGA <socket> [ <socket ] * |
||
| 1228 | @application vertical_hdl |
||
| 1229 | @text |
||
| 1230 | This clears the FPGA attribute flags from all sockets. The |
||
| 1231 | name matching rules are the same as for set FPGA command |
||
| 1232 | @end |
||
| 1233 | */ |
||
| 11 | mjames | 1234 | int DelFPGAHandler(ET_TCLARGS) |
| 2 | mjames | 1235 | { |
| 11 | mjames | 1236 | int i; |
| 1237 | for(i=0;i<argc;i++) { |
||
| 1238 | clear_FPGA_flags(argv[i]); |
||
| 1239 | } |
||
| 1240 | return(TCL_OK); |
||
| 1241 | } |
||
| 2 | mjames | 1242 | |
| 1243 | /*********************** Delete Partition Command ***************************/ |
||
| 1244 | /* Clears the partition selection on all sockets */ |
||
| 1245 | /* |
||
| 1246 | @title |
||
| 1247 | delete partition <socket> [ <socket>* ] |
||
| 1248 | @application vertical_hdl |
||
| 1249 | @text |
||
| 1250 | This clears the partition flags from wildcarded named sockets. The |
||
| 1251 | name matching rules are the same as for set partition command |
||
| 1252 | @break |
||
| 1253 | If no arguments are given this results in routing created for the partition being |
||
| 11 | mjames | 1254 | ripped up. Use |
| 2 | mjames | 1255 | @listing |
| 1256 | delete partition |
||
| 1257 | @text |
||
| 1258 | to clean up |
||
| 1259 | @end |
||
| 1260 | */ |
||
| 11 | mjames | 1261 | int DelPartitionHandler(ET_TCLARGS) |
| 1262 | { |
||
| 1263 | int i,Status = TCL_OK; |
||
| 1264 | if (argc==0) |
||
| 1265 | { |
||
| 1266 | clear_partition_nets(); |
||
| 1267 | Status = set_clear_partition(".*",0); |
||
| 1268 | } |
||
| 2 | mjames | 1269 | |
| 11 | mjames | 1270 | for(i=0;i<argc && Status == TCL_OK;i++){ |
| 1271 | Status = set_clear_partition(argv[i],0); |
||
| 1272 | } |
||
| 1273 | if(Status != TCL_OK) |
||
| 1274 | { |
||
| 1275 | Log(LOG_ERROR,"-- ERROR with pattern '%s'\n",argv[i]); |
||
| 1276 | } |
||
| 1277 | return(Status); |
||
| 1278 | } |
||
| 2 | mjames | 1279 | |
| 11 | mjames | 1280 | |
| 2 | mjames | 1281 | /*********************** Delete Generic Command ***************************/ |
| 11 | mjames | 1282 | /* |
| 2 | mjames | 1283 | @title |
| 1284 | delete generic <generic_name> <scope> |
||
| 1285 | @application vertical_hdl |
||
| 1286 | @text |
||
| 11 | mjames | 1287 | This function will delete any generic given in either global generics or all sockets matching pattern. |
| 1288 | See set generic for naming rules. |
||
| 2 | mjames | 1289 | @end |
| 1290 | */ |
||
| 11 | mjames | 1291 | int DelGenericHandler(ET_TCLARGS) |
| 1292 | { |
||
| 1293 | generic_info_t info ; |
||
| 1294 | int rc; |
||
| 1295 | socket_t * skt = socket_head; |
||
| 1296 | int found = 0; |
||
| 1297 | /* compile regular expression */ |
||
| 1298 | vert_regex_t * preg; |
||
| 2 | mjames | 1299 | |
| 11 | mjames | 1300 | if (argc<2) |
| 1301 | return (TCL_ERROR); |
||
| 2 | mjames | 1302 | |
| 1303 | |||
| 11 | mjames | 1304 | info.name = argv[1]; |
| 2 | mjames | 1305 | |
| 11 | mjames | 1306 | /* pick out a wildcard if all sockets then scope is the global generics */ |
| 1307 | if(ISNULLSTR(argv[0])) |
||
| 1308 | { |
||
| 1309 | del_generic_value(&global_generics,&info); |
||
| 1310 | return 0; |
||
| 1311 | } |
||
| 2 | mjames | 1312 | |
| 1313 | |||
| 1314 | |||
| 11 | mjames | 1315 | rc = vert_regcomp(&preg,argv[0]); |
| 2 | mjames | 1316 | |
| 11 | mjames | 1317 | if (rc != 0 ) |
| 1318 | { |
||
| 1319 | char errbuff[100]; |
||
| 1320 | regerror(rc,preg->preg,errbuff,100); |
||
| 1321 | Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,argv[0]); |
||
| 1322 | |||
| 1323 | return TCL_ERROR; |
||
| 1324 | } |
||
| 1325 | else |
||
| 1326 | { |
||
| 1327 | Log(LOG_GENERAL,"-- Using '%s' as match pattern\n",argv[0]); |
||
| 1328 | } |
||
| 1329 | |||
| 1330 | |||
| 1331 | |||
| 1332 | |||
| 1333 | while(skt) { |
||
| 1334 | found = regexec(preg->preg,skt->identifier,0,preg->regpatt,0); |
||
| 1335 | if(!found) { |
||
| 1336 | del_generic_value(&skt->generics,&info); |
||
| 1337 | } |
||
| 1338 | skt = skt->next; |
||
| 1339 | } |
||
| 1340 | vert_regfree(&preg); |
||
| 1341 | return 0; |
||
| 1342 | } |
||
| 1343 | |||
| 1344 | |||
| 1345 | |||
| 2 | mjames | 1346 | /*********************** Delete Command ***************************/ |
| 1347 | |||
| 1348 | |||
| 1349 | |||
| 11 | mjames | 1350 | CommandMenu DeleteMenu= { |
| 1351 | {"port", 2, DelPortHandler,NULL, |
||
| 1352 | "Remove port from partition", |
||
| 1353 | "<net_name_prefix>* ",NULL}, |
||
| 1354 | {"routable", 3, DelRouteHandler,NULL, |
||
| 1355 | "Flags routed nets as NOT_ROUTABLE", |
||
| 1356 | "<net_id>*",NULL}, |
||
| 1357 | {"netname", 3, DelNetNameHandler,NULL, |
||
| 1358 | "Remove name from nets by ID", |
||
| 1359 | "<net_ID>*",NULL}, |
||
| 1360 | {"external", 3, DelExternHandler,NULL, |
||
| 1361 | "Set sockets as being internal", |
||
| 1362 | "<name_prefix>*",NULL}, |
||
| 1363 | {"fpga", 3, DelFPGAHandler,NULL, |
||
| 1364 | "Set sockets as not being FPGA: Verilog declaration given", |
||
| 1365 | "<name_prefix>*",NULL}, |
||
| 1366 | {"generic", 3, DelGenericHandler,NULL, |
||
| 1367 | "Removes generic values from sockets", |
||
| 1368 | "<socket>* <generic_name>",NULL}, |
||
| 1369 | {"partition", 3, DelPartitionHandler,NULL, |
||
| 1370 | "Clear the partition list", |
||
| 1371 | "",NULL}, |
||
| 1372 | { NULL,0,NULL,NULL,NULL} |
||
| 1373 | |||
| 1374 | }; |
||
| 1375 | |||
| 1376 | |||
| 2 | mjames | 1377 | /*********************** Partial routing calls ***************************/ |
| 1378 | |||
| 1379 | /*********************** Route By Path ***************************/ |
||
| 1380 | /* |
||
| 1381 | @title |
||
| 1382 | preroute path |
||
| 1383 | @application vertical_pin |
||
| 1384 | @application vertical_pcb |
||
| 1385 | @text |
||
| 1386 | Route by path only: If there exists a routed path between the |
||
| 1387 | chips which has the correct pin directions on each chip |
||
| 1388 | visited, then this path will be used to carry the unrouted |
||
| 1389 | net. |
||
| 1390 | @end |
||
| 1391 | */ |
||
| 1392 | |||
| 1393 | int RoutePathHandler (ET_TCLARGS) |
||
| 11 | mjames | 1394 | { |
| 1395 | Log (LOG_GENERAL, "#begin routing\n"); |
||
| 1396 | perform_routing(By_Net); |
||
| 1397 | Log (LOG_GENERAL, "#done routing\n"); |
||
| 1398 | return (TCL_OK); |
||
| 1399 | } |
||
| 2 | mjames | 1400 | /*********************** Route By Exact Path ***************************/ |
| 1401 | /* |
||
| 1402 | @title |
||
| 1403 | preroute EXact |
||
| 1404 | @application vertical_pin |
||
| 1405 | @application vertical_pcb |
||
| 1406 | @text |
||
| 1407 | Route by exact same path only: As for preroute path, but the |
||
| 1408 | unrouted net and the routed net must both visit the same pins |
||
| 1409 | on the chips that are visited by the nets. This is important |
||
| 1410 | where there are very specific pin functions associated with a |
||
| 1411 | pin. |
||
| 1412 | @break |
||
| 1413 | It also helps with maintenace of similar routing if a design |
||
| 1414 | is recompiled via maxplus2, the newly unrouted nets will tend |
||
| 1415 | to be routed on the same routed nets as for the first compile |
||
| 1416 | if this is used. |
||
| 1417 | @end |
||
| 1418 | */ |
||
| 1419 | |||
| 1420 | int RouteExactPathHandler (ET_TCLARGS) |
||
| 11 | mjames | 1421 | { |
| 1422 | Log (LOG_GENERAL, "#begin routing\n"); |
||
| 1423 | perform_routing(By_Exact_Net); |
||
| 1424 | Log (LOG_GENERAL, "#done routing\n"); |
||
| 1425 | return (TCL_OK); |
||
| 1426 | } |
||
| 2 | mjames | 1427 | /*********************** Route By Fixed Net ***************************/ |
| 1428 | /* |
||
| 1429 | @title |
||
| 1430 | preroute FIxed |
||
| 1431 | @application vertical_pin |
||
| 1432 | @application vertical_pcb |
||
| 1433 | @text |
||
| 1434 | Route by fixed nets only. Any nets which have a fixed pin on |
||
| 1435 | them will be routed first. Fixed pins are those where the pin |
||
| 1436 | identifier used on a socket in the unrouted list should carry |
||
| 1437 | the same signal after routing. This is used to keep e.g. |
||
| 1438 | external connections. |
||
| 1439 | @end |
||
| 1440 | */ |
||
| 1441 | int RouteFixedNetHandler (ET_TCLARGS) |
||
| 11 | mjames | 1442 | { |
| 1443 | Log (LOG_GENERAL, "#begin routing\n"); |
||
| 1444 | perform_routing(By_Fixed_Net); |
||
| 1445 | Log (LOG_GENERAL, "#done routing\n"); |
||
| 1446 | return (TCL_OK); |
||
| 1447 | } |
||
| 2 | mjames | 1448 | |
| 1449 | /*********************** Route By Name ***************************/ |
||
| 1450 | /* |
||
| 1451 | @title |
||
| 1452 | preroute NAMe |
||
| 1453 | @application vertical_pin |
||
| 1454 | @application vertical_pcb |
||
| 1455 | @text |
||
| 1456 | Route by name only: If the net identifier of an unrouted net |
||
| 1457 | matches either the net name or identifier of a routed net then |
||
| 1458 | the router will try and use this net. All pins must be in the |
||
| 1459 | right direction and of the right type for a route to succeed. |
||
| 1460 | @break |
||
| 1461 | Once an unrouted net has been routed, the name of a routed net |
||
| 1462 | will be changed to the identifier of the unrouted net. This |
||
| 1463 | again encourages successive re-routings of a design to use the |
||
| 1464 | same nets wherever possible. |
||
| 1465 | @end |
||
| 1466 | */ |
||
| 1467 | int RouteNameHandler (ET_TCLARGS) |
||
| 11 | mjames | 1468 | { |
| 1469 | Log (LOG_GENERAL, "#begin routing\n"); |
||
| 1470 | perform_routing(By_Name); |
||
| 1471 | Log (LOG_GENERAL, "#done routing\n"); |
||
| 1472 | return (TCL_OK); |
||
| 1473 | } |
||
| 2 | mjames | 1474 | |
| 1475 | /*********************** Route By creating Nets ***************************/ |
||
| 1476 | /* |
||
| 1477 | @title |
||
| 1478 | preroute CREate |
||
| 1479 | @application vertical_pin |
||
| 1480 | @application vertical_hdl |
||
| 1481 | @application vertical_pcb |
||
| 1482 | @text |
||
| 1483 | Route by creating nets only: The user will be asked to join |
||
| 1484 | the pins of the devices in question with wires. This is |
||
| 1485 | intended for use with uncomitted wirewrap boards. Once a board |
||
| 1486 | has been part-wired, or if it is a PCB, then the use of the |
||
| 1487 | jumpering commands permits the generation of new wiring lists. |
||
| 1488 | @break |
||
| 1489 | If nets are created during routing of a PCB there is a |
||
| 1490 | problem. This is why this subcommand is not performed by default |
||
| 1491 | with the route command. |
||
| 1492 | |||
| 1493 | @end |
||
| 1494 | */ |
||
| 1495 | int RouteCreateHandler (ET_TCLARGS) |
||
| 11 | mjames | 1496 | { |
| 1497 | Log (LOG_GENERAL, "#begin routing\n"); |
||
| 1498 | perform_routing(By_Creating); |
||
| 1499 | Log (LOG_GENERAL, "#done routing\n"); |
||
| 1500 | return (TCL_OK); |
||
| 1501 | } |
||
| 2 | mjames | 1502 | |
| 1503 | |||
| 1504 | |||
| 11 | mjames | 1505 | CommandMenu PrerouteMenu = { |
| 1506 | {"path", 2, RoutePathHandler,NULL, |
||
| 1507 | "Route by path only", |
||
| 1508 | "",NULL}, |
||
| 1509 | {"fixed", 2, RouteFixedNetHandler,NULL, |
||
| 1510 | "Route by fixed nets only", |
||
| 1511 | "",NULL}, |
||
| 1512 | {"exact", 2, RouteExactPathHandler,NULL, |
||
| 1513 | "Route by exact same path only", |
||
| 1514 | "",NULL}, |
||
| 1515 | {"name", 3, RouteNameHandler,NULL, |
||
| 1516 | "Route by name only", |
||
| 1517 | "",NULL}, |
||
| 1518 | {"create", 3, RouteCreateHandler,NULL, |
||
| 1519 | "Route by creating nets only", |
||
| 1520 | "",NULL}, |
||
| 1521 | { NULL,0,NULL,NULL,NULL}, |
||
| 1522 | |||
| 1523 | }; |
||
| 1524 | |||
| 2 | mjames | 1525 | /*********************** Simple command calls ***************************/ |
| 11 | mjames | 1526 | /* |
| 2 | mjames | 1527 | @title |
| 1528 | route |
||
| 1529 | @application vertical_pin |
||
| 1530 | @application vertical_hdl |
||
| 1531 | @application vertical_pcb |
||
| 1532 | @text |
||
| 1533 | Route the wiring. |
||
| 1534 | Any nets with their routing status set as NOT_ROUTABLE will |
||
| 1535 | not be considered for routing. Use to protect VDD, GND from |
||
| 1536 | being used for general signal routing. |
||
| 1537 | @break |
||
| 1538 | An experiment in version 16.5 onwards allows for NOT_ROUTABLE_H |
||
| 1539 | and NOT_ROUTABLE_L tracks that can be used as pullup and |
||
| 1540 | pulldown, as they represent logic '1' and logic '0' values. |
||
| 1541 | @break |
||
| 1542 | The list of metal tracks on the PCB, the wired nets is |
||
| 1543 | reconciled with the list of desired connections, the unrouted |
||
| 1544 | nets and the assignment of the unrouted nets to the wired nets |
||
| 1545 | produces the routed nets list. |
||
| 1546 | @break |
||
| 1547 | As there are several phases to the routing, and the order in |
||
| 1548 | which they are applied is fixed, it has been found necessary |
||
| 1549 | to occasionally use the preroute command to order the use of |
||
| 1550 | the routing algorithms. |
||
| 1551 | @break |
||
| 1552 | The order of use of routing algorithms implied by using route |
||
| 1553 | is as follows: |
||
| 1554 | @listing |
||
| 1555 | preroute name, preroute fixed , preroute exact, preroute path |
||
| 1556 | @text |
||
| 1557 | This is then automatically followed by the |
||
| 1558 | @listing |
||
| 1559 | reserve |
||
| 1560 | @text |
||
| 1561 | command, which ensures pin reservation for Maxplus2. If you need to use 'preroute' then |
||
| 1562 | you will need to use the 'reserve' command, to ensure pin reservation. |
||
| 1563 | @break |
||
| 1564 | The 'preroute create' option is now only available via preroute. Nobody |
||
| 1565 | needs a PCB to silently grow extra tracks. If the goal is to |
||
| 1566 | create a new PCB or wirewrap list then this option will be |
||
| 1567 | necessary. |
||
| 1568 | @break |
||
| 1569 | To achieve the same effect as the older 'route' command, use |
||
| 1570 | 'route' then 'preroute create'. |
||
| 1571 | @break |
||
| 1572 | Just prior to issuing any route commands, any new pins added |
||
| 1573 | to the design will be checked for pin renaming and the |
||
| 11 | mjames | 1574 | unrouted netlist is updated. |
| 2 | mjames | 1575 | @end |
| 1576 | */ |
||
| 1577 | int ROUTEHandler (ET_TCLARGS) |
||
| 11 | mjames | 1578 | { |
| 1579 | Log (LOG_GENERAL, "#begin routing\n"); |
||
| 1580 | perform_routing(Free); |
||
| 1581 | Log (LOG_GENERAL, "#done routing\n"); |
||
| 1582 | return (TCL_OK); |
||
| 1583 | } |
||
| 2 | mjames | 1584 | |
| 1585 | /**************************************************************************/ |
||
| 1586 | /* |
||
| 1587 | @title |
||
| 1588 | reserve |
||
| 1589 | @application vertical_pin |
||
| 1590 | @text |
||
| 1591 | Perform pin reservation according to Maxplus2 requirements. |
||
| 1592 | @break |
||
| 1593 | This function ensures net reservation is made for all internal |
||
| 1594 | nodes that are on internal sockets . |
||
| 1595 | @break |
||
| 1596 | If any external socket is on the net then all internal pins are reserved. |
||
| 11 | mjames | 1597 | Otherwise a single internal pin is left as a non-reserved driver |
| 2 | mjames | 1598 | @end |
| 1599 | */ |
||
| 1600 | |||
| 1601 | int ReservePinsHandler (ET_TCLARGS) |
||
| 11 | mjames | 1602 | { |
| 1603 | Log (LOG_GENERAL, "#begin pin reservation\n"); |
||
| 1604 | ensure_reservation(); |
||
| 1605 | Log (LOG_GENERAL, "#done pin reservation\n"); |
||
| 1606 | return (TCL_OK); |
||
| 1607 | } |
||
| 2 | mjames | 1608 | |
| 11 | mjames | 1609 | |
| 1610 | |||
| 1611 | |||
| 1612 | |||
| 2 | mjames | 1613 | /*********************** Simple command calls ***************************/ |
| 1614 | /* partitioning */ |
||
| 1615 | /* |
||
| 1616 | @title |
||
| 1617 | partition |
||
| 1618 | @application vertical_hdl |
||
| 1619 | @text |
||
| 1620 | Do the partition calculation. This takes the entities given in |
||
| 1621 | the partition and works out the port list for the top level. |
||
| 1622 | @break |
||
| 1623 | To do this the partitioner must be made aware of the entire set |
||
| 1624 | of top level entity port lists in the system. |
||
| 1625 | @break |
||
| 1626 | To do this an acfp, vhdl or verilog file must be read in |
||
| 11 | mjames | 1627 | containing a description of the top level entity for each |
| 2 | mjames | 1628 | block used in the partition. |
| 11 | mjames | 1629 | @break |
| 2 | mjames | 1630 | See the section on Vertical script files. |
| 1631 | @end |
||
| 1632 | */ |
||
| 1633 | |||
| 11 | mjames | 1634 | int PARTHandler( ET_TCLARGS) |
| 1635 | { |
||
| 1636 | Log (LOG_GENERAL, "#begin partition\n"); |
||
| 1637 | create_unrouted_list(); |
||
| 1638 | clear_partition_generics(&partition_generics); |
||
| 1639 | perform_partition(); |
||
| 1640 | Log (LOG_GENERAL, "#done partition\n"); |
||
| 1641 | return (TCL_OK); |
||
| 1642 | } |
||
| 2 | mjames | 1643 | |
| 11 | mjames | 1644 | |
| 1645 | |||
| 1646 | |||
| 2 | mjames | 1647 | /*********************** Simple command calls ***************************/ |
| 1648 | /* trial */ |
||
| 1649 | /* |
||
| 1650 | @title |
||
| 1651 | fix_pins |
||
| 1652 | @application vertical_pin |
||
| 1653 | @application vertical_pcb |
||
| 1654 | @text |
||
| 11 | mjames | 1655 | This command is used in conjunction with set external on a socket. If a socket is set external and it has unrouted nets connected to it, the fix_pins command |
| 1656 | will attempt to freeze the connections given in the unrouted netlist. This means that a socket with a defined pinout should be routed with that pinout rather than |
||
| 1657 | having the pinout exchanged by VERTICAL. |
||
| 2 | mjames | 1658 | @break |
| 11 | mjames | 1659 | NB If an attempt is made to connect a signal to a net which cannot reach its destination because |
| 1660 | there is no wire present, then the signal will be moved to another pin which reaches the destination. |
||
| 2 | mjames | 1661 | |
| 11 | mjames | 1662 | @end |
| 2 | mjames | 1663 | */ |
| 1664 | |||
| 1665 | int FIXHandler (ET_TCLARGS) |
||
| 11 | mjames | 1666 | { |
| 1667 | Log (LOG_GENERAL, "#begin attempting to fix port pins\n"); |
||
| 1668 | perform_trial_naming(); |
||
| 1669 | Log (LOG_GENERAL, "#done fixing pins\n"); |
||
| 1670 | return (TCL_OK); |
||
| 1671 | } |
||
| 2 | mjames | 1672 | /*********************** Simple command calls ***************************/ |
| 11 | mjames | 1673 | /* Auto-jumpering |
| 1674 | @title |
||
| 2 | mjames | 1675 | jumper <suffix> |
| 1676 | @application vertical_pin |
||
| 1677 | @application vertical_pcb |
||
| 1678 | @text |
||
| 1679 | This is the original routing algorithm for VERTICAL. |
||
| 1680 | This can be used to create wirewrap jumper lists. |
||
| 11 | mjames | 1681 | If there are unrouted connections made between sockets that are flagged as external, and which therefore |
| 1682 | need wirewrapped connections. |
||
| 2 | mjames | 1683 | @break |
| 11 | mjames | 1684 | In use different pairs or groups of sockets would be set as external and then the jumper command is issued for that pair or group. |
| 1685 | The suffix would be used to identify the jumpers created from each induvidual jumper command: These can then be extracted for wirewrap lists. |
||
| 2 | mjames | 1686 | @end |
| 1687 | */ |
||
| 1688 | |||
| 1689 | int JUMPERHandler (ET_TCLARGS) |
||
| 11 | mjames | 1690 | { |
| 1691 | char * Suffix; |
||
| 1692 | if (argc<1 ) |
||
| 1693 | Suffix = NULL; |
||
| 1694 | else |
||
| 1695 | Suffix = argv[0]; |
||
| 1696 | Log (LOG_GENERAL, "#begin jumpering\n"); |
||
| 1697 | create_unrouted_list(); |
||
| 1698 | perform_jumpering(Suffix); |
||
| 1699 | Log (LOG_GENERAL, "#done jumpering\n"); |
||
| 1700 | return (TCL_OK); |
||
| 1701 | } |
||
| 2 | mjames | 1702 | |
| 11 | mjames | 1703 | |
| 2 | mjames | 1704 | /******************** Parser for the 'DO' batch files ***********************/ |
| 11 | mjames | 1705 | /* |
| 1706 | @title |
||
| 2 | mjames | 1707 | do <commandfile> [ <arg1> <arg2> ... ] |
| 1708 | @application vertical_pin |
||
| 1709 | @application vertical_hdl |
||
| 1710 | @application vertical_pcb |
||
| 1711 | @text |
||
| 11 | mjames | 1712 | Interpret the command file as though typed in on the command line. |
| 2 | mjames | 1713 | @break |
| 11 | mjames | 1714 | The argument list are accessible as $1, $2 etc while interpreting the command file, and can be used to pass down |
| 1715 | arguments to the file. |
||
| 2 | mjames | 1716 | @break |
| 11 | mjames | 1717 | Up to 10 levels of nesting of command files is allowed. This limit is imposed to trap recursion. |
| 2 | mjames | 1718 | @end |
| 1719 | |||
| 1720 | */ |
||
| 1721 | int DOHandler (ET_TCLARGS) |
||
| 11 | mjames | 1722 | { |
| 1723 | FILE *DoFile; |
||
| 1724 | if (argc<1) |
||
| 1725 | return(TCL_ERROR); |
||
| 2 | mjames | 1726 | |
| 11 | mjames | 1727 | |
| 1728 | DoFile = trap_fopen(argv[0], "r"); /* open text file for reading */ |
||
| 1729 | if (!DoFile) { |
||
| 1730 | Log (LOG_ERROR, "# Error opening file: <%s>\n", argv[0]); |
||
| 1731 | return(TCL_ERROR); |
||
| 1732 | } |
||
| 1733 | else { |
||
| 1734 | ParseFile (DoFile,argc-1,argv+1); |
||
| 1735 | fclose (DoFile); |
||
| 1736 | InitialiseData(); /* March 8 2000 : |
||
| 1737 | * added to make sure any environment |
||
| 1738 | * variables which are directly used as |
||
| 1739 | * C structures are set. */ |
||
| 1740 | return (TCL_OK); |
||
| 1741 | } |
||
| 1742 | } |
||
| 2 | mjames | 1743 | /******************** Calling the count nets with few nodes ***********************/ |
| 11 | mjames | 1744 | /* |
| 1745 | @title |
||
| 2 | mjames | 1746 | count_nets [ <threshold> ] |
| 1747 | @application vertical_pin |
||
| 1748 | @application vertical_hdl |
||
| 1749 | @application vertical_pcb |
||
| 1750 | @text |
||
| 1751 | Report on nets with a node count less than or equal to threshold. Used to find |
||
| 1752 | hanging unrouted nets where there is an error in the netname. |
||
| 1753 | @break |
||
| 1754 | If no threshold is given , the threshold defaults to 1 |
||
| 1755 | @end |
||
| 1756 | */ |
||
| 1757 | |||
| 1758 | |||
| 1759 | |||
| 11 | mjames | 1760 | |
| 1761 | int COUNTNETSHandler (ET_TCLARGS) { |
||
| 1762 | |||
| 1763 | |||
| 1764 | long limit; |
||
| 1765 | if (argc<1) |
||
| 1766 | limit = 1; |
||
| 1767 | else |
||
| 1768 | limit = atoi(argv[0]); |
||
| 1769 | count_nets_with_few_nodes((int) limit); |
||
| 1770 | |||
| 1771 | return (TCL_OK); |
||
| 1772 | } |
||
| 1773 | |||
| 2 | mjames | 1774 | /*********************** Ensure Templates Command ***************************/ |
| 1775 | /* this ensures all templated sockets have all correct pin properties */ |
||
| 1776 | |||
| 1777 | /* |
||
| 11 | mjames | 1778 | @title |
| 2 | mjames | 1779 | Socket Templating Background Information |
| 1780 | @application vertical_pin |
||
| 1781 | @application vertical_hdl |
||
| 1782 | @application vertical_pcb |
||
| 1783 | @text |
||
| 1784 | When the maxplus2 software runs and it fits a design to an |
||
| 1785 | EPLD, it only lists out the pins that it has in fact used. |
||
| 1786 | All unused pins on a chip will remain unknown to VERTICAL. The |
||
| 1787 | use of templates is meant to overcome this. If a template is |
||
| 1788 | read in for a particular device type , the VERTICAL tool can |
||
| 1789 | ensure that every instance of that device in the design will |
||
| 1790 | have all of its pins available. An aliasing mechanism exists |
||
| 1791 | for allowing a group of device types (e.g. speed variants) to |
||
| 1792 | all share the same template. |
||
| 1793 | @break |
||
| 11 | mjames | 1794 | In addition in Vertical-HDL, the socket templates are used as being logically equivalent to a VHDL component declaration. |
| 1795 | The elaborate command ensures that the socket templates( declarations of ports and generics) are applied to the component instances. |
||
| 2 | mjames | 1796 | @break |
| 1797 | |||
| 1798 | There are two template commands. When these are issued, all |
||
| 1799 | sockets are checked to see if there is a template for them. |
||
| 1800 | For any socket with a template, if the socket lacks a pin |
||
| 1801 | identifier defined in the template, it is given an unassigned |
||
| 1802 | pin with that identifier and appropriate pin type. |
||
| 1803 | All definition of socket templating is achieved by the use of |
||
| 1804 | ACFP files. A socket type template has the same general syntax |
||
| 1805 | as the CHIP template. Pins are listed out with no name but |
||
| 1806 | with an identifier (pin number) and a direction. There is also |
||
| 1807 | the possiblility of aliasing chip types - e.g. all speed |
||
| 1808 | variants of the FLEX10k50GC403 have the same pinout. Only one |
||
| 1809 | template need be defined, the others can all be derived simply |
||
| 1810 | from it by using template aliasing in the acfp file. |
||
| 1811 | So you would find e.g. |
||
| 1812 | @listing |
||
| 1813 | TEMPLATE FLEX10K50GC403; |
||
| 1814 | BEGIN |
||
| 1815 | "" : INPUT_PIN = AL1 ; |
||
| 1816 | . "" : CONFIG_PIN = AL2; |
||
| 1817 | ... more stuff .... |
||
| 1818 | END; |
||
| 1819 | @text |
||
| 1820 | Then, assuming you have |
||
| 1821 | @listing |
||
| 1822 | TEMPLATE EPM10K50GC403-3; |
||
| 1823 | BEGIN |
||
| 1824 | ALIAS FLEX10K50GC403; |
||
| 1825 | END; |
||
| 1826 | @text |
||
| 1827 | Then if a chip of type EPM10K50GC403-3 is seen then the pinout |
||
| 1828 | template that will be used will be the FLEX10K50GC403 version. |
||
| 1829 | |||
| 1830 | @end |
||
| 1831 | |||
| 1832 | @title |
||
| 1833 | Templating Equivalent Pins: Series resistor handling |
||
| 1834 | @application vertical_pin |
||
| 1835 | @application vertical_hdl |
||
| 1836 | @application vertical_pcb |
||
| 1837 | @text |
||
| 1838 | In order to deal with problems associated with series |
||
| 1839 | termination resistors in signal lines on high performance |
||
| 1840 | FPGAs, where the resistors are seen as disconnections of nets, |
||
| 1841 | the concept of equivalent pins has been developed. |
||
| 1842 | @break |
||
| 1843 | If a device has equivalent pins then any signal seen on one |
||
| 1844 | equivalent pin can be regarded as also appearing on any other |
||
| 1845 | of the equivalent pins. As of Sep 2000 the pin directions of |
||
| 1846 | the device are ignored. If a device has equivalent pins then |
||
| 1847 | these can be automatically connected via 'virtual jumpers' |
||
| 1848 | allowing VERTICAL to then use the completed nets as signal |
||
| 1849 | paths between FPGAs |
||
| 1850 | @break |
||
| 1851 | An example of a template file for a dual in line |
||
| 1852 | series terminator resistor pack |
||
| 1853 | |||
| 1854 | @listing |
||
| 1855 | template rp8dil |
||
| 1856 | |||
| 1857 | begin |
||
| 1858 | "" : bidir_pin = 1; |
||
| 1859 | "" : bidir_pin = 2; |
||
| 1860 | "" : bidir_pin = 3; |
||
| 1861 | "" : bidir_pin = 4; |
||
| 1862 | "" : bidir_pin = 5; |
||
| 1863 | "" : bidir_pin = 6; |
||
| 1864 | "" : bidir_pin = 7; |
||
| 1865 | "" : bidir_pin = 8; |
||
| 1866 | equivalent (1;8); |
||
| 1867 | equivalent (2;7); |
||
| 1868 | equivalent (3;6); |
||
| 1869 | equivalent (4;5); |
||
| 1870 | end; |
||
| 1871 | @text |
||
| 1872 | The information in this file consists firstly of a list of pin |
||
| 1873 | identifiers, followed by a list of which pins can be regarded |
||
| 11 | mjames | 1874 | as equivalent. |
| 2 | mjames | 1875 | @break |
| 1876 | More than 2 pins may be included in the set of pins in an |
||
| 1877 | equivalent group. |
||
| 1878 | @break |
||
| 1879 | If this template file has been read in then for all devices of |
||
| 1880 | type 'rp8dil' the sequence of |
||
| 1881 | 'template' followed by 'equivalent' will produce jumpers |
||
| 1882 | across pins 1 and 8 , 2 and 7 , 3 and 6 , also 4 and 5. Then |
||
| 1883 | when routing is performed, Vertical will be able to see wired |
||
| 1884 | connections across the resistor packs and complete the |
||
| 1885 | routing. |
||
| 1886 | @break |
||
| 11 | mjames | 1887 | Note that this mechanism can be applied to single resistors, or 8 pin devices with different |
| 2 | mjames | 1888 | resistor arrangements (e.g. SIL rather than DIL). |
| 1889 | @break |
||
| 1890 | For example a two pin resistor: |
||
| 1891 | @listing |
||
| 1892 | template res0805 |
||
| 1893 | |||
| 1894 | begin |
||
| 1895 | "" : bidir_pin = 1; |
||
| 1896 | "" : bidir_pin = 2; |
||
| 1897 | equivalent (1;2); |
||
| 1898 | end; |
||
| 1899 | @end |
||
| 1900 | |||
| 1901 | @title |
||
| 1902 | template <socket_id_template> |
||
| 1903 | @application vertical_pin |
||
| 1904 | @application vertical_hdl |
||
| 1905 | @application vertical_pcb |
||
| 1906 | @text |
||
| 11 | mjames | 1907 | Apply the templating process to all sockets whose identifiers match the given template e.g. 'U1*' which have a valid template |
| 1908 | defining pin directions and unrouable pins for example. |
||
| 2 | mjames | 1909 | @text |
| 11 | mjames | 1910 | DO NOT define any pins that the device ought to posess according to the template but which are not used in the |
| 1911 | netlist. |
||
| 2 | mjames | 1912 | @end |
| 1913 | */ |
||
| 11 | mjames | 1914 | int EnsureTemplateHandler(ET_TCLARGS) |
| 2 | mjames | 1915 | { |
| 11 | mjames | 1916 | |
| 1917 | char * Word = NULL; |
||
| 1918 | if(argc>0) |
||
| 1919 | Word = argv[0]; |
||
| 1920 | template_ensure(Word,TEMPLATE_NO_OP); |
||
| 1921 | return(TCL_OK); |
||
| 2 | mjames | 1922 | } |
| 1923 | /*********************** Create Template Command ***************************/ |
||
| 1924 | /* this ensures all sockets have all pins available even if not connected to nets*/ |
||
| 1925 | /* |
||
| 1926 | @title |
||
| 1927 | create_template <socket_id_template> |
||
| 1928 | @application vertical_pin |
||
| 1929 | @application vertical_hdl |
||
| 1930 | @application vertical_pcb |
||
| 1931 | @text |
||
| 11 | mjames | 1932 | Apply the templating process to all sockets whose identifiers match the given template e.g. 'U1*' which have a valid template |
| 1933 | defining pin directions and unrouable pins for example. |
||
| 2 | mjames | 1934 | @text |
| 11 | mjames | 1935 | DEFINE any pins that the device ought to posess according to the template but which are not used in the |
| 1936 | netlist. |
||
| 2 | mjames | 1937 | @end |
| 1938 | */ |
||
| 11 | mjames | 1939 | int EnsureCreateTemplateHandler(ET_TCLARGS) |
| 2 | mjames | 1940 | { |
| 11 | mjames | 1941 | char * Word = NULL; |
| 1942 | if (argc > 0 ) |
||
| 1943 | Word = argv[0]; |
||
| 1944 | template_ensure(Word,TEMPLATE_CREATE_MISSING_PINS); |
||
| 1945 | return(TCL_OK); |
||
| 1946 | } |
||
| 2 | mjames | 1947 | /*********************** Match Template Command ***************************/ |
| 1948 | /* this ensures all sockets have all pins available even if not connected to nets*/ |
||
| 1949 | /* |
||
| 1950 | @title |
||
| 1951 | match_template <socket_id_template> |
||
| 1952 | @application vertical_pin |
||
| 1953 | @application vertical_hdl |
||
| 1954 | @application vertical_pcb |
||
| 1955 | @text |
||
| 11 | mjames | 1956 | Apply the templating process to all sockets whose identifiers match the given template e.g. 'U1*' which have a valid template |
| 1957 | defining pin directions and unrouable pins for example. |
||
| 2 | mjames | 1958 | @text |
| 11 | mjames | 1959 | DEFINE any pins that the device ought to posess according to the template but which are not used in the |
| 1960 | netlist. |
||
| 2 | mjames | 1961 | @break |
| 11 | mjames | 1962 | DISCONNECT any pins that the device socket has , but which are not in the template. This is for use with FPGAs which |
| 1963 | have fewer pins connected than there are pins in the socket (eg APEX 20k600 in a 20k1000 position) |
||
| 2 | mjames | 1964 | @break |
| 11 | mjames | 1965 | Any nets that are disconnected are also set as not routable so that they are not listed |
| 2 | mjames | 1966 | in Verilog output. |
| 1967 | @end |
||
| 1968 | */ |
||
| 11 | mjames | 1969 | int EnsureMatchTemplateHandler(ET_TCLARGS) |
| 2 | mjames | 1970 | { |
| 11 | mjames | 1971 | char * Word = NULL; |
| 1972 | if (argc > 0 ) |
||
| 1973 | Word = argv[0]; |
||
| 1974 | template_ensure(Word,TEMPLATE_CREATE_MISSING_PINS | TEMPLATE_DISCONNECT_PINS); |
||
| 1975 | return(TCL_OK); |
||
| 1976 | } |
||
| 2 | mjames | 1977 | |
| 11 | mjames | 1978 | |
| 1979 | |||
| 2 | mjames | 1980 | /* ********************* extract template command **********************************/ |
| 1981 | /* |
||
| 1982 | @title |
||
| 1983 | extract_template |
||
| 1984 | @application vertical_pin |
||
| 1985 | @application vertical_hdl |
||
| 1986 | @application vertical_pcb |
||
| 1987 | @text |
||
| 1988 | This command scans the netlist for all chips or components of the same type and produces |
||
| 1989 | a single description of the component in a template which is then used in write vhdl or |
||
| 1990 | write verilog commands. It is also usable in other cases where chip templates are needed, |
||
| 1991 | they can be extracted from the PCB netlist instead of needing additional work to create them. |
||
| 1992 | @break |
||
| 11 | mjames | 1993 | Pins will only be created on the template if |
| 2 | mjames | 1994 | They are connected to a net. |
| 1995 | @end |
||
| 1996 | */ |
||
| 1997 | |||
| 11 | mjames | 1998 | int ExtractTemplateHandler(ET_TCLARGS) { |
| 1999 | /* templates are used to make VHDL component instances |
||
| 2000 | match up to the declared components */ |
||
| 2001 | extract_templates(); |
||
| 2002 | return(TCL_OK); |
||
| 2 | mjames | 2003 | } |
| 2004 | /*********************** modify_names Command ***************************/ |
||
| 2005 | /* |
||
| 2006 | @title |
||
| 11 | mjames | 2007 | modify_names <socket_id> [ <alternate_prefix> ] |
| 2 | mjames | 2008 | @application vertical_pin |
| 2009 | @application vertical_hdl |
||
| 2010 | @application vertical_pcb |
||
| 2011 | @text |
||
| 2012 | This affects the name of nets, not the pins of the device to which they are connected. |
||
| 2013 | @break |
||
| 11 | mjames | 2014 | Routable nets attached to pins on sockets are renamed to be by default socketID_pinID |
| 2 | mjames | 2015 | in order to make them more traceable. |
| 2016 | If an alternate prefix is given then it is used instead (not advisable if the socket name |
||
| 2017 | regular expression will match more than one socket). |
||
| 2018 | @end |
||
| 2019 | */ |
||
| 11 | mjames | 2020 | int Modify_NamesHandler(ET_TCLARGS) |
| 2 | mjames | 2021 | { |
| 11 | mjames | 2022 | if (argc) |
| 2023 | { |
||
| 2024 | alter_net_to_socket_name(argv[0],argc>1?argv[1]:NULL); |
||
| 2025 | } |
||
| 2026 | else |
||
| 2027 | { |
||
| 2028 | Log(LOG_ERROR,"-- Need at least one socket identifier for this command\n"); |
||
| 2029 | return (TCL_ERROR); |
||
| 2030 | } |
||
| 2031 | return(TCL_OK); |
||
| 2 | mjames | 2032 | } |
| 2033 | |||
| 2034 | /*********************** edit_pins type Command ***************************/ |
||
| 2035 | /* |
||
| 2036 | @title |
||
| 11 | mjames | 2037 | edit_pins type <socket_type> <pin_match_pattern> <replacement> |
| 2 | mjames | 2038 | @application vertical_pin |
| 2039 | @application vertical_hdl |
||
| 2040 | @application vertical_pcb |
||
| 2041 | @application regular_exp |
||
| 2042 | @text |
||
| 2043 | This command is a more sophisticated form of the swap command. |
||
| 2044 | @break |
||
| 2045 | Searching finds all sockets of a given TYPE. |
||
| 2046 | @break |
||
| 2047 | All sockets are searched for in both component template and netlist space. |
||
| 2048 | If a socket type is matched then the pin identifiers are edited using regular expressions. |
||
| 2049 | |||
| 2050 | e.g. |
||
| 2051 | @listing |
||
| 2052 | edit_pins type SK ([a-z]+)([0-9]+) &2&1 |
||
| 2053 | @text |
||
| 11 | mjames | 2054 | Will reverse (on sockets of type 'SK) all pin identifiers identified by letters followed by digits, swapping the |
| 2055 | letter and digit parts of the string. |
||
| 2 | mjames | 2056 | @break |
| 11 | mjames | 2057 | See edit_pins ident for more information on the regular expressions and pattern replacement of these commands. |
| 2 | mjames | 2058 | @break |
| 2059 | This supercedes the swap command which is kept for compatibility. |
||
| 2060 | |||
| 2061 | |||
| 2062 | @end |
||
| 2063 | */ |
||
| 2064 | |||
| 11 | mjames | 2065 | int Edit_PinNames_By_ChipType_Handler(ET_TCLARGS) |
| 2 | mjames | 2066 | { |
| 11 | mjames | 2067 | if (argc>=3) |
| 2068 | { |
||
| 2069 | edit_socket_pin_name(argv[0],argv[1],argv[2],Type); |
||
| 2070 | } |
||
| 2071 | else |
||
| 2072 | { |
||
| 2073 | Log(LOG_ERROR,"-- Need socket type, a search and replace pattern for this command\n"); |
||
| 2074 | return (TCL_ERROR); |
||
| 2075 | } |
||
| 2076 | return(TCL_OK); |
||
| 2 | mjames | 2077 | } |
| 2078 | |||
| 2079 | /*********************** edit_pins ident Command ***************************/ |
||
| 2080 | /* |
||
| 2081 | @title |
||
| 11 | mjames | 2082 | edit_pins ident <socket_ident> <pin_match_pattern> <replacement> |
| 2 | mjames | 2083 | @application vertical_pin |
| 2084 | @application vertical_hdl |
||
| 2085 | @application vertical_pcb |
||
| 2086 | @application regular_exp |
||
| 2087 | @text |
||
| 2088 | @text |
||
| 2089 | This command is a more sophisticated form of the swap command. |
||
| 2090 | @break |
||
| 2091 | Searching finds all sockets with matching IDENTIFIERS. |
||
| 2092 | @break |
||
| 11 | mjames | 2093 | If a socket identifier is matched then the pin identifiers are edited using regular expressions. |
| 2 | mjames | 2094 | |
| 2095 | e.g. |
||
| 2096 | @listing |
||
| 2097 | edit_pins ident U[0-9] ([a-z]+)([0-9]+) &2&1 |
||
| 2098 | @text |
||
| 11 | mjames | 2099 | Will reverse all pins identifiers on chip U0 .. U9 where the pins are identified by letters followed by digits, |
| 2100 | swapping the |
||
| 2101 | letter and digit parts of the string. |
||
| 2 | mjames | 2102 | @break |
| 2103 | The pattern &0 is a special pattern which means the whole of the string. |
||
| 11 | mjames | 2104 | @listing |
| 2 | mjames | 2105 | edit type ep20k1000efc672 .* pin_&0 |
| 2106 | @text |
||
| 2107 | Will prefix all pin identifiers with "pin_" on all sockets of type ep20k1000efc672 |
||
| 2108 | @break |
||
| 2109 | This command will also work with HDL port names... |
||
| 2110 | @listing |
||
| 2111 | The special patterns that can be used in the replace string are: |
||
| 2112 | &0 : the whole of the matched pattern |
||
| 2113 | &1..&9 : The n'th bracketed regular expression |
||
| 2114 | &a : The alphabetic = column identifier part of an alphanumeric pin ident |
||
| 2115 | &n : The numeric = row identifier part of an alphanumeric pin ident |
||
| 2116 | &c : The identifier of the connected net |
||
| 2117 | &d : The chip identifier |
||
| 11 | mjames | 2118 | &i : The numerical pin index = row + column * total_rows |
| 2 | mjames | 2119 | @text |
| 2120 | The &a,&n and &i patterns are extracted from the _current_ pin identifiers of the chip. |
||
| 11 | mjames | 2121 | If you have already edited the pin identifiers then the pin identification is extracted from the |
| 2122 | new pin identifier pattern. There may be some problems created if the command is |
||
| 2123 | repeated on the the same chip. |
||
| 2 | mjames | 2124 | @break |
| 11 | mjames | 2125 | All of the alphabetic part of the pin identifiers are converted to numbers representing device |
| 2126 | pin columns. Dont use this command with pin identifiers with a lot of letters like BOOT12, as the conversion of letters |
||
| 2127 | to numbers can cause arithmetic overflows and strange results. |
||
| 2 | mjames | 2128 | @break |
| 11 | mjames | 2129 | Currently the illegal characters in pin identifiers are PIN_MAP_ILLEGAL_CHARS. If these appear they are mapped onto the |
| 2130 | next character in the alphabet. |
||
| 2 | mjames | 2131 | @break |
| 2132 | It is possible to define the rows and columns of a chip where the pin identifiers are numeric |
||
| 2133 | @listing |
||
| 2134 | |||
| 2135 | set generic attribute SK2 min_pin_row 1 |
||
| 2136 | set generic attribute SK2 max_pin_row 50 |
||
| 2137 | set generic attribute SK2 min_pin_col 0 |
||
| 2138 | set generic attribute SK2 max_pin_col 3 |
||
| 2139 | @text |
||
| 11 | mjames | 2140 | This is describing a 200 pin package with 4 columns of 50 rows. Rows number from 1 to N, columns from 0 to M-1. |
| 2 | mjames | 2141 | @end |
| 2142 | */ |
||
| 2143 | |||
| 11 | mjames | 2144 | int Edit_PinNames_By_ChipIdent_Handler(ET_TCLARGS) |
| 2 | mjames | 2145 | { |
| 11 | mjames | 2146 | if (argc>=3) |
| 2147 | { |
||
| 2148 | edit_socket_pin_name(argv[0],argv[1],argv[2],Ident); |
||
| 2149 | } |
||
| 2150 | else |
||
| 2151 | { |
||
| 2152 | Log(LOG_ERROR,"-- Need socket ident, a search and replace pattern for this command\n"); |
||
| 2153 | return (TCL_ERROR); |
||
| 2154 | } |
||
| 2155 | return(TCL_OK); |
||
| 2 | mjames | 2156 | } |
| 2157 | |||
| 2158 | |||
| 11 | mjames | 2159 | CommandMenu EditPinNamesMenu = |
| 2160 | { |
||
| 2161 | {"ident", 3, Edit_PinNames_By_ChipIdent_Handler,NULL, "Edit pin names selecting chips by ID","<chip_name_template> <search_expr> <replace_expr>",NULL}, |
||
| 2162 | {"type", 3, Edit_PinNames_By_ChipType_Handler,NULL, "Edit pin names selecting chips by Type","<chip_name_template> <search_expr> <replace_expr>",NULL}, |
||
| 2163 | {NULL, 0, NULL,NULL,NULL,NULL}, |
||
| 2164 | }; |
||
| 2165 | |||
| 2166 | |||
| 2 | mjames | 2167 | /*********************** edit_nets ident Command ***************************/ |
| 2168 | /* |
||
| 2169 | @title |
||
| 11 | mjames | 2170 | edit_nets name <net_match_pattern> <replacement> |
| 2 | mjames | 2171 | @application vertical_pin |
| 2172 | @application vertical_hdl |
||
| 2173 | @application vertical_pcb |
||
| 2174 | @application regular_exp |
||
| 2175 | @text |
||
| 11 | mjames | 2176 | This commmand matches all nets by name and then renames them according to the replacement pattern. |
| 2 | mjames | 2177 | @listing |
| 2178 | The special patterns that can be used in the replace string are: |
||
| 2179 | &0 : the whole of the matched pattern |
||
| 2180 | &1..&9 : The n'th bracketed regular expression |
||
| 2181 | &n : The net name in its entirety |
||
| 2182 | &i : The net identifier |
||
| 2183 | @break |
||
| 2184 | I am sure that this command is extremely dangerous but anyway it is provided. |
||
| 2185 | @end |
||
| 2186 | */ |
||
| 2187 | |||
| 11 | mjames | 2188 | int Edit_NetNames_Handler(ET_TCLARGS) |
| 2 | mjames | 2189 | { |
| 11 | mjames | 2190 | if (argc>=2) |
| 2191 | { |
||
| 2192 | edit_net_names(argv[0],argv[1],Name); |
||
| 2193 | } |
||
| 2194 | else |
||
| 2195 | { |
||
| 2196 | Log(LOG_ERROR,"-- Need a search and replace pattern for this command\n"); |
||
| 2197 | return (TCL_ERROR); |
||
| 2198 | } |
||
| 2199 | return(TCL_OK); |
||
| 2 | mjames | 2200 | } |
| 2201 | |||
| 2202 | /*********************** edit_nets ident Command ***************************/ |
||
| 2203 | /* |
||
| 2204 | @title |
||
| 11 | mjames | 2205 | edit_nets ident <net_match_pattern> <replacement> |
| 2 | mjames | 2206 | @application vertical_pin |
| 2207 | @application vertical_hdl |
||
| 2208 | @application vertical_pcb |
||
| 2209 | @application regular_exp |
||
| 2210 | @text |
||
| 11 | mjames | 2211 | This commmand matches all nets by identifier and then replaces identifier according to the replacement pattern. |
| 2 | mjames | 2212 | @listing |
| 2213 | The special patterns that can be used in the replace string are: |
||
| 2214 | &0 : the whole of the matched pattern |
||
| 2215 | &1..&9 : The n'th bracketed regular expression |
||
| 2216 | &n : The net name in its entirety |
||
| 2217 | &i : The net identifier |
||
| 2218 | @break |
||
| 2219 | I am sure that this command is extremely dangerous but anyway it is provided. |
||
| 2220 | |||
| 2221 | @end |
||
| 2222 | */ |
||
| 2223 | |||
| 11 | mjames | 2224 | int Edit_NetIdents_Handler(ET_TCLARGS) |
| 2 | mjames | 2225 | { |
| 11 | mjames | 2226 | if (argc>=2) |
| 2227 | { |
||
| 2228 | edit_net_names(argv[0],argv[1],Ident); |
||
| 2229 | } |
||
| 2230 | else |
||
| 2231 | { |
||
| 2232 | Log(LOG_ERROR,"-- Need a search and replace pattern for this command\n"); |
||
| 2233 | return (TCL_ERROR); |
||
| 2234 | } |
||
| 2235 | return(TCL_OK); |
||
| 2 | mjames | 2236 | } |
| 2237 | |||
| 11 | mjames | 2238 | |
| 2239 | |||
| 2240 | |||
| 2 | mjames | 2241 | /*********************** Top level menu driver ******************************/ |
| 2242 | |||
| 11 | mjames | 2243 | CommandMenu EditNetNamesMenu = |
| 2244 | { |
||
| 2245 | {"name", 3, Edit_NetNames_Handler,NULL, "Edit net names ","<search_expr> <replace_expr>",NULL}, |
||
| 2246 | {"ident", 3, Edit_NetIdents_Handler,NULL, "Edit net idents ","<search_expr> <replace_expr>",NULL}, |
||
| 2247 | {NULL, 0, NULL,NULL,NULL,NULL}, |
||
| 2248 | }; |
||
| 2 | mjames | 2249 | |
| 11 | mjames | 2250 | |
| 2 | mjames | 2251 | /*********************** Bundle Command ***************************/ |
| 2252 | /* |
||
| 2253 | @title |
||
| 2254 | bundle <socket_id> [ <socket_id> * ] |
||
| 2255 | @application vertical_hdl |
||
| 2256 | @text |
||
| 11 | mjames | 2257 | The bundle command is used with Certify in order to reduce the port count of a |
| 2258 | PCB. It converts all of the signals connected to a single multipin socket into |
||
| 2 | mjames | 2259 | a single bus where each pin of the bus is defined according to the connector pin identifier. |
| 2260 | @break |
||
| 11 | mjames | 2261 | The initial assumption is that each socket will have pins labelled either 'a1' or '1a' or simply numbers or letters. |
| 2 | mjames | 2262 | @break |
| 2263 | In each case the letter codes are regarded as the columns of the connector and |
||
| 2264 | the numbers as the rows of the connector. |
||
| 2265 | @break |
||
| 11 | mjames | 2266 | The highest and lowest numbered rows are identified and once the number of rows is |
| 2 | mjames | 2267 | known the array index of the bundle is defined by : |
| 2268 | @listing |
||
| 2269 | BundleIndex = RowNum-LowestRow + (ColNum-LowestCol)*TotalRows; |
||
| 2270 | @text |
||
| 2271 | This should always be consistent for any multipole connector. |
||
| 2272 | @break |
||
| 2273 | A port on the top level of the design will appear, the net identifier is the same as the |
||
| 11 | mjames | 2274 | connector identifier. If Verilog printout is used then the ports will be assigned automatically to the correct signals. |
| 2 | mjames | 2275 | @break |
| 11 | mjames | 2276 | This command is fully implemented for working with |
| 2277 | "write vlog", Verilog output. It is not |
||
| 2 | mjames | 2278 | yet implemented for "write VHDL", VHDL output. |
| 2279 | |||
| 2280 | @end |
||
| 2281 | */ |
||
| 11 | mjames | 2282 | int BundleHandler(ET_TCLARGS) |
| 2 | mjames | 2283 | { |
| 11 | mjames | 2284 | |
| 2285 | int i = 0; |
||
| 2286 | char * Word = NULL; |
||
| 2287 | while(i<argc) |
||
| 2288 | { |
||
| 2289 | Word = argv[i++]; |
||
| 2290 | wildcard_bundle(Word,1); |
||
| 2291 | } |
||
| 2292 | return(TCL_OK); |
||
| 2 | mjames | 2293 | } |
| 2294 | |||
| 11 | mjames | 2295 | |
| 2 | mjames | 2296 | /*********************** UnBundle Command ***************************/ |
| 2297 | /* |
||
| 2298 | @title |
||
| 2299 | unbundle <socket_id> [ <socket_id> * ] |
||
| 2300 | @application vertical_hdl |
||
| 2301 | @text |
||
| 2302 | The unbundle command is used to undo the effect of the bundle command. |
||
| 2303 | @end |
||
| 2304 | */ |
||
| 11 | mjames | 2305 | int UnBundleHandler(ET_TCLARGS) |
| 2 | mjames | 2306 | { |
| 11 | mjames | 2307 | |
| 2308 | int i = 0; |
||
| 2309 | char * Word = NULL; |
||
| 2310 | while(i<argc) |
||
| 2311 | { |
||
| 2312 | Word = argv[i++]; |
||
| 2313 | wildcard_bundle(Word,0); |
||
| 2314 | } |
||
| 2315 | return(TCL_OK); |
||
| 2 | mjames | 2316 | } |
| 2317 | |||
| 11 | mjames | 2318 | |
| 2319 | |||
| 2320 | |||
| 2321 | |||
| 2 | mjames | 2322 | /*********************** Jumper Equivalent Pins Command ***************************/ |
| 2323 | /* Connect together pin groups that are equivalent */ |
||
| 11 | mjames | 2324 | /* |
| 2 | mjames | 2325 | @title |
| 2326 | equivalent |
||
| 2327 | @application vertical_pin |
||
| 2328 | @application vertical_hdl |
||
| 2329 | @application vertical_pcb |
||
| 2330 | @text |
||
| 2331 | @text |
||
| 11 | mjames | 2332 | The netlist is searched for all sockets which have had a template applied to them, which includes defined |
| 2333 | equivalent pins, or the socket has an equivalent pins section defined in the ACF source file. |
||
| 2 | mjames | 2334 | @break |
| 11 | mjames | 2335 | For these sockets, |
| 2336 | a netlist jumper is created to create a logical short circuit between the sets of defined equivalent pins |
||
| 2 | mjames | 2337 | @break |
| 11 | mjames | 2338 | This is used in order to create logical shorts across series termination resistors. For example from a well known FPGA672 card: |
| 2 | mjames | 2339 | @listing |
| 2340 | -- an ACFP template file |
||
| 2341 | template resistor |
||
| 2342 | begin |
||
| 2343 | "" : bidir_pin = 1; |
||
| 2344 | "" : bidir_pin = 2; |
||
| 2345 | equivalent (1;2); |
||
| 2346 | end; |
||
| 2347 | |||
| 2348 | |||
| 2349 | template "RES INNER 16R" |
||
| 2350 | begin |
||
| 2351 | alias resistor; |
||
| 2352 | end; |
||
| 2353 | |||
| 2354 | template "RES INNER 51R" |
||
| 2355 | begin |
||
| 11 | mjames | 2356 | alias resistor; |
| 2 | mjames | 2357 | end; |
| 2358 | @text |
||
| 2359 | Which is read in and then the template command is applied for all resistors in the design. |
||
| 11 | mjames | 2360 | Only those of type 'resistor', "RES INNER 16R" and "RES INNER 51R" would have their pins |
| 2361 | connected together in this case. |
||
| 2 | mjames | 2362 | @break |
| 11 | mjames | 2363 | It can also be used to make e.g. bus buffers invisible for the purpose of routing signals from interface pins via a bus buffer: |
| 2364 | something like |
||
| 2365 | @listing |
||
| 2 | mjames | 2366 | template bus245buf |
| 2367 | begin |
||
| 2368 | "" : bidir pin = 2; |
||
| 2369 | "" : bidir pin = 3; |
||
| 2370 | .... |
||
| 2371 | |||
| 2372 | |||
| 2373 | "" : bidir_pin = 18; |
||
| 2374 | "" : bidir_pin = 17; |
||
| 2375 | equivalent (2;18); |
||
| 2376 | equivalent (3;17); |
||
| 2377 | ... |
||
| 11 | mjames | 2378 | end; |
| 2 | mjames | 2379 | |
| 2380 | template "74HCT245" |
||
| 2381 | begin |
||
| 2382 | alias bus245buf; |
||
| 2383 | end; |
||
| 2384 | |||
| 2385 | |||
| 11 | mjames | 2386 | -- Schematic netlist component library naming error |
| 2 | mjames | 2387 | -- mapped by alias template |
| 2388 | template "bizarre245" |
||
| 2389 | begin |
||
| 2390 | alias bus245buf; |
||
| 2391 | end; |
||
| 2392 | |||
| 2393 | @text |
||
| 11 | mjames | 2394 | Which will short out any type of 245 buffer for the purpose of signal routing. It is expected to introduce the concept |
| 2395 | of directional jumpers to more correctly map the behaviour of a bus buffer. At the moment Vertical will not take any notice of |
||
| 2396 | unidirectional buffers ! |
||
| 2 | mjames | 2397 | @end |
| 2398 | */ |
||
| 2399 | |||
| 11 | mjames | 2400 | int JumperEquivPairsHandler(ET_TCLARGS) { |
| 2401 | jumper_equivalent_pins(); |
||
| 2402 | return(TCL_OK); |
||
| 2 | mjames | 2403 | } |
| 2404 | |||
| 2405 | /*********************** Elaborate Command ***************************/ |
||
| 2406 | /* Connect together pin groups that are equivalent */ |
||
| 11 | mjames | 2407 | /* |
| 2 | mjames | 2408 | @title |
| 2409 | elaborate |
||
| 2410 | @application vertical_pin |
||
| 2411 | @application vertical_hdl |
||
| 2412 | @application vertical_pcb |
||
| 2413 | @break |
||
| 2414 | This performs exactly the same task as for VHDL. All component instances which use a declared |
||
| 11 | mjames | 2415 | component are elaborated into unique instances of that component. |
| 2 | mjames | 2416 | @break |
| 11 | mjames | 2417 | Generic values are then evaluated for such things as bus widths on ports which have |
| 2 | mjames | 2418 | variable widths defined by constants and expressions of those constants. |
| 2419 | @break |
||
| 11 | mjames | 2420 | Finally, all of the unrouted nets created by the implied connections of VHDL component |
| 2 | mjames | 2421 | instances (port name matching and renaming via port=>fred types of mapping) |
| 2422 | are converted into wires by creating wiring automatically. |
||
| 2423 | @end |
||
| 2424 | */ |
||
| 2425 | |||
| 2426 | |||
| 11 | mjames | 2427 | |
| 2428 | int ElaborateHandler(ET_TCLARGS) { |
||
| 2429 | /* templates are used to make VHDL component instances |
||
| 2430 | match up to the declared components */ |
||
| 2431 | template_ensure(NULL,Search); |
||
| 2432 | elaborate_all(); |
||
| 2433 | create_vhdl_connections(); |
||
| 2434 | perform_routing(By_Creating); |
||
| 2435 | |||
| 2436 | return(TCL_OK); |
||
| 2 | mjames | 2437 | } |
| 2438 | |||
| 2439 | /******************** Swapping pin ids on sockets. ***************************/ |
||
| 2440 | /* first arg. chip ID template, second is max number of chars before letter ***********/ |
||
| 11 | mjames | 2441 | /* |
| 2442 | @title |
||
| 2 | mjames | 2443 | swap <identifier> [ <style> ] |
| 2444 | @application vertical_pin |
||
| 2445 | @application vertical_pcb |
||
| 2446 | @text |
||
| 2447 | This is replaced by the edit_pin commands, which can do much more than this. |
||
| 2448 | @break |
||
| 11 | mjames | 2449 | All pin identifiers on the device identified (or identified by the "name*") type of syntax will be |
| 2450 | converted to the defined style. |
||
| 2 | mjames | 2451 | @break |
| 2452 | Valid styles are "1a" or "a1" indicating either leading or trailing numeric parts to the |
||
| 2453 | pin identifier. |
||
| 2454 | @break |
||
| 2455 | SO the following would happen: |
||
| 2456 | @listing |
||
| 2457 | Style | A1 | A1 | 1A | 1A |
||
| 2458 | ------------------------------------- |
||
| 2459 | Original ident | X32 | 4b | X32 | 4b |
||
| 2460 | Swapped ident | X32 | b4 | 32X | 4B |
||
| 2461 | @text |
||
| 2462 | The default style is "A1". |
||
| 2463 | |||
| 2464 | @end |
||
| 11 | mjames | 2465 | */ |
| 2 | mjames | 2466 | |
| 11 | mjames | 2467 | int SwapIdHandler (ET_TCLARGS) { |
| 2468 | char *Template=NULL; |
||
| 2469 | int limit; |
||
| 2470 | AlphaSwap_t swapping; |
||
| 2471 | Log(LOG_GENERAL,"# Freezing pin renames\n"); |
||
| 2472 | create_unrouted_list(); |
||
| 2473 | limit = 2; |
||
| 2474 | swapping = Want_A1; |
||
| 2475 | if (argc > 0) |
||
| 2476 | Template = argv[0]; |
||
| 2 | mjames | 2477 | |
| 11 | mjames | 2478 | if (argc > 1) |
| 2479 | { |
||
| 2480 | if (isalpha(argv[1][0])) |
||
| 2 | mjames | 2481 | { |
| 11 | mjames | 2482 | swapping = Want_A1; |
| 2 | mjames | 2483 | } |
| 11 | mjames | 2484 | else { |
| 2485 | swapping = Want_1A; |
||
| 2 | mjames | 2486 | } |
| 11 | mjames | 2487 | } |
| 2 | mjames | 2488 | |
| 11 | mjames | 2489 | if (argc > 2) |
| 2490 | { |
||
| 2491 | limit = atoi(argv[2]); |
||
| 2492 | } |
||
| 2493 | |||
| 2494 | pin_id_swap(Template,limit,swapping); |
||
| 2495 | return (TCL_OK); |
||
| 2496 | } |
||
| 2 | mjames | 2497 | /*********************** SetEnv ***************************/ |
| 2498 | /* Set acfread environment */ |
||
| 2499 | /* |
||
| 2500 | @title |
||
| 2501 | setenv <name> <string> |
||
| 2502 | @application vertical_pin |
||
| 2503 | @application vertical_hdl |
||
| 2504 | @application vertical_pcb |
||
| 2505 | @text |
||
| 2506 | The environment variable is a special class of generic which |
||
| 2507 | is not used in e.g. VHDL listings. |
||
| 2508 | @break |
||
| 11 | mjames | 2509 | It is rougly equivalent to the shell environment variables |
| 2 | mjames | 2510 | which may also be looked up by Vertical if no variable/generic |
| 2511 | of the wanted name exists inside Vertical. |
||
| 2512 | @break |
||
| 2513 | Set the environment variable (looked up by $(name) within netlists) |
||
| 2514 | named to be the string given. e.g. |
||
| 2515 | @listing |
||
| 2516 | setenv fred "A string" |
||
| 2517 | echo $(fred) |
||
| 2518 | @text |
||
| 11 | mjames | 2519 | Will result in the string |
| 2 | mjames | 2520 | @listing |
| 2521 | A string |
||
| 2522 | @text |
||
| 2523 | appearing on standard output and in the log file. |
||
| 2524 | @end |
||
| 2525 | */ |
||
| 2526 | |||
| 11 | mjames | 2527 | int SetEnvHandler(ET_TCLARGS) { |
| 2528 | generic_info_t info; |
||
| 2529 | if (argc < 2) |
||
| 2530 | return TCL_ERROR; |
||
| 2531 | info.name = argv[0]; |
||
| 2532 | info.typename = "env_string"; |
||
| 2533 | info.g_type = IS_STRING; |
||
| 2534 | info.expr = compile_string(argv[1]); |
||
| 2535 | set_generic_value(&global_generics,&info); |
||
| 2536 | return(TCL_OK); |
||
| 2537 | } |
||
| 2 | mjames | 2538 | |
| 11 | mjames | 2539 | |
| 2 | mjames | 2540 | /*********************** ECHO ***************************/ |
| 2541 | /* |
||
| 2542 | @title |
||
| 2543 | echo [ <string>* ] |
||
| 2544 | @application vertical_pin |
||
| 2545 | @application vertical_hdl |
||
| 2546 | @application vertical_pcb |
||
| 2547 | @text |
||
| 11 | mjames | 2548 | Prints out the strings given to standard output and to the |
| 2 | mjames | 2549 | Vertical log file. |
| 2550 | @end |
||
| 2551 | */ |
||
| 11 | mjames | 2552 | int ECHOHandler(ET_TCLARGS) { |
| 2553 | int i; |
||
| 2554 | for(i=0;i<argc;i++) { |
||
| 2555 | Log(LOG_GENERAL,"%s ",argv[i]); |
||
| 2556 | }; |
||
| 2557 | Log(LOG_GENERAL,"\n"); |
||
| 2558 | return(TCL_OK); |
||
| 2559 | } |
||
| 2 | mjames | 2560 | /*********************** ECHO quoted ***************************/ |
| 2561 | /* |
||
| 2562 | @title |
||
| 2563 | echoq [ <string>* ] |
||
| 2564 | @application vertical_pin |
||
| 2565 | @application vertical_hdl |
||
| 2566 | @application vertical_pcb |
||
| 2567 | @text |
||
| 11 | mjames | 2568 | Prints out the strings given , with "" quotes around them to standard output and to the Vertical log file. used to check |
| 2569 | command parser behaviour. It also can show up any variable with space characters in its value (which may be a problem) |
||
| 2 | mjames | 2570 | @listing |
| 2571 | Vertical : setenv earwig "one two " |
||
| 2572 | Vertical : echoe $(earwig) |
||
| 2573 | "one two " |
||
| 2574 | Vertical : echo $(earwig) |
||
| 2575 | one two |
||
| 2576 | @text |
||
| 2577 | In the second echo example it is not clear there is a space inside |
||
| 11 | mjames | 2578 | the variable. |
| 2 | mjames | 2579 | |
| 2580 | @end |
||
| 2581 | */ |
||
| 11 | mjames | 2582 | int ECHOQHandler(ET_TCLARGS) { |
| 2583 | int i; |
||
| 2584 | for(i=0;i<argc;i++) { |
||
| 2585 | Log(LOG_GENERAL,"\"%s\" ",argv[i]); |
||
| 2586 | }; |
||
| 2587 | Log(LOG_GENERAL,"\n"); |
||
| 2588 | return(TCL_OK); |
||
| 2589 | } |
||
| 2 | mjames | 2590 | /*********************** ECHO to error log ***************************/ |
| 2591 | /* |
||
| 2592 | @title |
||
| 2593 | echoe [ <string>* ] |
||
| 2594 | @application vertical_pin |
||
| 2595 | @application vertical_hdl |
||
| 2596 | @application vertical_pcb |
||
| 2597 | @text |
||
| 11 | mjames | 2598 | This is echoe where the e stands for ERROR. Allows tagging of the error report file |
| 2 | mjames | 2599 | with the progress of scripts. It also prints to the standard Vertical log file. |
| 2600 | @break |
||
| 2601 | Prints out the strings given to standard output and to the Vertical ERROR log file |
||
| 2602 | @end |
||
| 2603 | */ |
||
| 2604 | |||
| 11 | mjames | 2605 | int ECHOEHandler(ET_TCLARGS) { |
| 2606 | int i; |
||
| 2607 | for(i=0;i<argc;i++) { |
||
| 2608 | Log(LOG_ERROR,"%s ",argv[i]); |
||
| 2609 | }; |
||
| 2610 | Log(LOG_ERROR,"\n"); |
||
| 2611 | for(i=0;i<argc;i++) { |
||
| 2612 | Log(LOG_GENERAL,"%s ",argv[i]); |
||
| 2613 | }; |
||
| 2614 | Log(LOG_GENERAL,"\n"); |
||
| 2 | mjames | 2615 | |
| 11 | mjames | 2616 | return(TCL_OK); |
| 2617 | } |
||
| 2 | mjames | 2618 | |
| 11 | mjames | 2619 | |
| 2 | mjames | 2620 | /**************************************************/ |
| 11 | mjames | 2621 | /* Disconnect node handler |
| 2 | mjames | 2622 | @title |
| 2623 | disconnect <chip>'('<pin_ident>')' ( <chip>'('<pin_ident>')' ) * |
||
| 2624 | @application vertical_pin |
||
| 2625 | @application vertical_hdl |
||
| 2626 | @application vertical_pcb |
||
| 2627 | @text |
||
| 11 | mjames | 2628 | The pin will be disconnected from the routed net list. This is is used to delete pins |
| 2 | mjames | 2629 | on chips which are broken. For more than a few pins on the chip it is better to use |
| 2630 | the template command to disconnect unused pins en masse. |
||
| 2631 | @break |
||
| 2632 | This command has been promised for about 5 years but was implemented only in 2001. |
||
| 2633 | @end |
||
| 2634 | */ |
||
| 2635 | |||
| 11 | mjames | 2636 | int DisconnectNodeHandler(ET_TCLARGS) |
| 2637 | { |
||
| 2638 | int i; |
||
| 2639 | char * s, * t , * u; |
||
| 2640 | socket_t * socket; |
||
| 2641 | node_t * node; |
||
| 2642 | if (argc < 2) |
||
| 2643 | return(TCL_ERROR); |
||
| 2644 | for (i=0;i<argc;i++) |
||
| 2645 | { |
||
| 2646 | |||
| 2647 | s=strdup(argv[i]); |
||
| 2648 | /* look for (x) and point at it and the closing bracket */ |
||
| 2649 | t=strchr(s,'('); |
||
| 2650 | if(t) |
||
| 2651 | { |
||
| 2652 | u=strchr(t,')'); |
||
| 2653 | if(u) |
||
| 2 | mjames | 2654 | { |
| 11 | mjames | 2655 | *t++ = 0; /* terminate first half of string, point at second string */ |
| 2656 | *u = 0; /* terminate second string */ |
||
| 2657 | socket = find_socket(Ident,s,Search,&socket_head); |
||
| 2658 | if(socket) |
||
| 2659 | { |
||
| 2660 | node = find_node(socket,Ident,t,Search); |
||
| 2661 | if(node) |
||
| 2662 | { |
||
| 2663 | disconnect_node(socket,node); |
||
| 2664 | } |
||
| 2665 | else |
||
| 2666 | { |
||
| 2667 | Log(LOG_GENERAL,"-- No pin '%s' on socket '%s'\n",t,s); |
||
| 2668 | } |
||
| 2669 | |||
| 2670 | } |
||
| 2671 | else |
||
| 2672 | { |
||
| 2673 | Log(LOG_GENERAL,"-- No socket '%s'\n",s); |
||
| 2674 | } |
||
| 2675 | } |
||
| 2676 | } |
||
| 2677 | if(!t || !u) |
||
| 2678 | { |
||
| 2679 | Log(LOG_GENERAL,"-- Use chip(pin) instead of '%s'\n",argv[i]); |
||
| 2680 | } |
||
| 2681 | free(s); /* free up allocated string */ |
||
| 2682 | } |
||
| 2683 | return(TCL_OK); |
||
| 2684 | } |
||
| 2 | mjames | 2685 | |
| 11 | mjames | 2686 | |
| 2687 | |||
| 2 | mjames | 2688 | /**********************************************************/ |
| 2689 | /* |
||
| 2690 | @title |
||
| 2691 | version |
||
| 2692 | @application vertical_pin |
||
| 2693 | @application vertical_hdl |
||
| 2694 | @application vertical_pcb |
||
| 2695 | @text |
||
| 2696 | List out all of the RCS/CVS $header$ tagged modules present |
||
| 2697 | in Vertical and the netlist readers. This allows for identification |
||
| 11 | mjames | 2698 | of the exact versions of code used within a particular build of |
| 2 | mjames | 2699 | Vertical. |
| 11 | mjames | 2700 | @end |
| 2701 | */ |
||
| 2702 | int VersionHandler(ET_TCLARGS) { |
||
| 2703 | list_versions(stdout); |
||
| 2704 | return TCL_OK; |
||
| 2705 | } |
||
| 2 | mjames | 2706 | |
| 11 | mjames | 2707 | |
| 2 | mjames | 2708 | /**********************************************************/ |
| 2709 | /* |
||
| 2710 | @title |
||
| 2711 | require <minimum_version> |
||
| 2712 | @application vertical_pin |
||
| 2713 | @application vertical_hdl |
||
| 2714 | @application vertical_pcb |
||
| 2715 | @text |
||
| 2716 | The lowest release version of Vertical required to run this script is the command argument. |
||
| 2717 | @break |
||
| 11 | mjames | 2718 | If the Vertical version is older than that required, then an error will appear. Before Version 16.0 the error is because the |
| 2719 | require command does not exist. Above this version, the number given is checked |
||
| 2 | mjames | 2720 | |
| 2721 | |||
| 11 | mjames | 2722 | @end |
| 2723 | */ |
||
| 2724 | int RequireHandler(ET_TCLARGS) { |
||
| 2725 | |||
| 2 | mjames | 2726 | |
| 11 | mjames | 2727 | if (argc < 1) |
| 2728 | { |
||
| 2729 | return(TCL_ERROR); |
||
| 2730 | } |
||
| 2731 | |||
| 2732 | if(strcmp(Vertical_Version,argv[0]) >= 0) |
||
| 2733 | { |
||
| 2734 | Log(LOG_GENERAL,"# Vertical version %s is OK, version %s required for this script\n", |
||
| 2735 | Vertical_Version,argv[0]); |
||
| 2736 | return(TCL_OK); |
||
| 2737 | } |
||
| 2738 | else |
||
| 2739 | { |
||
| 2740 | Log(LOG_ERROR,"# ERROR : Vertical version %s is too old , version %s required for this script\n", |
||
| 2741 | Vertical_Version,argv[0]); |
||
| 2742 | |||
| 2743 | return(TCL_ERROR); |
||
| 2744 | } |
||
| 2745 | |||
| 2 | mjames | 2746 | |
| 11 | mjames | 2747 | return TCL_OK; |
| 2748 | } |
||
| 2 | mjames | 2749 | |
| 2750 | |||
| 11 | mjames | 2751 | |
| 2752 | |||
| 2753 | |||
| 2754 | |||
| 2755 | |||
| 2756 | |||
| 2 | mjames | 2757 | /*********************** Top level menu driver ******************************/ |
| 2758 | |||
| 11 | mjames | 2759 | CommandMenu TopMenu = |
| 2760 | { |
||
| 2761 | {"bye", 3, BYEHandler,NULL, "Leave program",NULL}, |
||
| 2762 | {"quit", 1, BYEHandler,NULL, "Leave program",NULL}, |
||
| 2763 | {"bundle", 3, BundleHandler,NULL, "Bundle together nets leaving connector","[<chip_name_template>*]",NULL}, |
||
| 2764 | {"modify_names",3, Modify_NamesHandler,NULL, "Rename nets to match chip pin identifiers"," <chip_name_template> <optional_prefix>",NULL}, |
||
| 2765 | {"equivalent",3, JumperEquivPairsHandler,NULL,"Connect together equivalent pins on devices by jumpers","",NULL}, |
||
| 2766 | {"elaborate", 3, ElaborateHandler,NULL,"VHDL style variable elaboration handler","",NULL}, |
||
| 2767 | {"exit", 3, BYEHandler,NULL, "Leave program",NULL}, |
||
| 2768 | {"extract_template", 3, ExtractTemplateHandler,NULL,"Extract component declarations from netlist","",NULL}, |
||
| 2769 | {"echoe", 5, ECHOEHandler,NULL, "Expand remainder of line and print it as an error",NULL}, |
||
| 2770 | {"echoq", 5, ECHOQHandler,NULL, "Expand remainder of line and print strings as quoted",NULL}, |
||
| 2771 | {"echo", 4, ECHOHandler,NULL, "Expand remainder of line and print it out",NULL}, |
||
| 2772 | {"edit_pins", 6, NULL,EditPinNamesMenu, "Rename pin identifiers on chips ","(more)",NULL}, |
||
| 2773 | {"edit_nets", 6, NULL,EditNetNamesMenu, "Rename net identifiers ","(more)",NULL}, |
||
| 2774 | {"do", 2, DOHandler,NULL, "Run a batch file","<do_file>",NULL}, |
||
| 2775 | {"read", 4, READHandler,NULL,"Read a data file in with <suffix> on net and socket IDs","<acf_file> [<suffix>] [ <args> ]",NULL}, |
||
| 2776 | {"list", 4, NULL,ListMenu, "Print information","(more)",NULL}, |
||
| 2777 | {"setenv", 4, SetEnvHandler,NULL,"set environment variable","<name> <value>",NULL}, |
||
| 2778 | {"set", 3, NULL,SetMenu, "Alter part of the database","(more)",NULL}, |
||
| 2779 | {"delete", 3, NULL,DeleteMenu, "Remove part of the database","(more)",NULL}, |
||
| 2780 | {"disconnect",3, DisconnectNodeHandler,NULL, "Remove a pin from a chip","chip(pin)",NULL}, |
||
| 2781 | {"write", 4, NULL,WriteMenu, "Write out a data file","(more)",NULL}, |
||
| 2782 | {"route", 4, ROUTEHandler,NULL,"Route the wiring",NULL}, |
||
| 2783 | {"preroute", 4, NULL,PrerouteMenu,"Partially route the wiring","(more)",NULL}, |
||
| 2784 | {"fix_nets", 3, FIXHandler,NULL, "Fix unrouted connections to External ports",NULL}, |
||
| 2785 | {"count_nets",3, COUNTNETSHandler,NULL, "Count nets with less than <limit> nodes","[<limit>]",NULL}, |
||
| 2786 | {"jumper", 4, JUMPERHandler,NULL,"Create new paths with unique jumpers","[<suffix>]",NULL}, |
||
| 2787 | {"partition", 3, PARTHandler,NULL,"Do the partition calculation","",NULL}, |
||
| 2788 | {"logging", 3, NULL,LoggingMenu,"Setup transcript logging file","(more)",NULL}, |
||
| 2789 | {"debug", 3, DEBUGHandler,NULL,"Internal debugging","<debug_flags>",NULL}, |
||
| 2790 | {"template", 3, EnsureTemplateHandler,NULL,"Ensure chips have correct pin directions only","[<chip_name_template>*]",NULL}, |
||
| 2791 | {"create_template", 3, EnsureCreateTemplateHandler,NULL,"Ensure chips have all possible pins","[<chip_name_template>*]",NULL}, |
||
| 2792 | {"match_template", 3, EnsureMatchTemplateHandler,NULL,"Ensure chips have all possible valid pins: disconnect extra pins ","[<chip_name_template>*]",NULL}, |
||
| 2793 | {"connection",3, ConnectionHandler,NULL,"Connect two connectors pin for pin","<socket1> <socket2>",NULL}, |
||
| 2794 | {"swap", 3, SwapIdHandler,NULL,"reverse chip pin id A23=>23A","<chip_template> <max_letters>",NULL}, |
||
| 2795 | {"reserve", 3, ReservePinsHandler,NULL,"reserve pins for Altera FPGA use after routing","",NULL}, |
||
| 2796 | {"require", 3, RequireHandler,NULL,"Require a given version (or later) of VERTICAL","<version>",NULL}, |
||
| 2797 | {"unbundle", 3, UnBundleHandler,NULL, "Unbundle nets leaving connector","[<chip_name_template>*]",NULL}, |
||
| 2798 | {"version", 3, VersionHandler,NULL,"list module versions to standard output","",NULL}, |
||
| 2799 | {NULL, 0, NULL,NULL,NULL,NULL}, |
||
| 2800 | }; |
||
| 2 | mjames | 2801 | |
| 2802 | /****************************************************************************/ |
||
| 11 | mjames | 2803 |