ipxact-ruby 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
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,168 @@
1
+ /*****************************************************************************
2
+ Description: pv_target_port.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_TARGET_PORT_H_
45
+ #define _PV_TARGET_PORT_H_
46
+
47
+ /*------------------------------------------------------------------------------
48
+ * Includes
49
+ *----------------------------------------------------------------------------*/
50
+ #include "systemc.h"
51
+ #include <string>
52
+
53
+ #include "tlm.h"
54
+ #include "pv_tlm_if.h"
55
+ #include "pv_target_port_base.h"
56
+
57
+ //----------------------------------------------------------------------------
58
+ template<typename ADDRESS,typename DATA>
59
+ class pv_target_port :
60
+ public pv_target_port_base,
61
+ public sc_export<tlm::tlm_transport_if<pv_request<ADDRESS,DATA>, pv_response<DATA> > >
62
+ {
63
+
64
+ public:
65
+ typedef pv_request<ADDRESS,DATA> request_type;
66
+ typedef pv_response<DATA> response_type;
67
+
68
+ typedef tlm::tlm_transport_if<request_type,response_type> interface_type;
69
+ typedef sc_export<interface_type> target_port_type;
70
+
71
+ typedef pv_target_port_base target_port_base_type;
72
+
73
+ //--------------
74
+ // Constructor
75
+ //--------------
76
+ pv_target_port(const char * port_name) :
77
+ target_port_type(port_name)
78
+ {}
79
+
80
+ void before_end_of_elaboration();
81
+ void end_of_elaboration();
82
+
83
+ void bind(target_port_type& target_port_);
84
+ void bind(interface_type& interface) {
85
+ target_port_type::bind(interface);
86
+ }
87
+
88
+ void operator() (interface_type& interface) {
89
+ target_port_type::bind(interface);
90
+ }
91
+
92
+ protected:
93
+ bool is_already_bound(sc_interface * other_if);
94
+ };
95
+
96
+ template<typename ADDRESS,typename DATA>
97
+ bool
98
+ pv_target_port<ADDRESS, DATA>::is_already_bound(sc_interface * other_if) {
99
+ if (dynamic_cast<sc_interface * >(this->get_interface()) == NULL) return(false);
100
+ else {
101
+ std::string if_name1,if_name2 ;
102
+ sc_object * tmp = dynamic_cast<sc_object * >(other_if);
103
+ if (tmp) if_name1 = tmp->name();
104
+ else if_name1 = "unnamed interface (non sc_object)";
105
+ tmp = dynamic_cast<sc_object * >(this->get_interface());
106
+ if (tmp) if_name2 = tmp->name();
107
+ else if_name2 = "unnamed interface (non sc_object)";
108
+
109
+ std::string msg(sc_object::name());
110
+ msg += (std::string)(": tlm_target_port warning, Can't bind to \"") + if_name1;
111
+ msg += (std::string)("\" interface,the target port is already bound to this interface: \"");
112
+ msg += if_name2 + (std::string)("\"\n");
113
+ SC_REPORT_WARNING("binding warning",msg.c_str());
114
+
115
+ return(true);
116
+ }
117
+ }
118
+
119
+ template<typename ADDRESS,typename DATA>
120
+ void
121
+ pv_target_port<ADDRESS, DATA>::before_end_of_elaboration()
122
+ {
123
+ // if this target port is not directly connected to the core interface
124
+ if (get_target_port_list().size() > 1) {
125
+
126
+ for(typename std::vector<target_port_base_type *>::iterator target_port = get_target_port_list().begin();
127
+ target_port != get_target_port_list().end();
128
+ target_port++) {
129
+ set_tlm_export_id((*target_port)->get_tlm_export_id()); // Propagate the target port id
130
+ }
131
+ }
132
+ }
133
+
134
+ template<typename ADDRESS,typename DATA>
135
+ void
136
+ pv_target_port<ADDRESS, DATA>::end_of_elaboration() {
137
+
138
+ #ifdef TLM_PORT_DEBUG
139
+ printf("DEBUG\t\t%s: Registered target port list :\n",sc_object::name());
140
+ for(typename std::vector<target_port_base_type *>::iterator port = get_target_port_list().begin();
141
+ port != get_target_port_list().end();
142
+ port++) {
143
+ printf("DEBUG\t\t%s: \t- %s\n",sc_object::name(),(static_cast<target_port_type * >(*port))->name());
144
+ }
145
+ printf("DEBUG\t\t%s: -------------------------------------------------------\n",sc_object::name());
146
+ #endif
147
+
148
+ }
149
+
150
+ template<typename ADDRESS,typename DATA>
151
+ void
152
+ pv_target_port<ADDRESS, DATA>::bind(target_port_type& target_port_)
153
+ {
154
+ // If the target port is still not bound
155
+ if (!is_already_bound(target_port_.get_interface())) {
156
+ // Copy the list of registered target ports to the current bound port (port propagation)
157
+ for(typename std::vector<target_port_base_type *>::iterator target_port = target_port_.get_target_port_list().begin();
158
+ target_port != target_port_.get_target_port_list().end();
159
+ target_port++) {
160
+ this->register_target_port(*target_port);
161
+ }
162
+
163
+ // Calls sc_export standard bind method
164
+ sc_export<interface_type>::bind(target_port_);
165
+ }
166
+ }
167
+ #endif /* _PV_TARGET_PORT_H_ */
168
+
@@ -0,0 +1,133 @@
1
+ /*****************************************************************************
2
+ Description: pv_target_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
+ 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_TARGET_PORT_BASE_H_
45
+ #define _PV_TARGET_PORT_BASE_H_
46
+
47
+ /*------------------------------------------------------------------------------
48
+ * Includes
49
+ *----------------------------------------------------------------------------*/
50
+ #include <vector>
51
+
52
+ #include "systemc.h"
53
+
54
+
55
+
56
+ //----------------------------------------------------------------------------
57
+ /// Class pv_target_port_base: This class is a base class for pv_target_port class.
58
+ /**
59
+ *
60
+ * \n It provides a container to store registered target ports as pointer list.
61
+ * \n In addition, it provides a target port ID used by to identify the input export port.
62
+ * This ID is injected in the request structure by the initiator at run time.
63
+ *
64
+ * \n Accessors are provided for the port list and port ID.
65
+ **/
66
+ //----------------------------------------------------------------------------
67
+ class pv_target_port_base {
68
+
69
+ typedef pv_target_port_base this_type;
70
+
71
+ public:
72
+
73
+ //--------------
74
+ // Constructor
75
+ //--------------
76
+ pv_target_port_base():
77
+ m_tlm_export_id(0) {
78
+ m_target_port_list.push_back(this);
79
+ }
80
+
81
+ //------------------------------------------
82
+ /// @name Data members access methods
83
+ //------------------------------------------
84
+ /// @{
85
+
86
+ /// Returns the port id
87
+ inline int get_tlm_export_id() const {
88
+ return(m_tlm_export_id);
89
+ }
90
+
91
+ /// Sets the port id
92
+ void set_tlm_export_id(int tlm_export_id) {
93
+ m_tlm_export_id = tlm_export_id;
94
+ }
95
+
96
+
97
+ //---------------------------------------------------------------------------
98
+
99
+ /// Register the target port
100
+ inline void register_target_port(this_type * target_port) {
101
+ m_target_port_list.push_back(target_port);
102
+ }
103
+
104
+ /// Returns the vector of registered target port(s)
105
+ inline std::vector<this_type *>& get_target_port_list() {
106
+ return(m_target_port_list);
107
+ }
108
+
109
+ /// Sets the vector of registered target port(s) (port propagation)
110
+ inline void set_target_port_list(std::vector<this_type*>& target_port_list) {
111
+ m_target_port_list = target_port_list;
112
+ }
113
+
114
+ /// @}
115
+
116
+ protected:
117
+
118
+ /// Port instance ID
119
+ int m_tlm_export_id;
120
+
121
+ /// target port objects registration
122
+ /**
123
+ * Direct registration of the target port(s) into current target port.
124
+ * \n Used for transaction recording and target port id propagation in case of target port binding
125
+ * through a module hierarchy
126
+ **/
127
+ std::vector<this_type *> m_target_port_list;
128
+
129
+ };
130
+
131
+ #endif /* _PV_TARGET_PORT_BASE_H_ */
132
+
133
+
@@ -0,0 +1,280 @@
1
+ /*****************************************************************************
2
+ Description: pv_tlm_if.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
+ #ifndef _PV_TLM_IF_H_
44
+ #define _PV_TLM_IF_H_
45
+
46
+
47
+ /*------------------------------------------------------------------------------
48
+ * Includes
49
+ *----------------------------------------------------------------------------*/
50
+ #include "tlm.h"
51
+
52
+ //----------------------------------------------------------------------------
53
+ // extra definitions added to the tlm namespace
54
+
55
+ namespace tlm {
56
+ class tlm_status {
57
+
58
+ public:
59
+
60
+ tlm_status() :
61
+ m_status(TLM_ERROR_FLAG)
62
+ {}
63
+
64
+ inline bool is_ok() const {
65
+ return (!is_error());
66
+ }
67
+ inline void set_ok() {
68
+ reset_error();
69
+ }
70
+ inline bool is_error() const {
71
+ return (m_status & TLM_ERROR_FLAG);
72
+ }
73
+ inline void set_error() {
74
+ m_status |= TLM_ERROR_FLAG;
75
+ }
76
+ inline void reset_error() {
77
+ m_status &= ~TLM_ERROR_FLAG;
78
+ }
79
+ inline bool is_no_response() const {
80
+ return (m_status & TLM_NO_RESPONSE_FLAG);
81
+ }
82
+ inline void set_no_response() {
83
+ m_status |= TLM_NO_RESPONSE_FLAG;
84
+ }
85
+ inline void reset_no_response() {
86
+ m_status &= ~TLM_NO_RESPONSE_FLAG;
87
+ }
88
+
89
+ protected :
90
+
91
+ unsigned int m_status;
92
+
93
+ enum status_list {
94
+ TLM_SUCCESS = 0, ///< Successful completion
95
+ TLM_ERROR, ///< Target indicates an error occurs during the access
96
+ TLM_NO_RESPONSE ///< No target response to the initiator's request
97
+
98
+ };
99
+
100
+ enum status_flags {
101
+ TLM_ERROR_FLAG = 0x01ul << TLM_ERROR, ///< Mask to set and reset TLM_ERROR flag
102
+ TLM_NO_RESPONSE_FLAG = 0x01ul << TLM_NO_RESPONSE, ///< Mask to set and reset TLM_NO_RESPONSE flag
103
+ };
104
+
105
+ };
106
+
107
+ enum tlm_mode {
108
+ REGULAR
109
+ };
110
+
111
+ enum tlm_endianness {
112
+ TLM_LITTLE_ENDIAN,
113
+ TLM_BIG_ENDIAN
114
+ };
115
+
116
+ #if defined(_WIN32) && defined(_MSC_VER)
117
+
118
+ typedef unsigned __int64 tlm_uint64_t;
119
+ typedef unsigned __int32 tlm_uint32_t;
120
+ typedef unsigned __int16 tlm_uint16_t;
121
+ typedef unsigned __int8 tlm_uint8_t;
122
+
123
+ typedef __int64 tlm_sint64_t;
124
+ typedef __int32 tlm_sint32_t;
125
+ typedef __int16 tlm_sint16_t;
126
+ typedef __int8 tlm_sint8_t;
127
+
128
+ #else
129
+
130
+ typedef unsigned long long tlm_uint64_t;
131
+ typedef unsigned long tlm_uint32_t;
132
+ typedef unsigned short tlm_uint16_t;
133
+ typedef unsigned char tlm_uint8_t;
134
+
135
+ typedef long long tlm_sint64_t;
136
+ typedef long tlm_sint32_t;
137
+ typedef short tlm_sint16_t;
138
+ typedef char tlm_sint8_t;
139
+
140
+ #endif
141
+
142
+ static const unsigned int NO_BE = 0xffffffff;
143
+ }
144
+
145
+ /** Host arch. identification and associated typedef and define.
146
+ **/
147
+
148
+ #if defined(__sparc) || defined(macintosh) || defined(__hppa)
149
+
150
+ /* Workstation endianness */
151
+ #define HOST_ENDIAN_BIG
152
+
153
+ /* SOC Endianness default value = host endianness */
154
+ #define PV_HOST_ENDIAN tlm::TLM_BIG_ENDIAN
155
+
156
+ #elif defined(__acorn) || defined(__mvs) || defined(_WIN32) || \
157
+ (defined(__alpha) && defined(__osf__)) || defined(__i386) || defined(x86_64)
158
+
159
+ /* Workstation endianness */
160
+ #define HOST_ENDIAN_LITTLE
161
+
162
+ /* SOC Endianness default value = host endianness */
163
+ #define PV_HOST_ENDIAN tlm::TLM_LITTLE_ENDIAN
164
+
165
+ #else
166
+ /* Workstation endianness */
167
+ #define HOST_ENDIAN_UNKNOWN
168
+
169
+ #endif
170
+
171
+ //----------------------------------------------------------------------------
172
+ // PV_TLM abstract interface class, convenience API.
173
+
174
+ template< typename ADDRESS,typename DATA>
175
+ class pv_tlm_if {
176
+
177
+ public:
178
+
179
+ virtual ~pv_tlm_if() {}
180
+
181
+ virtual tlm::tlm_status read(const ADDRESS& address,
182
+ DATA& data,
183
+ const unsigned int byte_enable = tlm::NO_BE,
184
+ const tlm::tlm_mode mode = tlm::REGULAR,
185
+ const unsigned int export_id = 0
186
+ ) = 0;
187
+
188
+ virtual tlm::tlm_status write(const ADDRESS& address,
189
+ const DATA& data,
190
+ const unsigned int byte_enable = tlm::NO_BE,
191
+ const tlm::tlm_mode mode = tlm::REGULAR,
192
+ const unsigned int export_id = 0
193
+ ) = 0;
194
+ };
195
+
196
+ //----------------------------------------------------------------------------
197
+ // PV request and response data structures
198
+
199
+ enum pv_command {
200
+ PV_READ,
201
+ PV_WRITE
202
+ };
203
+
204
+ template< typename ADDRESS , typename DATA >
205
+ class pv_request
206
+ {
207
+ public:
208
+
209
+ typedef pv_request<ADDRESS,DATA> this_type;
210
+
211
+ pv_request() :
212
+ m_command(PV_READ),
213
+ m_address(0),
214
+ m_data(0)
215
+ {}
216
+ pv_request(const this_type& other) :
217
+ m_command(other.m_command),
218
+ m_address(other.m_address),
219
+ m_data(other.m_data)
220
+ {}
221
+
222
+ this_type& operator= (const this_type& other) {
223
+ m_command = other.m_command;
224
+ m_address = other.m_address;
225
+ m_data = other.m_data;
226
+ return *this;
227
+ }
228
+
229
+ inline pv_command get_command() const { return m_command; }
230
+ inline void set_command(const pv_command command) { m_command = command; }
231
+
232
+ inline ADDRESS get_address() const { return m_address; }
233
+ inline void set_address(const ADDRESS address) { m_address = address; }
234
+
235
+ inline const DATA& get_data() const { return m_data; }
236
+ inline void set_data(const DATA& data) { m_data = data; }
237
+
238
+ protected:
239
+ pv_command m_command;
240
+ ADDRESS m_address;
241
+ DATA m_data;
242
+ };
243
+
244
+ template< typename DATA >
245
+ class pv_response
246
+ {
247
+ public:
248
+
249
+ typedef pv_response<DATA> this_type;
250
+
251
+ pv_response() :
252
+ m_status(),
253
+ m_data(0)
254
+ {}
255
+ pv_response(const this_type& other) :
256
+ m_status(other.m_status),
257
+ m_data(other.m_data)
258
+ {}
259
+
260
+ this_type& operator= (const this_type& other) {
261
+ m_status = other.m_status;
262
+ m_data = other.m_data;
263
+ return *this;
264
+ }
265
+
266
+ inline const tlm::tlm_status get_status() const { return m_status; }
267
+ inline tlm::tlm_status get_status() { return m_status; }
268
+ inline void set_status(const tlm::tlm_status& status) { m_status = status; }
269
+
270
+ inline const DATA& get_data() const { return m_data; }
271
+ inline DATA& get_data() { return m_data; }
272
+ inline void set_data(const DATA& data) { m_data = data; }
273
+
274
+ protected:
275
+ tlm::tlm_status m_status;
276
+ DATA m_data;
277
+ };
278
+
279
+ #endif /* _PV_TLM_IF_H_ */
280
+