1 | #ifndef morpheo_behavioural_generic_registerfile_registerfile_monolithic_RegisterFile_Monolithic |
---|
2 | #define morpheo_behavioural_generic_registerfile_registerfile_monolithic_RegisterFile_Monolithic |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id$ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #ifdef SYSTEMC |
---|
12 | #include "systemc.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | #include "Common/include/Debug.h" |
---|
16 | #include "Common/include/ToString.h" |
---|
17 | #include <iostream> |
---|
18 | using namespace std; |
---|
19 | |
---|
20 | #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Parameters.h" |
---|
21 | #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Types.h" |
---|
22 | #ifdef STATISTICS |
---|
23 | #include "Behavioural/include/Stat.h" |
---|
24 | #endif |
---|
25 | #include "Behavioural/include/Component.h" |
---|
26 | #ifdef VHDL |
---|
27 | #include "Behavioural/include/Vhdl.h" |
---|
28 | #endif |
---|
29 | #include "Behavioural/include/Usage.h" |
---|
30 | |
---|
31 | using namespace std; |
---|
32 | |
---|
33 | namespace morpheo { |
---|
34 | namespace behavioural { |
---|
35 | namespace generic { |
---|
36 | namespace registerfile { |
---|
37 | namespace registerfile_monolithic { |
---|
38 | |
---|
39 | typedef enum {RW_READ, RW_WRITE} rw_t; |
---|
40 | |
---|
41 | class RegisterFile_Monolithic |
---|
42 | #if SYSTEMC |
---|
43 | : public sc_module |
---|
44 | #endif |
---|
45 | { |
---|
46 | // -----[ fields ]---------------------------------------------------- |
---|
47 | // Parameters |
---|
48 | protected : const string _name; |
---|
49 | protected : const Parameters * _param; |
---|
50 | private : const Tusage_t _usage; |
---|
51 | |
---|
52 | #ifdef STATISTICS |
---|
53 | private : Stat * _stat; |
---|
54 | |
---|
55 | private : counter_t * _stat_nb_read; |
---|
56 | private : counter_t * _stat_nb_write; |
---|
57 | private : counter_t * _stat_average_read ; |
---|
58 | private : counter_t * _stat_average_write; |
---|
59 | private : counter_t * _stat_percent_use_read ; |
---|
60 | private : counter_t * _stat_percent_use_write; |
---|
61 | #endif |
---|
62 | |
---|
63 | public : Component * _component; |
---|
64 | private : Interfaces * _interfaces; |
---|
65 | |
---|
66 | #ifdef SYSTEMC |
---|
67 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
68 | // Interface |
---|
69 | public : SC_CLOCK * in_CLOCK ; |
---|
70 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
71 | |
---|
72 | // ----- Interface Read |
---|
73 | public : SC_IN (Tcontrol_t) ** in_READ_VAL ; |
---|
74 | public : SC_OUT (Tcontrol_t) ** out_READ_ACK ; |
---|
75 | public : SC_IN (Taddress_t) ** in_READ_ADDRESS ; |
---|
76 | public : SC_OUT (Tdata_t) ** out_READ_DATA ; |
---|
77 | |
---|
78 | // ----- Interface Write |
---|
79 | public : SC_IN (Tcontrol_t) ** in_WRITE_VAL ; |
---|
80 | public : SC_OUT (Tcontrol_t) ** out_WRITE_ACK ; |
---|
81 | public : SC_IN (Taddress_t) ** in_WRITE_ADDRESS; |
---|
82 | public : SC_IN (Tdata_t) ** in_WRITE_DATA ; |
---|
83 | |
---|
84 | // ----- Interface Read_Write |
---|
85 | public : SC_IN (Tcontrol_t) ** in_READ_WRITE_VAL ; |
---|
86 | public : SC_OUT (Tcontrol_t) ** out_READ_WRITE_ACK ; |
---|
87 | public : SC_IN (Tcontrol_t) ** in_READ_WRITE_RW ; |
---|
88 | public : SC_IN (Taddress_t) ** in_READ_WRITE_ADDRESS; |
---|
89 | public : SC_OUT (Tdata_t) ** out_READ_WRITE_RDATA ; |
---|
90 | public : SC_IN (Tdata_t) ** in_READ_WRITE_WDATA ; |
---|
91 | |
---|
92 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
93 | private : SC_REGISTER (Tdata_t) ** reg_DATA ; |
---|
94 | |
---|
95 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
96 | #endif |
---|
97 | |
---|
98 | // -----[ methods ]--------------------------------------------------- |
---|
99 | |
---|
100 | #ifdef SYSTEMC |
---|
101 | SC_HAS_PROCESS (RegisterFile_Monolithic); |
---|
102 | #endif |
---|
103 | public : RegisterFile_Monolithic |
---|
104 | ( |
---|
105 | #ifdef SYSTEMC |
---|
106 | sc_module_name name |
---|
107 | #else |
---|
108 | string name |
---|
109 | #endif |
---|
110 | #ifdef STATISTICS |
---|
111 | ,morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
112 | #endif |
---|
113 | ,Parameters * param |
---|
114 | ,morpheo::behavioural::Tusage_t usage=USE_ALL |
---|
115 | ); |
---|
116 | |
---|
117 | public : ~RegisterFile_Monolithic (void); |
---|
118 | |
---|
119 | private : void allocation (void); |
---|
120 | private : void deallocation (void); |
---|
121 | |
---|
122 | #ifdef SYSTEMC |
---|
123 | public : void transition (void); |
---|
124 | //public : void genMoore (void) {/* empty */}; |
---|
125 | public : void genMealy_read (void); |
---|
126 | #endif |
---|
127 | |
---|
128 | #ifdef STATISTICS |
---|
129 | public : void statistics_declaration (morpheo::behavioural::Parameters_Statistics * param_statistics); |
---|
130 | public : string statistics_print (uint32_t depth); |
---|
131 | #endif |
---|
132 | |
---|
133 | #if VHDL |
---|
134 | private : void vhdl (void); |
---|
135 | private : void vhdl_declaration (Vhdl * & vhdl); |
---|
136 | private : void vhdl_body (Vhdl * & vhdl); |
---|
137 | #endif |
---|
138 | |
---|
139 | private : void end_cycle (void); |
---|
140 | |
---|
141 | }; |
---|
142 | |
---|
143 | }; // end namespace registerfile_monolithic |
---|
144 | }; // end namespace registerfile |
---|
145 | }; // end namespace generic |
---|
146 | }; // end namespace behavioural |
---|
147 | }; // end namespace morpheo |
---|
148 | |
---|
149 | #endif |
---|