diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-12 17:21:46 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-12 17:21:46 +0200 |
commit | a6eb3c69badee386579fba82cae5b29cfb3e8171 (patch) | |
tree | b394befa733f960fe85323f8a5d12b27bc2b12d3 /GateOr.cpp | |
parent | e689d7947050face22fa1533d9a1cba6d43ea6b8 (diff) | |
parent | d1e381e301bb55432997ff355b5c938e76cd4f20 (diff) |
change nothing
Diffstat (limited to 'GateOr.cpp')
-rw-r--r-- | GateOr.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/GateOr.cpp b/GateOr.cpp new file mode 100644 index 0000000..db1e04a --- /dev/null +++ b/GateOr.cpp @@ -0,0 +1,23 @@ +#include "GateOr.h" + +GateOr GateOr::instance(GateOr::type); + +SignalLevel GateOr::level() { + if (this->inputs.size() < 1) throw CircuitException("Or-gate input size error"); + + SignalLevel new_level = LOW; + for (int i = 0; i < this->inputs.size(); i++){ + SignalLevel l = this->inputs[i]->getLevel(); + + if (l == UNDEFINED) return UNDEFINED; + if (l == HIGH) new_level = HIGH; + } + return new_level; +} + +GateOr::GateOr(const GateOr * prototype) : Node() { } + +GateOr * GateOr::clone() const { + return new GateOr(this); +} + |