1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Generic/RegisterFile/include/RegisterFile.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace generic { |
---|
13 | namespace registerfile { |
---|
14 | |
---|
15 | #ifdef SYSTEMC |
---|
16 | RegisterFile::RegisterFile (sc_module_name name, |
---|
17 | #else |
---|
18 | RegisterFile::RegisterFile (string name , |
---|
19 | #endif |
---|
20 | #ifdef STATISTICS |
---|
21 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
22 | #endif |
---|
23 | morpheo::behavioural::generic::registerfile::Parameters param ): |
---|
24 | _name (name) |
---|
25 | ,_param (param) |
---|
26 | { |
---|
27 | #ifdef STATISTICS |
---|
28 | _stat = new Statistics (static_cast<string>(_name), |
---|
29 | param_statistics , |
---|
30 | param); |
---|
31 | #endif |
---|
32 | |
---|
33 | #ifdef VHDL_TESTBENCH |
---|
34 | _vhdl_testbench = new Vhdl_Testbench (_name); |
---|
35 | vhdl_testbench_port (*_vhdl_testbench); |
---|
36 | _vhdl_testbench->set_clock ("in_CLOCK",true); |
---|
37 | #endif |
---|
38 | |
---|
39 | #ifdef VHDL |
---|
40 | // generate the vhdl |
---|
41 | vhdl(); |
---|
42 | #endif |
---|
43 | |
---|
44 | #ifdef SYSTEMC |
---|
45 | allocation (); |
---|
46 | |
---|
47 | SC_METHOD (transition); |
---|
48 | dont_initialize (); |
---|
49 | sensitive_pos << *(in_CLOCK); |
---|
50 | |
---|
51 | SC_METHOD (genMealy_read); |
---|
52 | dont_initialize (); |
---|
53 | sensitive_neg << *(in_CLOCK); |
---|
54 | for (uint32_t i=0; i<_param._nb_port_read; i++) |
---|
55 | sensitive << *(in_READ_ENABLE [i]) |
---|
56 | << *(in_READ_ADDRESS [i]); |
---|
57 | |
---|
58 | #ifdef SYSTEMCASS_SPECIFIC |
---|
59 | // List dependency information |
---|
60 | for (uint32_t i=0; i<_param._nb_port_read; i++) |
---|
61 | { |
---|
62 | (*(out_READ_DATA [i])) (*( in_READ_ENABLE [i])); |
---|
63 | (*(out_READ_DATA [i])) (*( in_READ_ADDRESS [i])); |
---|
64 | } |
---|
65 | #endif |
---|
66 | #endif |
---|
67 | }; |
---|
68 | |
---|
69 | RegisterFile::~RegisterFile (void) |
---|
70 | { |
---|
71 | #ifdef SYSTEMC |
---|
72 | deallocation (); |
---|
73 | #endif |
---|
74 | |
---|
75 | #ifdef VHDL_TESTBENCH |
---|
76 | // generate the test bench |
---|
77 | _vhdl_testbench->generate_file(); |
---|
78 | delete _vhdl_testbench; |
---|
79 | #endif |
---|
80 | |
---|
81 | #ifdef STATISTICS |
---|
82 | _stat->generate_file(statistics(0)); |
---|
83 | delete _stat; |
---|
84 | #endif |
---|
85 | }; |
---|
86 | |
---|
87 | }; // end namespace registerfile |
---|
88 | }; // end namespace generic |
---|
89 | }; // end namespace behavioural |
---|
90 | }; // end namespace morpheo |
---|