source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Branch_History_Table/src/Branch_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.2 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/Branch_History_Table/include/Branch_History_Table.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace stage_1_ifetch {
14namespace predictor {
15namespace meta_predictor {
16namespace two_level_branch_predictor {
17namespace branch_history_table {
18
19
20  void Branch_History_Table::allocation (void)
21  {
22    string rename;
23
24     in_CLOCK           = new SC_CLOCK           ("in_CLOCK");
25
26     in_PREDICT_VAL     = new SC_IN (Tcontrol_t) * [_param._nb_prediction];
27    out_PREDICT_ACK     = new SC_OUT(Tcontrol_t) * [_param._nb_prediction];
28     in_PREDICT_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_prediction];
29    out_PREDICT_HISTORY = new SC_OUT(Thistory_t) * [_param._nb_prediction];
30
31    for (uint32_t i=0; i<_param._nb_prediction; i++)
32      {
33        rename = "in_PREDICT_VAL["     +toString(i)+"]";
34         in_PREDICT_VAL     [i] = new SC_IN (Tcontrol_t) (rename.c_str());
35
36        rename = "out_PREDICT_ACK["    +toString(i)+"]";
37        out_PREDICT_ACK     [i] = new SC_OUT(Tcontrol_t) (rename.c_str());
38
39        rename = "in_PREDICT_ADDRESS["+toString(i)+"]";
40         in_PREDICT_ADDRESS [i] = new SC_IN (Taddress_t) (rename.c_str());
41
42        rename = "out_PREDICT_HISTORY["+toString(i)+"]";
43        out_PREDICT_HISTORY [i] = new SC_OUT(Thistory_t) (rename.c_str());
44      }
45
46        in_BRANCH_COMPLETE_VAL     = new SC_IN     (Tcontrol_t) * [_param._nb_branch_complete];
47       out_BRANCH_COMPLETE_ACK     = new SC_OUT    (Tcontrol_t) * [_param._nb_branch_complete];
48        in_BRANCH_COMPLETE_ADDRESS = new SC_IN     (Taddress_t) * [_param._nb_branch_complete];
49        in_BRANCH_COMPLETE_HISTORY = new SC_IN     (Thistory_t) * [_param._nb_branch_complete];
50        in_BRANCH_COMPLETE_DIRECTION= new SC_IN     (Tcontrol_t) * [_param._nb_branch_complete];
51    signal_BRANCH_COMPLETE_HISTORY = new SC_SIGNAL (Thistory_t) * [_param._nb_branch_complete];
52
53    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
54      {
55         rename = "in_BRANCH_COMPLETE_VAL["    +toString(i)+"]";
56          in_BRANCH_COMPLETE_VAL     [i] = new SC_IN (Tcontrol_t) (rename.c_str());
57
58         rename = "out_BRANCH_COMPLETE_ACK["   +toString(i)+"]";
59         out_BRANCH_COMPLETE_ACK     [i] = new SC_OUT(Tcontrol_t) (rename.c_str());
60
61         rename = "in_BRANCH_COMPLETE_ADDRESS["+toString(i)+"]";
62          in_BRANCH_COMPLETE_ADDRESS [i] = new SC_IN (Taddress_t) (rename.c_str());
63
64         rename = "in_BRANCH_COMPLETE_HISTORY["+toString(i)+"]";
65          in_BRANCH_COMPLETE_HISTORY [i] = new SC_IN (Thistory_t) (rename.c_str());
66
67         rename = "in_BRANCH_COMPLETE_DIRECTION["    +toString(i)+"]";
68          in_BRANCH_COMPLETE_DIRECTION[i] = new SC_IN (Tcontrol_t) (rename.c_str());
69
70         rename = "signal_BRANCH_COMPLETE_HISTORY["+toString(i)+"]";
71         signal_BRANCH_COMPLETE_HISTORY [i] = new SC_SIGNAL (Thistory_t) (rename.c_str());
72
73      }
74   
75    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
76    string name_component;
77    // =====[ component_Shifter ]=========================================   
78   
79    name_component = _name+"_Shifter";
80
81    component_Shifter = new morpheo::behavioural::generic::shifter::Shifter (name_component.c_str(),
82#ifdef STATISTICS
83                                                                             _param_statistics             ,
84#endif
85                                                                             *(_param._param_shifter)      );
86   
87   
88    // Instantiation
89#if (defined(STATISTICS) || defined (VHDL_TESTBENCH))
90    (*(component_Shifter->in_CLOCK))        (*(in_CLOCK));
91#endif
92
93    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
94      {
95        (*(component_Shifter-> in_SHIFTER_DATA       [i]))    (*(    in_BRANCH_COMPLETE_HISTORY  [i]));
96        (*(component_Shifter-> in_SHIFTER_CARRY_IN   [i]))    (*(    in_BRANCH_COMPLETE_DIRECTION[i]));
97        (*(component_Shifter->out_SHIFTER_DATA       [i]))    (*(signal_BRANCH_COMPLETE_HISTORY  [i]));
98      }
99   
100     // =====[ component_RegisterFile ]====================================   
101   
102    name_component = _name+"_RegisterFile";
103   
104    component_RegisterFile = new morpheo::behavioural::generic::registerfile::RegisterFile (name_component.c_str(),
105#ifdef STATISTICS
106                                                                                            _param_statistics            ,
107#endif
108                                                                                            *(_param._param_registerfile));
109     
110    // Instantiation
111    (*(component_RegisterFile->in_CLOCK))        (*(in_CLOCK));
112   
113    for (uint32_t i=0; i<_param._nb_prediction; i++)
114      {
115        (*(component_RegisterFile-> in_READ_ENABLE   [i])) (*( in_PREDICT_VAL      [i]));
116        (*(component_RegisterFile-> in_READ_ADDRESS  [i])) (*( in_PREDICT_ADDRESS  [i]));
117        (*(component_RegisterFile->out_READ_DATA     [i])) (*(out_PREDICT_HISTORY  [i]));   
118      }
119   
120    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
121      {
122        (*(component_RegisterFile-> in_WRITE_ENABLE  [i])) (*(    in_BRANCH_COMPLETE_VAL      [i]));
123        (*(component_RegisterFile-> in_WRITE_ADDRESS [i])) (*(    in_BRANCH_COMPLETE_ADDRESS  [i]));
124        (*(component_RegisterFile-> in_WRITE_DATA    [i])) (*(signal_BRANCH_COMPLETE_HISTORY  [i]));   
125      }
126  };
127
128}; // end namespace branch_history_table
129}; // end namespace two_level_branch_predictor
130}; // end namespace meta_predictor
131}; // end namespace predictor
132}; // end namespace stage_1_ifetch
133}; // end namespace behavioural
134}; // end namespace morpheo             
135#endif
Note: See TracBrowser for help on using the repository browser.