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