1 /* -*- tab-width: 4 -*- 2 * 3 * Electric(tm) VLSI Design System 4 * 5 * File: eio.h 6 * Input/output tool: header file 7 * Written by: Steven M. Rubin, Static Free Software 8 * 9 * Copyright (c) 2000 Static Free Software. 10 * 11 * Electric(tm) is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * Electric(tm) is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with Electric(tm); see the file COPYING. If not, write to 23 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, 24 * Boston, Mass 02111-1307, USA. 25 * 26 * Static Free Software 27 * 4119 Alpine Road 28 * Portola Valley, California 94028 29 * info@staticfreesoft.com 30 */ 31 32 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS) 33 extern "C" 34 { 35 #endif 36 37 #include <setjmp.h> 38 39 /* #define REPORTCONVERSION 1 */ /* uncomment to report on library conversion */ 40 41 /* successive versions of the binary file have smaller numbers */ 42 #define MAGIC13 -1597 /* current magic number: version 13 */ 43 #define MAGIC12 -1595 /* older magic number: version 12 */ 44 #define MAGIC11 -1593 /* older magic number: version 11 */ 45 #define MAGIC10 -1591 /* older magic number: version 10 */ 46 #define MAGIC9 -1589 /* older magic number: version 9 */ 47 #define MAGIC8 -1587 /* older magic number: version 8 */ 48 #define MAGIC7 -1585 /* older magic number: version 7 */ 49 #define MAGIC6 -1583 /* older magic number: version 6 */ 50 #define MAGIC5 -1581 /* older magic number: version 5 */ 51 #define MAGIC4 -1579 /* older magic number: version 4 */ 52 #define MAGIC3 -1577 /* older magic number: version 3 */ 53 #define MAGIC2 -1575 /* older magic number: version 2 */ 54 #define MAGIC1 -1573 /* oldest magic number: version 1 */ 55 56 /* I/O formats: */ 57 #define FBINARY 0 /* Binary */ 58 #define FBINARYNOBACKUP 1 /* Binary without backup */ 59 #define FCIF 2 /* CIF */ 60 #define FDXF 3 /* DXF format */ 61 #define FEDIF 4 /* Electronic Design Interchange Format */ 62 #define FGDS 5 /* Calma GDS-II format */ 63 #define FHPGL 6 /* HPGL format (plotting) */ 64 #define FL 7 /* L format (Silicon Compilers) */ 65 #define FPOSTSCRIPT 8 /* PostScript (plotting) */ 66 #define FPRINTEDPOSTSCRIPT 9 /* Printed PostScript (plotting) */ 67 #define FQUICKDRAW 10 /* Quickdraw (plotting) */ 68 #define FSDF 11 /* SDF */ 69 #define FTEXT 12 /* Text */ 70 #define FVHDL 13 /* VHDL */ 71 #define FSUE 14 /* SUE */ 72 #define FLEF 15 /* LEF (Library Exchange Format) */ 73 #define FDEF 16 /* DEF (Design Exchange Format) */ 74 #define FSKILL 17 /* SKILL (CADENCE command language) */ 75 #define FEAGLE 18 /* EAGLE (CadSoft) netlist */ 76 #define FPADS 19 /* PADS netlist */ 77 #define FECAD 20 /* ECAD netlist */ 78 79 /* tool:inout.IO_state: */ 80 #define NUMIOSTATEBITWORDS 2 /* number of words for these bits */ 81 82 #define CIFINSQUARE 01 /* 0: bit set for CIF input to square wires */ 83 #define CIFOUTEXACT 02 /* 0: bit set for CIF output to mimic screen */ 84 #define CIFOUTMERGE 04 /* 0: bit set for CIF output to merge polygons */ 85 #define CIFOUTADDDRC 010 /* 0: bit set for CIF output to include DRC layer */ 86 #define IODEBUG 020 /* 0: bit set to debug input */ 87 #define PLOTFOCUS 040 /* 0: bit set to focus plot output */ 88 #define PLOTDATES 0100 /* 0: bit set to include dates in plot output */ 89 #define CIFOUTNORMALIZE 0200 /* 0: bit set for normalized CIF coordinates */ 90 #define GDSOUTMERGE 0400 /* 0: bit set for GDS output to merge polgons */ 91 #define GDSOUTADDDRC 01000 /* 0: bit set for GDS output to include DRC layer */ 92 #define EPSPSCRIPT 02000 /* 0: bit set for Encapsulated PostScript output */ 93 #define HPGL2 04000 /* 0: bit set for HPGL/2 output instead of HPGL */ 94 #define EDIFSCHEMATIC 010000 /* 0: bit set for EDIF write schematic instead of netlist */ 95 #define DXFALLLAYERS 020000 /* 0: bit set for DXF to read all layers instead of technology list */ 96 #define DXFFLATTENINPUT 040000 /* 0: bit set for DXF to flatten input */ 97 #define DEFNOPHYSICAL 0100000 /* 0: bit set to ignore DEF physical data */ 98 #define GDSINTEXT 0200000 /* 0: bit set for GDS input of text */ 99 #define GDSINEXPAND 0400000 /* 0: bit set for GDS expansion of cells */ 100 #define GDSINARRAYS 01000000 /* 0: bit set for GDS array instantiation */ 101 #define PSCOLOR1 02000000 /* 0: first bit for color PostScript output */ 102 #define PSPLOTTER 04000000 /* 0: bit set for PostScript plotting (continuous roll) */ 103 #define PSROTATE 010000000 /* 0: bit set for PostScript rotation (by 90 degrees) */ 104 #define CIFOUTNOTOPCALL 020000000 /* 0: bit set for CIF output to not call top cell */ 105 #define GDSINIGNOREUKN 040000000 /* 0: bit set for GDS input to ignore unknown layers */ 106 #define DEFNOLOGICAL 0100000000 /* 0: bit set to ignore DEF logical data */ 107 #define BINOUTBACKUP 0600000000 /* 0: bits that determine binary output backups */ 108 #define BINOUTNOBACK 0000000000 /* for no backup of binary output files */ 109 #define BINOUTONEBACK 0200000000 /* for one backup of binary output files */ 110 #define BINOUTFULLBACK 0400000000 /* for full backup of binary output files */ 111 #define CHECKATWRITE 01000000000 /* 0: bit set for database check before write */ 112 #define PSCOLOR2 02000000000 /* 0: second bit for color PostScript output */ 113 #define GDSOUTUC 04000000000 /* 0: bit set to force GDS output to be upper case */ 114 #define PLOTFOCUSDPY 010000000000 /* 0: bit set to focus plot output on display */ 115 #define SKILLNOHIER 020000000000 /* 0: bit set to ignore subcells in SKILL */ 116 #define CIFRESHIGH 01 /* 1: bit set for CIF resolution errors to highlight */ 117 #define SKILLFLATHIER 02 /* 1: bit set to flatten hierarchy in SKILL */ 118 #define CDLNOBRACKETS 04 /* 1: bit set to convert brackets in CDL */ 119 #define GDSOUTPINS 010 /* 1: bit set for GDS to write pins at exports */ 120 #define PSAUTOROTATE 020 /* 1: bit set to automatically rotate PS to fit best */ 121 #define SUEUSE4PORTTRANS 040 /* 1: bit set to make 4-port transistors in Sue input */ 122 123 #define DEFAULTPSWIDTH 638 /* default PostScript page width (8.5" at 75dpi) */ 124 #define DEFAULTPSHEIGHT 825 /* default PostScript page height (11.0" at 75dpi) */ 125 #define DEFAULTPSMARGIN 56 /* default PostScript page height (0.75" at 75dpi) */ 126 127 128 #define NOFAKECELL ((FAKECELL *)-1) 129 130 typedef struct Ifakecell 131 { 132 CHAR *cellname; /* name of this fakecell */ 133 struct Inodeproto *firstincell; /* first nodeproto in list */ 134 } FAKECELL; 135 136 /* miscellaneous */ 137 extern FILE *io_fileout; /* channel for output */ 138 extern jmp_buf io_filerror; /* nonlocal jump when I/O fails */ 139 extern INTBIG io_cifbase; /* index used when writing CIF */ 140 extern INTBIG io_postscriptfilenamekey;/* key for "IO_postscript_filename" */ 141 extern INTBIG io_postscriptfiledatekey;/* key for "IO_postscript_filedate" */ 142 extern INTBIG io_postscriptepsscalekey;/* key for "IO_postscript_EPS_scale" */ 143 extern INTBIG io_verbose; /* 0: silent 1:verbose -1:display cells during input */ 144 extern INTBIG io_filetypeblib; /* Binary library disk file descriptor */ 145 extern INTBIG io_filetypecif; /* CIF disk file descriptor */ 146 extern INTBIG io_filetypedef; /* DEF disk file descriptor */ 147 extern INTBIG io_filetypedxf; /* DXF disk file descriptor */ 148 extern INTBIG io_filetypeeagle; /* EAGLE netlist disk file descriptor */ 149 extern INTBIG io_filetypeecad; /* ECAD netlist disk file descriptor */ 150 extern INTBIG io_filetypeedif; /* EDIF disk file descriptor */ 151 extern INTBIG io_filetypegds; /* GDS disk file descriptor */ 152 extern INTBIG io_filetypehpgl; /* HPGL disk file descriptor */ 153 extern INTBIG io_filetypehpgl2; /* HPGL2 disk file descriptor */ 154 extern INTBIG io_filetypel; /* L disk file descriptor */ 155 extern INTBIG io_filetypelef; /* LEF disk file descriptor */ 156 extern INTBIG io_filetypepads; /* PADS netlist disk file descriptor */ 157 extern INTBIG io_filetypeps; /* PostScript disk file descriptor */ 158 extern INTBIG io_filetypeskill; /* SKILL commands disk file descriptor */ 159 extern INTBIG io_filetypesdf; /* SDF disk file descriptor */ 160 extern INTBIG io_filetypesue; /* SUE disk file descriptor */ 161 extern INTBIG io_filetypetlib; /* Text library disk file descriptor */ 162 extern INTBIG io_filetypevhdl; /* VHDL disk file descriptor */ 163 extern INTBIG io_libinputrecursivedepth; /* for recursing when reading dependent libraries */ 164 extern INTBIG io_libinputreadmany;/* nonzero if reading dependent libraries */ 165 extern void *io_inputprogressdialog; 166 167 /* prototypes for tool interface */ 168 void io_init(INTBIG*, CHAR1*[], TOOL*); 169 void io_done(void); 170 void io_set(INTBIG, CHAR*[]); 171 INTBIG io_request(CHAR*, va_list); 172 void io_slice(void); 173 174 /* prototypes for intratool interface */ 175 void io_buildcellgrouppointersfromnames(LIBRARY*); 176 INTBIG *io_getstatebits(void); 177 void io_setstatebits(INTBIG *bits); 178 PORTPROTO *io_convertoldportname(CHAR *portname, NODEPROTO *np); 179 void io_fixnewlib(LIBRARY *lib, void *dia); 180 NODEPROTO *io_convertoldprimitives(TECHNOLOGY *tech, CHAR *name); 181 INTBIG io_setuptechorder(TECHNOLOGY *tech); 182 void io_queuereadlibraryannouncement(LIBRARY *lib); 183 INTBIG io_nextplotlayer(INTBIG i); 184 INTBIG io_getoutputbloat(CHAR *layer); 185 BOOLEAN io_doreadbinlibrary(LIBRARY *lib, BOOLEAN newprogress); 186 BOOLEAN io_doreadtextlibrary(LIBRARY *lib, BOOLEAN newprogress); 187 BOOLEAN io_getareatoprint(NODEPROTO *np, INTBIG *lx, INTBIG *hx, INTBIG *ly, INTBIG *hy, BOOLEAN reduce); 188 BOOLEAN io_readbinlibrary(LIBRARY *lib); 189 BOOLEAN io_readciflibrary(LIBRARY *lib); 190 BOOLEAN io_readdeflibrary(LIBRARY *lib); 191 BOOLEAN io_readdxflibrary(LIBRARY *lib); 192 BOOLEAN io_readediflibrary(LIBRARY *lib); 193 BOOLEAN io_readgdslibrary(LIBRARY *lib, INTBIG position); 194 BOOLEAN io_readleflibrary(LIBRARY *lib); 195 BOOLEAN io_readsdflibrary(LIBRARY *lib); 196 BOOLEAN io_readsuelibrary(LIBRARY *lib); 197 BOOLEAN io_readtextlibrary(LIBRARY *lib); 198 BOOLEAN io_readvhdllibrary(LIBRARY *lib); 199 BOOLEAN io_writebinlibrary(LIBRARY *lib, BOOLEAN nobackup); 200 BOOLEAN io_writeciflibrary(LIBRARY *lib); 201 BOOLEAN io_writedxflibrary(LIBRARY *lib); 202 BOOLEAN io_writeeaglelibrary(LIBRARY *lib); 203 BOOLEAN io_writeecadlibrary(LIBRARY *lib); 204 BOOLEAN io_writeediflibrary(LIBRARY *lib); 205 BOOLEAN io_writegdslibrary(LIBRARY *lib); 206 BOOLEAN io_writehpgllibrary(LIBRARY *lib); 207 BOOLEAN io_writellibrary(LIBRARY *lib); 208 BOOLEAN io_writeleflibrary(LIBRARY *lib); 209 BOOLEAN io_writepadslibrary(LIBRARY *lib); 210 BOOLEAN io_writepostscriptlibrary(LIBRARY *lib, BOOLEAN printit); 211 BOOLEAN io_writequickdrawlibrary(LIBRARY *lib); 212 BOOLEAN io_writeskilllibrary(LIBRARY *lib); 213 BOOLEAN io_writetextlibrary(LIBRARY *lib); 214 void io_freebininmemory(void); 215 void io_freebinoutmemory(void); 216 void io_freecifinmemory(void); 217 void io_freecifparsmemory(void); 218 void io_freecifoutmemory(void); 219 void io_freedxfmemory(void); 220 void io_freegdsoutmemory(void); 221 void io_freepostscriptmemory(void); 222 void io_freesdfimemory(void); 223 void io_freesuememory(void); 224 void io_freetextinmemory(void); 225 void io_freedefimemory(void); 226 void io_freelefimemory(void); 227 void io_freeedifinmemory(void); 228 void io_freegdsinmemory(void); 229 void io_initskill(void); 230 void io_initdef(void); 231 void io_initdxf(void); 232 void io_initcif(void); 233 void io_initedif(void); 234 void io_initgds(void); 235 void io_pscolorplot(NODEPROTO *np, BOOLEAN epsformat, BOOLEAN useplotter, 236 INTBIG pagewid, INTBIG pagehei, INTBIG pagemargin); 237 void io_pswrite(CHAR *s, ...); 238 void io_pswritestring(CHAR*); 239 240 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS) 241 } 242 #endif 243