ipxact-tools 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/config/detector.yml +63 -0
  2. data/lib/ipxact_tools.rb +287 -0
  3. data/lib/ipxact_tools/graph_pathfinder.rb +191 -0
  4. data/lib/ipxact_tools/interrupt_line_detector.rb +98 -0
  5. data/spec/integration/integration_spec.rb +254 -0
  6. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port.h +135 -0
  7. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port.tpp +247 -0
  8. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port_base.h +189 -0
  9. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_router.h +205 -0
  10. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_router.tpp +278 -0
  11. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_slave_base.h +115 -0
  12. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_slave_base.tpp +126 -0
  13. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_target_port.h +168 -0
  14. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_target_port_base.h +133 -0
  15. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_tlm_if.h +280 -0
  16. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/user_types.h +38 -0
  17. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/Leon2Platform.xml +77 -0
  18. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/design_Leon2Platform.xml +156 -0
  19. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/tlmsrc/Leon2Platform.h +149 -0
  20. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/apbSubSystem.xml +406 -0
  21. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/design_apbSubSystem.xml +135 -0
  22. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/tlmsrc/apbSubSystem.h +133 -0
  23. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/Leon2Platform.xml +77 -0
  24. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/design_Leon2Platform.xml +157 -0
  25. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/tlmsrc/Leon2Platform.h +150 -0
  26. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/apbSubSystem.xml +422 -0
  27. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/designConfig_apbSubSystem.xml +79 -0
  28. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/design_apbSubSystem.xml +184 -0
  29. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/tlmsrc/apbSubSystem.h +164 -0
  30. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/Leon2Platform.xml +105 -0
  31. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/design_Leon2Platform.xml +157 -0
  32. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/tlmsrc/Leon2Platform.h +152 -0
  33. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/apbSubSystem.xml +429 -0
  34. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/designConfig_apbSubSystem.xml +64 -0
  35. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/design_apbSubSystem.xml +150 -0
  36. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/tlmsrc/apbSubSystem.h +167 -0
  37. data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbbus/1.4/ahbbus22.xml +236 -0
  38. data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbbus/1.4/tlmsrc/ahbbus.h +52 -0
  39. data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/ahbram.xml +184 -0
  40. data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/tlmsrc/ahbram.cc +93 -0
  41. data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/tlmsrc/ahbram.h +77 -0
  42. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbbus/1.4/apbbus8.xml +544 -0
  43. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbbus/1.4/tlmsrc/apbbus.h +55 -0
  44. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbmst/1.4/apbmst.xml +209 -0
  45. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbmst/1.4/tlmsrc/apbmst.h +53 -0
  46. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/apbram.xml +395 -0
  47. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.cc +89 -0
  48. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.h +69 -0
  49. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.v +82 -0
  50. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.vhd +132 -0
  51. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/cgu.xml +686 -0
  52. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/tlmsrc/cgu.cc +121 -0
  53. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/tlmsrc/cgu.h +81 -0
  54. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/cgu.xml +707 -0
  55. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/tlmsrc/cgu.cc +121 -0
  56. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/tlmsrc/cgu.h +81 -0
  57. data/spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/dma.xml +272 -0
  58. data/spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/tlmsrc/dma.cc +230 -0
  59. data/spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/tlmsrc/dma.h +116 -0
  60. data/spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/irqctrl.xml +530 -0
  61. data/spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/tlmsrc/irqctrl.cc +211 -0
  62. data/spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/tlmsrc/irqctrl.h +108 -0
  63. data/spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/processor.xml +423 -0
  64. data/spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/tlmsrc/processor.cc +331 -0
  65. data/spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/tlmsrc/processor.h +121 -0
  66. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/pv2apb.xml +240 -0
  67. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/tlmsrc/pv2apb.cc +153 -0
  68. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/tlmsrc/pv2apb.h +77 -0
  69. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/pv2tac.xml +154 -0
  70. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/tlmsrc/pv2tac.cc +114 -0
  71. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/tlmsrc/pv2tac.h +67 -0
  72. data/spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/rgu.xml +766 -0
  73. data/spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/tlmsrc/rgu.cc +126 -0
  74. data/spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/tlmsrc/rgu.h +105 -0
  75. data/spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/scmlAdaptor.xml +154 -0
  76. data/spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/tlmsrc/scmladaptor.cc +100 -0
  77. data/spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/tlmsrc/scmladaptor.h +62 -0
  78. data/spec/test_data/spiritconsortium.org/Leon2TLM/serial_device/1.0/serial_device.xml +151 -0
  79. data/spec/test_data/spiritconsortium.org/Leon2TLM/serial_device/1.0/tlmsrc/serial_device.h +85 -0
  80. data/spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/timers.xml +460 -0
  81. data/spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/tlmsrc/timers.cc +201 -0
  82. data/spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/tlmsrc/timers.h +102 -0
  83. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart.h +152 -0
  84. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_fifo.h +113 -0
  85. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_memory_map.h +96 -0
  86. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_types.h +60 -0
  87. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart.cc +125 -0
  88. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_interrupt_handler.cc +136 -0
  89. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_register_bank.cc +129 -0
  90. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_serial_tx_rx.cc +145 -0
  91. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/uart_scml.xml +372 -0
  92. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/Leon2_uart.h +216 -0
  93. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/def_Leon2_uart.h +34 -0
  94. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlm_field.h +72 -0
  95. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlm_register.h +129 -0
  96. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlmreg_Leon2_uart.h +133 -0
  97. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/Leon2_uart.cc +316 -0
  98. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/tlmreg_Leon2_uart.cc +197 -0
  99. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/user_specific_Leon2_uart.cc +146 -0
  100. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/uart_tac.xml +222 -0
  101. data/spec/unit/graph_pathfinder_spec.rb +128 -0
  102. metadata +272 -0
