1 | #ifndef morpheo_behavioural_generic_registerfile_RegisterFile |
---|
2 | #define morpheo_behavioural_generic_registerfile_RegisterFile |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id$ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #ifdef SYSTEMC |
---|
12 | #include "systemc.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | #include "Include/Debug.h" |
---|
16 | #include "Include/ToString.h" |
---|
17 | #include <iostream> |
---|
18 | using namespace std; |
---|
19 | |
---|
20 | #include "Behavioural/Generic/RegisterFile/include/Parameters.h" |
---|
21 | #include "Behavioural/Generic/RegisterFile/include/Types.h" |
---|
22 | #ifdef STATISTICS |
---|
23 | #include "Behavioural/Generic/RegisterFile/include/Statistics.h" |
---|
24 | #endif |
---|
25 | #ifdef VHDL |
---|
26 | #include "Behavioural/include/Vhdl.h" |
---|
27 | #endif |
---|
28 | #ifdef VHDL_TESTBENCH |
---|
29 | #include "Behavioural/include/Vhdl_Testbench.h" |
---|
30 | #endif |
---|
31 | |
---|
32 | using namespace std; |
---|
33 | |
---|
34 | namespace morpheo { |
---|
35 | namespace behavioural { |
---|
36 | namespace generic { |
---|
37 | namespace registerfile { |
---|
38 | |
---|
39 | class RegisterFile |
---|
40 | #if SYSTEMC |
---|
41 | : public sc_module |
---|
42 | #endif |
---|
43 | { |
---|
44 | // -----[ fields ]---------------------------------------------------- |
---|
45 | // Parameters |
---|
46 | protected : const string _name; |
---|
47 | |
---|
48 | protected : const Parameters _param; |
---|
49 | #ifdef STATISTICS |
---|
50 | private : Statistics * _stat; |
---|
51 | |
---|
52 | private : uint32_t _stat_nb_read; |
---|
53 | private : uint32_t _stat_nb_write; |
---|
54 | #endif |
---|
55 | |
---|
56 | #ifdef VHDL_TESTBENCH |
---|
57 | private : Vhdl_Testbench * _vhdl_testbench; |
---|
58 | #endif |
---|
59 | |
---|
60 | #ifdef SYSTEMC |
---|
61 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
62 | // Interface |
---|
63 | public : SC_CLOCK * in_CLOCK ; |
---|
64 | |
---|
65 | // ----- Interface Read |
---|
66 | public : SC_IN (Tcontrol_t) ** in_READ_ENABLE ; |
---|
67 | public : SC_IN (Taddress_t) ** in_READ_ADDRESS ; |
---|
68 | public : SC_OUT (Tdata_t) ** out_READ_DATA ; |
---|
69 | |
---|
70 | // ----- Interface Write |
---|
71 | public : SC_IN (Tcontrol_t) ** in_WRITE_ENABLE ; |
---|
72 | public : SC_IN (Taddress_t) ** in_WRITE_ADDRESS; |
---|
73 | public : SC_IN (Tdata_t) ** in_WRITE_DATA ; |
---|
74 | |
---|
75 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
76 | private : SC_REGISTER (Tdata_t) ** reg_DATA ; |
---|
77 | |
---|
78 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
79 | #endif |
---|
80 | |
---|
81 | // -----[ methods ]--------------------------------------------------- |
---|
82 | |
---|
83 | #ifdef SYSTEMC |
---|
84 | SC_HAS_PROCESS (RegisterFile); |
---|
85 | #endif |
---|
86 | |
---|
87 | public : RegisterFile ( |
---|
88 | #ifdef SYSTEMC |
---|
89 | sc_module_name name, |
---|
90 | #else |
---|
91 | string name, |
---|
92 | #endif |
---|
93 | #ifdef STATISTICS |
---|
94 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
95 | #endif |
---|
96 | Parameters param ); |
---|
97 | |
---|
98 | public : RegisterFile (Parameters param ); |
---|
99 | public : ~RegisterFile (void); |
---|
100 | |
---|
101 | #ifdef SYSTEMC |
---|
102 | private : void allocation (void); |
---|
103 | private : void deallocation (void); |
---|
104 | |
---|
105 | public : void transition (void); |
---|
106 | //public : void genMoore (void) {/* empty */}; |
---|
107 | public : void genMealy_read (void); |
---|
108 | #endif |
---|
109 | |
---|
110 | #ifdef STATISTICS |
---|
111 | public : string statistics (uint32_t depth); |
---|
112 | #endif |
---|
113 | #if VHDL |
---|
114 | private : void vhdl (void); |
---|
115 | private : void vhdl_port (Vhdl & vhdl); |
---|
116 | private : void vhdl_type (Vhdl & vhdl); |
---|
117 | private : void vhdl_signal (Vhdl & vhdl); |
---|
118 | private : void vhdl_body (Vhdl & vhdl); |
---|
119 | #endif |
---|
120 | |
---|
121 | #ifdef VHDL_TESTBENCH |
---|
122 | private : void vhdl_testbench (Vhdl_Testbench & vhdl_testbench); |
---|
123 | private : void vhdl_testbench_port (Vhdl_Testbench & vhdl_testbench); |
---|
124 | private : void vhdl_testbench_transition (Vhdl_Testbench & vhdl_testbench); |
---|
125 | #endif |
---|
126 | |
---|
127 | }; |
---|
128 | |
---|
129 | }; // end namespace registerfile |
---|
130 | }; // end namespace generic |
---|
131 | }; // end namespace behavioural |
---|
132 | }; // end namespace morpheo |
---|
133 | |
---|
134 | #endif |
---|