ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
verilog_const_parser.h
Go to the documentation of this file.
1 // -- Hongce Zhang (hongcez@princeton.edu)
4 
5 #ifndef ILANG_VERILOG_IN_VERILOG_CONST_PARSER_H__
6 #define ILANG_VERILOG_IN_VERILOG_CONST_PARSER_H__
7 
8 #include <map>
9 #include <string>
10 #include <vector>
11 
12 extern "C" {
13 #include <verilogparser/verilog_ast.h>
14 }
15 
17 namespace ilang {
18 
22 public:
23  // --------------------- Type Definitions ---------------------------- //
25  typedef std::pair<ast_module_declaration*, ast_module_instantiation*>
28  typedef std::vector<param_hier_item_t> param_def_hierarchy;
30  typedef std::map<std::string, double> named_parameter_dict_t;
32  typedef std::vector<double> ordered_parameter_dict_t;
33 
34 protected:
36  bool eval_error;
38  std::string error_str;
42  // --------------------- HELPER FUNC ---------------------------- //
43  double virtual _eval(ast_expression* e,
44  const named_parameter_dict_t& param_defs);
48  ast_module_declaration* m,
49  const named_parameter_dict_t& named_parameter_override,
50  const ordered_parameter_dict_t& ordered_parameter_override,
51  named_parameter_dict_t& output_parameter_dict);
52 
53 public:
54  // --------------------- CONSTRUCTOR ---------------------------- //
59  ast_module_declaration* current_module);
61  double Eval(ast_expression* _s);
63  bool error() const;
64 }; // class VerilogConstantExprEval
65 
66 }; // namespace ilang
67 
68 #endif // ILANG_VERILOG_IN_VERILOG_CONST_PARSER_H__
std::vector< double > ordered_parameter_dict_t
ordered paramater dictionary
Definition: verilog_const_parser.h:32
double Eval(ast_expression *_s)
Get the value.
std::pair< ast_module_declaration *, ast_module_instantiation * > param_hier_item_t
An item in the hierarchy.
Definition: verilog_const_parser.h:26
bool eval_error
record if there was an error in eval
Definition: verilog_const_parser.h:36
std::string error_str
record the errorneous part:
Definition: verilog_const_parser.h:38
bool error() const
Get parsing error.
The class to convert a constant expr to an integer number.
Definition: verilog_const_parser.h:21
std::vector< param_hier_item_t > param_def_hierarchy
The hierarchy.
Definition: verilog_const_parser.h:28
std::map< std::string, double > named_parameter_dict_t
named parameter dictionary
Definition: verilog_const_parser.h:30
void ParseCurrentModuleParameters(ast_module_declaration *m, const named_parameter_dict_t &named_parameter_override, const ordered_parameter_dict_t &ordered_parameter_override, named_parameter_dict_t &output_parameter_dict)
named_parameter_dict_t current_module_param_defs
to record the variable binding in the current module
Definition: verilog_const_parser.h:40
void PopulateParameterDefByHierarchy(const param_def_hierarchy &hier, ast_module_declaration *current_module)
parse a hierarchy
VerilogConstantExprEval()
input : the string to evaluate