forked from cdkersey/chdl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gatesimpl.cpp
40 lines (31 loc) · 906 Bytes
/
gatesimpl.cpp
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
#include "gatesimpl.h"
using namespace std;
using namespace chdl;
bool invimpl::eval(cdomain_handle_t cd) {
if (t_cval != sim_time(cd)) {
cval = !(nodes[src[0]]->eval(cd));
t_cval = sim_time(cd);
}
return cval;
}
void invimpl::print(ostream &out) {
out << " inv " << src[0] << ' ' << id << endl;
}
void invimpl::print_vl(ostream &out) {
out << " not __i" << id << "(__x" << id << ", " << "__x" << src[0] << ");"
<< endl;
}
bool nandimpl::eval(cdomain_handle_t cd) {
if (t_cval != sim_time(cd)) {
cval = !(nodes[src[0]]->eval(cd) && nodes[src[1]]->eval(cd));
t_cval = sim_time(cd);
}
return cval;
}
void nandimpl::print(ostream &out) {
out << " nand " << src[0] << ' ' << src[1] << ' ' << id << endl;
}
void nandimpl::print_vl(ostream &out) {
out << " nand __n" << id << "(__x" << id << ", __x" << src[0] << ", __x"
<< src[1] << ");" << endl;
}