source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Pattern_History_Table/src/Pattern_History_Table.cpp @ 2

Last change on this file since 2 was 2, checked in by kane, 17 years ago

Import Morpheo

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