1 #ifndef IVL_parse_api_H 2 #define IVL_parse_api_H 3 /* 4 * Copyright (c) 2001-2017 Stephen Williams (steve@icarus.com) 5 * 6 * This source code is free software; you can redistribute it 7 * and/or modify it in source code form under the terms of the GNU 8 * General Public License as published by the Free Software 9 * Foundation; either version 2 of the License, or (at your option) 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 */ 21 22 # include <cstdio> 23 # include "StringHeap.h" 24 # include <string> 25 # include <ostream> 26 # include <map> 27 # include <set> 28 29 class Design; 30 class Module; 31 class PClass; 32 class PPackage; 33 class PTaskFunc; 34 class PUdp; 35 class data_type_t; 36 struct enum_type_t; 37 38 /* 39 * These are maps of the modules and primitives parsed from the 40 * Verilog source into pform for elaboration. The parser adds modules 41 * to these maps as it compiles modules in the Verilog source. 42 */ 43 extern std::map<perm_string,Module*> pform_modules; 44 extern std::map<perm_string,PUdp*> pform_primitives; 45 extern std::vector<PPackage*> pform_units; 46 extern std::map<perm_string,PPackage*> pform_packages; 47 48 extern void pform_dump(std::ostream&out, const PClass*pac); 49 extern void pform_dump(std::ostream&out, const PPackage*pac); 50 extern void pform_dump(std::ostream&out, const PTaskFunc*tf); 51 52 /* 53 * This code actually invokes the parser to make modules. If the path 54 * parameter is "-", the parser reads from stdin, otherwise it attempts 55 * to open and read the specified file. When reading from a file, if 56 * the ivlpp_string variable is not set to null, the file will be piped 57 * through the command specified by ivlpp_string before being parsed. 58 */ 59 extern int pform_parse(const char*path); 60 61 extern string vl_file; 62 63 extern void pform_set_timescale(int units, int prec, const char*file, 64 unsigned lineno); 65 extern int def_ts_units; 66 extern int def_ts_prec; 67 68 #endif /* IVL_parse_api_H */ 69