@@ -0,0 +1,247 @@
1
+ /* -*- C++ -*- */
2
+ /*****************************************************************************
3
+
4
+ Revision: $Revision: 1506 $
5
+ Date: $Date: 2009-04-26 01:51:56 -0500 (Sun, 26 Apr 2009) $
6
+
7
+ Copyright (c) 2008, 2009 The SPIRIT Consortium.
8
+
9
+ This work forms part of a deliverable of The SPIRIT Consortium.
10
+
11
+ Use of these materials are governed by the legal terms and conditions
12
+ outlined in the disclaimer available from www.spiritconsortium.org.
13
+
14
+ This source file is provided on an AS IS basis. The SPIRIT
15
+ Consortium disclaims any warranty express or implied including
16
+ any warranty of merchantability and fitness for use for a
17
+ particular purpose.
18
+
19
+ The user of the source file shall indemnify and hold The SPIRIT
20
+ Consortium and its members harmless from any damages or liability.
21
+ Users are requested to provide feedback to The SPIRIT Consortium
22
+ using either mailto:feedback@lists.spiritconsortium.org or the forms at
23
+ http://www.spiritconsortium.org/about/contact_us/
24
+
25
+ This file may be copied, and distributed, with or without
26
+ modifications; but this notice must be included on any copy.
27
+
28
+ The following code is derived, directly or indirectly, from the SystemC
29
+ source code Copyright (c) 1996-2004 by all Contributors.
30
+ All Rights reserved.
31
+
32
+ The contents of this file are subject to the restrictions and limitations
33
+ set forth in the SystemC Open Source License Version 2.4 (the "License");
34
+ You may not use this file except in compliance with such restrictions and
35
+ limitations. You may obtain instructions on how to receive a copy of the
36
+ License at http://www.systemc.org/. Software distributed by Contributors
37
+ under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
38
+ ANY KIND, either express or implied. See the License for the specific
39
+ language governing rights and limitations under the License.
40
+
41
+ *****************************************************************************/
42
+
43
+ /*------------------------------------------------------------------------------
44
+ * Includes
45
+ *----------------------------------------------------------------------------*/
46
+ #include "pv_initiator_port.h"
47
+ #include <string>
48
+
49
+
50
+
51
+ //--------------
52
+ // Constructor
53
+ //--------------
54
+ template<typename ADDRESS,typename DATA,int N>
55
+ pv_initiator_port<ADDRESS,DATA,N>::pv_initiator_port(const char * port_name) :
56
+ sc_initiator_port_type(port_name)
57
+ {}
58
+
59
+ //---------------------------------------
60
+ // Execute the transaction transfer
61
+ //---------------------------------------
62
+ template<typename ADDRESS,typename DATA,int N>
63
+ void
64
+ pv_initiator_port<ADDRESS,DATA,N>::do_transport(request_type& request,
65
+ response_type& response,
66
+ unsigned int target_port_rank)
67
+ {
68
+ // Send initiator request to the target, functionnal call method using -> operator of sc_port
69
+ // response = (*this)[target_port_rank]->transport(request);
70
+
71
+ pv_target_port<ADDRESS,DATA>& target_port = *(static_cast<pv_target_port<ADDRESS,DATA>* >(this->get_target_port_list()[target_port_rank]));
72
+ response = target_port->transport(request);
73
+ }
74
+
75
+ //-------------------------------
76
+ // pv_tlm_if methods implementation
77
+ //-------------------------------
78
+
79
+ //----------------------------
80
+ // Read access
81
+ template<typename ADDRESS,typename DATA,int N>
82
+ tlm::tlm_status
83
+ pv_initiator_port<ADDRESS,DATA,N>::read(const ADDRESS& address,
84
+ DATA& data,
85
+ const unsigned int byte_enable,
86
+ const tlm::tlm_mode mode,
87
+ const unsigned int export_id
88
+ )
89
+ {
90
+ response_type response;
91
+ request_type request;
92
+ request.set_command(PV_READ);
93
+ request.set_address(address);
94
+
95
+ do_transport(request,response);
96
+
97
+ data = response.get_data();
98
+
99
+ return response.get_status();
100
+ }
101
+
102
+ //----------------------------
103
+ // Write access
104
+ template<typename ADDRESS,typename DATA,int N>
105
+ tlm::tlm_status
106
+ pv_initiator_port<ADDRESS,DATA,N>::write(const ADDRESS& address,
107
+ const DATA& data,
108
+ const unsigned int byte_enable,
109
+ const tlm::tlm_mode mode,
110
+ const unsigned int export_id
111
+ )
112
+ {
113
+ response_type response;
114
+ request_type request;
115
+ request.set_command(PV_WRITE);
116
+ request.set_address(address);
117
+ request.set_data(data);
118
+
119
+ do_transport(request,response);
120
+
121
+ return(response.get_status());
122
+ }
123
+
124
+
125
+ template<typename ADDRESS,typename DATA,int N>
126
+ bool
127
+ pv_initiator_port<ADDRESS,DATA,N>::is_interface_bound_twice(sc_export_base& target_port_)
128
+ {
129
+ for(int i=0;i<this->size();i++) {
130
+ if ((*this)[i] == target_port_.get_interface()) {
131
+ sc_object * tmp = dynamic_cast<sc_object * >(target_port_.get_interface());
132
+ std::string if_name;
133
+ if (tmp) if_name = tmp->name();
134
+ else if_name = "unnamed interface/non sc_object";
135
+
136
+ std::string msg(sc_object::name());
137
+ msg += (std::string)(": tlm_initiator_port warning, while binding the interface \"");
138
+ msg += if_name + (std::string)("\" exported by target port ");
139
+ msg += (std::string)(target_port_.name()) + (std::string)(": the initiator port is already bound to this interface\n");
140
+ SC_REPORT_WARNING("binding warning",msg.c_str());
141
+
142
+ return(true);
143
+ }
144
+ }
145
+ return(false);
146
+ }
147
+
148
+ template<typename ADDRESS,typename DATA,int N>
149
+ void
150
+ pv_initiator_port<ADDRESS,DATA,N>::before_end_of_elaboration()
151
+ {
152
+
153
+ // Registered target port list propagation (complete sharing of target_port_list between all initiator ports)
154
+ // If current port's target port list exist, share the list with all other port of the chain using the
155
+ // reversed initiator port list.
156
+ if (m_target_port_list.size()) {
157
+ for(typename std::vector<initiator_port_base_type *>::iterator port = get_reversed_initiator_port_list().begin();
158
+ port != get_reversed_initiator_port_list().end();
159
+ port++) {
160
+
161
+ // Copy the target port(s) to the target port list of the registered initiator (port info. propagation)
162
+ if ((*port) != this) {
163
+ for(typename std::vector<target_port_base_type *>::iterator target_port = m_target_port_list.begin();
164
+ target_port != m_target_port_list.end();
165
+ target_port++) {
166
+ (*port)->register_target_port((*target_port));
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ // Recreate the complete list of registered initiator_port, from deeper port to higher port (hierarchically speaking)
173
+ // Objective: deeper port is able to "see" all others but intermediate port cannot "see" deeper ports.
174
+ std::vector<initiator_port_base_type *> tmp_initiator_port_list;
175
+ tmp_initiator_port_list.push_back(this);
176
+ this->create_port_list(tmp_initiator_port_list);
177
+ // replace the regular initiator port list: this list is now complete
178
+ this->set_initiator_port_list(tmp_initiator_port_list);
179
+ }
180
+
181
+
182
+ template<typename ADDRESS,typename DATA,int N>
183
+ void
184
+ pv_initiator_port<ADDRESS,DATA,N>::end_of_elaboration()
185
+ {
186
+ // Checks the target port list
187
+ if ((!get_target_port_list().size()) && this->size()) {
188
+ std::string msg(sc_object::name());
189
+ msg += (std::string)(": tlm_initiator_port error, target port list is empty. Initiator port should be bound at least to one target port\n");
190
+ SC_REPORT_ERROR("port end of elaboration",msg.c_str());
191
+ }
192
+ }
193
+
194
+ template<typename ADDRESS,typename DATA,int N>
195
+ void
196
+ pv_initiator_port<ADDRESS,DATA,N>::bind(pv_target_port_type& target_port_) {
197
+ if (!is_interface_bound_twice(target_port_))
198
+ // Registers the target port
199
+ register_target_port(&target_port_);
200
+
201
+ // Calls sc_port standard bind() method
202
+ sc_port_b<interface_type>::bind(target_port_);
203
+ }
204
+
205
+ template<typename ADDRESS,typename DATA,int N>
206
+ void
207
+ pv_initiator_port<ADDRESS,DATA,N>::operator() (pv_target_port_type& target_port_) {
208
+ bind(target_port_);
209
+ }
210
+
211
+ template<typename ADDRESS,typename DATA,int N>
212
+ void
213
+ pv_initiator_port<ADDRESS,DATA,N>::bind(sc_port_b<interface_type>& port_) {
214
+ // Register the bound port in the regular list
215
+ this->register_initiator_port(static_cast<pv_initiator_port_type *>(&port_));
216
+
217
+ // Bound port registers the current port. Used to share the target port list between all port before the end of elaboration
218
+ for(typename std::vector<initiator_port_base_type *>::iterator initiator_port = get_reversed_initiator_port_list().begin();
219
+ initiator_port != get_reversed_initiator_port_list().end();
220
+ initiator_port++) {
221
+ static_cast<pv_initiator_port_type *>(&port_)->reversed_register_initiator_port(*initiator_port);
222
+ }
223
+
224
+ // Calls sc_port standard bind() method
225
+ sc_port_b<interface_type>::bind(port_);
226
+ }
227
+
228
+ template<typename ADDRESS,typename DATA,int N>
229
+ void
230
+ pv_initiator_port<ADDRESS,DATA,N>::operator() (sc_port_b<interface_type>& port_) {
231
+ bind(port_);
232
+ }
233
+
234
+ template<typename ADDRESS,typename DATA,int N>
235
+ void
236
+ pv_initiator_port<ADDRESS,DATA,N>::bind(interface_type& interface_) {
237
+ // Calls sc_port standard bind method
238
+ sc_port_b<interface_type>::bind(interface_);
239
+ }
240
+
241
+ template<typename ADDRESS,typename DATA,int N>
242
+ void
243
+ pv_initiator_port<ADDRESS,DATA,N>::operator() (interface_type& interface_) {
244
+ sc_port_b<interface_type>::bind(interface_);
245
+ }
246
+
247
+ /* END of pv_initiator_port.tpp */
@@ -0,0 +1,189 @@
1
+ /*****************************************************************************
2
+ Description: pv_initiator_port_base.h
3
+ Author: The SPIRIT Consortium
4
+ Revision: $Revision: 1506 $
5
+ Date: $Date: 2009-04-26 01:51:56 -0500 (Sun, 26 Apr 2009) $
6
+
7
+ Copyright (c) 2008, 2009 The SPIRIT Consortium.
8
+
9
+ This work forms part of a deliverable of The SPIRIT Consortium.
10
+
11
+ Use of these materials are governed by the legal terms and conditions
12
+ outlined in the disclaimer available from www.spiritconsortium.org.
13
+
14
+ This source file is provided on an AS IS basis. The SPIRIT
15
+ Consortium disclaims any warranty express or implied including
16
+ any warranty of merchantability and fitness for use for a
17
+ particular purpose.
18
+
19
+ The user of the source file shall indemnify and hold The SPIRIT
20
+ Consortium and its members harmless from any damages or liability.
21
+ Users are requested to provide feedback to The SPIRIT Consortium
22
+ using either mailto:feedback@lists.spiritconsortium.org or the forms at
23
+ http://www.spiritconsortium.org/about/contact_us/
24
+
25
+ This file may be copied, and distributed, with or without
26
+ modifications; but this notice must be included on any copy.
27
+ -----------------------------------------------------------------------------
28
+
29
+ The following code is derived, directly or indirectly, from the SystemC
30
+ source code Copyright (c) 1996-2004 by all Contributors.
31
+ All Rights reserved.
32
+
33
+ The contents of this file are subject to the restrictions and limitations
34
+ set forth in the SystemC Open Source License Version 2.4 (the "License");
35
+ You may not use this file except in compliance with such restrictions and
36
+ limitations. You may obtain instructions on how to receive a copy of the
37
+ License at http://www.systemc.org/. Software distributed by Contributors
38
+ under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
39
+ ANY KIND, either express or implied. See the License for the specific
40
+ language governing rights and limitations under the License.
41
+
42
+ *****************************************************************************/
43
+
44
+
45
+ #ifndef _PV_INITIATOR_PORT_BASE_H_
46
+ #define _PV_INITIATOR_PORT_BASE_H_
47
+
48
+
49
+ /*------------------------------------------------------------------------------
50
+ * Includes
51
+ *----------------------------------------------------------------------------*/
52
+ #include <vector>
53
+
54
+ #include "systemc.h"
55
+
56
+ #include "pv_target_port_base.h"
57
+
58
+
59
+ //----------------------------------------------------------------------------
60
+ /// Class pv_initiator_port_base: This class is a base class for pv_initiator_port.
61
+ /**
62
+ * \n It provides a container to store registered target ports as pointer list (required for target port ID propagation and
63
+ * transaction recording).
64
+ * \n It provides also two containers to store registered initiator ports as pointer list:
65
+ * - The first container registers initiator port from "deeper" initiator port to the the initiator
66
+ * port directly bound to the interface.
67
+ * - The second list, named reversed list, allows the port directly bound to the interface to propagate its target
68
+ * port list to "deeper" initiator ports.
69
+ *
70
+ * \n Accessors are provided for all the port lists.
71
+ **/
72
+ //----------------------------------------------------------------------------
73
+ class pv_initiator_port_base {
74
+
75
+ typedef pv_initiator_port_base this_type;
76
+ typedef pv_target_port_base target_port_type;
77
+
78
+ public:
79
+
80
+ //--------------
81
+ // Constructor
82
+ //--------------
83
+ pv_initiator_port_base() {
84
+ // Adds the port itself to the reversed initiator port list
85
+ m_reversed_initiator_port_list.push_back(this);
86
+ }
87
+
88
+
89
+ //------------------------------------------
90
+ /// @name Data members access methods
91
+ //------------------------------------------
92
+ /// @{
93
+
94
+ /// Register the target port
95
+ inline void register_target_port(target_port_type * target_port) {
96
+ m_target_port_list.push_back(target_port);
97
+ }
98
+
99
+ /// Returns the vector of registered target port(s)
100
+ inline std::vector<target_port_type *>& get_target_port_list() {
101
+ return(m_target_port_list);
102
+ }
103
+
104
+ /// Sets the vector of registered target port(s) (port propagation)
105
+ inline void set_target_port_list(std::vector<target_port_type *>& target_port_list) {
106
+ m_target_port_list = target_port_list;
107
+ }
108
+
109
+ //---------------------------------------------------------------------------
110
+
111
+ /// Register the initiator port in the regular list
112
+ inline void register_initiator_port(this_type * initiator_port) {
113
+ m_initiator_port_list.push_back(initiator_port);
114
+ }
115
+
116
+ /// Returns the vector of registered initiator port(s)
117
+ inline std::vector<this_type *>& get_initiator_port_list() {
118
+ return(m_initiator_port_list);
119
+ }
120
+
121
+ /// Sets the vector of registered initiator port(s) (port propagation)
122
+ inline void set_initiator_port_list(std::vector<this_type *>& initiator_port_list) {
123
+ m_initiator_port_list = initiator_port_list;
124
+ }
125
+
126
+ //---------------------------------------------------------------------------
127
+
128
+ /// Register the initiator port in the reversed list
129
+ inline void reversed_register_initiator_port(this_type * initiator_port) {
130
+ m_reversed_initiator_port_list.push_back(initiator_port);
131
+ }
132
+
133
+ /// Returns the vector of registered initiator port(s), reversed list
134
+ inline std::vector<this_type *>& get_reversed_initiator_port_list() {
135
+ return(m_reversed_initiator_port_list);
136
+ }
137
+
138
+ /// Sets the vector of registered initiator port(s) (port propagation) reversed list
139
+ inline void set_reversed_initiator_port_list(std::vector<this_type *>& initiator_port_list) {
140
+ m_reversed_initiator_port_list = initiator_port_list;
141
+ }
142
+
143
+ /// @}
144
+
145
+
146
+ protected:
147
+
148
+ /// sc_export objects registration
149
+ /**
150
+ * Direct registration of the bound target port(s) into current initiator port
151
+ **/
152
+ std::vector<target_port_type *> m_target_port_list;
153
+
154
+
155
+ /// sc_port objects registration
156
+ /**
157
+ * Direct registration of the bound initiator port into current initiator port
158
+ **/
159
+ std::vector<this_type *> m_initiator_port_list;
160
+
161
+ /// sc_port objects registration
162
+ /**
163
+ * Direct registration of the current initiator port into the bound initiator port for
164
+ * port propagation: all bound initiator ports get back the same target_port_list
165
+ **/
166
+ std::vector<this_type *> m_reversed_initiator_port_list;
167
+
168
+ /// Creates the initiator port list from a non NULL initiator_port_type * list
169
+ /** Reentreant function to create the complete list of bound initiator_port
170
+ **/
171
+ void create_port_list(std::vector<this_type *>& port_list) {
172
+ assert(port_list.size() > 0);
173
+ this_type& current_port = *port_list[(port_list.size()-1)];
174
+ // For all the registed initiator port of the port
175
+ for (int i=0;i<(int)current_port.get_initiator_port_list().size();i++) {
176
+ // register only other ports (the list contains the port itself)
177
+ if (static_cast<this_type *>(&current_port) != current_port.get_initiator_port_list()[i]) {
178
+ port_list.push_back(current_port.get_initiator_port_list()[i]); // register port
179
+ this->create_port_list(port_list); // find again in the updated port list
180
+ }
181
+ }
182
+ }
183
+
184
+
185
+ };
186
+
187
+ #endif /* _PV_INITIATOR_PORT_BASE_H_ */
188
+
189
+
@@ -0,0 +1,205 @@
1
+ /*****************************************************************************
2
+
3
+ Description: pv_router.h
4
+ Author: The SPIRIT Consortium
5
+ Revision: $Revision: 1506 $
6
+ Date: $Date: 2009-04-26 01:51:56 -0500 (Sun, 26 Apr 2009) $
7
+
8
+ Copyright (c) 2008, 2009 The SPIRIT Consortium.
9
+
10
+ This work forms part of a deliverable of The SPIRIT Consortium.
11
+
12
+ Use of these materials are governed by the legal terms and conditions
13
+ outlined in the disclaimer available from www.spiritconsortium.org.
14
+
15
+ This source file is provided on an AS IS basis. The SPIRIT
16
+ Consortium disclaims any warranty express or implied including
17
+ any warranty of merchantability and fitness for use for a
18
+ particular purpose.
19
+
20
+ The user of the source file shall indemnify and hold The SPIRIT
21
+ Consortium and its members harmless from any damages or liability.
22
+ Users are requested to provide feedback to The SPIRIT Consortium
23
+ using either mailto:feedback@lists.spiritconsortium.org or the forms at
24
+ http://www.spiritconsortium.org/about/contact_us/
25
+
26
+ This file may be copied, and distributed, with or without
27
+ modifications; but this notice must be included on any copy.
28
+
29
+ The following code is derived, directly or indirectly, from the SystemC
30
+ source code Copyright (c) 1996-2004 by all Contributors.
31
+ All Rights reserved.
32
+
33
+ The contents of this file are subject to the restrictions and limitations
34
+ set forth in the SystemC Open Source License Version 2.4 (the "License");
35
+ You may not use this file except in compliance with such restrictions and
36
+ limitations. You may obtain instructions on how to receive a copy of the
37
+ License at http://www.systemc.org/. Software distributed by Contributors
38
+ under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
39
+ ANY KIND, either express or implied. See the License for the specific
40
+ language governing rights and limitations under the License.
41
+
42
+ *****************************************************************************/
43
+
44
+ #ifndef _PV_ROUTER_H_
45
+ #define _PV_ROUTER_H_
46
+
47
+
48
+ /*------------------------------------------------------------------------------
49
+ * Includes
50
+ *----------------------------------------------------------------------------*/
51
+ #include <string>
52
+ #include <iostream>
53
+ #include <sstream>
54
+
55
+ #include "systemc.h"
56
+
57
+ #include "pv_initiator_port.h"
58
+ #include "pv_target_port.h"
59
+
60
+
61
+ //----------------------------------------------------------------------------
62
+ template<typename ADDRESS>
63
+ class address_map {
64
+
65
+ public:
66
+
67
+ //----------------------
68
+ // Constructors
69
+ //----------------------
70
+ address_map() :
71
+ m_target_port_rank(0),
72
+ m_start_address(0),
73
+ m_end_address(0)
74
+ {}
75
+
76
+ address_map(std::string& name,ADDRESS start,ADDRESS end) :
77
+ m_target_port_rank(0),
78
+ m_entry_port_name(name),
79
+ m_start_address(start),
80
+ m_end_address(end)
81
+ {}
82
+
83
+ //--------------------------------------------------
84
+ // Accessors
85
+ //--------------------------------------------------
86
+ inline void set_target_port_rank(unsigned int target_port_rank) {m_target_port_rank = target_port_rank;}
87
+ inline unsigned int get_target_port_rank() const {return(m_target_port_rank);}
88
+
89
+ inline std::string& get_entry_port_name() {return(m_entry_port_name);}
90
+ inline void set_entry_port_name(const char * name) {m_entry_port_name = name;}
91
+ inline void set_entry_port_name(const std::string& name) {m_entry_port_name = name;}
92
+
93
+ inline ADDRESS get_start_address() const {return(m_start_address);}
94
+ inline void set_start_address(ADDRESS address) {m_start_address = address;}
95
+
96
+ inline ADDRESS get_end_address() const {return(m_end_address);}
97
+ inline void set_end_address(ADDRESS address) {m_end_address = address;}
98
+
99
+
100
+ //--------------------------------------------------------------
101
+ // Decode method used to check port address range
102
+ //--------------------------------------------------------------
103
+ /// Returns true if input address matches the port address range
104
+ inline bool decode(const ADDRESS& address) const {
105
+ return((address>=m_start_address)&&(address<=m_end_address));
106
+ }
107
+
108
+ protected:
109
+
110
+ unsigned int m_target_port_rank; // Target port binding rank (initiator port<->target port binding order)
111
+ std::string m_entry_port_name; // Name of the mapfile port name entry corresponding to the address range
112
+ ADDRESS m_start_address; // Start address
113
+ ADDRESS m_end_address; // End address
114
+ };
115
+
116
+ //----------------------------------------------------------------------------
117
+ template<typename ADDRESS,typename DATA>
118
+ class pv_router :
119
+ public sc_module,
120
+ public virtual tlm::tlm_transport_if<pv_request<ADDRESS,DATA>, pv_response<DATA> >
121
+ {
122
+ typedef pv_request<ADDRESS,DATA> request_type;
123
+ typedef pv_response<DATA> response_type;
124
+
125
+ typedef tlm::tlm_transport_if<request_type,response_type> interface_type;
126
+
127
+ typedef pv_initiator_port<ADDRESS,DATA,0> initiator_port_type; // 0 allows this port to be bound to several interfaces
128
+ typedef pv_target_port<ADDRESS,DATA> target_port_type;
129
+
130
+ typedef address_map<ADDRESS> address_map_type;
131
+
132
+ public:
133
+
134
+ //--------------
135
+ // Module ports
136
+ //--------------
137
+ initiator_port_type initiator_port;
138
+ target_port_type target_port;
139
+
140
+
141
+ //--------------
142
+ // Constructors
143
+ //--------------
144
+ pv_router(sc_module_name module_name,
145
+ const char * map_filename = NULL
146
+ );
147
+
148
+ //-------------
149
+ // Destructor
150
+ //-------------
151
+ ~pv_router();
152
+
153
+
154
+
155
+ //-------------------------------------------------
156
+ // sc_module method override
157
+ //-------------------------------------------------
158
+ // Called by elaboration_done. Used here to load the mapfile when the SC binding is finished
159
+ void end_of_elaboration();
160
+
161
+ //-------------------------------------------------
162
+ // tlm_transport_if method implementation
163
+ //-------------------------------------------------
164
+ virtual response_type transport(const request_type& request);
165
+ // virtual void transport(const request_type& request,response_type& response );
166
+
167
+ //-------------------------------------------------
168
+ // Load mapfile. Called at the end of elaboration
169
+ // Can be called again dirung the simulation -> remap
170
+ //-------------------------------------------------
171
+ bool load_mapfile(const char * filename);
172
+
173
+ protected :
174
+
175
+ std::string m_map_filename; // Name of the file containing the mapping informations
176
+ std::stringstream m_map_stream; // Stringsteam containing the mapping information
177
+ std::vector<address_map_type *> m_address_map_list; // List of address_map objects
178
+
179
+ //--------------------------------------------------------------
180
+ /* If the given address matches one address map, returns a reference on
181
+ the address map. The address parameter is modified: remove address map start address
182
+ */
183
+ inline address_map_type * decode(ADDRESS& address) {
184
+ // For each registered & mapped target port
185
+ for(typename std::vector<address_map_type *>::iterator map = m_address_map_list.begin();
186
+ map != m_address_map_list.end();
187
+ map ++) {
188
+ if ((*map)->decode(address)) {
189
+ address = address - (*map)->get_start_address();
190
+ return(*map);
191
+ }
192
+ }
193
+ return(NULL);
194
+ }
195
+
196
+ };
197
+
198
+
199
+ // Class implementation
200
+ #include "./pv_router.tpp"
201
+
202
+
203
+ #endif /* _PV_ROUTER_H_ */
204
+
205
+