summaryrefslogtreecommitdiffstats
path: root/cpu8/cpu_srlatch/cpu_srlatch.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpu8/cpu_srlatch/cpu_srlatch.hpp')
-rw-r--r--cpu8/cpu_srlatch/cpu_srlatch.hpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/cpu8/cpu_srlatch/cpu_srlatch.hpp b/cpu8/cpu_srlatch/cpu_srlatch.hpp
new file mode 100644
index 0000000..f495e70
--- /dev/null
+++ b/cpu8/cpu_srlatch/cpu_srlatch.hpp
@@ -0,0 +1,55 @@
+#ifndef __SYSC_CPU_SRLATCH_HPP
+#define __SYSC_CPU_SRLATCH_HPP
+
+#include "systemc.h"
+#include "../cpu_or/cpu_or.hpp"
+#include "../cpu_not/cpu_not.hpp"
+
+SC_MODULE (cpu_srlatch)
+{
+ //Inputs
+ sc_in <bool> in_r;
+ sc_in <bool> in_s;
+ sc_out <bool> out_q,out_nq;
+
+ cpu_or *or1,*or2;
+ cpu_not *not1, *not2;
+
+ sc_signal<bool,SC_MANY_WRITERS> sig_or1not1, sig_or2not2;
+ sc_signal<bool,SC_MANY_WRITERS> sig_outq_ins, sig_outnq_inr;
+
+ void do_srlatch()
+ {
+
+ }
+
+ SC_CTOR(cpu_srlatch)
+ {
+ or1 = new cpu_or("OR1");
+ or2 = new cpu_or("OR2");
+ not1 = new cpu_not("NOT1");
+ not2 = new cpu_not("NOT2");
+
+ or1->in_a(in_r);
+ or1->in_b(sig_outnq_inr);
+ or1->out_c(sig_or1not1);
+
+ or2->in_a(sig_outq_ins);
+ or2->in_b(in_s);
+ or2->out_c(sig_or2not2);
+
+ not1->in_a(sig_or1not1);
+ not1->out_b(out_q);
+ not1->out_b(sig_outq_ins);
+
+ not2->in_a(sig_or2not2);
+ not2->out_b(out_nq);
+ not2->out_b(sig_outnq_inr);
+
+ //SC_METHOD(do_srlatch);
+ //sensitive << in_r << in_s;
+ }
+
+};
+
+#endif \ No newline at end of file