source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Ifetch_queue/src/Ifetch_queue_allocation.cpp @ 145

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

1) Add new algo in ifetch queue
2) Add Cancel bit
3) new config

  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1/*
2 * $Id: Ifetch_queue_allocation.cpp 136 2009-10-20 18:52:15Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Ifetch_queue/include/Ifetch_queue.h"
9#include "Behavioural/include/Allocation.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace ifetch_unit {
17namespace ifetch_queue {
18
19
20
21#undef  FUNCTION
22#define FUNCTION "Ifetch_queue::allocation"
23  void Ifetch_queue::allocation (
24#ifdef STATISTICS
25                               morpheo::behavioural::Parameters_Statistics * param_statistics
26#else
27                               void
28#endif
29                               )
30  {
31    log_printf(FUNC,Ifetch_queue,FUNCTION,"Begin");
32
33    _component   = new Component (_usage);
34
35    Entity * entity = _component->set_entity (_name       
36                                              ,"Ifetch_queue"
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 : "address" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59    {
60      ALLOC0_INTERFACE_BEGIN("address", IN, NORTH, "Transaction with PC management.");
61
62      ALLOC0_VALACK_IN ( in_ADDRESS_VAL                        ,VAL);
63      ALLOC0_VALACK_OUT(out_ADDRESS_ACK                        ,ACK);
64      ALLOC0_SIGNAL_IN ( in_ADDRESS_INSTRUCTION_ADDRESS        ,"instruction_address"        ,Tgeneral_address_t ,_param->_size_instruction_address        );
65      ALLOC0_SIGNAL_IN ( in_ADDRESS_INST_IFETCH_PTR            ,"inst_ifetch_ptr"            ,Tinst_ifetch_ptr_t ,_param->_size_inst_ifetch_ptr);
66      ALLOC0_SIGNAL_IN ( in_ADDRESS_BRANCH_STATE               ,"branch_state"               ,Tbranch_state_t    ,_param->_size_branch_state   );
67      ALLOC0_SIGNAL_IN ( in_ADDRESS_BRANCH_UPDATE_PREDICTION_ID,"branch_update_prediction_id",Tprediction_ptr_t  ,_param->_size_depth          );
68      ALLOC0_SIGNAL_OUT(out_ADDRESS_IFETCH_QUEUE_ID            ,"ifetch_queue_id"            ,Tifetch_queue_ptr_t,_param->_size_ifetch_queue_ptr);
69
70      ALLOC0_INTERFACE_END();
71    }
72    {
73      ALLOC1_INTERFACE_BEGIN("address", IN, NORTH, _("Transaction with PC management."),_param->_nb_instruction);
74
75      ALLOC1_SIGNAL_IN( in_ADDRESS_INSTRUCTION_ENABLE         ,"instruction_enable"         ,Tcontrol_t         ,1);
76
77      ALLOC1_INTERFACE_END(_param->_nb_instruction);
78    }
79
80    // ~~~~~[ Interface : "decod" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81    {
82      ALLOC1_INTERFACE_BEGIN("decod",OUT, EAST, _("Send instruction bundle to the decod's stage."),_param->_nb_instruction);
83     
84      ALLOC1_VALACK_OUT(out_DECOD_VAL        ,VAL);
85      ALLOC1_VALACK_IN ( in_DECOD_ACK        ,ACK);
86      ALLOC1_SIGNAL_OUT(out_DECOD_INSTRUCTION                ,"instruction"                ,Tinstruction_t    ,_param->_size_instruction);
87      ALLOC1_SIGNAL_OUT(out_DECOD_ADDRESS                    ,"address"                    ,Tgeneral_address_t,_param->_size_instruction_address);
88      ALLOC1_SIGNAL_OUT(out_DECOD_BRANCH_STATE               ,"branch_state"               ,Tbranch_state_t   ,_param->_size_branch_state);
89      ALLOC1_SIGNAL_OUT(out_DECOD_BRANCH_UPDATE_PREDICTION_ID,"branch_update_prediction_id",Tprediction_ptr_t ,_param->_size_depth);
90      ALLOC1_SIGNAL_OUT(out_DECOD_EXCEPTION                  ,"exception"                  ,Texception_t      ,_param->_size_exception_ifetch);
91
92      ALLOC1_INTERFACE_END(_param->_nb_instruction);
93    }
94//     {
95//       ALLOC0_INTERFACE_BEGIN("decod",OUT, EAST, _("Send instruction bundle to the decod's stage."));
96     
97//       ALLOC0_SIGNAL_OUT(out_DECOD_ADDRESS                    ,"address"                    ,Tgeneral_address_t,_param->_size_instruction_address         );
98//       ALLOC0_SIGNAL_OUT(out_DECOD_INST_IFETCH_PTR            ,"inst_ifetch_ptr"            ,Tinst_ifetch_ptr_t,_param->_size_inst_ifetch_ptr );
99//       ALLOC0_SIGNAL_OUT(out_DECOD_BRANCH_STATE               ,"branch_state"               ,Tbranch_state_t   ,_param->_size_branch_state    );
100//       ALLOC0_SIGNAL_OUT(out_DECOD_BRANCH_UPDATE_PREDICTION_ID,"branch_update_prediction_id",Tprediction_ptr_t ,_param->_size_depth           );
101//       ALLOC0_SIGNAL_OUT(out_DECOD_EXCEPTION                  ,"exception"                  ,Texception_t      ,_param->_size_exception_ifetch);
102
103//       ALLOC0_INTERFACE_END();
104//     }
105
106    // ~~~~~[ Interface "icache_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107    {
108      ALLOC0_INTERFACE_BEGIN("icache_rsp", IN, WEST, _("Respons from Instruction Cache."));
109     
110      ALLOC0_VALACK_IN ( in_ICACHE_RSP_VAL      ,VAL);
111      ALLOC0_VALACK_OUT(out_ICACHE_RSP_ACK      ,ACK);
112      ALLOC0_SIGNAL_IN ( in_ICACHE_RSP_PACKET_ID,"packet_id",Tpacket_t      ,_param->_size_ifetch_queue_ptr);
113      ALLOC0_SIGNAL_IN ( in_ICACHE_RSP_ERROR    ,"error"    ,Ticache_error_t,_param->_size_icache_error);
114
115      ALLOC0_INTERFACE_END();
116    }
117    {
118      ALLOC1_INTERFACE_BEGIN("icache_rsp", IN, WEST, _("Respons from Instruction Cache."),_param->_nb_instruction);
119     
120      ALLOC1_SIGNAL_IN ( in_ICACHE_RSP_INSTRUCTION,"instruction",Ticache_instruction_t,_param->_size_instruction);
121
122      ALLOC1_INTERFACE_END(_param->_nb_instruction);
123    }
124
125    // ~~~~~[ Interface "event_reset" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126    {
127      ALLOC0_INTERFACE_BEGIN("event_reset", IN, NORTH, _("An event occure and reset queue."));
128
129      ALLOC0_VALACK_IN ( in_EVENT_RESET_VAL,VAL);
130      ALLOC0_VALACK_OUT(out_EVENT_RESET_ACK,ACK);
131
132      ALLOC0_INTERFACE_END();
133    }
134
135    // ~~~~~[ Internal ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136    if (usage_is_set(_usage,USE_SYSTEMC))
137      {
138        ALLOC1(internal_DECOD_VAL ,Tcontrol_t,_param->_nb_instruction);
139        if (_param->_queue_scheme == IFETCH_QUEUE_SCHEME_FULL_ASSOC)
140          {
141        ALLOC1(internal_DECOD_PTR ,uint32_t  ,_param->_nb_instruction);
142        ALLOC1(internal_DECOD_SLOT,uint32_t  ,_param->_nb_instruction);
143          }
144
145        _queue = new ifetch_queue_entry_t * [_param->_size_queue];
146        for (uint32_t i=0;i<_param->_size_queue; i++)
147          _queue [i] = new ifetch_queue_entry_t (_param->_nb_instruction);
148      }
149
150    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
151
152#ifdef POSITION
153     if (usage_is_set(_usage,USE_POSITION))
154       _component->generate_file();
155#endif
156
157    log_printf(FUNC,Ifetch_queue,FUNCTION,"End");
158  };
159
160}; // end namespace ifetch_queue
161}; // end namespace ifetch_unit
162}; // end namespace front_end
163}; // end namespace multi_front_end
164}; // end namespace core
165
166}; // end namespace behavioural
167}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.