source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/Two_Level_Branch_Predictor_Glue/src/Two_Level_Branch_Predictor_Glue_allocation.cpp @ 47

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

Modification des classes d'encapsulation des interfaces :

  • gère les signaux à écrire dans le vhdl
  • les traces pour le testbench
  • la génération des vhdl structurelles

-> test sur la Pattern History Table

File size: 6.1 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/Two_Level_Branch_Predictor_Glue/include/Two_Level_Branch_Predictor_Glue.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace stage_1_ifetch {
14namespace predictor {
15namespace meta_predictor {
16namespace two_level_branch_predictor {
17namespace two_level_branch_predictor_glue {
18
19
20  void Two_Level_Branch_Predictor_Glue::allocation (void)
21  {
22    string rename;
23
24    log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"allocation","Begin");
25
26    _component   = new Component ();
27
28    Entity * entity = _component->set_entity (_name                 
29                                             ,"Two_Level_Branch_Predictor_Glue"
30#ifdef POSITION
31                                             ,COMBINATORY
32#endif
33                                              );
34   
35    _interfaces = entity->set_interfaces();
36
37    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38    {
39      Interface * interface = _interfaces->set_interface(""
40#ifdef POSITION
41                                                         , IN 
42                                                         , SOUTH
43                                                         , "Generalist interface"
44#endif
45                                                         );
46     
47      in_CLOCK              = interface->set_signal_clk              ("clock" ,1,CLOCK_VHDL_NO);
48      in_NRESET             = interface->set_signal_in  <Tcontrol_t> ("nreset",1,RESET_VHDL_NO);
49    }
50   
51    // ~~~~~[ Interface : "Predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52    if (_param._have_bht)
53      {
54     in_PREDICT_BHT_ACK              = new SC_IN (Tcontrol_t)           * [_param._nb_prediction];
55    out_PREDICT_BHT_ADDRESS          = new SC_OUT(Taddress_t)           * [_param._nb_prediction];
56      }
57    if (_param._have_pht)
58      {
59     in_PREDICT_PHT_ACK              = new SC_IN (Tcontrol_t)           * [_param._nb_prediction];
60    out_PREDICT_PHT_ADDRESS          = new SC_OUT(Taddress_t)           * [_param._nb_prediction];
61      }
62    if (_param._have_bht and _param._have_pht)
63     in_PREDICT_BHT_HISTORY          = new SC_IN (Tbht_history_t)       * [_param._nb_prediction];
64    out_PREDICT_ACK                  = new SC_OUT(Tcontrol_t)           * [_param._nb_prediction];
65     in_PREDICT_ADDRESS              = new SC_IN (Taddress_t)           * [_param._nb_prediction];
66
67    for (uint32_t i=0; i<_param._nb_prediction; i++)
68      {
69        Interface_fifo * interface = _interfaces->set_interface("predict_"+toString(i)
70#ifdef POSITION
71                                                                , IN 
72                                                                , WEST
73                                                                , "Interface Predict"
74#endif
75                                                                );
76
77        if (_param._have_bht)
78          {
79         in_PREDICT_BHT_ACK             [i] = interface->set_signal_in  <Tcontrol_t>     ("bht_ack"    ,1);
80        out_PREDICT_BHT_ADDRESS         [i] = interface->set_signal_out <Taddress_t>     ("bht_address",_param._bht_size_address);
81          }
82        if (_param._have_pht)
83          {
84         in_PREDICT_PHT_ACK             [i] = interface->set_signal_in  <Tcontrol_t>     ("pht_ack"    ,1);
85        out_PREDICT_PHT_ADDRESS         [i] = interface->set_signal_out <Taddress_t>     ("pht_address",_param._pht_size_address);
86          }
87        if (_param._have_bht and _param._have_pht)
88         in_PREDICT_BHT_HISTORY         [i] = interface->set_signal_in  <Tbht_history_t> ("bht_history",_param._bht_size_history);
89        out_PREDICT_ACK                 [i] = interface->set_signal_out <Tcontrol_t>     ("ack"        ,1);
90         in_PREDICT_ADDRESS             [i] = interface->set_signal_in  <Taddress_t>     ("address"    ,_param._size_address);
91      }
92
93    // ~~~~~[ Interface : "branch_complete" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94
95    if (_param._have_bht)
96      {
97     in_BRANCH_COMPLETE_BHT_ACK              = new SC_IN (Tcontrol_t)           * [_param._nb_branch_complete];
98    out_BRANCH_COMPLETE_BHT_ADDRESS          = new SC_OUT(Taddress_t)           * [_param._nb_branch_complete];
99      }
100    if (_param._have_pht)
101      {
102     in_BRANCH_COMPLETE_PHT_ACK              = new SC_IN (Tcontrol_t)           * [_param._nb_branch_complete];
103    out_BRANCH_COMPLETE_PHT_ADDRESS          = new SC_OUT(Taddress_t)           * [_param._nb_branch_complete];
104      }
105    if (_param._have_bht and _param._have_pht)
106     in_BRANCH_COMPLETE_BHT_HISTORY          = new SC_IN (Tbht_history_t)       * [_param._nb_branch_complete];
107   
108    out_BRANCH_COMPLETE_ACK                  = new SC_OUT(Tcontrol_t)           * [_param._nb_branch_complete];
109     in_BRANCH_COMPLETE_ADDRESS              = new SC_IN (Taddress_t)           * [_param._nb_branch_complete];
110
111    for (uint32_t i=0; i<_param._nb_branch_complete; i++)
112      {
113        Interface_fifo * interface = _interfaces->set_interface("branch_complete_"+toString(i)
114#ifdef POSITION
115                                                                , IN 
116                                                                , EAST
117                                                                , "Interface branch complete"
118#endif
119                                                                );
120        if (_param._have_bht)
121          {
122         in_BRANCH_COMPLETE_BHT_ACK             [i] = interface->set_signal_in  <Tcontrol_t>     ("bht_ack"    ,1);
123        out_BRANCH_COMPLETE_BHT_ADDRESS         [i] = interface->set_signal_out <Taddress_t>     ("bht_address",_param._bht_size_address);
124          }
125        if (_param._have_pht)
126          {
127         in_BRANCH_COMPLETE_PHT_ACK             [i] = interface->set_signal_in  <Tcontrol_t>     ("pht_ack"    ,1);
128        out_BRANCH_COMPLETE_PHT_ADDRESS         [i] = interface->set_signal_out <Taddress_t>     ("pht_address",_param._pht_size_address);
129          }
130        if (_param._have_bht and _param._have_pht)
131         in_BRANCH_COMPLETE_BHT_HISTORY         [i] = interface->set_signal_in  <Tbht_history_t> ("bht_history",_param._bht_size_history);
132
133        out_BRANCH_COMPLETE_ACK                 [i] = interface->set_signal_out <Tcontrol_t>     ("ack"        ,1);
134         in_BRANCH_COMPLETE_ADDRESS             [i] = interface->set_signal_in  <Taddress_t>     ("address"    ,_param._size_address);
135      }
136
137    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
138
139#ifdef POSITION
140    _component->generate_file();
141#endif
142
143    log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"allocation","End");
144  };
145
146}; // end namespace two_level_branch_predictor_glue
147}; // end namespace two_level_branch_predictor
148}; // end namespace meta_predictor
149}; // end namespace predictor
150}; // end namespace stage_1_ifetch
151
152}; // end namespace behavioural
153}; // end namespace morpheo             
154#endif
Note: See TracBrowser for help on using the repository browser.