aboutsummaryrefslogtreecommitdiff
path: root/Gate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Gate.cpp')
-rw-r--r--Gate.cpp45
1 files changed, 41 insertions, 4 deletions
diff --git a/Gate.cpp b/Gate.cpp
index 22d57e2..0724b44 100644
--- a/Gate.cpp
+++ b/Gate.cpp
@@ -1,10 +1,47 @@
#include "Gate.h"
-Gate::Gate(/* args */){}
+#include <iostream>
+
+Gate::Gate(){}
Gate::~Gate(){}
-void Gate::addInput(Net*){
-
+void Gate::addInput(Net* net){
+ net->attach(this);
+}
+void Gate::setOutput(Net* net){
+ this->output = net;
+}
+
+void Gate::update(){
+ std::cout << "updated" << std::endl;
+ this->compare();
}
-void Gate::addOutput(Net*){
+
+/*/ Concrete Gates: /*/
+
+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);
+ // }
}