summaryrefslogtreecommitdiffstats
path: root/cpu8/cpu_srlatch/cpu_srlatch.hpp
blob: f495e70d039d43b4da7af908e00fe018df1d8748 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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