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 @ 15

Last change on this file since 15 was 15, checked in by rosiere, 17 years ago

Interface normalisé
Début du banc de registres multi niveaux

File size: 5.5 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     in_NRESET          = new SC_IN (Tcontrol_t) ("in_NRESET");
26
27     in_PREDICT_VAL     = new SC_IN (Tcontrol_t) * [_param._nb_prediction];
28    out_PREDICT_ACK     = new SC_OUT(Tcontrol_t) * [_param._nb_prediction];
29     in_PREDICT_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_prediction];
30    out_PREDICT_HISTORY = new SC_OUT(Thistory_t) * [_param._nb_prediction];
31
32    for (uint32_t i=0; i<_param._nb_prediction; i++)
33      {
34        rename = "in_PREDICT_VAL["     +toString(i)+"]";
35         in_PREDICT_VAL     [i] = new SC_IN (Tcontrol_t) (rename.c_str());
36
37        rename = "out_PREDICT_ACK["    +toString(i)+"]";
38        out_PREDICT_ACK     [i] = new SC_OUT(Tcontrol_t) (rename.c_str());
39
40        rename = "in_PREDICT_ADDRESS["+toString(i)+"]";
41         in_PREDICT_ADDRESS [i] = new SC_IN (Taddress_t) (rename.c_str());
42
43        rename = "out_PREDICT_HISTORY["+toString(i)+"]";
44        out_PREDICT_HISTORY [i] = new SC_OUT(Thistory_t) (rename.c_str());
45      }
46
47        in_BRANCH_COMPLETE_VAL     = new SC_IN     (Tcontrol_t) * [_param._nb_branch_complete];
48       out_BRANCH_COMPLETE_ACK     = new SC_OUT    (Tcontrol_t) * [_param._nb_branch_complete];
49        in_BRANCH_COMPLETE_ADDRESS = new SC_IN     (Taddress_t) * [_param._nb_branch_complete];
50        in_BRANCH_COMPLETE_HISTORY = new SC_IN     (Thistory_t) * [_param._nb_branch_complete];
51        in_BRANCH_COMPLETE_DIRECTION= new SC_IN     (Tcontrol_t) * [_param._nb_branch_complete];
52    signal_BRANCH_COMPLETE_HISTORY = new SC_SIGNAL (Thistory_t) * [_param._nb_branch_complete];
53
54    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
55      {
56         rename = "in_BRANCH_COMPLETE_VAL["    +toString(i)+"]";
57          in_BRANCH_COMPLETE_VAL     [i] = new SC_IN (Tcontrol_t) (rename.c_str());
58
59         rename = "out_BRANCH_COMPLETE_ACK["   +toString(i)+"]";
60         out_BRANCH_COMPLETE_ACK     [i] = new SC_OUT(Tcontrol_t) (rename.c_str());
61
62         rename = "in_BRANCH_COMPLETE_ADDRESS["+toString(i)+"]";
63          in_BRANCH_COMPLETE_ADDRESS [i] = new SC_IN (Taddress_t) (rename.c_str());
64
65         rename = "in_BRANCH_COMPLETE_HISTORY["+toString(i)+"]";
66          in_BRANCH_COMPLETE_HISTORY [i] = new SC_IN (Thistory_t) (rename.c_str());
67
68         rename = "in_BRANCH_COMPLETE_DIRECTION["    +toString(i)+"]";
69          in_BRANCH_COMPLETE_DIRECTION[i] = new SC_IN (Tcontrol_t) (rename.c_str());
70
71         rename = "signal_BRANCH_COMPLETE_HISTORY["+toString(i)+"]";
72         signal_BRANCH_COMPLETE_HISTORY [i] = new SC_SIGNAL (Thistory_t) (rename.c_str());
73
74      }
75   
76    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
77    string name_component;
78    // =====[ component_Shifter ]=========================================   
79   
80    name_component = _name+"_Shifter";
81
82    component_Shifter = new morpheo::behavioural::generic::shifter::Shifter (name_component.c_str(),
83#ifdef STATISTICS
84                                                                             _param_statistics             ,
85#endif
86                                                                             *(_param._param_shifter)      );
87   
88   
89    // Instantiation
90#if (defined(STATISTICS) || defined (VHDL_TESTBENCH))
91    (*(component_Shifter->in_CLOCK))        (*(in_CLOCK));
92#endif
93
94    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
95      {
96        (*(component_Shifter-> in_SHIFTER_DATA       [i]))    (*(    in_BRANCH_COMPLETE_HISTORY  [i]));
97        (*(component_Shifter-> in_SHIFTER_CARRY_IN   [i]))    (*(    in_BRANCH_COMPLETE_DIRECTION[i]));
98        (*(component_Shifter->out_SHIFTER_DATA       [i]))    (*(signal_BRANCH_COMPLETE_HISTORY  [i]));
99      }
100   
101     // =====[ component_RegisterFile ]====================================   
102   
103    name_component = _name+"_RegisterFile";
104   
105    component_RegisterFile = new morpheo::behavioural::generic::registerfile::registerfile_monolithic::RegisterFile_Monolithic(name_component.c_str(),
106#ifdef STATISTICS
107                                                                                            _param_statistics            ,
108#endif
109                                                                                            *(_param._param_registerfile));
110     
111    // Instantiation
112    (*(component_RegisterFile->in_CLOCK ))       (*(in_CLOCK ));
113    (*(component_RegisterFile->in_NRESET))       (*(in_NRESET));
114   
115    for (uint32_t i=0; i<_param._nb_prediction; i++)
116      {
117        (*(component_RegisterFile-> in_READ_VAL      [i])) (*( in_PREDICT_VAL      [i]));
118        (*(component_RegisterFile->out_READ_ACK      [i])) (*(out_PREDICT_ACK      [i]));
119        (*(component_RegisterFile-> in_READ_ADDRESS  [i])) (*( in_PREDICT_ADDRESS  [i]));
120        (*(component_RegisterFile->out_READ_DATA     [i])) (*(out_PREDICT_HISTORY  [i]));   
121      }
122   
123    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
124      {
125        (*(component_RegisterFile-> in_WRITE_VAL     [i])) (*(    in_BRANCH_COMPLETE_VAL      [i]));
126        (*(component_RegisterFile->out_WRITE_ACK     [i])) (*(   out_BRANCH_COMPLETE_ACK      [i]));
127        (*(component_RegisterFile-> in_WRITE_ADDRESS [i])) (*(    in_BRANCH_COMPLETE_ADDRESS  [i]));
128        (*(component_RegisterFile-> in_WRITE_DATA    [i])) (*(signal_BRANCH_COMPLETE_HISTORY  [i]));   
129      }
130  };
131
132}; // end namespace branch_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}; // end namespace behavioural
138}; // end namespace morpheo             
139#endif
Note: See TracBrowser for help on using the repository browser.