Limbo 3.5.4
Loading...
Searching...
No Matches
VerilogDriver.h
Go to the documentation of this file.
1
7
8#ifndef VERILOGPARSER_DRIVER_H
9#define VERILOGPARSER_DRIVER_H
10
11#include "VerilogDataBase.h"
12
16namespace VerilogParser {
17
18using std::cout;
19using std::endl;
20using std::cerr;
21using std::string;
22using std::vector;
23using std::pair;
24using std::make_pair;
25using std::ostringstream;
26
35class Driver
36{
37public:
41
44
47
49 string streamname;
50
56 bool parse_stream(std::istream& in,
57 const string& sname = "stream input");
58
64 bool parse_string(const string& input,
65 const string& sname = "string stream");
66
72 bool parse_file(const string& filename);
73
74 // To demonstrate pure handling of parse errors, instead of
75 // simply dumping them on the standard error output, we will pass
76 // them to the driver using the following two member functions.
77
80 void error(const class location& l, const string& m);
81
84 void error(const string& m);
85
88 class Scanner* lexer;
89
93
95 void module_name_cbk(std::string const&, std::vector<GeneralName> const&);
96 void module_name_cbk(std::string const&, std::vector<GeneralName> const&, std::vector<GeneralName> const&);
97 void wire_pin_cbk(std::string&, std::string&, Range const& = Range());
98 void wire_pin_cbk(int, int, std::string&);
99 void wire_pin_cbk(std::vector<GeneralName>&, std::string&);
100 void wire_declare_cbk(std::vector<GeneralName> const&, Range const&);
101 void wire_declare_cbk(std::vector<GeneralName> const& vNetName);
102 void pin_declare_cbk(std::vector<GeneralName> const&, unsigned, Range const&);
103 void pin_declare_cbk(std::vector<GeneralName> const&, unsigned);
104 void module_instance_cbk(std::string const&, std::string const&);
105 void assignment_cbk(std::string const&, Range const&, std::string const&, Range const&);
107
108protected:
112};
113
118bool read(VerilogDataBase& db, const string& verilogFile);
119
120} // namespace example
121
122#endif // EXAMPLE_DRIVER_H
Database for Verilog parser.
VerilogDataBase & m_db
bool trace_scanning
enable debug output in the flex scanner
string streamname
stream name (file or input stream) used for error messages.
bool parse_file(const string &filename)
Driver(VerilogDataBase &db)
class Scanner * lexer
vector< NetPin > m_vNetPin
Use as a stack for node and pin pairs in a net, because wire_pin_cbk will be called before module_i...
void error(const string &m)
bool trace_parsing
enable debug output in the bison parser
bool parse_string(const string &input, const string &sname="string stream")
bool parse_stream(std::istream &in, const string &sname="stream input")
void error(const class location &l, const string &m)
Base class for verilog database. Only pure virtual functions are defined. User needs to inheritate ...
namespace for VerilogParser
bool read(VerilogDataBase &db, const string &verilogFile)
API for VerilogParser. Read Verilog file and initialize database by calling user-defined callback fun...
range with pair of low and high values