1 /////////////////////////////////////////////////////////////////////////////// 2 // BSD 3-Clause License 3 // 4 // Copyright (c) 2019, Nefelus Inc 5 // All rights reserved. 6 // 7 // Redistribution and use in source and binary forms, with or without 8 // modification, are permitted provided that the following conditions are met: 9 // 10 // * Redistributions of source code must retain the above copyright notice, this 11 // list of conditions and the following disclaimer. 12 // 13 // * Redistributions in binary form must reproduce the above copyright notice, 14 // this list of conditions and the following disclaimer in the documentation 15 // and/or other materials provided with the distribution. 16 // 17 // * Neither the name of the copyright holder nor the names of its 18 // contributors may be used to endorse or promote products derived from 19 // this software without specific prior written permission. 20 // 21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 // POSSIBILITY OF SUCH DAMAGE. 32 33 #ifndef ADS_EXTPROCESS_H 34 #define ADS_EXTPROCESS_H 35 36 #include "array1.h" 37 #include "odb.h" 38 #include "parse.h" 39 40 namespace utl { 41 class Logger; 42 } 43 44 namespace rcx { 45 46 using utl::Logger; 47 48 class extProcess; 49 50 class extConductor 51 { 52 extConductor(Logger* logger); 53 bool readConductor(Ath__parser* parser); 54 void print(FILE* fp, 55 const char* sep, 56 const char* key, 57 int v, 58 bool pos = false); 59 void printConductor(FILE* fp, Ath__parser* parse); 60 61 char _name[128]; 62 double _height; 63 double _distance; 64 double _thickness; 65 double _min_width; 66 double _min_spacing; 67 double _origin_x; 68 double _bottom_left_x; 69 double _bottom_right_x; 70 double _top_left_x; 71 double _top_right_x; 72 double _top_ext; 73 double _bot_ext; 74 75 double _p; 76 int _var_table_index; 77 78 double _min_cw_del; 79 double _max_cw_del; 80 double _min_ct_del; 81 double _max_ct_del; 82 double _min_ca; 83 double _max_ca; 84 85 friend class extRCModel; 86 friend class extProcess; 87 friend class extMasterConductor; 88 89 protected: 90 Logger* logger_; 91 }; 92 93 class extDielectric 94 { 95 extDielectric(Logger* logger); 96 bool readDielectric(Ath__parser* parser); 97 void printInt(FILE* fp, 98 const char* sep, 99 const char* key, 100 int v, 101 bool pos = false); 102 void printDielectric(FILE* fp, Ath__parser* parser); 103 void printDielectric(FILE* fp, float planeWidth, float planeThickness); 104 void printDielectric3D(FILE* fp, 105 float blockWidth, 106 float blockThickness, 107 float blockLength); 108 109 char _name[128]; 110 char _non_conformal_metal[128]; 111 bool _conformal; 112 double _epsilon; 113 double _height; 114 double _distance; 115 double _thickness; 116 double _left_thickness; 117 double _right_thickness; 118 double _top_thickness; 119 double _bottom_thickness; 120 double _bottom_ext; 121 double _slope; 122 double _trench; 123 124 int _met; 125 int _nextMet; 126 127 friend class extProcess; 128 friend class extMasterConductor; 129 130 protected: 131 Logger* logger_; 132 }; 133 class extMasterConductor 134 { 135 extMasterConductor(uint condId, 136 extConductor* cond, 137 double prevHeight, 138 Logger* logger); 139 extMasterConductor(uint dielId, 140 extDielectric* diel, 141 double xlo, 142 double dx1, 143 double xhi, 144 double dx2, 145 double h, 146 double th, 147 Logger* logger); 148 149 public: 150 void reset(double height, 151 double top_width, 152 double bottom_width, 153 double thickness); 154 void resetThicknessHeight(double height, double thickness); 155 void resetWidth(double top_width, double bottom_width); 156 157 double writeRaphaelBox(FILE* fp, 158 uint wireNum, 159 double width, 160 double X, 161 double volt); 162 void writeRaphaelPoly(FILE* fp, uint wireNum, double X, double volt); 163 void writeRaphaelPoly3D(FILE* fp, 164 uint wireNum, 165 double X, 166 double length, 167 double volt); 168 void writeRaphaelConformalPoly(FILE* fp, 169 double width, 170 double X, 171 extProcess* p); 172 void writeRaphaelConformalGround(FILE* fp, 173 double X, 174 double width, 175 extProcess* p); 176 double writeRaphaelPoly(FILE* fp, 177 uint wireNum, 178 double width, 179 double X, 180 double volt, 181 extProcess* p = NULL); 182 double writeRaphaelPoly3D(FILE* fp, 183 uint wireNum, 184 double width, 185 double length, 186 double X, 187 double volt); 188 void printDielBox(FILE* fp, 189 double X, 190 double width, 191 extDielectric* diel, 192 const char* width_name); 193 void printDielBox3D(FILE* fp, 194 double X, 195 double width, 196 double length, 197 extDielectric* diel, 198 const char* width_name); 199 void writeRaphaelPointXY(FILE* fp, double X, double Y); 200 void writeRaphaelDielPoly(FILE* fp, 201 double X, 202 double width, 203 extDielectric* diel); 204 void writeRaphaelDielPoly3D(FILE* fp, 205 double X, 206 double width, 207 double length, 208 extDielectric* diel); 209 void writeBoxName(FILE* fp, uint wireNum); 210 211 uint _conformalId[3]; 212 213 protected: 214 Logger* logger_; 215 216 private: 217 uint _condId; 218 double _loLeft[3]; 219 double _loRight[3]; 220 double _hiLeft[3]; 221 double _hiRight[3]; 222 double _dy; 223 double _e; 224 225 friend class extProcess; 226 }; 227 class extVarTable 228 { 229 public: 230 extVarTable(uint rowCnt); 231 ~extVarTable(); 232 233 int readWidthSpacing2D(Ath__parser* parser, 234 const char* keyword1, 235 const char* keyword2, 236 const char* keyword3, 237 const char* key); 238 Ath__array1D<double>* readDoubleArray(Ath__parser* parser, 239 const char* keyword); 240 void printOneLine(FILE* fp, 241 Ath__array1D<double>* A, 242 const char* header, 243 const char* trail); 244 void printTable(FILE* fp, const char* valKey); getVal(uint ii,uint jj)245 double getVal(uint ii, uint jj) { return _vTable[ii]->get(jj); }; 246 247 private: 248 Ath__array1D<double>* _width; 249 Ath__array1D<double>* _space; 250 Ath__array1D<double>* _density; 251 Ath__array1D<double>* _p; 252 uint _rowCnt; 253 Ath__array1D<double>** _vTable; 254 255 friend class extVariation; 256 }; 257 class extVariation 258 { 259 public: 260 int readVariation(Ath__parser* parser); 261 extVarTable* readVarTable(Ath__parser* parser, 262 const char* key1, 263 const char* key2, 264 const char* key3, 265 const char* endKey); 266 void printVariation(FILE* fp, uint n); 267 Ath__array1D<double>* getWidthTable(); 268 Ath__array1D<double>* getSpaceTable(); 269 Ath__array1D<double>* getDataRateTable(); 270 Ath__array1D<double>* getPTable(); 271 double getTopWidth(uint ii, uint jj); 272 double getTopWidthR(uint ii, uint jj); 273 double getBottomWidth(double w, uint dIndex); 274 double getBottomWidthR(double w, uint dIndex); 275 double getThickness(double w, uint dIndex); 276 double getThicknessR(double w, uint dIndex); 277 double getP(double w); 278 double interpolate(double w, 279 Ath__array1D<double>* X, 280 Ath__array1D<double>* Y); setLogger(Logger * logger)281 void setLogger(Logger* logger) { logger_ = logger; } 282 283 extVarTable* _hiWidthC; 284 extVarTable* _loWidthC; 285 extVarTable* _thicknessC; 286 extVarTable* _hiWidthR; 287 extVarTable* _loWidthR; 288 extVarTable* _thicknessR; 289 extVarTable* _p; 290 291 protected: 292 Logger* logger_; 293 }; 294 class extProcess 295 { 296 protected: 297 Logger* logger_; 298 299 public: 300 extProcess(uint condCnt, uint dielCnt, Logger* logger); 301 ~extProcess(); 302 FILE* openFile(const char* filename, const char* permissions); 303 uint readProcess(const char* name, char* filename); 304 void writeProcess(const char* filename); 305 void createMasterLayers(); 306 void writeProcess(FILE* fp, 307 char* gndName, 308 float planeWidth, 309 float planeThickness); 310 void writeProcess3D(FILE* fp, 311 char* gndName, 312 float blockWidth, 313 float blockThickness, 314 float blockLength); 315 extConductor* getConductor(uint ii); 316 extMasterConductor* getMasterConductor(uint ii); getConductorCnt()317 uint getConductorCnt() { return _condTable->getCnt(); }; 318 extDielectric* getDielectric(uint ii); 319 extMasterConductor* getMasterConductor(uint met, 320 uint wIndex, 321 uint sIndex, 322 double& w, 323 double& s); 324 325 void writeFullProcess(FILE* fp, 326 char* gndName, 327 double planeWidth, 328 double planeThickness); 329 void writeFullProcess(FILE* fp, double X, double width, char* width_name); 330 void writeFullProcess3D(FILE* fp, 331 double X, 332 double width, 333 double length, 334 char* width_name); 335 void writeRaphaelPointXY(FILE* fp, double X, double Y); 336 void writeParam(FILE* fp, const char* name, double val); 337 void writeWindow(FILE* fp, 338 const char* param_width_name, 339 double y1, 340 const char* param_thickness_name); 341 void writeWindow3D(FILE* fp, 342 const char* param_width_name, 343 double y1, 344 const char* param_thickness_name, 345 const char* param_length_name); 346 void writeGround(FILE* fp, 347 int met, 348 const char* name, 349 const char* param_width_name, 350 double x1, 351 double volt); 352 void writeGround(FILE* fp, 353 int met, 354 const char* name, 355 double width, 356 double x1, 357 double volt, 358 bool diag = false); 359 void writeGround3D(FILE* fp, 360 int met, 361 const char* name, 362 double width, 363 double length, 364 double x1, 365 double volt, 366 bool diag = false); 367 void writeProcessAndGround(FILE* wfp, 368 const char* gndName, 369 int underMet, 370 int overMet, 371 double X, 372 double width, 373 double thichness, 374 bool diag = false); 375 void writeProcessAndGround3D(FILE* wfp, 376 const char* gndName, 377 int underMet, 378 int overMet, 379 double X, 380 double width, 381 double length, 382 double thickness, 383 double W, 384 bool diag = false); 385 386 extVariation* getVariation(uint met); 387 Ath__array1D<double>* getWidthTable(uint met); 388 Ath__array1D<double>* getSpaceTable(uint met); 389 Ath__array1D<double>* getDiagSpaceTable(uint met); 390 Ath__array1D<double>* getDataRateTable(uint met); 391 void readDataRateTable(Ath__parser* parser, const char* keyword); 392 double adjustMasterLayersForHeight(uint met, double thickness); 393 double adjustMasterDielectricsForHeight(uint met, double dth); 394 bool getMaxMinFlag(); 395 bool getThickVarFlag(); 396 397 private: 398 uint _condctorCnt; 399 uint _dielectricCnt; 400 bool _maxMinFlag; 401 bool _thickVarFlag; 402 Ath__array1D<extConductor*>* _condTable; 403 Ath__array1D<extDielectric*>* _dielTable; 404 Ath__array1D<extMasterConductor*>* _masterConductorTable; 405 Ath__array1D<extMasterConductor*>* _masterDielectricTable; 406 Ath__array1D<extVariation*>* _varTable; 407 Ath__array1D<double>* _dataRateTable; 408 }; 409 410 } // namespace rcx 411 412 #endif 413