1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace stage_1_ifetch { |
---|
13 | namespace predictor { |
---|
14 | namespace meta_predictor { |
---|
15 | namespace two_level_branch_predictor { |
---|
16 | |
---|
17 | |
---|
18 | #ifdef SYSTEMC |
---|
19 | Two_Level_Branch_Predictor::Two_Level_Branch_Predictor (sc_module_name name, |
---|
20 | #else |
---|
21 | Two_Level_Branch_Predictor::Two_Level_Branch_Predictor (string name, |
---|
22 | #endif |
---|
23 | #ifdef STATISTICS |
---|
24 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
25 | #endif |
---|
26 | morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::Parameters param ): |
---|
27 | _name (name) |
---|
28 | ,_param (param) |
---|
29 | #ifdef STATISTICS |
---|
30 | ,_param_statistics (param_statistics) |
---|
31 | #endif |
---|
32 | { |
---|
33 | log_printf(FUNC,Two_Level_Branch_Predictor,"Two_Level_Branch_Predictor","Begin"); |
---|
34 | |
---|
35 | #ifdef STATISTICS |
---|
36 | // Allocation of statistics |
---|
37 | _stat = new Statistics (static_cast<string>(_name), |
---|
38 | param_statistics , |
---|
39 | param); |
---|
40 | #endif |
---|
41 | |
---|
42 | #ifdef VHDL_TESTBENCH |
---|
43 | // Creation of a testbench |
---|
44 | // -> port |
---|
45 | // -> clock's signals |
---|
46 | _vhdl_testbench = new Vhdl_Testbench (_name); |
---|
47 | vhdl_testbench_port (); |
---|
48 | _vhdl_testbench->set_clock ("in_CLOCK",true); |
---|
49 | #endif |
---|
50 | |
---|
51 | #ifdef VHDL |
---|
52 | // generate the vhdl |
---|
53 | vhdl(); |
---|
54 | #endif |
---|
55 | |
---|
56 | #ifdef SYSTEMC |
---|
57 | allocation (); |
---|
58 | |
---|
59 | #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) |
---|
60 | SC_METHOD (transition); |
---|
61 | dont_initialize (); |
---|
62 | sensitive_pos << *(in_CLOCK); |
---|
63 | #endif |
---|
64 | |
---|
65 | // SC_METHOD (genMoore); |
---|
66 | // dont_initialize (); |
---|
67 | // sensitive_neg << *(in_CLOCK); |
---|
68 | |
---|
69 | #ifdef SYSTEMCASS_SPECIFIC |
---|
70 | // List dependency information |
---|
71 | #endif |
---|
72 | |
---|
73 | #endif |
---|
74 | log_printf(FUNC,Two_Level_Branch_Predictor,"Two_Level_Branch_Predictor","End"); |
---|
75 | }; |
---|
76 | |
---|
77 | Two_Level_Branch_Predictor::~Two_Level_Branch_Predictor (void) |
---|
78 | { |
---|
79 | log_printf(FUNC,Two_Level_Branch_Predictor,"~Two_Level_Branch_Predictor","Begin"); |
---|
80 | |
---|
81 | #ifdef VHDL_TESTBENCH |
---|
82 | // generate the test bench |
---|
83 | _vhdl_testbench->generate_file(); |
---|
84 | delete _vhdl_testbench; |
---|
85 | #endif |
---|
86 | |
---|
87 | #ifdef STATISTICS |
---|
88 | _stat->generate_file(statistics(0)); |
---|
89 | |
---|
90 | delete _stat; |
---|
91 | #endif |
---|
92 | |
---|
93 | #ifdef SYSTEMC |
---|
94 | deallocation (); |
---|
95 | #endif |
---|
96 | |
---|
97 | log_printf(FUNC,Two_Level_Branch_Predictor,"~Two_Level_Branch_Predictor","End"); |
---|
98 | }; |
---|
99 | |
---|
100 | }; // end namespace two_level_branch_predictor |
---|
101 | }; // end namespace meta_predictor |
---|
102 | }; // end namespace predictor |
---|
103 | }; // end namespace stage_1_ifetch |
---|
104 | }; // end namespace behavioural |
---|
105 | }; // end namespace morpheo |
---|