summaryrefslogtreecommitdiff
path: root/cpu8/cpu_gatedlatch/cpu_gatedlatch.hpp
blob: d3f314f9cccfb953a854be0d74ce8f073d26956e (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
56
57
58
59
60
61
62
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