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

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

1) Ajout d'un "printer" XML pour la configuration de paramètres

2) Fin du composant "Two_Level_Branch_Predictor"

validation * systemc

  • vhdl
File size: 5.3 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Pattern_History_Table/include/Pattern_History_Table.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace stage_1_ifetch {
14namespace predictor {
15namespace meta_predictor {
16namespace two_level_branch_predictor {
17namespace pattern_history_table {
18
19
20  void Pattern_History_Table::allocation (void)
21  {
22    string rename;
23
24    log_printf(FUNC,Pattern_History_Table,"allocation","Begin");
25
26    in_CLOCK  = new SC_CLOCK           ("in_CLOCK");
27
28     in_PREDICT_VAL     = new SC_IN (Tcontrol_t) * [_param._nb_prediction];
29    out_PREDICT_ACK     = new SC_OUT(Tcontrol_t) * [_param._nb_prediction];
30     in_PREDICT_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_prediction];
31    out_PREDICT_HISTORY = new SC_OUT(Thistory_t) * [_param._nb_prediction];
32
33    for (uint32_t i=0; i<_param._nb_prediction; i++)
34      {
35        rename = "in_PREDICT_VAL["     +toString(i)+"]";
36         in_PREDICT_VAL     [i] = new SC_IN (Tcontrol_t) (rename.c_str());
37
38        rename = "out_PREDICT_ACK["    +toString(i)+"]";
39        out_PREDICT_ACK     [i] = new SC_OUT(Tcontrol_t) (rename.c_str());
40
41        rename = "in_PREDICT_ADDRESS["+toString(i)+"]";
42         in_PREDICT_ADDRESS [i] = new SC_IN (Taddress_t) (rename.c_str());
43
44        rename = "out_PREDICT_HISTORY["+toString(i)+"]";
45        out_PREDICT_HISTORY [i] = new SC_OUT(Thistory_t) (rename.c_str());
46      }
47
48        in_BRANCH_COMPLETE_VAL       = new SC_IN     (Tcontrol_t) * [_param._nb_branch_complete];
49       out_BRANCH_COMPLETE_ACK       = new SC_OUT    (Tcontrol_t) * [_param._nb_branch_complete];
50        in_BRANCH_COMPLETE_ADDRESS   = new SC_IN     (Taddress_t) * [_param._nb_branch_complete];
51        in_BRANCH_COMPLETE_HISTORY   = new SC_IN     (Thistory_t) * [_param._nb_branch_complete];
52        in_BRANCH_COMPLETE_DIRECTION = new SC_IN     (Tcontrol_t) * [_param._nb_branch_complete];
53    signal_BRANCH_COMPLETE_HISTORY   = new SC_SIGNAL (Thistory_t) * [_param._nb_branch_complete];
54
55    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
56      {
57         rename = "in_BRANCH_COMPLETE_VAL["    +toString(i)+"]";
58          in_BRANCH_COMPLETE_VAL     [i] = new SC_IN (Tcontrol_t) (rename.c_str());
59
60         rename = "out_BRANCH_COMPLETE_ACK["   +toString(i)+"]";
61         out_BRANCH_COMPLETE_ACK     [i] = new SC_OUT(Tcontrol_t) (rename.c_str());
62
63         rename = "in_BRANCH_COMPLETE_ADDRESS["+toString(i)+"]";
64          in_BRANCH_COMPLETE_ADDRESS [i] = new SC_IN (Taddress_t) (rename.c_str());
65
66         rename = "in_BRANCH_COMPLETE_HISTORY["+toString(i)+"]";
67          in_BRANCH_COMPLETE_HISTORY [i] = new SC_IN (Thistory_t) (rename.c_str());
68
69         rename = "in_BRANCH_COMPLETE_DIRECTION["    +toString(i)+"]";
70          in_BRANCH_COMPLETE_DIRECTION [i] = new SC_IN (Tcontrol_t) (rename.c_str());
71
72         rename = "signal_BRANCH_COMPLETE_HISTORY["+toString(i)+"]";
73         signal_BRANCH_COMPLETE_HISTORY [i] = new SC_SIGNAL (Thistory_t) (rename.c_str());
74
75      }
76   
77    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
78    string name_component;
79    // =====[ component_Counter ]=========================================   
80   
81    name_component = _name+"_Counter";
82
83    component_Counter = new morpheo::behavioural::generic::counter::Counter (name_component.c_str(),
84#ifdef STATISTICS
85                                                                             _param_statistics             ,
86#endif
87                                                                             *(_param._param_counter)      );
88   
89   
90    // Instantiation
91#if (defined(STATISTICS) || defined (VHDL_TESTBENCH))
92    (*(component_Counter->in_CLOCK))        (*(in_CLOCK));
93#endif
94
95    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
96      {
97        (*(component_Counter-> in_COUNTER_DATA       [i]))    (*(    in_BRANCH_COMPLETE_HISTORY   [i]));
98        (*(component_Counter-> in_COUNTER_ADDSUB     [i]))    (*(    in_BRANCH_COMPLETE_DIRECTION [i]));
99        (*(component_Counter->out_COUNTER_DATA       [i]))    (*(signal_BRANCH_COMPLETE_HISTORY   [i]));
100      }
101   
102     // =====[ component_RegisterFile ]====================================   
103   
104    name_component = _name+"_RegisterFile";
105   
106    component_RegisterFile = new morpheo::behavioural::generic::registerfile::RegisterFile (name_component.c_str(),
107#ifdef STATISTICS
108                                                                                            _param_statistics            ,
109#endif
110                                                                                            *(_param._param_registerfile));
111     
112    // Instantiation
113    (*(component_RegisterFile->in_CLOCK))        (*(in_CLOCK));
114   
115    for (uint32_t i=0; i<_param._nb_prediction; i++)
116      {
117        (*(component_RegisterFile-> in_READ_ENABLE   [i])) (*( in_PREDICT_VAL      [i]));
118        (*(component_RegisterFile-> in_READ_ADDRESS  [i])) (*( in_PREDICT_ADDRESS  [i]));
119        (*(component_RegisterFile->out_READ_DATA     [i])) (*(out_PREDICT_HISTORY  [i]));   
120      }
121   
122    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
123      {
124        (*(component_RegisterFile-> in_WRITE_ENABLE  [i])) (*(    in_BRANCH_COMPLETE_VAL      [i]));
125        (*(component_RegisterFile-> in_WRITE_ADDRESS [i])) (*(    in_BRANCH_COMPLETE_ADDRESS  [i]));
126        (*(component_RegisterFile-> in_WRITE_DATA    [i])) (*(signal_BRANCH_COMPLETE_HISTORY  [i]));   
127      }
128
129    log_printf(FUNC,Pattern_History_Table,"allocation","End");
130  };
131
132}; // end namespace pattern_history_table
133}; // end namespace two_level_branch_predictor
134}; // end namespace meta_predictor
135}; // end namespace predictor
136}; // end namespace stage_1_ifetch
137
138}; // end namespace behavioural
139}; // end namespace morpheo             
140#endif
Note: See TracBrowser for help on using the repository browser.