-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathnodeimpl.h
More file actions
54 lines (41 loc) · 1.28 KB
/
Copy pathnodeimpl.h
File metadata and controls
54 lines (41 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Node implementation.
#ifndef CHDL_NODEIMPL_H
#define CHDL_NODEIMPL_H
#include <vector>
#include <iostream>
#include <typeinfo>
#include "node.h"
#include "hierarchy.h"
#include "cdomain.h"
#include "printable.h"
namespace chdl {
struct nodeimpl;
extern std::vector<nodeimpl*> nodes;
struct nodeimpl : public printable {
nodeimpl() {
register_print_phase(PRINT_LANG_VERILOG, 10);
register_print_phase(PRINT_LANG_VERILOG, 100);
register_print_phase(PRINT_LANG_NETLIST, 100);
id = nodes.size();
nodes.push_back(this);
path = get_hpath();
}
virtual ~nodeimpl() {}
virtual bool eval(cdomain_handle_t) = 0;
virtual void reset() {}
virtual void print(std::ostream &) = 0;
virtual void print_vl(std::ostream &) = 0;
virtual bool is_initial(print_lang l, print_phase p) {
return (l == PRINT_LANG_VERILOG) && (p == 10);
}
virtual void predecessors(print_lang, print_phase, std::set<printable *> &);
virtual void print(std::ostream &out, print_lang l, print_phase p);
// The node keeps a copy of its ID. This makes mapping from nodeimpl
// pointers to node objects straightforward.
nodeid_t id;
// Where is this node in the hierarchy?
hpath_t path;
std::vector<node> src;
};
};
#endif