1 /* 2 PADRING -- a padring generator for ASICs. 3 4 Copyright (c) 2019, Niels Moseley <niels@symbioticeda.com> 5 6 Permission to use, copy, modify, and/or distribute this software for any 7 purpose with or without fee is hereby granted, provided that the above 8 copyright notice and this permission notice appear in all copies. 9 10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 18 */ 19 20 #ifndef prlefreader_h 21 #define prlefreader_h 22 23 #include <string> 24 #include <unordered_map> 25 26 #include "lef/lefreader.h" 27 28 /** LEF Reader + cell database */ 29 class PRLEFReader : public LEFReader 30 { 31 public: 32 PRLEFReader(); 33 34 /** callback for each LEF macro */ 35 virtual void onMacro(const std::string ¯oName) override; 36 37 /** callback for CLASS within a macro */ 38 virtual void onClass(const std::string &className) override; 39 40 /** callback for FOREIGN within a macro */ 41 virtual void onForeign(const std::string &foreignName, double x, double y) override; 42 43 /** callback for SIZE within a macro */ 44 virtual void onSize(double sx, double sy) override; 45 46 /** callback for SYMMETRY within a macro */ 47 virtual void onSymmetry(const std::string &symmetry) override; 48 49 50 /** callback for UNITS DATABASE MICRONS */ 51 virtual void onDatabaseUnitsMicrons(double unitsPerMicron) override; 52 53 void doIntegrityChecks(); 54 55 class LEFCellInfo_t 56 { 57 public: LEFCellInfo_t()58 LEFCellInfo_t() : m_sx(0.0), m_sy(0.0) {} 59 60 std::string m_name; ///< LEF cell name 61 std::string m_foreign; ///< foreign name 62 double m_sx; ///< size in microns 63 double m_sy; ///< size in microns 64 std::string m_symmetry; ///< symmetry string taken from LEF. 65 bool m_isFiller; 66 }; 67 68 LEFCellInfo_t *getCellByName(const std::string &name) const; 69 LEFCellInfo_t *m_parseCell; ///< current cell being parsed 70 71 std::unordered_map<std::string, LEFCellInfo_t*> m_cells; 72 73 double m_lefDatabaseUnits; ///< database units in microns 74 }; 75 76 #endif