-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWire.h
109 lines (82 loc) · 1.97 KB
/
Wire.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef WIRE_H
#define WIRE_H
#include "CircuitElement.h"
#include <vector>
#define SIGSTEP (sizeof(unsigned long long)*8)
enum CoverType { NOCOVER, EQUAL, AND, OR };
class Port;
class Wire : public CircuitElement {
public:
Wire(std::string name_) : CircuitElement(name_), driver(0), sig_temp(0) {}
CircuitElementType get_type() const
{
return WIRE;
}
Port* get_driver()
{
return driver;
}
void set_driver(Port* in_port);
void add_output_port(Port* port);
bool is_output();
unsigned int num_outputs() const
{
return outputs.size();
}
Port* get_output(int id)
{
return outputs[id];
}
/*!
* Reassign the output to the given wire to
* the current object instance.
*/
void reassign_outputs(Wire* wire);
typedef std::vector<Port*>::iterator output_iterator;
output_iterator output_begin()
{
return output_iterator(outputs.begin());
}
output_iterator output_end()
{
return output_iterator(outputs.end());
}
unsigned long long get_sig_temp() const
{
return sig_temp;
}
void set_sig_temp(unsigned long long sig_temp_)
{
sig_temp = sig_temp_;
}
int num_sig_spots()
{
return signatures.size();
}
void commit_signature()
{
signatures.push_back(sig_temp);
}
void clear_signature()
{
signatures.clear();
}
int sig_diffs(Wire& wire1);
bool sig_equiv(Wire& wire1, CoverType type = EQUAL);
void randomize();
unsigned long long get_signature(int i)
{
return signatures[i];
}
std::vector<unsigned long long> get_signature()
{
return signatures;
}
private:
std::vector<Port*> outputs;
Port* driver;
//! contains value from simulation, not yet saved to signatures
unsigned long long sig_temp;
std::vector<unsigned long long> signatures;
};
#endif