diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-13 09:10:41 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-13 09:10:41 +0200 |
commit | 4fa64f6d99cb475e74188c0a270844347a48c59c (patch) | |
tree | 8ce048cb16ff39e44760c566fdaa0f58cf331f22 /NodeOutput.cpp | |
parent | 3e5b602cb7bfb625ac7f7094f9d33409271073fb (diff) |
actually print right output values
Diffstat (limited to 'NodeOutput.cpp')
-rw-r--r-- | NodeOutput.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/NodeOutput.cpp b/NodeOutput.cpp index a02ba1f..cf1b979 100644 --- a/NodeOutput.cpp +++ b/NodeOutput.cpp @@ -1,21 +1,31 @@ #include "NodeOutput.h" #include "Exception.h" -#include "prut.h" - NodeOutput NodeOutput::instance(NodeOutput::type); -NodeOutput::NodeOutput(const char * type) : Node(type) { } +NodeOutput::NodeOutput(const char * type) : Node(type) { init(); } -void NodeOutput::sim() { - if (this->inputs.size() == 0) - throw CircuitException("No inputs on probe"); +void NodeOutput::init() { + this->min_inputs = 1; + this->max_inputs = 1; +} - prutprintf("level: %u", this->inputs[0]->getLevel()); +void NodeOutput::sim() { + Node::sim(); + this->input = this->inputs[0]->getLevel(); } -NodeOutput::NodeOutput(const NodeOutput * prototype) : Node() { } +NodeOutput::NodeOutput(const NodeOutput * prototype) : Node() { init(); } NodeOutput * NodeOutput::clone() const { return new NodeOutput(this); } + +void NodeOutput::setOutput(Net *) { + throw CircuitException("NodeOutput cannot have an output"); +} + +SignalLevel NodeOutput::level() { + return this->input; +} + |