1 | /* |
---|
2 | * $Id: RegisterFile_Monolithic.cpp 98 2008-12-31 10:18:08Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace generic { |
---|
13 | namespace registerfile { |
---|
14 | namespace registerfile_monolithic { |
---|
15 | |
---|
16 | RegisterFile_Monolithic::RegisterFile_Monolithic |
---|
17 | ( |
---|
18 | #ifdef SYSTEMC |
---|
19 | sc_module_name name, |
---|
20 | #else |
---|
21 | std::string name , |
---|
22 | #endif |
---|
23 | #ifdef STATISTICS |
---|
24 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
25 | #endif |
---|
26 | morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters * param, |
---|
27 | morpheo::behavioural::Tusage_t usage |
---|
28 | ): |
---|
29 | _name (name), |
---|
30 | _param (param), |
---|
31 | _usage (usage) |
---|
32 | { |
---|
33 | log_printf(FUNC,RegisterFile_Monolithic,"RegisterFile_Monolithic","Begin"); |
---|
34 | |
---|
35 | #if DEBUG_RegisterFile_Monolithic == true |
---|
36 | log_printf(INFO,RegisterFile_Monolithic,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
37 | |
---|
38 | std::cout << *param << std::endl; |
---|
39 | #endif |
---|
40 | |
---|
41 | log_printf(INFO,RegisterFile_Monolithic,"RegisterFile_Monolithic","Allocation"); |
---|
42 | allocation (); |
---|
43 | |
---|
44 | #ifdef STATISTICS |
---|
45 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
46 | statistics_declaration(param_statistics); |
---|
47 | #endif |
---|
48 | |
---|
49 | #ifdef VHDL |
---|
50 | // generate the vhdl |
---|
51 | if (usage_is_set(_usage,USE_VHDL)) |
---|
52 | vhdl(); |
---|
53 | #endif |
---|
54 | |
---|
55 | #ifdef SYSTEMC |
---|
56 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
57 | { |
---|
58 | SC_METHOD (transition); |
---|
59 | dont_initialize (); |
---|
60 | sensitive << (*(in_CLOCK)).pos(); |
---|
61 | |
---|
62 | SC_METHOD (genMealy_read); |
---|
63 | dont_initialize (); |
---|
64 | sensitive << (*(in_CLOCK)).neg(); |
---|
65 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
66 | { |
---|
67 | sensitive << *(in_READ_VAL [i]); |
---|
68 | if (_param->_have_port_address) |
---|
69 | sensitive << *(in_READ_ADDRESS [i]); |
---|
70 | } |
---|
71 | for (uint32_t i=0; i<_param->_nb_port_read_write; i++) |
---|
72 | { |
---|
73 | sensitive << *(in_READ_WRITE_VAL [i]) |
---|
74 | << *(in_READ_WRITE_RW [i]); |
---|
75 | if (_param->_have_port_address) |
---|
76 | sensitive << *(in_READ_WRITE_ADDRESS [i]); |
---|
77 | } |
---|
78 | |
---|
79 | # ifdef SYSTEMCASS_SPECIFIC |
---|
80 | // List dependency information |
---|
81 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
82 | { |
---|
83 | (*(out_READ_DATA [i])) (*( in_READ_VAL [i])); |
---|
84 | if (_param->_have_port_address) |
---|
85 | (*(out_READ_DATA [i])) (*( in_READ_ADDRESS [i])); |
---|
86 | } |
---|
87 | for (uint32_t i=0; i<_param->_nb_port_read_write; i++) |
---|
88 | { |
---|
89 | (*(out_READ_WRITE_RDATA [i])) (*( in_READ_WRITE_VAL [i])); |
---|
90 | (*(out_READ_WRITE_RDATA [i])) (*( in_READ_WRITE_RW [i])); |
---|
91 | if (_param->_have_port_address) |
---|
92 | (*(out_READ_WRITE_RDATA [i])) (*( in_READ_WRITE_ADDRESS [i])); |
---|
93 | } |
---|
94 | # endif |
---|
95 | |
---|
96 | for (uint32_t i=0; i<_param->_nb_port_read ; i++) |
---|
97 | PORT_WRITE(out_READ_ACK [i], 1); |
---|
98 | for (uint32_t i=0; i<_param->_nb_port_write ; i++) |
---|
99 | PORT_WRITE(out_WRITE_ACK [i], 1); |
---|
100 | for (uint32_t i=0; i<_param->_nb_port_read_write ; i++) |
---|
101 | PORT_WRITE(out_READ_WRITE_ACK [i], 1); |
---|
102 | } |
---|
103 | #endif |
---|
104 | |
---|
105 | log_printf(FUNC,RegisterFile_Monolithic,"RegisterFile_Monolithic","End"); |
---|
106 | }; |
---|
107 | |
---|
108 | RegisterFile_Monolithic::~RegisterFile_Monolithic (void) |
---|
109 | { |
---|
110 | #ifdef STATISTICS |
---|
111 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
112 | delete _stat; |
---|
113 | #endif |
---|
114 | |
---|
115 | deallocation (); |
---|
116 | }; |
---|
117 | |
---|
118 | }; // end namespace registerfile_monolithic |
---|
119 | }; // end namespace registerfile |
---|
120 | }; // end namespace generic |
---|
121 | }; // end namespace behavioural |
---|
122 | }; // end namespace morpheo |
---|