diff options
Diffstat (limited to 'Gate.cpp')
-rw-r--r-- | Gate.cpp | 45 |
1 files changed, 41 insertions, 4 deletions
@@ -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); + // } } |