aboutsummaryrefslogtreecommitdiff
path: root/Node.cpp
blob: d351af153c2ff9d6724be9e2cd3945c534ce4cbd (plain)
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
#include "Node.h"

#include <iostream>

Node::Node(){}
Node::~Node(){}
void Node::addInput(Net* net){
   net->attach(this);
}
void Node::setOutput(Net* net){
   this->output = net;
}

void Node::update(){
   std::cout << "updated" << std::endl;
   this->compare();
}

/*/ Concrete Nodes: /*/

void GateAnd::compare(){
   SignalLevel new_out = HIGH;

   // TODO fix segfault somewhere below
   // for (int i = 0; i < this->inputs.size(); i++){
   //    switch (this->inputs[i]->getLevel()){
   //    case LOW:
   //       new_out = LOW;
   //       break;
   //    case HIGH:
   //       continue;
   //       break;
   //    case UNDEFINED:
   //    default:
   //       new_out = UNDEFINED;
   //       exit;
   //       break;
   //    }
   // }

   // if (this->output->getLevel() == new_out){
   //    /* do nothing */
   // } else {
   //    this->output->setLevel(new_out);
   // }

}