From 4fa64f6d99cb475e74188c0a270844347a48c59c Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Thu, 13 Jun 2024 09:10:41 +0200 Subject: actually print right output values --- NodeOutput.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'NodeOutput.cpp') 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; +} + -- cgit v1.2.3