1 | /* |
---|
2 | * $Id: Icache_Access_allocation.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Icache_Access/include/Icache_Access.h" |
---|
9 | #include "Behavioural/include/Allocation.h" |
---|
10 | #include "Common/include/Max.h" |
---|
11 | |
---|
12 | namespace morpheo { |
---|
13 | namespace behavioural { |
---|
14 | namespace core { |
---|
15 | namespace icache_access { |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | #undef FUNCTION |
---|
20 | #define FUNCTION "Icache_Access::allocation" |
---|
21 | void Icache_Access::allocation ( |
---|
22 | #ifdef STATISTICS |
---|
23 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
24 | #else |
---|
25 | void |
---|
26 | #endif |
---|
27 | ) |
---|
28 | { |
---|
29 | log_begin(Icache_Access,FUNCTION); |
---|
30 | |
---|
31 | _component = new Component (_usage); |
---|
32 | |
---|
33 | Entity * entity = _component->set_entity (_name |
---|
34 | ,"Icache_Access" |
---|
35 | #ifdef POSITION |
---|
36 | ,COMBINATORY |
---|
37 | #endif |
---|
38 | ); |
---|
39 | |
---|
40 | _interfaces = entity->set_interfaces(); |
---|
41 | |
---|
42 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
43 | { |
---|
44 | Interface * interface = _interfaces->set_interface("" |
---|
45 | #ifdef POSITION |
---|
46 | ,IN |
---|
47 | ,SOUTH, |
---|
48 | _("Generalist interface") |
---|
49 | #endif |
---|
50 | ); |
---|
51 | |
---|
52 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
53 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
54 | } |
---|
55 | |
---|
56 | // ~~~~~[ Interface "icache_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
57 | { |
---|
58 | ALLOC1_INTERFACE("icache_req",WEST,OUT,_("Request to instruction cache"),_param->_nb_icache_port); |
---|
59 | |
---|
60 | ALLOC1_VALACK_OUT(out_ICACHE_REQ_VAL ,VAL); |
---|
61 | ALLOC1_VALACK_IN ( in_ICACHE_REQ_ACK ,ACK); |
---|
62 | ALLOC1_SIGNAL_OUT(out_ICACHE_REQ_THREAD_ID ,"thread_id",Tcontext_t ,_param->_size_icache_thread_id); |
---|
63 | ALLOC1_SIGNAL_OUT(out_ICACHE_REQ_PACKET_ID ,"packet_id",Tpacket_t ,_param->_size_icache_packet_id); |
---|
64 | ALLOC1_SIGNAL_OUT(out_ICACHE_REQ_ADDRESS ,"address" ,Ticache_address_t ,_param->_size_address ); |
---|
65 | ALLOC1_SIGNAL_OUT(out_ICACHE_REQ_TYPE ,"type" ,Ticache_type_t ,_param->_size_icache_type ); |
---|
66 | } |
---|
67 | |
---|
68 | // ~~~~~[ Interface "icache_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
69 | { |
---|
70 | ALLOC1_INTERFACE("icache_rsp",WEST,IN ,_("Respons from instruction cache"),_param->_nb_icache_port); |
---|
71 | |
---|
72 | ALLOC1_VALACK_IN ( in_ICACHE_RSP_VAL ,VAL); |
---|
73 | ALLOC1_VALACK_OUT(out_ICACHE_RSP_ACK ,ACK); |
---|
74 | ALLOC1_SIGNAL_IN ( in_ICACHE_RSP_THREAD_ID ,"thread_id" ,Tcontext_t ,_param->_size_icache_thread_id); |
---|
75 | ALLOC1_SIGNAL_IN ( in_ICACHE_RSP_PACKET_ID ,"packet_id" ,Tpacket_t ,_param->_size_icache_packet_id); |
---|
76 | ALLOC1_SIGNAL_IN ( in_ICACHE_RSP_ERROR ,"error" ,Ticache_error_t ,_param->_size_icache_error ); |
---|
77 | } |
---|
78 | { |
---|
79 | // NOTE : max_nb_instruction is too wide ... |
---|
80 | ALLOC2_INTERFACE("icache_rsp",WEST,IN ,_("Respons from instruction cache"),_param->_nb_icache_port,_param->_icache_nb_instruction[it1]); |
---|
81 | |
---|
82 | _ALLOC2_SIGNAL_IN ( in_ICACHE_RSP_INSTRUCTION ,"instruction",Ticache_instruction_t,_param->_size_instruction,_param->_nb_icache_port,_param->_icache_nb_instruction[it1]); |
---|
83 | } |
---|
84 | |
---|
85 | // ~~~~~[ Interface "context_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
86 | { |
---|
87 | ALLOC2_INTERFACE("context_req",EAST,IN ,_("Request from context_unit."),_param->_nb_front_end, _param->_nb_context[it1]); |
---|
88 | |
---|
89 | _ALLOC2_VALACK_IN ( in_CONTEXT_REQ_VAL ,VAL,_param->_nb_front_end, _param->_nb_context[it1]); |
---|
90 | _ALLOC2_VALACK_OUT(out_CONTEXT_REQ_ACK ,ACK,_param->_nb_front_end, _param->_nb_context[it1]); |
---|
91 | // _ALLOC2_SIGNAL_IN ( in_CONTEXT_REQ_THREAD_ID ,"thread_id" ,Tcontext_t ,_param->_size_); |
---|
92 | _ALLOC2_SIGNAL_IN ( in_CONTEXT_REQ_PACKET_ID ,"packet_id" ,Tpacket_t ,_param->_size_packet_id[it1][it2],_param->_nb_front_end, _param->_nb_context[it1]); |
---|
93 | _ALLOC2_SIGNAL_IN ( in_CONTEXT_REQ_ADDRESS ,"address" ,Ticache_address_t ,_param->_size_address ,_param->_nb_front_end, _param->_nb_context[it1]); |
---|
94 | _ALLOC2_SIGNAL_IN ( in_CONTEXT_REQ_TYPE ,"type" ,Ticache_type_t ,_param->_size_icache_type ,_param->_nb_front_end, _param->_nb_context[it1]); |
---|
95 | } |
---|
96 | |
---|
97 | // ~~~~~[ Interface "context_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
98 | { |
---|
99 | ALLOC2_INTERFACE("context_rsp",EAST,OUT,_("Respons to context_unit."),_param->_nb_front_end, _param->_nb_context[it1]); |
---|
100 | |
---|
101 | _ALLOC2_VALACK_OUT(out_CONTEXT_RSP_VAL ,VAL,_param->_nb_front_end, _param->_nb_context[it1]); |
---|
102 | _ALLOC2_VALACK_IN ( in_CONTEXT_RSP_ACK ,ACK,_param->_nb_front_end, _param->_nb_context[it1]); |
---|
103 | // _ALLOC2_SIGNAL_OUT(out_CONTEXT_RSP_THREAD_ID ,"thread_id" ,Tcontext_t ,_param->_size_ ,_param->_nb_front_end, _param->_nb_context[it1]); |
---|
104 | _ALLOC2_SIGNAL_OUT(out_CONTEXT_RSP_PACKET_ID ,"packet_id" ,Tpacket_t ,_param->_size_packet_id[it1][it2],_param->_nb_front_end, _param->_nb_context[it1]); |
---|
105 | _ALLOC2_SIGNAL_OUT(out_CONTEXT_RSP_ERROR ,"error" ,Ticache_error_t ,_param->_size_icache_error ,_param->_nb_front_end, _param->_nb_context[it1]); |
---|
106 | } |
---|
107 | { |
---|
108 | ALLOC3_INTERFACE("context_rsp",EAST,OUT,_("Respons to context_unit."),_param->_nb_front_end, _param->_nb_context[it1],_param->_nb_instruction[it1][it2]); |
---|
109 | |
---|
110 | _ALLOC3_SIGNAL_OUT(out_CONTEXT_RSP_INSTRUCTION,"instruction",Ticache_instruction_t,_param->_size_instruction,_param->_nb_front_end, _param->_nb_context[it1],_param->_nb_instruction[it1][it2]); |
---|
111 | } |
---|
112 | |
---|
113 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
114 | { |
---|
115 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
116 | #ifdef STATISTICS |
---|
117 | _internal_ICACHE_REQ_NB_ACCESS = new uint32_t [_param->_nb_icache_port]; |
---|
118 | _internal_ICACHE_REQ_NB_ACCESS_CONFLIT = new uint32_t [_param->_nb_icache_port]; |
---|
119 | #endif |
---|
120 | } |
---|
121 | |
---|
122 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
123 | _priority = new generic::priority::Priority (_name+"_priority", |
---|
124 | _param->_priority , |
---|
125 | _param->_load_balancing, |
---|
126 | _param->_nb_front_end , |
---|
127 | _param->_nb_context , |
---|
128 | _param->_nb_front_end ); |
---|
129 | |
---|
130 | #ifdef POSITION |
---|
131 | if (usage_is_set(_usage,USE_POSITION)) |
---|
132 | _component->generate_file(); |
---|
133 | #endif |
---|
134 | |
---|
135 | log_end(Icache_Access,FUNCTION); |
---|
136 | }; |
---|
137 | |
---|
138 | }; // end namespace icache_access |
---|
139 | }; // end namespace core |
---|
140 | |
---|
141 | }; // end namespace behavioural |
---|
142 | }; // end namespace morpheo |
---|