File tree Expand file tree Collapse file tree 4 files changed +65
-0
lines changed Expand file tree Collapse file tree 4 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ SRC = aval_bval_encoding.cpp \
18
18
verilog_preprocessor.cpp \
19
19
verilog_preprocessor_lex.yy.cpp \
20
20
verilog_preprocessor_tokenizer.cpp \
21
+ verilog_scope.cpp \
21
22
verilog_simplifier.cpp \
22
23
verilog_standard.cpp \
23
24
verilog_symbol_table.cpp \
Original file line number Diff line number Diff line change 13
13
#include < util/parser.h>
14
14
15
15
#include " verilog_parse_tree.h"
16
+ #include " verilog_scope.h"
16
17
#include " verilog_standard.h"
17
18
18
19
#include < map>
Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: Verilog Scope
4
+
5
+ Author: Daniel Kroening, [email protected]
6
+
7
+ \*******************************************************************/
8
+
9
+ #include " verilog_scope.h"
Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: Verilog Scopes
4
+
5
+ Author: Daniel Kroening, [email protected]
6
+
7
+ \*******************************************************************/
8
+
9
+ #ifndef CPROVER_VERILOG_SCOPE_H
10
+ #define CPROVER_VERILOG_SCOPE_H
11
+
12
+ #include < util/irep.h>
13
+
14
+ #include < map>
15
+
16
+ // parser scopes and identifiers
17
+ struct scopet
18
+ {
19
+ scopet () : parent(nullptr ), prefix(" Verilog::" )
20
+ {
21
+ }
22
+
23
+ explicit scopet (
24
+ irep_idt _base_name,
25
+ const std::string &separator,
26
+ scopet *_parent)
27
+ : parent(_parent),
28
+ __base_name(_base_name),
29
+ prefix(id2string(_parent->prefix) + id2string(_base_name) + separator)
30
+ {
31
+ }
32
+
33
+ scopet *parent = nullptr ;
34
+ bool is_type = false ;
35
+ irep_idt __base_name;
36
+ std::string prefix;
37
+
38
+ irep_idt identifier () const
39
+ {
40
+ PRECONDITION (parent != nullptr );
41
+ return parent->prefix + id2string (__base_name);
42
+ }
43
+
44
+ const irep_idt &base_name () const
45
+ {
46
+ return __base_name;
47
+ }
48
+
49
+ // sub-scopes
50
+ using scope_mapt = std::map<irep_idt, scopet>;
51
+ scope_mapt scope_map;
52
+ };
53
+
54
+ #endif
You can’t perform that action at this time.
0 commit comments