ipxact-ruby 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. data/.autotest +15 -0
  2. data/.gitignore +2 -0
  3. data/README.html +89 -0
  4. data/README.mdown +91 -0
  5. data/Rakefile +31 -0
  6. data/VERSION +1 -0
  7. data/autotest/discover.rb +17 -0
  8. data/lib/ipxact.rb +263 -0
  9. data/lib/ipxact/component.rb +235 -0
  10. data/lib/ipxact/parser.rb +27 -0
  11. data/lib/ipxact/parser/bus_data_parser.rb +229 -0
  12. data/lib/ipxact/parser/component_data_parser.rb +309 -0
  13. data/lib/ipxact/parser/platform_data_parser.rb +63 -0
  14. data/lib/ipxact/pathfinder/graph_pathfinder.rb +191 -0
  15. data/lib/ipxact/platform.rb +43 -0
  16. data/schemas/abstractionDefinition.xsd +332 -0
  17. data/schemas/abstractor.xsd +156 -0
  18. data/schemas/autoConfigure.xsd +226 -0
  19. data/schemas/busDefinition.xsd +99 -0
  20. data/schemas/busInterface.xsd +640 -0
  21. data/schemas/commonStructures.xsd +189 -0
  22. data/schemas/component.xsd +253 -0
  23. data/schemas/configurable.xsd +82 -0
  24. data/schemas/constraints.xsd +283 -0
  25. data/schemas/design.xsd +105 -0
  26. data/schemas/designConfig.xsd +144 -0
  27. data/schemas/file.xsd +560 -0
  28. data/schemas/fileType.xsd +86 -0
  29. data/schemas/generator.xsd +240 -0
  30. data/schemas/identifier.xsd +93 -0
  31. data/schemas/index.xsd +67 -0
  32. data/schemas/memoryMap.xsd +1007 -0
  33. data/schemas/model.xsd +291 -0
  34. data/schemas/port.xsd +441 -0
  35. data/schemas/signalDrivers.xsd +220 -0
  36. data/schemas/simpleTypes.xsd +90 -0
  37. data/schemas/subInstances.xsd +256 -0
  38. data/spec/integration/bus_data_extraction_spec.rb +105 -0
  39. data/spec/integration/data_calculation_spec.rb +133 -0
  40. data/spec/integration/data_construction_spec.rb +52 -0
  41. data/spec/integration/general_spec.rb +121 -0
  42. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port.h +135 -0
  43. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port.tpp +247 -0
  44. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port_base.h +189 -0
  45. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_router.h +205 -0
  46. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_router.tpp +278 -0
  47. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_slave_base.h +115 -0
  48. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_slave_base.tpp +126 -0
  49. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_target_port.h +168 -0
  50. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_target_port_base.h +133 -0
  51. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_tlm_if.h +280 -0
  52. data/spec/test_data/spiritconsortium.org/Leon2TLM/PV/user_types.h +38 -0
  53. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/Leon2Platform.xml +77 -0
  54. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/design_Leon2Platform.xml +156 -0
  55. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/tlmsrc/Leon2Platform.h +149 -0
  56. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/apbSubSystem.xml +406 -0
  57. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/design_apbSubSystem.xml +135 -0
  58. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/tlmsrc/apbSubSystem.h +133 -0
  59. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/Leon2Platform.xml +77 -0
  60. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/design_Leon2Platform.xml +157 -0
  61. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/tlmsrc/Leon2Platform.h +150 -0
  62. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/apbSubSystem.xml +422 -0
  63. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/designConfig_apbSubSystem.xml +79 -0
  64. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/design_apbSubSystem.xml +184 -0
  65. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/tlmsrc/apbSubSystem.h +164 -0
  66. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/Leon2Platform.xml +105 -0
  67. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/design_Leon2Platform.xml +157 -0
  68. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/tlmsrc/Leon2Platform.h +152 -0
  69. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/apbSubSystem.xml +429 -0
  70. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/designConfig_apbSubSystem.xml +64 -0
  71. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/design_apbSubSystem.xml +150 -0
  72. data/spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/tlmsrc/apbSubSystem.h +167 -0
  73. data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbbus/1.4/ahbbus22.xml +236 -0
  74. data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbbus/1.4/tlmsrc/ahbbus.h +52 -0
  75. data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/ahbram.xml +184 -0
  76. data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/tlmsrc/ahbram.cc +93 -0
  77. data/spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/tlmsrc/ahbram.h +77 -0
  78. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbbus/1.4/apbbus8.xml +544 -0
  79. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbbus/1.4/tlmsrc/apbbus.h +55 -0
  80. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbmst/1.4/apbmst.xml +209 -0
  81. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbmst/1.4/tlmsrc/apbmst.h +53 -0
  82. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/apbram.xml +395 -0
  83. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.cc +89 -0
  84. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.h +69 -0
  85. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.v +82 -0
  86. data/spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.vhd +132 -0
  87. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/cgu.xml +686 -0
  88. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/tlmsrc/cgu.cc +121 -0
  89. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/tlmsrc/cgu.h +81 -0
  90. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/cgu.xml +707 -0
  91. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/tlmsrc/cgu.cc +121 -0
  92. data/spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/tlmsrc/cgu.h +81 -0
  93. data/spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/dma.xml +272 -0
  94. data/spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/tlmsrc/dma.cc +230 -0
  95. data/spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/tlmsrc/dma.h +116 -0
  96. data/spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/irqctrl.xml +530 -0
  97. data/spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/tlmsrc/irqctrl.cc +211 -0
  98. data/spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/tlmsrc/irqctrl.h +108 -0
  99. data/spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/processor.xml +423 -0
  100. data/spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/tlmsrc/processor.cc +331 -0
  101. data/spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/tlmsrc/processor.h +121 -0
  102. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/pv2apb.xml +240 -0
  103. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/tlmsrc/pv2apb.cc +153 -0
  104. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/tlmsrc/pv2apb.h +77 -0
  105. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/pv2tac.xml +154 -0
  106. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/tlmsrc/pv2tac.cc +114 -0
  107. data/spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/tlmsrc/pv2tac.h +67 -0
  108. data/spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/rgu.xml +766 -0
  109. data/spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/tlmsrc/rgu.cc +126 -0
  110. data/spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/tlmsrc/rgu.h +105 -0
  111. data/spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/scmlAdaptor.xml +154 -0
  112. data/spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/tlmsrc/scmladaptor.cc +100 -0
  113. data/spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/tlmsrc/scmladaptor.h +62 -0
  114. data/spec/test_data/spiritconsortium.org/Leon2TLM/serial_device/1.0/serial_device.xml +151 -0
  115. data/spec/test_data/spiritconsortium.org/Leon2TLM/serial_device/1.0/tlmsrc/serial_device.h +85 -0
  116. data/spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/timers.xml +460 -0
  117. data/spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/tlmsrc/timers.cc +201 -0
  118. data/spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/tlmsrc/timers.h +102 -0
  119. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart.h +152 -0
  120. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_fifo.h +113 -0
  121. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_memory_map.h +96 -0
  122. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_types.h +60 -0
  123. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart.cc +125 -0
  124. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_interrupt_handler.cc +136 -0
  125. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_register_bank.cc +129 -0
  126. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_serial_tx_rx.cc +145 -0
  127. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/uart_scml.xml +372 -0
  128. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/Leon2_uart.h +216 -0
  129. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/def_Leon2_uart.h +34 -0
  130. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlm_field.h +72 -0
  131. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlm_register.h +129 -0
  132. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlmreg_Leon2_uart.h +133 -0
  133. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/Leon2_uart.cc +316 -0
  134. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/tlmreg_Leon2_uart.cc +197 -0
  135. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/user_specific_Leon2_uart.cc +146 -0
  136. data/spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/uart_tac.xml +222 -0
  137. data/spec/unit/component_spec.rb +98 -0
  138. data/spec/unit/graph_pathfinder_spec.rb +128 -0
  139. data/spec/unit/interconnect_spec.rb +177 -0
  140. data/spec/unit/ipxact_spec.rb +69 -0
  141. data/spec/unit/platform_spec.rb +34 -0
  142. metadata +225 -0
