source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/src/Context_State_allocation.cpp @ 95

Last change on this file since 95 was 95, checked in by rosiere, 16 years ago

1) Update Prediction Table - New architecture (systemC) done (and tested) -> need change interface in top level
2) Change documentation on VHDL generation
3) Change VHDL constant (case std_logic and std_logic_vector)

  • Property svn:keywords set to Id
File size: 11.0 KB
Line 
1/*
2 * $Id: Context_State_allocation.cpp 95 2008-12-16 16:24:26Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Context_State/include/Context_State.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 context_state {
18
19
20
21#undef  FUNCTION
22#define FUNCTION "Context_State::allocation"
23  void Context_State::allocation (
24#ifdef STATISTICS
25                               morpheo::behavioural::Parameters_Statistics * param_statistics
26#else
27                               void
28#endif
29                               )
30  {
31    log_begin(Context_State,FUNCTION);
32
33    _component   = new Component (_usage);
34
35    Entity * entity = _component->set_entity (_name       
36                                              ,"Context_State"
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 : "branch_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59    {
60      ALLOC1_INTERFACE("branch_event", IN,SOUTH, "branch_event", _param->_nb_context);
61     
62      ALLOC1_VALACK_IN ( in_BRANCH_EVENT_VAL                   ,VAL);
63      ALLOC1_VALACK_OUT(out_BRANCH_EVENT_ACK                   ,ACK);
64//    ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_CONTEXT_ID            ,"context_id"             ,Tcontext_t         ,_param->_size_context_id);
65//    ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_DEPTH                 ,"depth"                  ,Tdepth_t           ,_param->_size_depth);
66//    ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_MISS_PREDICTION       ,"miss_prediction"        ,Tcontrol_t         ,1);
67      ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_ADDRESS_SRC           ,"address_src"            ,Taddress_t         ,_param->_size_instruction_address);
68      ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_ADDRESS_DEST_VAL      ,"address_dest_val"       ,Tcontrol_t         ,1);
69      ALLOC1_SIGNAL_IN ( in_BRANCH_EVENT_ADDRESS_DEST          ,"address_dest"           ,Taddress_t         ,_param->_size_instruction_address);
70    }
71
72    // ~~~~~[ Interface : "decod_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73    {
74      ALLOC1_INTERFACE("decod_event",IN ,SOUTH, _("Decod Interface"), _param->_nb_decod_unit);
75
76      ALLOC1_VALACK_IN ( in_DECOD_EVENT_VAL                    ,VAL);
77      ALLOC1_VALACK_OUT(out_DECOD_EVENT_ACK                    ,ACK);
78      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_CONTEXT_ID             ,"context_id"             ,Tcontext_t         ,_param->_size_context_id);
79      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_DEPTH                  ,"depth"                  ,Tdepth_t           ,_param->_size_depth);
80      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_TYPE                   ,"type"                   ,Tevent_type_t      ,_param->_size_event_type);
81      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_IS_DELAY_SLOT          ,"is_delay_slot"          ,Tcontrol_t         ,1);
82      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_ADDRESS                ,"address"                ,Taddress_t         ,_param->_size_instruction_address);
83      ALLOC1_SIGNAL_IN ( in_DECOD_EVENT_ADDRESS_EPCR           ,"address_epcr"           ,Taddress_t         ,_param->_size_instruction_address);
84    }
85
86    // ~~~~~[ Interface : "commit_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
87    {
88      ALLOC_INTERFACE("commit_event",IN ,EAST, _("Interface with the Re Order Buffer"));
89
90      ALLOC_VALACK_IN  ( in_COMMIT_EVENT_VAL                   ,VAL);
91      ALLOC_VALACK_OUT (out_COMMIT_EVENT_ACK                   ,ACK);
92      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_CONTEXT_ID            ,"context_id"      ,Tcontext_t         ,_param->_size_context_id);
93      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_DEPTH                 ,"depth"           ,Tdepth_t           ,_param->_size_depth);
94      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_TYPE                  ,"type"            ,Tevent_type_t      ,_param->_size_event_type);
95      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_IS_DELAY_SLOT         ,"is_delay_slot"   ,Tcontrol_t         ,1);
96      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_ADDRESS               ,"address"         ,Taddress_t         ,_param->_size_instruction_address);
97      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_ADDRESS_EPCR          ,"address_epcr"    ,Taddress_t         ,_param->_size_instruction_address);
98      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_ADDRESS_EEAR_VAL      ,"address_eear_val",Tcontrol_t         ,1);
99      ALLOC_SIGNAL_IN  ( in_COMMIT_EVENT_ADDRESS_EEAR          ,"address_eear"    ,Taddress_t         ,_param->_size_instruction_address);
100    }
101
102    // ~~~~~[ Interface : "branch_complete" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103    {
104      ALLOC1_INTERFACE("branch_complete",IN ,NORTH, _("Interface with the prediction_unit."), _param->_nb_inst_branch_complete);
105
106      ALLOC1_VALACK_IN ( in_BRANCH_COMPLETE_VAL                ,VAL);
107      ALLOC1_VALACK_OUT(out_BRANCH_COMPLETE_ACK                ,ACK);
108      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_CONTEXT_ID         ,"context_id"     ,Tcontext_t         ,_param->_size_context_id);
109      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_DEPTH              ,"depth"          ,Tdepth_t           ,_param->_size_depth);
110      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_MISS_PREDICTION    ,"miss_prediction",Tcontrol_t         ,1);
111      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_TAKE               ,"take"           ,Tcontrol_t         ,1);
112      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_ADDRESS_SRC        ,"address_src"    ,Taddress_t         ,_param->_size_instruction_address);
113      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_ADDRESS_DEST       ,"address_dest"   ,Taddress_t         ,_param->_size_instruction_address);
114    }
115
116    // ~~~~~[ Interface : "nb_inst" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
117    {
118      ALLOC1_INTERFACE("nb_inst",IN ,EAST, _("Interface to count in fligt present instruction."),_param->_nb_context);
119
120      ALLOC1_SIGNAL_IN ( in_NB_INST_DECOD_ALL                  ,"decod_all" ,Tcounter_t         ,_param->_size_nb_inst_decod);
121      ALLOC1_SIGNAL_IN ( in_NB_INST_COMMIT_ALL                 ,"commit_all",Tcounter_t         ,_param->_size_nb_inst_commit);
122      ALLOC1_SIGNAL_IN ( in_NB_INST_COMMIT_MEM                 ,"commit_mem",Tcounter_t         ,_param->_size_nb_inst_commit);
123    }
124
125    // ~~~~~[ Interface "event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126    {
127      ALLOC1_INTERFACE("event",OUT,WEST, _("An event occure : change PC address."), _param->_nb_context);
128     
129      ALLOC1_VALACK_OUT(out_EVENT_VAL                          ,VAL);
130      ALLOC1_VALACK_IN ( in_EVENT_ACK                          ,ACK);
131      ALLOC1_SIGNAL_OUT(out_EVENT_ADDRESS                      ,"address"         ,Taddress_t        ,_param->_size_instruction_address);
132      ALLOC1_SIGNAL_OUT(out_EVENT_ADDRESS_NEXT                 ,"address_next"    ,Taddress_t        ,_param->_size_instruction_address); 
133      ALLOC1_SIGNAL_OUT(out_EVENT_ADDRESS_NEXT_VAL             ,"address_next_val",Tcontrol_t        ,1);
134      ALLOC1_SIGNAL_OUT(out_EVENT_IS_DS_TAKE                   ,"is_ds_take"      ,Tcontrol_t        ,1);
135    }
136
137    // ~~~~~[ Interface "spr_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138    {
139      ALLOC1_INTERFACE("spr_event",OUT,WEST, _("An exception occure : write \"exception PC\"."), _param->_nb_context);
140
141      ALLOC1_VALACK_OUT(out_SPR_EVENT_VAL                      ,VAL);
142      ALLOC1_VALACK_IN ( in_SPR_EVENT_ACK                      ,ACK);
143      ALLOC1_SIGNAL_OUT(out_SPR_EVENT_EPCR                     ,"epcr"     ,Taddress_t, _param->_size_instruction_address);
144      ALLOC1_SIGNAL_OUT(out_SPR_EVENT_EEAR                     ,"eear"     ,Taddress_t, _param->_size_instruction_address);
145      ALLOC1_SIGNAL_OUT(out_SPR_EVENT_EEAR_WEN                 ,"eear_wen" ,Tcontrol_t,1);
146      ALLOC1_SIGNAL_OUT(out_SPR_EVENT_SR_DSX                   ,"sr_dsx"   ,Tcontrol_t,1);
147      ALLOC1_SIGNAL_OUT(out_SPR_EVENT_SR_TO_ESR                ,"sr_to_esr",Tcontrol_t,1);
148    }
149
150    // ~~~~~[ Interface : "context" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151    {
152      ALLOC1_INTERFACE("context",OUT,SOUTH, _("To decod."), _param->_nb_context);
153     
154      ALLOC1_SIGNAL_OUT(out_CONTEXT_DECOD_ENABLE               ,"decod_enable",Tcontrol_t,1);
155    }
156
157    // ~~~~~[ Interface : "depth" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158    {
159      ALLOC1_INTERFACE("depth",IN ,NORTH, _("From prediction_unit."), _param->_nb_context);
160     
161      ALLOC1_SIGNAL_IN ( in_DEPTH_MIN                          ,"min" ,Tdepth_t,_param->_size_depth);
162    }
163
164
165    // ~~~~~[ Interface : "spr" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~         
166    {
167      ALLOC1_INTERFACE("spr",IN,EAST,_("Interface with the special registerFile"),_param->_nb_context);
168     
169      ALLOC1_SIGNAL_IN ( in_SPR_SR_IEE                         ,"SR_IEE",Tcontrol_t,1);
170      ALLOC1_SIGNAL_IN ( in_SPR_SR_EPH                         ,"SR_EPH",Tcontrol_t,1);
171    }
172
173    // ~~~~~[ Interface : "interrupt" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174    {
175      ALLOC1_INTERFACE("interrupt",IN,NORTH,_("Interrupt Exception"),_param->_nb_context);
176
177      ALLOC1_SIGNAL_IN ( in_INTERRUPT_ENABLE                   ,"ENABLE",Tcontrol_t,1);
178    }
179
180    if (usage_is_set(_usage,USE_SYSTEMC))
181      {
182     // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
183       
184     reg_STATE                  = new context_state_t [_param->_nb_context];
185     reg_EVENT_ADDRESS          = new Taddress_t      [_param->_nb_context];
186     reg_EVENT_ADDRESS_EPCR     = new Taddress_t      [_param->_nb_context]; 
187     reg_EVENT_ADDRESS_EPCR_VAL = new Tcontrol_t      [_param->_nb_context];
188     reg_EVENT_ADDRESS_EEAR     = new Taddress_t      [_param->_nb_context]; 
189     reg_EVENT_ADDRESS_EEAR_VAL = new Tcontrol_t      [_param->_nb_context];
190     reg_EVENT_IS_DELAY_SLOT    = new Tcontrol_t      [_param->_nb_context];
191     reg_EVENT_IS_DS_TAKE       = new Tcontrol_t      [_param->_nb_context];
192     reg_EVENT_DEPTH            = new Tdepth_t        [_param->_nb_context];
193     reg_INTERRUPT_ENABLE       = new Tcontrol_t      [_param->_nb_context];
194       
195     // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
196     internal_BRANCH_EVENT_ACK    = new Tcontrol_t [_param->_nb_context];
197     internal_DECOD_EVENT_ACK     = new Tcontrol_t [_param->_nb_decod_unit];
198     internal_BRANCH_COMPLETE_ACK = new Tcontrol_t [_param->_nb_inst_branch_complete];
199     internal_EVENT_VAL           = new Tcontrol_t [_param->_nb_context];
200     internal_SPR_EVENT_VAL       = new Tcontrol_t [_param->_nb_context];
201      }
202
203    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
204
205#ifdef POSITION
206    if (usage_is_set(_usage,USE_POSITION))
207      _component->generate_file();
208#endif
209
210    log_end(Context_State,FUNCTION);
211  };
212
213}; // end namespace context_state
214}; // end namespace front_end
215}; // end namespace multi_front_end
216}; // end namespace core
217
218}; // end namespace behavioural
219}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.