source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_allocation.cpp @ 81

Last change on this file since 81 was 81, checked in by rosiere, 16 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 5.4 KB
Line 
1/*
2 * $Id: Return_Address_Stack_allocation.cpp 81 2008-04-15 18:40:01Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/include/Return_Address_Stack.h"
9#include "Behavioural/include/Allocation.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17namespace return_address_stack {
18
19
20
21#undef  FUNCTION
22#define FUNCTION "Return_Address_Stack::allocation"
23  void Return_Address_Stack::allocation (
24#ifdef STATISTICS
25                               morpheo::behavioural::Parameters_Statistics * param_statistics
26#else
27                               void
28#endif
29                               )
30  {
31    log_printf(FUNC,Return_Address_Stack,FUNCTION,"Begin");
32
33    _component   = new Component (_usage);
34
35    Entity * entity = _component->set_entity (_name       
36                                              ,"Return_Address_Stack"
37#ifdef POSITION
38                                              ,COMBINATORY
39#endif
40                                              );
41
42    _interfaces = entity->set_interfaces();
43
44    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45    {
46      Interface * interface = _interfaces->set_interface(""
47#ifdef POSITION
48                                                         ,IN
49                                                         ,SOUTH,
50                                                         "Generalist interface"
51#endif
52                                                         );
53     
54      in_CLOCK        = interface->set_signal_clk              ("clock" ,1, CLOCK_VHDL_YES);
55      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
56    }
57
58    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59    {
60      ALLOC1_INTERFACE("predict", IN, SOUTH, "predict's interface", _param->_nb_inst_predict);
61
62      ALLOC1_VALACK_IN ( in_PREDICT_VAL         ,VAL);
63      ALLOC1_VALACK_OUT(out_PREDICT_ACK         ,ACK);
64      ALLOC1_SIGNAL_IN ( in_PREDICT_CONTEXT_ID  ,"context_id"  ,Tcontext_t,_param->_size_context_id); 
65      ALLOC1_SIGNAL_OUT(out_PREDICT_HIT         ,"hit"         ,Tcontrol_t,1); 
66      ALLOC1_SIGNAL_IN ( in_PREDICT_PUSH        ,"push"        ,Tcontrol_t,1);
67      ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS_PUSH,"address_push",Taddress_t,_param->_size_address);
68      ALLOC1_SIGNAL_OUT(out_PREDICT_ADDRESS_POP ,"address_pop" ,Taddress_t,_param->_size_address);
69      ALLOC1_SIGNAL_OUT(out_PREDICT_INDEX       ,"index"       ,Tptr_t    ,_param->_size_index);
70    }
71
72    // ~~~~~[ Interface : "decod" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73    {
74      ALLOC1_INTERFACE("decod", IN, SOUTH, "decod's interface", _param->_nb_inst_decod);
75
76      ALLOC1_VALACK_IN ( in_DECOD_VAL            ,VAL);
77      ALLOC1_VALACK_OUT(out_DECOD_ACK            ,ACK);
78      ALLOC1_SIGNAL_IN ( in_DECOD_CONTEXT_ID     ,"context_id"     ,Tcontext_t,_param->_size_context_id); 
79      ALLOC1_SIGNAL_OUT(out_DECOD_HIT            ,"hit"            ,Tcontrol_t,1); 
80      ALLOC1_SIGNAL_IN ( in_DECOD_PUSH           ,"push"           ,Tcontrol_t,1);
81      ALLOC1_SIGNAL_IN ( in_DECOD_ADDRESS_PUSH   ,"address_push"   ,Taddress_t,_param->_size_address);
82      ALLOC1_SIGNAL_OUT(out_DECOD_ADDRESS_POP    ,"address_pop"    ,Taddress_t,_param->_size_address);
83      ALLOC1_SIGNAL_OUT(out_DECOD_INDEX          ,"index"          ,Tptr_t    ,_param->_size_index);
84      ALLOC1_SIGNAL_IN ( in_DECOD_MISS_PREDICTION,"miss_prediction",Tcontrol_t,1);
85    }
86
87    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
88    {
89      ALLOC1_INTERFACE("update", IN, SOUTH, "update's interface", _param->_nb_inst_update);
90
91      ALLOC1_VALACK_IN ( in_UPDATE_VAL            ,VAL);
92      ALLOC1_VALACK_OUT(out_UPDATE_ACK            ,ACK);
93      ALLOC1_SIGNAL_IN ( in_UPDATE_CONTEXT_ID     ,"context_id"     ,Tcontext_t,_param->_size_context_id); 
94      ALLOC1_SIGNAL_IN ( in_UPDATE_PUSH           ,"push"           ,Tcontrol_t,1);
95      ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS        ,"address"        ,Taddress_t,_param->_size_address);
96      ALLOC1_SIGNAL_IN ( in_UPDATE_INDEX          ,"index"          ,Tptr_t    ,_param->_size_index);
97      ALLOC1_SIGNAL_IN ( in_UPDATE_MISS_PREDICTION,"miss_prediction",Tcontrol_t,1);
98      ALLOC1_SIGNAL_IN ( in_UPDATE_PREDICTION_IFETCH,"prediction_ifetch",Tcontrol_t,1);
99    }
100
101    // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102
103    reg_stack = new ras_entry_t * [_param->_nb_context];
104    for (uint32_t i=0; i<_param->_nb_context; i++)
105      reg_stack [i] = new ras_entry_t [_param->_size_queue [i]];
106
107    reg_TOP              = new Tptr_t     [_param->_nb_context];
108    reg_BOTTOM           = new Tptr_t     [_param->_nb_context];
109    reg_NB_ELT           = new Tptr_t     [_param->_nb_context];
110
111    reg_PREDICT_TOP      = new Tptr_t     [_param->_nb_context];
112    reg_PREDICT_BOTTOM   = new Tptr_t     [_param->_nb_context];
113    reg_PREDICT_NB_ELT   = new Tptr_t     [_param->_nb_context];
114
115    internal_PREDICT_ACK = new Tcontrol_t [_param->_nb_inst_predict];
116    internal_PREDICT_HIT = new Tcontrol_t [_param->_nb_inst_predict];
117    internal_DECOD_ACK   = new Tcontrol_t [_param->_nb_inst_decod  ];
118    internal_DECOD_HIT   = new Tcontrol_t [_param->_nb_inst_decod  ];
119    internal_UPDATE_ACK  = new Tcontrol_t [_param->_nb_inst_update ];
120
121    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
122
123#ifdef POSITION
124    _component->generate_file();
125#endif
126
127    log_printf(FUNC,Return_Address_Stack,FUNCTION,"End");
128  };
129
130}; // end namespace return_address_stack
131}; // end namespace prediction_unit
132}; // end namespace front_end
133}; // end namespace multi_front_end
134}; // end namespace core
135}; // end namespace behavioural
136}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.