summaryrefslogtreecommitdiff
path: root/cpu8/cpu_gatedlatch/cpu_gatedlatch.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpu8/cpu_gatedlatch/cpu_gatedlatch.hpp')
-rw-r--r--cpu8/cpu_gatedlatch/cpu_gatedlatch.hpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/cpu8/cpu_gatedlatch/cpu_gatedlatch.hpp b/cpu8/cpu_gatedlatch/cpu_gatedlatch.hpp
new file mode 100644
index 0000000..d3f314f
--- /dev/null
+++ b/cpu8/cpu_gatedlatch/cpu_gatedlatch.hpp
@@ -0,0 +1,63 @@
+#ifndef __SYSC_CPU_GATEDLATCH_HPP
+#define __SYSC_CPU_GATEDLATCH_HPP
+
+#include "systemc.h"
+#include "../cpu_nand/cpu_nand.hpp"
+
+SC_MODULE (cpu_gatedlatch)
+{
+ //Inputs
+ sc_in <bool> in_d;
+ sc_in <bool> in_e;
+ sc_out <bool> out_q,out_nq;
+
+ cpu_nand *nand1, *nand2, *nand3, *nand4, *nand5;
+
+ sc_signal<bool> sig_nand1nand3;
+ sc_signal<bool> sig_nand2nand4;
+ sc_signal<bool> sig_nand3nand5;
+ sc_signal<bool> sig_qnand5, sig_nqnand4;
+
+ void do_gatedlatch()
+ {
+
+ }
+
+ SC_CTOR(cpu_gatedlatch)
+ {
+
+ nand1 = new cpu_nand("NAND1");
+ nand2 = new cpu_nand("NAND2");
+ nand3 = new cpu_nand("NAND3");
+ nand4 = new cpu_nand("NAND4");
+ nand5 = new cpu_nand("NAND5");
+
+ nand1->in_a(in_d);
+ nand1->in_b(in_d);
+ nand1->out_c(sig_nand1nand3);
+
+ nand2->in_a(in_d);
+ nand2->in_b(in_e);
+ nand2->out_c(sig_nand2nand4);
+
+ nand3->in_a(in_e);
+ nand3->in_b(sig_nand1nand3);
+ nand3->out_c(sig_nand3nand5);
+
+ nand4->in_a(sig_nand2nand4);
+ nand4->in_b(sig_nqnand4);
+ nand4->out_c(out_q);
+ nand4->out_c(sig_qnand5);
+
+ nand5->in_a(sig_qnand5);
+ nand5->in_b(sig_nand3nand5);
+ nand5->out_c(out_nq);
+ nand5->out_c(sig_nqnand4);
+
+ //SC_METHOD(do_gatedlatch);
+ //sensitive << in_d << in_clk;
+ }
+
+};
+
+#endif \ No newline at end of file