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,128 @@
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
+
20
+ describe IPXACT::GraphPathFinder do
21
+
22
+ before(:each) do
23
+ @simple_graph = {
24
+ :nodes => ['component_a', 'component_b', 'component_c',
25
+ 'component_d'],
26
+ :connections =>
27
+ [
28
+ {:link => [0,1], :via => 'connect_1'},
29
+ {:link => [1,2], :via => 'connect_2'},
30
+ {:link => [2,0], :via => 'connect_3.1'},
31
+ {:link => [2,3], :via => 'connect_3.2'}
32
+ ]
33
+ }
34
+
35
+ @complete_graph = {
36
+ :nodes => ['i_proc', 'i_ahb', 'i_dma', 'i_sub', 'i_mem',
37
+ 'i_cgu', 'i_rgu'],
38
+ :connections =>
39
+ [
40
+ {:link => [0,1], :via => 'connect_1'},
41
+ {:link => [2,1], :via => 'connect_2'},
42
+ {:link => [1,4], :via => 'connect_3'},
43
+ {:link => [1,3], :via => 'connect_4'},
44
+ {:link => [3,0], :via => 'connect_5'},
45
+ {:link => [3,5], :via => 'connect_6'},
46
+ {:link => [3,6], :via => 'connect_7'},
47
+ {:link => [3,2], :via => 'connect_8'}
48
+ ]
49
+ }
50
+
51
+ @cheapest_path_graph = {
52
+ :nodes => ['component_a', 'component_b', 'component_c',
53
+ 'component_d'],
54
+ :connections =>
55
+ [
56
+ {:link => [0,1], :via => 'connect_1'},
57
+ {:link => [1,2], :cost => 8, :via => 'connect_expensive'},
58
+ {:link => [2,3], :via => 'connect_2'},
59
+ {:link => [1,3], :cost => 9, :via => 'connect_cheaper'}
60
+ ]
61
+ }
62
+ end
63
+
64
+ context "incorrect graph/arguments" do
65
+ it "should return an exception when the graph is empty" do
66
+ finder = IPXACT::GraphPathFinder.new({})
67
+ lambda {
68
+ finder.resolve('component_a', 'component_b')
69
+ }.should raise_exception
70
+ end
71
+
72
+ it "should return an exception if any component is not unique" do
73
+ @simple_graph[:nodes][1] = 'component_a'
74
+ finder = IPXACT::GraphPathFinder.new @simple_graph
75
+ lambda {
76
+ finder.resolve('component_a', 'component_c')
77
+ }.should raise_exception
78
+ end
79
+
80
+ it "should return an exception if the source or target component does not exist" do
81
+ finder = IPXACT::GraphPathFinder.new @simple_graph
82
+ lambda {
83
+ finder.resolve('component_a', 'component_z')
84
+ }.should raise_exception
85
+ lambda {
86
+ finder.resolve('component_z', 'component_a')
87
+ }.should raise_exception
88
+ end
89
+
90
+ end
91
+
92
+ context "graph pathfinding" do
93
+ it "should return an empty array if the source equals the destination" do
94
+ finder = IPXACT::GraphPathFinder.new @simple_graph
95
+ finder.resolve('component_a', 'component_a').should eql([])
96
+ end
97
+
98
+ it "should return an array with a single element if the source is right next to the destination" do
99
+ finder = IPXACT::GraphPathFinder.new(@simple_graph)
100
+ finder.resolve('component_a', 'component_b').should eql([0])
101
+ finder.resolve('component_c', 'component_a').should eql([2])
102
+ end
103
+
104
+ it "should raise an exception if the destination cannot be reached" do
105
+ finder = IPXACT::GraphPathFinder.new(@simple_graph)
106
+ lambda {
107
+ finder.resolve('component_d', 'component_a')
108
+ }.should raise_exception
109
+ end
110
+
111
+ it "should return a correct path from a simple graph" do
112
+ finder = IPXACT::GraphPathFinder.new(@simple_graph)
113
+ finder.resolve('component_a', 'component_d').should eql([0,1,3])
114
+ end
115
+
116
+ it "should be able to favor a cheaper path" do
117
+ finder = IPXACT::GraphPathFinder.new(@cheapest_path_graph)
118
+ finder.resolve('component_a', 'component_d').should eql([0,3])
119
+ end
120
+
121
+ it "should return a correct path from a realistic connection graph" do
122
+ finder = IPXACT::GraphPathFinder.new(@complete_graph)
123
+ finder.resolve('i_proc', 'i_dma').should eql([0,3,7])
124
+ finder.resolve('i_dma', 'i_proc').should eql([1,3,4])
125
+ end
126
+
127
+ end
128
+ end
@@ -0,0 +1,177 @@
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
+ describe "IPXACT component interconnections" do
18
+
19
+ it "should be able to reorder connection lists without modifying list size" do
20
+ test_list = [
21
+ [
22
+ {
23
+ :component_instance => 'comp_1',
24
+ :port_name => 'port_1',
25
+ :port_type => :master
26
+ },
27
+ {
28
+ :component_instance => 'comp_2',
29
+ :port_name => 'port_2a',
30
+ :port_type => :mirrored_master
31
+ }
32
+ ],
33
+ [
34
+ {
35
+ :component_instance => 'comp_2',
36
+ :port_name => 'port_2b',
37
+ :port_type => :slave
38
+ },
39
+ {
40
+ :component_instance => 'comp_3',
41
+ :port_name => 'port_3',
42
+ :port_type => :master
43
+ }
44
+ ]
45
+ ]
46
+ modified_list = test_list.collect do |test|
47
+ IPXACT::Parser::ComponentData.reorder_connection(test)
48
+ end
49
+ modified_list.compact.size.should == test_list.size
50
+ end
51
+
52
+ it "should raise an exception when reordering incorrect port types" do
53
+ test_list = [
54
+ [
55
+ {
56
+ :component_instance => 'comp_1',
57
+ :port_name => 'port_1',
58
+ :port_type => :slave
59
+ },
60
+ {
61
+ :component_instance => 'comp_2',
62
+ :port_name => 'port_2a',
63
+ :port_type => :mirrored_master
64
+ }
65
+ ],
66
+ [
67
+ {
68
+ :component_instance => 'comp_2',
69
+ :port_name => 'port_2b',
70
+ :port_type => :slave
71
+ },
72
+ {
73
+ :component_instance => 'comp_3',
74
+ :port_name => 'port_3',
75
+ :port_type => :master
76
+ }
77
+ ]
78
+ ]
79
+ lambda {
80
+ test_list.collect do |test|
81
+ IPXACT::Parser::ComponentData.reorder_connection(test)
82
+ end
83
+ }.should raise_exception
84
+ end
85
+
86
+ it "should reorder valid port types" do
87
+ test_list = [
88
+ [
89
+ {
90
+ :component_instance => 'comp_1',
91
+ :port_name => 'port_1a',
92
+ :port_type => :master
93
+ },
94
+ {
95
+ :component_instance => 'comp_2',
96
+ :port_name => 'port_2a',
97
+ :port_type => :mirrored_master
98
+ }
99
+ ],
100
+ [
101
+ {
102
+ :component_instance => 'comp_1',
103
+ :port_name => 'port_1b',
104
+ :port_type => :slave
105
+ },
106
+ {
107
+ :component_instance => 'comp_3',
108
+ :port_name => 'port_3',
109
+ :port_type => :master
110
+ }
111
+ ]
112
+ ]
113
+ expected_list = [
114
+ [
115
+ {
116
+ :component_instance => 'comp_1',
117
+ :port_name => 'port_1a',
118
+ :port_type => :master
119
+ },
120
+ {
121
+ :component_instance => 'comp_2',
122
+ :port_name => 'port_2a',
123
+ :port_type => :mirrored_master
124
+ }
125
+ ],
126
+ [
127
+ {
128
+ :component_instance => 'comp_3',
129
+ :port_name => 'port_3',
130
+ :port_type => :master
131
+ },
132
+ {
133
+ :component_instance => 'comp_1',
134
+ :port_name => 'port_1b',
135
+ :port_type => :slave
136
+ }
137
+ ]
138
+ ]
139
+ test_list.collect do |test|
140
+ IPXACT::Parser::ComponentData.reorder_connection(test)
141
+ end.should == expected_list
142
+ end
143
+
144
+ it "should allow connections with duplicate instances but different port names" do
145
+ test_list = [
146
+ [
147
+ {
148
+ :component_instance => 'comp_1',
149
+ :port_name => 'port_1a',
150
+ :port_type => :master
151
+ },
152
+ {
153
+ :component_instance => 'comp_2',
154
+ :port_name => 'port_2a',
155
+ :port_type => :mirrored_master
156
+ }
157
+ ],
158
+ [
159
+ {
160
+ :component_instance => 'comp_1',
161
+ :port_name => 'port_1b',
162
+ :port_type => :master
163
+ },
164
+ {
165
+ :component_instance => 'comp_2',
166
+ :port_name => 'port_2b',
167
+ :port_type => :slave
168
+ }
169
+ ]
170
+ ]
171
+ lambda {
172
+ test_list.each do |test|
173
+ IPXACT::Parser::ComponentData.reorder_connection(test)
174
+ end
175
+ }.should_not raise_exception
176
+ end
177
+ end
@@ -0,0 +1,69 @@
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
+ describe IPXACT do
20
+
21
+ context "version comparator" do
22
+
23
+ it "should return true when comparing '1' and '0'" do
24
+ IPXACT::is_most_recent_version?('1', '0').should be_true
25
+ end
26
+
27
+ it "should return false when comparing '0' and '1'" do
28
+ IPXACT::is_most_recent_version?('0', '1').should be_false
29
+ end
30
+
31
+ it "should return false when comparing '1' and '1'" do
32
+ IPXACT::is_most_recent_version?('1', '1').should be_false
33
+ end
34
+
35
+ it "should return false when comparing '1.0' and '1.0'" do
36
+ IPXACT::is_most_recent_version?('1.0', '1.0').should be_false
37
+ end
38
+
39
+ it "should return true when comparing '1.1' and '1.0'" do
40
+ IPXACT::is_most_recent_version?('1.1', '1.0').should be_true
41
+ end
42
+
43
+ it "should return false when comparing '1.0' and '1.1'" do
44
+ IPXACT::is_most_recent_version?('1.0', '1.1').should be_false
45
+ end
46
+
47
+ it "should return false when comparing '1.0.0' and '1.0'" do
48
+ IPXACT::is_most_recent_version?('1.0.0', '1.0').should be_false
49
+ end
50
+
51
+ it "should return false when comparing '1.0' and '1.0.0'" do
52
+ IPXACT::is_most_recent_version?('1.0', '1.0.0').should be_false
53
+ end
54
+
55
+ it "should return false when comparing '1.0' and '1.0.1'" do
56
+ IPXACT::is_most_recent_version?('1.0', '1.0.1').should be_false
57
+ end
58
+
59
+ it "should return true when comparing '1.0.1' and '1.0'" do
60
+ IPXACT::is_most_recent_version?('1.0.1', '1.0').should be_true
61
+ end
62
+
63
+ it "should return true when comparing '1.4.1' and '1.0'" do
64
+ IPXACT::is_most_recent_version?('1.4.1', '1.0').should be_true
65
+ end
66
+ end
67
+
68
+
69
+ end
@@ -0,0 +1,34 @@
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__), '../integration/general_spec'
18
+
19
+ describe IPXACT::Platform do
20
+
21
+ it "should get the most recent version of the platform if no version is specified" do
22
+ design_docs = IPXACT::load_designs(PLATFORM_PATH)
23
+ component_docs = IPXACT::load_components(PLATFORM_PATH)
24
+ platform = IPXACT::Parser::PlatformData.parse_platform("Leon2Platform", component_docs, design_docs)
25
+ platform[:version].should == "1.3"
26
+ end
27
+
28
+ it "should get the version of the platform that is specified in the arguments" do
29
+ design_docs = IPXACT::load_designs(PLATFORM_PATH)
30
+ component_docs = IPXACT::load_components(PLATFORM_PATH)
31
+ platform = IPXACT::Parser::PlatformData.parse_platform(["Leon2Platform", "1.1"], component_docs, design_docs)
32
+ platform[:version].should == "1.1"
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,225 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ipxact-ruby
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 11
8
+ - 1
9
+ version: 0.11.1
10
+ platform: ruby
11
+ authors:
12
+ - Guillaume Godet-Bar
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-13 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: nokogiri
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ description:
34
+ email: "guillaume.godetbar@gmail.com "
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files:
40
+ - README.html
41
+ - README.mdown
42
+ files:
43
+ - .autotest
44
+ - .gitignore
45
+ - Rakefile
46
+ - VERSION
47
+ - autotest/discover.rb
48
+ - lib/ipxact.rb
49
+ - lib/ipxact/component.rb
50
+ - lib/ipxact/parser.rb
51
+ - lib/ipxact/parser/bus_data_parser.rb
52
+ - lib/ipxact/parser/component_data_parser.rb
53
+ - lib/ipxact/parser/platform_data_parser.rb
54
+ - lib/ipxact/pathfinder/graph_pathfinder.rb
55
+ - lib/ipxact/platform.rb
56
+ - schemas/abstractionDefinition.xsd
57
+ - schemas/abstractor.xsd
58
+ - schemas/autoConfigure.xsd
59
+ - schemas/busDefinition.xsd
60
+ - schemas/busInterface.xsd
61
+ - schemas/commonStructures.xsd
62
+ - schemas/component.xsd
63
+ - schemas/configurable.xsd
64
+ - schemas/constraints.xsd
65
+ - schemas/design.xsd
66
+ - schemas/designConfig.xsd
67
+ - schemas/file.xsd
68
+ - schemas/fileType.xsd
69
+ - schemas/generator.xsd
70
+ - schemas/identifier.xsd
71
+ - schemas/index.xsd
72
+ - schemas/memoryMap.xsd
73
+ - schemas/model.xsd
74
+ - schemas/port.xsd
75
+ - schemas/signalDrivers.xsd
76
+ - schemas/simpleTypes.xsd
77
+ - schemas/subInstances.xsd
78
+ - spec/integration/bus_data_extraction_spec.rb
79
+ - spec/integration/data_calculation_spec.rb
80
+ - spec/integration/data_construction_spec.rb
81
+ - spec/integration/general_spec.rb
82
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port.h
83
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port.tpp
84
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_initiator_port_base.h
85
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_router.h
86
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_router.tpp
87
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_slave_base.h
88
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_slave_base.tpp
89
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_target_port.h
90
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_target_port_base.h
91
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/pv_tlm_if.h
92
+ - spec/test_data/spiritconsortium.org/Leon2TLM/PV/user_types.h
93
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/Leon2Platform.xml
94
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/design_Leon2Platform.xml
95
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/Leon2Platform/tlmsrc/Leon2Platform.h
96
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/apbSubSystem.xml
97
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/design_apbSubSystem.xml
98
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM1/apbSubSystem/tlmsrc/apbSubSystem.h
99
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/Leon2Platform.xml
100
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/design_Leon2Platform.xml
101
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/Leon2Platform/tlmsrc/Leon2Platform.h
102
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/apbSubSystem.xml
103
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/designConfig_apbSubSystem.xml
104
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/design_apbSubSystem.xml
105
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM2/apbSubSystem/tlmsrc/apbSubSystem.h
106
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/Leon2Platform.xml
107
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/design_Leon2Platform.xml
108
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/Leon2Platform/tlmsrc/Leon2Platform.h
109
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/apbSubSystem.xml
110
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/designConfig_apbSubSystem.xml
111
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/design_apbSubSystem.xml
112
+ - spec/test_data/spiritconsortium.org/Leon2TLM/SystemTLM3/apbSubSystem/tlmsrc/apbSubSystem.h
113
+ - spec/test_data/spiritconsortium.org/Leon2TLM/ahbbus/1.4/ahbbus22.xml
114
+ - spec/test_data/spiritconsortium.org/Leon2TLM/ahbbus/1.4/tlmsrc/ahbbus.h
115
+ - spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/ahbram.xml
116
+ - spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/tlmsrc/ahbram.cc
117
+ - spec/test_data/spiritconsortium.org/Leon2TLM/ahbram/1.4/tlmsrc/ahbram.h
118
+ - spec/test_data/spiritconsortium.org/Leon2TLM/apbbus/1.4/apbbus8.xml
119
+ - spec/test_data/spiritconsortium.org/Leon2TLM/apbbus/1.4/tlmsrc/apbbus.h
120
+ - spec/test_data/spiritconsortium.org/Leon2TLM/apbmst/1.4/apbmst.xml
121
+ - spec/test_data/spiritconsortium.org/Leon2TLM/apbmst/1.4/tlmsrc/apbmst.h
122
+ - spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/apbram.xml
123
+ - spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.cc
124
+ - spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.h
125
+ - spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.v
126
+ - spec/test_data/spiritconsortium.org/Leon2TLM/apbram/1.0/hdlsrc/apbram.vhd
127
+ - spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/cgu.xml
128
+ - spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/tlmsrc/cgu.cc
129
+ - spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.4/tlmsrc/cgu.h
130
+ - spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/cgu.xml
131
+ - spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/tlmsrc/cgu.cc
132
+ - spec/test_data/spiritconsortium.org/Leon2TLM/cgu/1.5/tlmsrc/cgu.h
133
+ - spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/dma.xml
134
+ - spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/tlmsrc/dma.cc
135
+ - spec/test_data/spiritconsortium.org/Leon2TLM/dma/1.4/tlmsrc/dma.h
136
+ - spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/irqctrl.xml
137
+ - spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/tlmsrc/irqctrl.cc
138
+ - spec/test_data/spiritconsortium.org/Leon2TLM/irqctrl/1.4/tlmsrc/irqctrl.h
139
+ - spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/processor.xml
140
+ - spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/tlmsrc/processor.cc
141
+ - spec/test_data/spiritconsortium.org/Leon2TLM/processor/1.4/tlmsrc/processor.h
142
+ - spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/pv2apb.xml
143
+ - spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/tlmsrc/pv2apb.cc
144
+ - spec/test_data/spiritconsortium.org/Leon2TLM/pv2apb/1.0/tlmsrc/pv2apb.h
145
+ - spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/pv2tac.xml
146
+ - spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/tlmsrc/pv2tac.cc
147
+ - spec/test_data/spiritconsortium.org/Leon2TLM/pv2tac/1.0/tlmsrc/pv2tac.h
148
+ - spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/rgu.xml
149
+ - spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/tlmsrc/rgu.cc
150
+ - spec/test_data/spiritconsortium.org/Leon2TLM/rgu/1.4/tlmsrc/rgu.h
151
+ - spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/scmlAdaptor.xml
152
+ - spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/tlmsrc/scmladaptor.cc
153
+ - spec/test_data/spiritconsortium.org/Leon2TLM/scmlAdaptor/1.0/tlmsrc/scmladaptor.h
154
+ - spec/test_data/spiritconsortium.org/Leon2TLM/serial_device/1.0/serial_device.xml
155
+ - spec/test_data/spiritconsortium.org/Leon2TLM/serial_device/1.0/tlmsrc/serial_device.h
156
+ - spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/timers.xml
157
+ - spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/tlmsrc/timers.cc
158
+ - spec/test_data/spiritconsortium.org/Leon2TLM/timers/1.4/tlmsrc/timers.h
159
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart.h
160
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_fifo.h
161
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_memory_map.h
162
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/inc/uart_types.h
163
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart.cc
164
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_interrupt_handler.cc
165
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_register_bank.cc
166
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/tlmsrc/src/uart_serial_tx_rx.cc
167
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_scml/1.0/uart_scml.xml
168
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/Leon2_uart.h
169
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/def_Leon2_uart.h
170
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlm_field.h
171
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlm_register.h
172
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/include/tlmreg_Leon2_uart.h
173
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/Leon2_uart.cc
174
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/tlmreg_Leon2_uart.cc
175
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/tlmsrc/src/user_specific_Leon2_uart.cc
176
+ - spec/test_data/spiritconsortium.org/Leon2TLM/uart_tac/1.0/uart_tac.xml
177
+ - spec/unit/component_spec.rb
178
+ - spec/unit/graph_pathfinder_spec.rb
179
+ - spec/unit/interconnect_spec.rb
180
+ - spec/unit/ipxact_spec.rb
181
+ - spec/unit/platform_spec.rb
182
+ - README.html
183
+ - README.mdown
184
+ has_rdoc: true
185
+ homepage: http://tima-sls.imag.fr
186
+ licenses: []
187
+
188
+ post_install_message:
189
+ rdoc_options:
190
+ - --charset=UTF-8
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ none: false
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ segments:
199
+ - 0
200
+ version: "0"
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
+ none: false
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ segments:
207
+ - 0
208
+ version: "0"
209
+ requirements: []
210
+
211
+ rubyforge_project:
212
+ rubygems_version: 1.3.7
213
+ signing_key:
214
+ specification_version: 3
215
+ summary: Ruby library for parsing IPXACT specifications and extracting relevant information.
216
+ test_files:
217
+ - spec/integration/bus_data_extraction_spec.rb
218
+ - spec/integration/data_calculation_spec.rb
219
+ - spec/integration/data_construction_spec.rb
220
+ - spec/integration/general_spec.rb
221
+ - spec/unit/component_spec.rb
222
+ - spec/unit/graph_pathfinder_spec.rb
223
+ - spec/unit/interconnect_spec.rb
224
+ - spec/unit/ipxact_spec.rb
225
+ - spec/unit/platform_spec.rb