aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2024-06-12 13:34:39 +0200
committerUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2024-06-12 13:34:39 +0200
commit6fd8dcb9e0d33f7660c4e3a602a5c2a2b5091a7c (patch)
tree552da0be4b056d8a35e8620f8788abc4a2d56061
parentdb98449454a0d94a9e375c0fe0998c76d7c5d6ef (diff)
renamed compare function to sim function
-rw-r--r--GateAnd.cpp2
-rw-r--r--GateAnd.h5
-rw-r--r--Node.cpp2
-rw-r--r--Node.h2
-rw-r--r--NodeInput.cpp6
-rw-r--r--NodeInput.h2
-rw-r--r--NodeOutput.cpp6
-rw-r--r--NodeOutput.h2
8 files changed, 16 insertions, 11 deletions
diff --git a/GateAnd.cpp b/GateAnd.cpp
index 6f19d61..93edacb 100644
--- a/GateAnd.cpp
+++ b/GateAnd.cpp
@@ -4,7 +4,7 @@ GateAnd GateAnd::instance(GateAnd::type);
GateAnd::GateAnd(const char * type) : Node(type) { }
-void GateAnd::compare() {
+void GateAnd::sim() {
SignalLevel new_out = HIGH;
// TODO: fix segfault somewhere below
for (int i = 0; i < this->inputs.size(); i++){
diff --git a/GateAnd.h b/GateAnd.h
index 5eedc07..12dad53 100644
--- a/GateAnd.h
+++ b/GateAnd.h
@@ -4,9 +4,10 @@
class GateAnd : public Node {
public:
+ GateAnd() = default;
GateAnd(const GateAnd * prototype);
- virtual ~GateAnd() = default;
- virtual void compare();
+ ~GateAnd() = default;
+ virtual void sim();
virtual GateAnd * clone() const;
private:
diff --git a/Node.cpp b/Node.cpp
index 1b0b9b8..d3564da 100644
--- a/Node.cpp
+++ b/Node.cpp
@@ -18,6 +18,6 @@ void Node::setOutput(Net * net){
void Node::update(){
std::cout << "updated" << std::endl;
- this->compare();
+ this->sim();
}
diff --git a/Node.h b/Node.h
index e6270a7..36da279 100644
--- a/Node.h
+++ b/Node.h
@@ -19,7 +19,7 @@ public:
void update();
virtual void addInput(Net *);
virtual void setOutput(Net *);
- virtual void compare() = 0;
+ virtual void sim() = 0;
int gert = 45;
protected:
diff --git a/NodeInput.cpp b/NodeInput.cpp
index 046cd72..17f9ed5 100644
--- a/NodeInput.cpp
+++ b/NodeInput.cpp
@@ -1,10 +1,12 @@
#include "NodeInput.h"
+#include <iostream>
+
NodeInput::NodeInput(const char * type) : Node(type) { }
-void NodeInput::compare() {
+void NodeInput::sim() {
if (this->output == nullptr) return;
-
+ std::cout << this->level << " bar\n";
this->output->setLevel(this->level);
}
diff --git a/NodeInput.h b/NodeInput.h
index 73ef6e1..bcca8f4 100644
--- a/NodeInput.h
+++ b/NodeInput.h
@@ -7,7 +7,7 @@ public:
NodeInput() = default;
NodeInput(const NodeInput * prototype);
~NodeInput() = default;
- virtual void compare();
+ virtual void sim();
virtual NodeInput * clone() const;
private:
diff --git a/NodeOutput.cpp b/NodeOutput.cpp
index cff66c0..d47b6a3 100644
--- a/NodeOutput.cpp
+++ b/NodeOutput.cpp
@@ -5,9 +5,11 @@ NodeOutput NodeOutput::instance(NodeOutput::type);
NodeOutput::NodeOutput(const char * type) : Node(type) { }
-void NodeOutput::compare() {
+void NodeOutput::sim() {
if (this->inputs.size() > 0) {
- std::cout << this->inputs[0]->getLevel() << std::endl;
+ std::cout << this->inputs[0]->getLevel() << "foo" << std::endl;
+ } else {
+ std::cout << "err: No inputs on probe" << std::endl;
}
}
diff --git a/NodeOutput.h b/NodeOutput.h
index 4e7f742..2e92bf0 100644
--- a/NodeOutput.h
+++ b/NodeOutput.h
@@ -6,7 +6,7 @@ class NodeOutput : public Node {
public:
NodeOutput(const NodeOutput * prototype);
~NodeOutput() = default;
- virtual void compare();
+ virtual void sim();
virtual NodeOutput * clone() const;
private: