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