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

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

1) Decod_queue : multi implementation (one_fifo, multi_fifo)
2) Issue_queue : multi implementation (in_order, out_of_order)
3) Direction : Add Meta predictor
4) Context_State : re add Branch_complete, More priority to Load miss (is not speculative)
5) Return_Address_Stack : update reg_PREDICT pointer on decod miss prediction
6) UPT : Fix bug in multi event
7) Prediction_glue : in read_stack case, insert in UPT pc_next
8) Rename select : when rob have an event (need flush), read_r{a,b,c} and write_r{d,e} is set at 0

  • Property svn:keywords set to Id
File size: 4.7 KB
Line 
1/*
2 * $Id: Two_Level_Branch_Predictor_allocation.cpp 111 2009-02-27 18:37:40Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h"
9#include "Behavioural/include/Allocation.h"
10#include "Common/include/Max.h"
11
12namespace morpheo                    {
13namespace behavioural {
14namespace core {
15namespace multi_front_end {
16namespace front_end {
17namespace prediction_unit {
18namespace direction {
19namespace meta_predictor {
20namespace two_level_branch_predictor {
21
22#undef  FUNCTION
23#define FUNCTION "Two_Level_Branch_Predictor::allocation"
24  void Two_Level_Branch_Predictor::allocation (
25#ifdef STATISTICS
26                               morpheo::behavioural::Parameters_Statistics * param_statistics
27#else
28                               void
29#endif
30                               )
31  {
32    log_begin(Two_Level_Branch_Predictor,FUNCTION);
33
34    _component   = new Component (_usage);
35
36    Entity * entity = _component->set_entity (_name       
37                                              ,"Two_Level_Branch_Predictor"
38#ifdef POSITION
39                                              ,COMBINATORY
40#endif
41                                              );
42
43    _interfaces = entity->set_interfaces();
44
45    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46    {
47      Interface * interface = _interfaces->set_interface(""
48#ifdef POSITION
49                                                         ,IN
50                                                         ,SOUTH,
51                                                         _("Generalist interface")
52#endif
53                                                         );
54     
55      in_CLOCK        = interface->set_signal_clk              ("clock" ,1, CLOCK_VHDL_YES);
56      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
57    }
58
59    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60    {
61      ALLOC1_INTERFACE("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict);
62
63      ALLOC1_VALACK_IN ( in_PREDICT_VAL          ,VAL);
64      ALLOC1_VALACK_OUT(out_PREDICT_ACK          ,ACK);
65      ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS      ,"ADDRESS"      ,Taddress_t,_param->_size_address);
66      ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
67      ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY      ,"HISTORY"      ,Thistory_t,_param->_size_history);
68      if (_param->_update_on_prediction)
69        {
70      ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION_VAL,"DIRECTION_VAL",Tcontrol_t,1                    );
71      ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION    ,"DIRECTION"    ,Tcontrol_t,1                    );
72        }
73    }
74
75    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76    {
77      ALLOC1_INTERFACE("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update);
78
79      ALLOC1_VALACK_IN ( in_UPDATE_VAL           ,VAL);
80      ALLOC1_VALACK_OUT(out_UPDATE_ACK           ,ACK);
81      ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS       ,"ADDRESS"      ,Taddress_t,_param->_size_address);
82      ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY       ,"HISTORY"      ,Thistory_t,_param->_size_history);
83      ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION     ,"DIRECTION"    ,Tcontrol_t,1                    );
84      if (_param->_update_on_prediction)
85      ALLOC1_SIGNAL_IN ( in_UPDATE_MISS          ,"MISS"         ,Tcontrol_t,1                    );
86    }
87
88    if (usage_is_set(_usage,USE_SYSTEMC))
89      {
90        if (_param->_have_bht)
91          {
92        ALLOC1(reg_BHT                       ,Thistory_t,_param->_bht_nb_shifter);
93
94        for (uint32_t i=0; i<_param->_bht_nb_shifter; ++i)
95          reg_BHT [i] = 0;
96          }
97
98        if (_param->_have_pht)
99          {
100        ALLOC2(reg_PHT                       ,Thistory_t,_param->_pht_nb_bank,_param->_pht_size_bank);
101
102        for (uint32_t i=0; i<_param->_pht_nb_bank; ++i)
103          for (uint32_t j=0; j<_param->_pht_size_bank; ++j)
104            reg_PHT [i][j] = 0;
105          }
106
107
108        ALLOC1(internal_PREDICT_ACK          ,Tcontrol_t,_param->_nb_inst_predict);
109        if (_param->_update_on_prediction)
110          {
111        if (_param->_have_bht)
112        ALLOC1(internal_PREDICT_BHT_NUM_REG  ,Thistory_t,_param->_nb_inst_predict);
113        if (_param->_have_pht)
114          {
115        ALLOC1(internal_PREDICT_PHT_NUM_BANK ,Thistory_t,_param->_nb_inst_predict);
116        ALLOC1(internal_PREDICT_PHT_NUM_REG  ,Thistory_t,_param->_nb_inst_predict);
117          }
118          }
119        ALLOC1(internal_UPDATE_ACK           ,Tcontrol_t,_param->_nb_inst_update );
120      }
121
122    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
123#ifdef POSITION
124    if (usage_is_set(_usage,USE_POSITION))
125        _component->generate_file();
126#endif
127
128    log_end(Two_Level_Branch_Predictor,FUNCTION);
129  };
130
131}; // end namespace two_level_branch_predictor
132}; // end namespace meta_predictor
133}; // end namespace direction
134}; // end namespace prediction_unit
135}; // end namespace front_end
136}; // end namespace multi_front_end
137}; // end namespace core
138
139}; // end namespace behavioural
140}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.