@@ -0,0 +1,278 @@
1
+ /* -*- C++ -*- */
2
+ /*****************************************************************************
3
+ Description: pv_router.tpp
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
+ /*------------------------------------------------------------------------------
45
+ * Includes
46
+ *----------------------------------------------------------------------------*/
47
+ #include "pv_router.h"
48
+
49
+
50
+
51
+ //--------------
52
+ // Constructors
53
+ //--------------
54
+ template<typename ADDRESS,typename DATA>
55
+ pv_router<ADDRESS,DATA>::pv_router(sc_module_name module_name,
56
+ const char * map_filename
57
+ ) :
58
+ sc_module(module_name),
59
+ initiator_port("initiator_port"),
60
+ target_port("target_port")
61
+ {
62
+ if (map_filename) m_map_filename = map_filename;
63
+ else m_map_filename = (std::string)(name()) + ".map";
64
+
65
+ target_port(*this);
66
+
67
+ std::cout << name() << " module created\n";
68
+
69
+ }
70
+
71
+
72
+ //-------------
73
+ // Destructor
74
+ //-------------
75
+ template<typename ADDRESS,typename DATA>
76
+ pv_router<ADDRESS,DATA>::~pv_router() {
77
+ for(typename std::vector<address_map_type *>::iterator map = m_address_map_list.begin();
78
+ map != m_address_map_list.end();
79
+ map ++) {
80
+ if ((*map)) delete (*map);
81
+ }
82
+ }
83
+
84
+ //-------------------------------------------------
85
+ // sc_module method override
86
+ //-------------------------------------------------
87
+
88
+ // Called by elaboration_done
89
+ template<typename ADDRESS,typename DATA>
90
+ void pv_router<ADDRESS,DATA>::end_of_elaboration() {
91
+ if (load_mapfile(m_map_filename.c_str()))
92
+ std::cout << name() << ": End of Elaboration: "<< initiator_port.get_target_port_list().size() << " target(s) connected\n";
93
+ else sc_stop();
94
+ }
95
+
96
+
97
+ //-------------------------------------------------
98
+ // tlm_transport_if method implementation
99
+ //-------------------------------------------------
100
+
101
+ // Transfer of transaction
102
+ template<typename ADDRESS,typename DATA>
103
+ pv_response<DATA>
104
+ pv_router<ADDRESS,DATA>::transport(const request_type& request) {
105
+
106
+ response_type response;
107
+ request_type router_request(request); // Copy from input request
108
+
109
+ ADDRESS addr = request.get_address();
110
+
111
+ // Search address map and modify the address
112
+ address_map_type * map = decode(addr);
113
+
114
+ if (map) {
115
+
116
+ // Request modification: modified address and port ID added
117
+ router_request.set_address(addr);
118
+
119
+ // Send initiator request to the target
120
+ initiator_port.do_transport(router_request,response,(*map).get_target_port_rank());
121
+ }
122
+ else {
123
+ response.get_status().set_error();
124
+ response.get_status().set_no_response();
125
+ std::cout << "ERROR\t" << name() << std::showbase << std::hex
126
+ << ": No target at this address: " << request.get_address() << std::endl;
127
+ }
128
+ return(response);
129
+ }
130
+
131
+ /*
132
+ // Transfer of transaction
133
+ template<typename ADDRESS,typename DATA>
134
+ void
135
+ pv_router<ADDRESS,DATA>::transport(const request_type& request,response_type& response) {
136
+
137
+ request_type router_request(request); // Copy from input request
138
+
139
+ ADDRESS addr = request.get_address();
140
+
141
+ // Search address map and modify the address
142
+ address_map_type * map = decode(addr);
143
+
144
+ if (map) {
145
+
146
+ // Request modification: modified address and port ID added
147
+ router_request.set_address(addr);
148
+
149
+ // Send initiator request to the target
150
+ initiator_port.do_transport(router_request,response,(*map).get_target_port_rank());
151
+ }
152
+ else {
153
+ response.get_status().set_error();
154
+ response.get_status().set_no_response();
155
+ std::cout << "ERROR\t" << name() << std::showbase << std::hex
156
+ << ": No target at this address: " << request.get_address();
157
+ }
158
+ }
159
+ */
160
+
161
+
162
+ //-------------------------------------------------
163
+ // Load mapfile. Called at the end of elaboration
164
+ // Can be called again dirung the simulation -> remap
165
+ //-------------------------------------------------
166
+ template<typename ADDRESS,typename DATA>
167
+ bool
168
+ pv_router<ADDRESS,DATA>::load_mapfile(const char * filename) {
169
+
170
+ // Temporary address map lists
171
+ std::vector<address_map_type *> tmp_address_map_list;
172
+
173
+ // Parse the map file to fill the temporary address_map list
174
+ ifstream mapfile(filename);
175
+ if( !mapfile.is_open() ) {
176
+ std::cout << "ERROR\t" << name() << ": Opening mapfile \"" << m_map_filename << "\"\n";
177
+ return(false);
178
+ }
179
+ else {
180
+ std::cout << name() << ": mapfile \"" << m_map_filename << "\" loaded\n";
181
+
182
+ // Reads the map stream and fills the address map list
183
+ char line[1024];
184
+ while (mapfile.good()) {
185
+ memset(line,0,1024);
186
+ mapfile.getline(line,1024);
187
+
188
+ // If the current map line is not a comment, the parser retrieves
189
+ // the address map parameters and creates a new address map object
190
+ if ((line[0]) && (line[0] != ';') && (line[0] != ' ') && (line[0] != '\n') && (line[0] != '\t')) {
191
+ std::string port_name;
192
+ ADDRESS addr,size = 0;
193
+ std::stringstream linestream(line);
194
+ linestream >> hex >> port_name >> addr >> size; // Read addresses using HEX format
195
+
196
+ if (size == 0) // Ignore map entry with null size
197
+ std::cout << "WARNING\t" << name() << ":Null entry size for \"" << port_name.c_str() << "\" entry while parsing map input. This entry will be ignored\n";
198
+ else {
199
+ address_map_type * map = new address_map_type(port_name,addr,addr+(size-1));
200
+ tmp_address_map_list.push_back(map);
201
+ }
202
+ }
203
+ }
204
+
205
+ // For all the child objects of the module (search initiator ports)
206
+ for (int i=0;i<(int)this->get_child_objects().size();i++) {
207
+ initiator_port_type * port;
208
+ if ((port = dynamic_cast<initiator_port_type *>(this->get_child_objects()[i])) != NULL) {
209
+ for (unsigned int target_port_rank = 0;target_port_rank<port->get_target_port_list().size();target_port_rank++) {
210
+ target_port_type& target_port = *(static_cast<target_port_type * >(port->get_target_port_list()[target_port_rank]));
211
+ bool mapped = false; // Unmapped port detection flag
212
+ std::string port_name(target_port.name()); // Gets port name: target port in the list
213
+
214
+ // Check the temporary address map object list to find a matching port map
215
+ for(typename std::vector<address_map_type *>::iterator map = tmp_address_map_list.begin();
216
+ map != tmp_address_map_list.end();
217
+ map ++) {
218
+ std::string entry_name((*map)->get_entry_port_name().c_str()); // Gets mapfile target port entry name
219
+ if (port_name == entry_name) {// port name and entry name matches
220
+
221
+ // New address_map object initialized with mapfile entry
222
+ address_map_type * tmp_map = new address_map_type(*(*map));
223
+ // Add target_port rang information
224
+ tmp_map->set_target_port_rank(target_port_rank);
225
+ m_address_map_list.push_back(tmp_map); // Register address_map object in temporary map list
226
+ mapped = true;
227
+ #ifdef PV_ROUTER_DEBUG
228
+ std::cout << std::showbase << std::hex << name() << ": port \"" << target_port.name()
229
+ << "\" identified - " << "Address range: "
230
+ << (*map)->get_start_address() << " - " << (*map)->get_end_address() << std::endl;
231
+ #endif
232
+ }
233
+ }
234
+ // Error if a registered target port has no associated mapping information
235
+ if (!mapped) std::cout << "ERROR\t" << name() << ": port \"" << port_name.c_str()
236
+ << "\" has no mapping defined in \"" << filename << "\"\n";
237
+ }
238
+ }
239
+ }
240
+
241
+ // Address map overlap detection
242
+ // For each registered address map object, the other address map objects are
243
+ // checked to detect mapping overlap
244
+ for(typename std::vector<address_map_type *>::iterator map = m_address_map_list.begin();
245
+ map != m_address_map_list.end();
246
+ map ++) {
247
+
248
+ for(typename std::vector<address_map_type *>::iterator other_map = map+1;
249
+ other_map != m_address_map_list.end();
250
+ other_map ++) {
251
+
252
+ if ( ( (*other_map)->decode((*map)->get_start_address() ) ) ||
253
+ ( (*other_map)->decode((*map)->get_end_address() ) ) ||
254
+ ( (*map)->decode((*other_map)->get_start_address() ) ) ||
255
+ ( (*map)->decode((*other_map)->get_end_address() ) )
256
+ ) {
257
+ // Print a Warning message if a map definition collision is detected
258
+ std::cout << "WARNING\t" << name() << ": "
259
+ << std::showbase << std::hex << " \"" << (*other_map)->get_entry_port_name() << "\" map definition ("
260
+ << (*other_map)->get_start_address() << " - " << (*other_map)->get_end_address() << ")"<< std::endl
261
+ << "\t\toverlaps map defined for \"" << (*map)->get_entry_port_name() << "\" ("
262
+ << (*map)->get_start_address() << " - " << (*map)->get_end_address() << ")" << std::endl;
263
+ }
264
+ }
265
+ }
266
+
267
+ // Cleanup temporary mapfile address map list
268
+ for(typename std::vector<address_map_type *>::iterator map = tmp_address_map_list.begin();
269
+ map != tmp_address_map_list.end();
270
+ map ++) {
271
+ if ((*map)) delete (*map);
272
+ }
273
+ return(true);
274
+ }
275
+ }
276
+
277
+
278
+ /* END of pv_router.tpp */
@@ -0,0 +1,115 @@
1
+ /*****************************************************************************
2
+ Description: pv_slave_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
+ 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
+ #ifndef _PV_SLAVE_BASE_H_
45
+ #define _PV_SLAVE_BASE_H_
46
+
47
+ /*------------------------------------------------------------------------------
48
+ * Includes
49
+ *----------------------------------------------------------------------------*/
50
+ #include <string>
51
+
52
+ #include "tlm.h"
53
+
54
+ #include "pv_tlm_if.h"
55
+ #include "pv_target_port.h"
56
+
57
+
58
+ //----------------------------------------------------------------------------
59
+ template<typename ADDRESS,typename DATA>
60
+ class pv_slave_base :
61
+ public virtual tlm::tlm_transport_if<pv_request<ADDRESS,DATA>,pv_response<DATA> >,
62
+ public virtual pv_tlm_if<ADDRESS,DATA> {
63
+
64
+ typedef pv_request<ADDRESS,DATA> request_type;
65
+ typedef pv_response<DATA> response_type;
66
+
67
+ typedef tlm::tlm_transport_if<request_type,response_type> interface_type;
68
+
69
+ typedef pv_target_port<ADDRESS,DATA> target_port_type;
70
+
71
+ public:
72
+
73
+ //---------------
74
+ // Constructor
75
+ //---------------
76
+ pv_slave_base(const char * module_name);
77
+
78
+ //-------------------------------------------------
79
+ // tlm_transport_if methods implementation
80
+ //-------------------------------------------------
81
+ virtual response_type transport(const request_type& request);
82
+
83
+
84
+ //--------------------------------------------------------
85
+ // Abstract class pv_tlm_if methods default implementation
86
+ //--------------------------------------------------------
87
+
88
+ virtual tlm::tlm_status read(const ADDRESS& address,
89
+ DATA& data,
90
+ const unsigned int byte_enable = tlm::NO_BE,
91
+ const tlm::tlm_mode mode = tlm::REGULAR,
92
+ const unsigned int export_id = 0);
93
+
94
+ virtual tlm::tlm_status write(const ADDRESS& address,
95
+ const DATA& data,
96
+ const unsigned int byte_enable = tlm::NO_BE,
97
+ const tlm::tlm_mode mode = tlm::REGULAR,
98
+ const unsigned int export_id = 0);
99
+
100
+ protected:
101
+
102
+ /// Slave name (used for debug and error messages: pv_slave_base is not a sc_object )
103
+ std::string m_slave_name;
104
+
105
+ };
106
+
107
+
108
+ // Class implementation
109
+ #include "./pv_slave_base.tpp"
110
+
111
+
112
+
113
+ #endif /* _PV_SLAVE_BASE_H_ */
114
+
115
+
@@ -0,0 +1,126 @@
1
+ /* -*- C++ -*- */
2
+ /*****************************************************************************
3
+ Description: pv_slave_base.tpp
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
+ /*------------------------------------------------------------------------------
45
+ * Includes
46
+ *----------------------------------------------------------------------------*/
47
+ #include "pv_slave_base.h"
48
+
49
+ //---------------
50
+ // Constructor
51
+ //---------------
52
+ template<typename ADDRESS,typename DATA>
53
+ pv_slave_base<ADDRESS,DATA>::pv_slave_base(const char * module_name) :
54
+ m_slave_name(module_name) {
55
+ }
56
+
57
+
58
+
59
+
60
+ //-------------------------------------------------
61
+ // tlm_transport_if methods implementation
62
+ //-------------------------------------------------
63
+ template<typename ADDRESS,typename DATA>
64
+ pv_response<DATA>
65
+ pv_slave_base<ADDRESS,DATA>::transport(const request_type& request) {
66
+
67
+ response_type response;
68
+
69
+ switch(request.get_command()) {
70
+
71
+ case PV_READ:
72
+
73
+ response.set_data(request.get_data());
74
+
75
+ response.set_status(this->read(request.get_address(), response.get_data()));
76
+ break;
77
+
78
+ case PV_WRITE:
79
+ response.set_status(this->write(request.get_address(), request.get_data()));
80
+ break;
81
+
82
+ default:
83
+ std::cout << "ERROR\t" << m_slave_name << ": Unknown command \n";
84
+ break;
85
+ }
86
+
87
+ return response;
88
+ }
89
+
90
+ //---------------------
91
+ // Read access
92
+ template<typename ADDRESS,typename DATA>
93
+ tlm::tlm_status
94
+ pv_slave_base<ADDRESS,DATA>::read(const ADDRESS& address,
95
+ DATA& data,
96
+ const unsigned int byte_enable,
97
+ const tlm::tlm_mode mode,
98
+ const unsigned int export_id
99
+ ) {
100
+ tlm::tlm_status status;
101
+
102
+ std::cout << "ERROR\t" << m_slave_name << ": Read is not implemented\n";
103
+
104
+ return(status);
105
+ }
106
+
107
+ //----------------------
108
+ // Write access
109
+ template<typename ADDRESS,typename DATA>
110
+ tlm::tlm_status
111
+ pv_slave_base<ADDRESS,DATA>::write(const ADDRESS& address,
112
+ const DATA& data,
113
+ const unsigned int byte_enable,
114
+ const tlm::tlm_mode mode,
115
+ const unsigned int export_id
116
+ ) {
117
+ tlm::tlm_status status;
118
+
119
+ std::cout << "ERROR\t" << m_slave_name << ": Write is not implemented\n";
120
+
121
+ return(status);
122
+
123
+ }
124
+
125
+ /* END of pv_slave_base.tpp */
126
+