| 815 | } |
| 816 | |
| 817 | void Database::readBookshelf(std::string const &aux_file) { |
| 818 | BookshelfDatabaseCallbacks cbk(*this); |
| 819 | cbk.setAuxFile(aux_file); |
| 820 | bookshelfparser::Driver driver(cbk); |
| 821 | std::ifstream ifs; |
| 822 | |
| 823 | // Parse bookshelf AUX file |
| 824 | openparfPrint(kInfo, "Parsing file %s\n", aux_file.c_str()); |
| 825 | ifs.open(aux_file); |
| 826 | openparfAssertMsg(ifs.good(), "Cannot open file %s", aux_file.c_str()); |
| 827 | driver.parse_stream(ifs); |
| 828 | ifs.close(); |
| 829 | |
| 830 | // Parse bookshelf files in order |
| 831 | for (auto file : |
| 832 | {cbk.libFile(), cbk.sclFile(), cbk.nodeFile(), cbk.plFile(), cbk.netFile(), cbk.shapeFile(), cbk.wtFile()}) { |
| 833 | if (!file.empty()) { |
| 834 | std::string path = cbk.inputDir() + file; |
| 835 | openparfPrint(kInfo, "Parsing file %s\n", path.c_str()); |
| 836 | ifs.open(path); |
| 837 | openparfAssertMsg(ifs.good(), "Cannot open file %s", path.c_str()); |
| 838 | driver.parse_stream(ifs); |
| 839 | ifs.close(); |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | // uniquify the design |
| 844 | design_.uniquify(design_.topModuleInstId()); |
| 845 | } |
| 846 | |
| 847 | bool Database::writeBookshelfPl(std::string const &pl_file) { |
| 848 | openparfPrint(kInfo, "write to %s\n", pl_file.c_str()); |