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,105 @@
1
+ # Copyright (C) 2010 TIMA Laboratory
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+ #
16
+
17
+ require File.join File.dirname(__FILE__), 'general_spec'
18
+
19
+ describe 'IPXACT, when using the tools for bus data extraction' do
20
+ it "should be able to extract data from a mirrored slave bus interface" do
21
+ variables = {
22
+ "range_slv0_mirror" => "0x00040000",
23
+ "range_slv1_mirror" => "0x00009000",
24
+ "start_addr_slv0_mirror" => "0x0",
25
+ "start_addr_slv1_mirror" => "0x30000000"
26
+ }
27
+ components = IPXACT::load_components(PLATFORM_PATH)
28
+
29
+ ahbbus22_component = components[['ahbbus22', '1.4']]
30
+ mirrored_slave_0 = ahbbus22_component.xpath(".//spirit:busInterface") \
31
+ .select{|bus| bus.xpath("./spirit:name").first.text == 'AHB_MirroredSlave0'} \
32
+ .first
33
+
34
+ IPXACT::Parser::BusData::extract_bus_data(mirrored_slave_0, ahbbus22_component, variables).should \
35
+ eql([:mirrored_slave, {
36
+ :remap => {:address => "0x0", :id => "start_addr_slv0_mirror"},
37
+ :range => {:value => "0x00040000", :id => "range_slv0_mirror"}
38
+ }])
39
+
40
+ mirrored_slave_1 = ahbbus22_component.xpath(".//spirit:busInterface") \
41
+ .select{|bus| bus.xpath("./spirit:name").first.text == 'AHB_MirroredSlave1'} \
42
+ .first
43
+
44
+ IPXACT::Parser::BusData::extract_bus_data(mirrored_slave_1, ahbbus22_component, variables).should \
45
+ eql([:mirrored_slave, {
46
+ :remap => {:address => "0x30000000", :id => "start_addr_slv1_mirror"},
47
+ :range => {:value => "0x00009000", :id => "range_slv1_mirror"}
48
+ }])
49
+ end
50
+
51
+ it "should be able to extract data from a mirrored master bus interface" do
52
+ components = IPXACT::load_components(PLATFORM_PATH)
53
+ ahbbus22_component = components[['ahbbus22', '1.4']]
54
+ mirrored_master_0 = ahbbus22_component.xpath(".//spirit:busInterface") \
55
+ .select{|bus| bus.xpath("./spirit:name").first.text == 'AHB_MirroredMaster0'} \
56
+ .first
57
+ IPXACT::Parser::BusData::extract_bus_data(mirrored_master_0, ahbbus22_component, []).should \
58
+ eql([:mirrored_master, nil])
59
+ end
60
+
61
+ it "should be able to extract data from a master bus interface" do
62
+ components = IPXACT::load_components(PLATFORM_PATH)
63
+ dma_component = components[['dma', '1.4']]
64
+ master = dma_component.xpath(".//spirit:busInterface") \
65
+ .select{|bus| bus.xpath("./spirit:name").first.text == 'AHB_Master'} \
66
+ .first
67
+ IPXACT::Parser::BusData::extract_bus_data(master, dma_component, []).should \
68
+ eql([:master, {:address_space_name => 'AHB_AS', :range => '4G', :width => '32'}])
69
+ end
70
+
71
+ it "should be able to extract data from a slave bus interface" do
72
+ components = IPXACT::load_components(PLATFORM_PATH)
73
+ dma_component = components[['dma', '1.4']]
74
+ slave = dma_component.xpath(".//spirit:busInterface") \
75
+ .select{|bus| bus.xpath("./spirit:name").first.text == 'APB_Slave'} \
76
+ .first
77
+ IPXACT::Parser::BusData::extract_bus_data(slave, dma_component, []).should \
78
+ eql([:slave, {
79
+ :memory_map_name => 'APB_MM',
80
+ :base_address => '0',
81
+ :range => '16',
82
+ :width => '32',
83
+ :registers => [
84
+ {
85
+ :name => 'sourceAddress',
86
+ :offset => '0x0',
87
+ :size => '32',
88
+ :access => 'read-write'
89
+ },
90
+ {
91
+ :name => 'destinationAddress',
92
+ :offset => '0x4',
93
+ :size => '32',
94
+ :access => 'read-write'
95
+ },
96
+ {
97
+ :name => 'control',
98
+ :offset => '0x8',
99
+ :size => '32',
100
+ :access => 'read-write'
101
+ }
102
+ ]
103
+ }])
104
+ end
105
+ end
@@ -0,0 +1,133 @@
1
+ # Copyright (C) 2010 TIMA Laboratory
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+ #
16
+
17
+ require File.join File.dirname(__FILE__), 'general_spec'
18
+
19
+ describe "The data calculation functions of our IPXACT tool" do
20
+ it "should be able to find valid data paths when building a driver" do
21
+ expected_data_path = [
22
+ [
23
+ {
24
+ :component_instance => 'i_proc',
25
+ :port_name => "AHB_Master",
26
+ },
27
+ {
28
+ :component_instance => 'i_ahb',
29
+ :port_name => 'AHB_MirroredMaster0'
30
+ }
31
+ ],
32
+ [
33
+ {
34
+ :component_instance => 'i_ahb',
35
+ :port_name => 'AHB_MirroredSlave1'
36
+ },
37
+ {
38
+ :component_instance => 'i_h2p',
39
+ :port_name => 'AHB_Slave'
40
+ }
41
+ ],
42
+ [
43
+ {
44
+ :component_instance => 'i_h2p',
45
+ :port_name => 'APB_Master'
46
+ },
47
+ {
48
+ :component_instance => 'i_apb',
49
+ :port_name => 'APB_MirroredMaster'
50
+ }
51
+ ],
52
+ [
53
+ {
54
+ :component_instance => 'i_apb',
55
+ :port_name => 'APB_MirroredSlave7'
56
+ },
57
+ {
58
+ :component_instance => 'i_dma',
59
+ :port_name => 'APB_Slave'
60
+ }
61
+ ]
62
+ ]
63
+
64
+ components = IPXACT::load_components(PLATFORM_PATH)
65
+ designs = IPXACT::load_designs(PLATFORM_PATH)
66
+ platform = IPXACT::Parser::PlatformData.parse_platform(["Leon2Platform", "1.1"], components, designs)
67
+
68
+ data_path = nil
69
+ lambda {
70
+ data_path = platform.resolve_data_path('i_proc', 'i_dma')
71
+ }.should_not raise_exception
72
+ data_path.should eql(expected_data_path)
73
+ end
74
+
75
+ it "should be able to assign instance variables to mirrored slave addresses and ranges" do
76
+ expected_values = {
77
+ "range_slv0_mirror" => "0x00040000",
78
+ "range_slv1_mirror" => "0x00009000",
79
+ "start_addr_slv0_mirror" => "0x0",
80
+ "start_addr_slv1_mirror" => "0x30000000"
81
+ }
82
+
83
+ components = IPXACT::load_components(PLATFORM_PATH)
84
+ designs = IPXACT::load_designs(PLATFORM_PATH)
85
+ platform = IPXACT::Parser::PlatformData.parse_platform(["Leon2Platform", "1.1"], components, designs)
86
+
87
+ nodes_with_mirrored_slaves = platform.components.values.select do |node|
88
+ node.ports.any?{|port| port[:type] == :mirrored_slave}
89
+ end
90
+
91
+ mirrored_slave_ports = nodes_with_mirrored_slaves.collect{|node|
92
+ node.ports.select{|port| port[:type] == :mirrored_slave}
93
+ }.flatten
94
+
95
+ expected_values.each do |expected_key, expected_value|
96
+ port = mirrored_slave_ports.select do | mirrored_s |
97
+ mirrored_s[:port_data] && (mirrored_s[:port_data][:remap][:id] == expected_key ||
98
+ mirrored_s[:port_data][:range][:id])
99
+ end.first
100
+
101
+ unless port.empty?
102
+ if port[:port_data][:remap][:id] == expected_key
103
+ port[:port_data][:remap][:address].should == expected_value
104
+ elsif port[:port_data][:range][:id] == expected_key
105
+ port[:port_data][:range][:value].should == expected_value
106
+ end
107
+ end
108
+ end
109
+ end
110
+
111
+ it "should be able to determine the dma component's base address from the interconnect path" do
112
+ # DMA remap address : 0x30000000 + 0x7000 = 0x30007000
113
+ components = IPXACT::load_components(PLATFORM_PATH)
114
+ designs = IPXACT::load_designs(PLATFORM_PATH)
115
+ platform = IPXACT::Parser::PlatformData.parse_platform(["Leon2Platform", "1.1"], components, designs)
116
+ data_path = platform.resolve_data_path('i_proc', 'i_dma')
117
+
118
+ base_address = platform.resolve_base_address(data_path)
119
+ base_address.should == 0x30007000 # AHB remap + APB remap (as defined in the apbSubsystem design file)
120
+ end
121
+
122
+
123
+ it "should be able to determine the cgu component's base address from the interconnect path" do
124
+ components = IPXACT::load_components(PLATFORM_PATH)
125
+ designs = IPXACT::load_designs(PLATFORM_PATH)
126
+ platform = IPXACT::Parser::PlatformData.parse_platform(["Leon2Platform", "1.2"], components, designs)
127
+ data_path = platform.resolve_data_path('i_proc', 'i_cgu')
128
+
129
+ base_address = platform.resolve_base_address(data_path)
130
+ base_address.should == 0x30004000
131
+ end
132
+
133
+ end
@@ -0,0 +1,52 @@
1
+ # Copyright (C) 2010 TIMA Laboratory
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+ #
16
+
17
+ require File.join File.dirname(__FILE__), 'general_spec'
18
+
19
+ describe "The data construction functions of our IPXACT tool" do
20
+ it "should be able to create an interconnect list with valid component nodes" do
21
+ components = IPXACT::load_components(PLATFORM_PATH)
22
+ designs = IPXACT::load_designs(PLATFORM_PATH)
23
+ platform = IPXACT::Parser::PlatformData.parse_platform(["Leon2Platform", "1.1"], components, designs)
24
+
25
+ expected_nodes = ['i_ahb', 'i_mem', 'i_sub', 'i_cgu', 'i_dma', 'i_proc', 'i_rgu']
26
+ nodes = platform.components.keys
27
+
28
+ expected_nodes.each {|expected_node| nodes.should include(expected_node)}
29
+ nodes.each {|node| expected_nodes.should include(node)}
30
+ end
31
+
32
+ it "should be able to create an interconnect list with a valid connections list" do
33
+ components = IPXACT::load_components(PLATFORM_PATH)
34
+ designs = IPXACT::load_designs(PLATFORM_PATH)
35
+ platform = IPXACT::Parser::PlatformData.parse_platform(["Leon2Platform", "1.1"], components, designs)
36
+
37
+ platform.interconnections.values.should include(
38
+ [
39
+ {
40
+ :component_instance => "i_proc",
41
+ :port_name => "AHB_Master",
42
+ :port_type => :master
43
+ },
44
+ {
45
+ :component_instance => "i_ahb",
46
+ :port_name => "AHB_MirroredMaster0",
47
+ :port_type => :mirrored_master
48
+ }
49
+ ]
50
+ )
51
+ end
52
+ end
@@ -0,0 +1,121 @@
1
+ # Copyright (C) 2010 TIMA Laboratory
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+ #
16
+
17
+ require File.join(File.dirname(__FILE__), '../../lib/ipxact')
18
+
19
+ PLATFORM_PATH = File.join File.dirname(__FILE__) , '../test_data/spiritconsortium.org/Leon2TLM'
20
+ DESIGN_PATH = 'SystemTLM1/Leon2Platform/design_Leon2Platform.xml'
21
+
22
+
23
+ describe "IPXACT: the tools for building transformation data" do
24
+
25
+ context "component and design validation" do
26
+ it "should confirm that a design file is not a valid component" do
27
+ IPXACT::is_valid_component?(File.join(PLATFORM_PATH,DESIGN_PATH)).should be_false
28
+ end
29
+
30
+ it "should confirm the validity of a valid component" do
31
+ IPXACT::is_valid_component?(File.join(PLATFORM_PATH, 'SystemTLM1/Leon2Platform/Leon2Platform.xml')).should be_true
32
+ end
33
+
34
+ it "should raise an exception when given an invalid path" do
35
+ lambda{
36
+ IPXACT::is_valid_component?(3)
37
+ }.should raise_exception(ArgumentError)
38
+
39
+ lambda{
40
+ IPXACT::is_valid_design?(3)
41
+ }.should raise_exception(ArgumentError)
42
+ end
43
+
44
+ it "should confirm a design file's validity" do
45
+ IPXACT::is_valid_design?(File.join(PLATFORM_PATH,DESIGN_PATH)).should be_true
46
+ end
47
+
48
+ it "should confirm that a component is not a valid design" do
49
+ IPXACT::is_valid_design?(File.join(PLATFORM_PATH, 'SystemTLM1/Leon2Platform/Leon2Platform.xml')).should be_false
50
+ end
51
+ end
52
+
53
+ context "extracting a component's identifier" do
54
+ it "should be able to extract a design's identifier" do
55
+ IPXACT::identifier(File.join(PLATFORM_PATH,DESIGN_PATH)).should == {
56
+ :name => 'design_Leon2Platform',
57
+ :vendor => 'spiritconsortium.org',
58
+ :library => 'Leon2TLM',
59
+ :version => '1.1'
60
+ }
61
+ end
62
+
63
+ it "should be able to extract a component's identifier" do
64
+ IPXACT::identifier(File.join(PLATFORM_PATH,'SystemTLM1/Leon2Platform/Leon2Platform.xml')).should == {
65
+ :name => 'Leon2Platform',
66
+ :vendor => 'spiritconsortium.org',
67
+ :library => 'Leon2TLM',
68
+ :version => '1.1'
69
+ }
70
+ end
71
+ end
72
+
73
+
74
+ context "data loading" do
75
+ it "should be able to load all the design files for the Leon2 Platform" do
76
+ design_docs = IPXACT::load_designs(PLATFORM_PATH)
77
+ design_docs.should have(6).keys
78
+ end
79
+
80
+ it "should be able to load all the components from the Leon2 Platform" do
81
+ component_docs = IPXACT::load_components(PLATFORM_PATH)
82
+ component_docs.should have(21).keys
83
+ end
84
+ end
85
+
86
+ context "platform creation" do
87
+ it "should be able to create a new platform, based on the documents that were loaded" do
88
+ design_docs = IPXACT::load_designs(PLATFORM_PATH)
89
+ component_docs = IPXACT::load_components(PLATFORM_PATH)
90
+
91
+ platform = nil
92
+ lambda {
93
+ platform = IPXACT::Parser::PlatformData.parse_platform(["Leon2Platform", "1.1"], component_docs, design_docs)
94
+ }.should_not raise_exception
95
+
96
+ platform.should_not be_nil
97
+ platform.should have(10).interconnections
98
+ platform.should have(7).components
99
+ end
100
+
101
+ it "should be able to load the subcomponents of the platform" do
102
+ design_docs = IPXACT::load_designs(PLATFORM_PATH)
103
+ component_docs = IPXACT::load_components(PLATFORM_PATH)
104
+ platform = IPXACT::Parser::PlatformData.parse_platform(["Leon2Platform", "1.1"], component_docs, design_docs)
105
+ platform.components['i_ahb'].should have(0).subcomponents
106
+ platform.components['i_ahb'].should have(0).interconnections
107
+ platform.components['i_sub'].should have(4).subcomponents
108
+ platform.components['i_sub'].should have(5).interconnections
109
+ platform.components['i_sub'][:version].should == "1.1"
110
+ platform.should have(0).ports
111
+ end
112
+
113
+ it "should be able to load component ports" do
114
+ design_docs = IPXACT::load_designs(PLATFORM_PATH)
115
+ component_docs = IPXACT::load_components(PLATFORM_PATH)
116
+ platform = IPXACT::Parser::PlatformData.parse_platform(["Leon2Platform", "1.1"], component_docs, design_docs)
117
+ ahb = platform.components['i_ahb']
118
+ ahb.should have(4).ports
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,135 @@
1
+ /*****************************************************************************
2
+ Revision: $Revision: 1506 $
3
+ Date: $Date: 2009-04-26 01:51:56 -0500 (Sun, 26 Apr 2009) $
4
+
5
+ Copyright (c) 2008, 2009 The SPIRIT Consortium.
6
+
7
+ This work forms part of a deliverable of The SPIRIT Consortium.
8
+
9
+ Use of these materials are governed by the legal terms and conditions
10
+ outlined in the disclaimer available from www.spiritconsortium.org.
11
+
12
+ This source file is provided on an AS IS basis. The SPIRIT
13
+ Consortium disclaims any warranty express or implied including
14
+ any warranty of merchantability and fitness for use for a
15
+ particular purpose.
16
+
17
+ The user of the source file shall indemnify and hold The SPIRIT
18
+ Consortium and its members harmless from any damages or liability.
19
+ Users are requested to provide feedback to The SPIRIT Consortium
20
+ using either mailto:feedback@lists.spiritconsortium.org or the forms at
21
+ http://www.spiritconsortium.org/about/contact_us/
22
+
23
+ This file may be copied, and distributed, with or without
24
+ modifications; but these notices must be included on any copy.
25
+
26
+ The following code is derived, directly or indirectly, from the SystemC
27
+ source code Copyright (c) 1996-2004 by all Contributors.
28
+ All Rights reserved.
29
+
30
+ The contents of this file are subject to the restrictions and limitations
31
+ set forth in the SystemC Open Source License Version 2.4 (the "License");
32
+ You may not use this file except in compliance with such restrictions and
33
+ limitations. You may obtain instructions on how to receive a copy of the
34
+ License at http://www.systemc.org/. Software distributed by Contributors
35
+ under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
36
+ ANY KIND, either express or implied. See the License for the specific
37
+ language governing rights and limitations under the License.
38
+
39
+ *****************************************************************************/
40
+
41
+
42
+ #ifndef _PV_INITIATOR_PORT_H_
43
+ #define _PV_INITIATOR_PORT_H_
44
+
45
+ /*------------------------------------------------------------------------------
46
+ * Includes
47
+ *----------------------------------------------------------------------------*/
48
+ #include <vector>
49
+
50
+ #include "systemc.h"
51
+
52
+ #include "tlm.h"
53
+
54
+ #include "pv_tlm_if.h"
55
+ #include "pv_initiator_port_base.h"
56
+ #include "pv_target_port.h"
57
+
58
+ //----------------------------------------------------------------------------
59
+ template<typename ADDRESS,typename DATA,int N = 1>
60
+ class pv_initiator_port :
61
+ public sc_port<tlm::tlm_transport_if<pv_request<ADDRESS,DATA>,pv_response<DATA> >, N>,
62
+ public pv_initiator_port_base,
63
+ public virtual pv_tlm_if<ADDRESS,DATA> {
64
+
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
+
70
+ typedef sc_export<interface_type> sc_target_port_type;
71
+ typedef sc_port<interface_type,N> sc_initiator_port_type;
72
+
73
+ typedef pv_target_port<ADDRESS,DATA> pv_target_port_type;
74
+ typedef pv_initiator_port<ADDRESS,DATA,N> pv_initiator_port_type;
75
+
76
+ typedef pv_target_port_base target_port_base_type;
77
+ typedef pv_initiator_port_base initiator_port_base_type;
78
+
79
+ public:
80
+
81
+ //--------------
82
+ // Constructor
83
+ //--------------
84
+ pv_initiator_port(const char * port_name);
85
+
86
+
87
+ //---------------------------------------
88
+ // Execute the transaction transfer
89
+ void do_transport(request_type& request,
90
+ response_type& response,
91
+ unsigned int target_port_rank = 0);
92
+
93
+ //-------------------------------------------------------------------
94
+ //Abstract class pv_tlm_if methods implementation: used as convenience API
95
+
96
+ virtual tlm::tlm_status read(const ADDRESS& address,
97
+ DATA& data,
98
+ const unsigned int byte_enable = tlm::NO_BE,
99
+ const tlm::tlm_mode mode = tlm::REGULAR,
100
+ const unsigned int export_id = 0
101
+ );
102
+
103
+ virtual tlm::tlm_status write(const ADDRESS& address,
104
+ const DATA& data,
105
+ const unsigned int byte_enable = tlm::NO_BE,
106
+ const tlm::tlm_mode mode = tlm::REGULAR,
107
+ const unsigned int export_id = 0
108
+ );
109
+
110
+ //------------------
111
+ //Additional methods
112
+ void before_end_of_elaboration();
113
+ void end_of_elaboration();
114
+
115
+ void bind(pv_target_port_type&);
116
+ void operator() (pv_target_port_type&);
117
+
118
+ void bind(sc_port_b<interface_type>&);
119
+ void operator() (sc_port_b<interface_type>&);
120
+
121
+ void bind(interface_type&);
122
+ void operator() (interface_type&);
123
+
124
+ protected:
125
+ bool is_interface_bound_twice(sc_export_base&);
126
+ };
127
+
128
+
129
+
130
+ // Class implementation
131
+ #include "./pv_initiator_port.tpp"
132
+
133
+ #endif /* _PV_INITIATOR_PORT_H_ */
134
+
135
+