cross_origen 0.5.0 → 0.6.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20fb4952ec7d0da9dcad3673c0442cbc1b79afc3
4
- data.tar.gz: 8b55d120f0783322f057ba2db4fc638d063f1443
3
+ metadata.gz: d5e7b5c2e2e62729143d48392467fbbf5903885f
4
+ data.tar.gz: 421c909d4b31cfe7614084194c06650b179ebd15
5
5
  SHA512:
6
- metadata.gz: 513b242817d94cd5b7f7614ca14087150e9e5cbcad31995e9eea344493d35bf525a6b9d52a268702b0d3ec73b44f31338d0d755e80b30fbcfec1d6a4183fe038
7
- data.tar.gz: 9b767385a47a1f14319b4c22e4feb4c575f4aef07f615a70f376f12998623921642eff97e9b8dc9940b4248a7074b78923c81ebf76fc64dde058bc5c3cd1cc7e
6
+ metadata.gz: 316821d70b48bf422ecdfd736512bc232be143db822a8a0c7022a195ad8003cd01de2d796a861f73320cc4ee59b8c81fb4fb3cee0ac1a6f1ce4eace3df7a2712
7
+ data.tar.gz: 803e9134ff9c1ed944f4529d0f84a73a53ea69d11b5252f7ab80f03e0d319577fed8497e4674221793662c51530cda1b68171acaf20d1338de4c8f1a88762282
data/config/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module CrossOrigen
2
2
  MAJOR = 0
3
- MINOR = 5
3
+ MINOR = 6
4
4
  BUGFIX = 0
5
5
  DEV = nil
6
6
 
@@ -21,15 +21,23 @@ module CrossOrigen
21
21
  end
22
22
  doc.xpath('//spirit:memoryMaps/spirit:memoryMap').each do |mem_map|
23
23
  mem_map_name = fetch mem_map.at_xpath('spirit:name'), downcase: true, to_sym: true, get_text: true
24
- owner.sub_block mem_map_name
25
- mem_map_obj = owner.send(mem_map_name)
24
+ if mem_map_name.to_s.empty?
25
+ mem_map_obj = owner
26
+ else
27
+ owner.sub_block mem_map_name
28
+ mem_map_obj = owner.send(mem_map_name)
29
+ end
26
30
  mem_map.xpath('spirit:addressBlock').each do |addr_block|
27
31
  name = fetch addr_block.at_xpath('spirit:name'), downcase: true, to_sym: true, get_text: true
28
32
  base_address = fetch addr_block.at_xpath('spirit:baseAddress'), get_text: true, to_dec: true
29
33
  range = fetch addr_block.at_xpath('spirit:range'), get_text: true, to_dec: true
30
34
  width = fetch addr_block.at_xpath('spirit:width'), get_text: true, to_i: true
31
- mem_map_obj.sub_block name, base_address: base_address, range: range, lau: width
32
- addr_block_obj = mem_map_obj.send(name)
35
+ if name.to_s.empty?
36
+ addr_block_obj = mem_map_obj
37
+ else
38
+ mem_map_obj.sub_block name, base_address: base_address, range: range, lau: width
39
+ addr_block_obj = mem_map_obj.send(name)
40
+ end
33
41
  addr_block.xpath('spirit:register').each do |register|
34
42
  name = fetch register.at_xpath('spirit:name'), downcase: true, to_sym: true, get_text: true
35
43
  size = fetch register.at_xpath('spirit:size'), get_text: true, to_i: true
@@ -74,7 +82,7 @@ module CrossOrigen
74
82
 
75
83
  # Returns a string representing the owner object in IP-XACT XML
76
84
  def owner_to_xml(options = {})
77
- require 'builder'
85
+ require 'nokogiri'
78
86
 
79
87
  options = {
80
88
  include_bit_field_values: true
@@ -82,10 +90,6 @@ module CrossOrigen
82
90
 
83
91
  @format = options[:format]
84
92
 
85
- xml = Builder::XmlMarkup.new(indent: 2, margin: 0)
86
-
87
- xml.instruct!
88
-
89
93
  schemas = [
90
94
  'http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.4',
91
95
  'http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.4/index.xsd'
@@ -103,69 +107,77 @@ module CrossOrigen
103
107
  headers['xmlns:vendorExtensions'] = '$IREG_GEN/XMLSchema/SPIRIT'
104
108
  end
105
109
 
106
- xml.tag!('spirit:component', headers) do
107
- xml.spirit :vendor, options[:vendor] || 'Freescale'
108
- xml.spirit :library, options[:library] || 'Freescale'
109
- # I guess this should really be the register owner's owner's name?
110
- xml.spirit :name, try(:ip_name, :pdm_part_name) || owner.class.to_s.split('::').last
111
- xml.spirit :version, try(:ip_version, :pdm_version, :pdm_cm_version, :version, :revision)
112
- xml.spirit :memoryMaps do
113
- memory_maps.each do |map_name, _map|
114
- xml.spirit :memoryMap do
115
- xml.spirit :name, map_name
116
- address_blocks do |domain_name, _domain, sub_block|
117
- xml.spirit :addressBlock do
118
- xml.spirit :name, address_block_name(domain_name, sub_block)
119
- xml.spirit :baseAddress, sub_block.base_address.to_hex
120
- xml.spirit :range, range(sub_block)
121
- xml.spirit :width, width(sub_block)
122
- sub_block.regs.each do |name, reg|
123
- # Required for now to ensure that the current value is the reset value
124
- reg.reset
125
- xml.spirit :register do
126
- xml.spirit :name, name
127
- xml.spirit :description, try(reg, :name_full, :full_name)
128
- xml.spirit :addressOffset, reg.offset.to_hex
129
- xml.spirit :size, reg.size
130
- if reg.bits.any?(&:writable?)
131
- xml.spirit :access, 'read-write'
132
- else
133
- xml.spirit :access, 'read-only'
134
- end
135
- xml.spirit :reset do
136
- xml.spirit :value, reg.data.to_hex
137
- xml.spirit :mask, mask(reg).to_hex
138
- end
139
- reg.named_bits do |name, bits|
140
- xml.spirit :field do
141
- xml.spirit :name, name
142
- xml.spirit :description, try(bits, :brief_description, :name_full, :full_name)
143
- xml.spirit :bitOffset, bits.position
144
- xml.spirit :bitWidth, bits.size
145
- xml.spirit :access, bits.access
146
- if options[:include_bit_field_values]
147
- if bits.bit_value_descriptions[0]
148
- bits.bit_value_descriptions.each do |val, desc|
149
- xml.spirit :values do
150
- xml.spirit :value, val.to_hex
151
- xml.spirit :name, "val_#{val.to_hex}"
152
- xml.spirit :description, desc
110
+ builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
111
+ spirit = xml['spirit']
112
+ spirit.component(headers) do
113
+ spirit.vendor options[:vendor] || 'Origen'
114
+ spirit.library options[:library] || 'Origen'
115
+ # I guess this should really be the register owner's owner's name?
116
+ spirit.name try(:ip_name) || owner.class.to_s.split('::').last
117
+ spirit.version try(:ip_version, :version, :revision)
118
+ spirit.memoryMaps do
119
+ memory_maps.each do |map_name, _map|
120
+ spirit.memoryMap do
121
+ spirit.name map_name
122
+ address_blocks do |domain_name, _domain, sub_block|
123
+ spirit.addressBlock do
124
+ if sub_block == owner
125
+ spirit.name nil
126
+ spirit.baseAddress 0.to_hex
127
+ else
128
+ spirit.name address_block_name(domain_name, sub_block)
129
+ spirit.baseAddress sub_block.base_address.to_hex
130
+ end
131
+ spirit.range range(sub_block)
132
+ spirit.width width(sub_block)
133
+ sub_block.regs.each do |name, reg|
134
+ # Required for now to ensure that the current value is the reset value
135
+ reg.reset
136
+ spirit.register do
137
+ spirit.name name
138
+ spirit.description try(reg, :name_full, :full_name)
139
+ spirit.addressOffset reg.offset.to_hex
140
+ spirit.size reg.size
141
+ if reg.bits.any?(&:writable?)
142
+ spirit.access 'read-write'
143
+ else
144
+ spirit.access 'read-only'
145
+ end
146
+ spirit.reset do
147
+ spirit.value reg.data.to_hex
148
+ spirit.mask mask(reg).to_hex
149
+ end
150
+ reg.named_bits do |name, bits|
151
+ spirit.field do
152
+ spirit.name name
153
+ spirit.description try(bits, :brief_description, :name_full, :full_name)
154
+ spirit.bitOffset bits.position
155
+ spirit.bitWidth bits.size
156
+ spirit.access bits.access
157
+ if options[:include_bit_field_values]
158
+ if bits.bit_value_descriptions[0]
159
+ bits.bit_value_descriptions.each do |val, desc|
160
+ spirit.values do
161
+ spirit.value val.to_hex
162
+ spirit.name "val_#{val.to_hex}"
163
+ spirit.description desc
164
+ end
153
165
  end
154
166
  end
155
167
  end
156
- end
157
- if uvm?
158
- xml.spirit :vendorExtensions do
159
- xml.vendorExtensions :hdl_path, bits.path(relative_to: sub_block)
168
+ if uvm?
169
+ spirit.vendorExtensions do
170
+ xml['vendorExtensions'].hdl_path bits.path(relative_to: sub_block)
171
+ end
160
172
  end
161
173
  end
162
174
  end
163
175
  end
164
176
  end
165
- end
166
- if uvm?
167
- xml.spirit :vendorExtensions do
168
- xml.vendorExtensions :hdl_path, sub_block.path(relative_to: owner)
177
+ if uvm?
178
+ spirit.vendorExtensions do
179
+ xml['vendorExtensions'].hdl_path sub_block.path(relative_to: owner)
180
+ end
169
181
  end
170
182
  end
171
183
  end
@@ -174,6 +186,7 @@ module CrossOrigen
174
186
  end
175
187
  end
176
188
  end
189
+ builder.to_xml
177
190
  end
178
191
 
179
192
  private
@@ -193,7 +206,7 @@ module CrossOrigen
193
206
  end
194
207
 
195
208
  def memory_maps
196
- { owner.name => {} }
209
+ { nil => {} }
197
210
  end
198
211
 
199
212
  def sub_blocks(domain_name)
@@ -207,6 +220,9 @@ module CrossOrigen
207
220
  domains = owner.register_domains
208
221
  domains = { default: {} } if domains.empty?
209
222
  domains.each do |domain_name, domain|
223
+ if owner.owns_registers?
224
+ yield domain_name, domain, owner
225
+ end
210
226
  sub_blocks(domain_name).each do |sub_block|
211
227
  yield domain_name, domain, sub_block
212
228
  end
@@ -7,7 +7,7 @@ module CrossOrigen
7
7
 
8
8
  def initialize
9
9
  @path = :hidden
10
- sub_block :atx, class_name: 'D_IP_ANA_TEST_ANNEX_SYN'
10
+ sub_block :atx, class_name: 'D_IP_ANA_TEST_ANNEX_SYN', base_address: 0x4000_0000
11
11
 
12
12
  # Register defined solely to test out the top level register export
13
13
  reg :dut_top_level_reg, 0x0, size: 32, bit_order: :msb0, lau: 8 do
@@ -23,6 +23,19 @@ module CrossOrigen
23
23
  cr_import(path: "#{Origen.root}/imports/ipxact.xml")
24
24
  end
25
25
 
26
+ def add_atx2
27
+ sub_block :atx2, class_name: 'ATX2', base_address: 0x6000_0000
28
+ end
29
+
30
+ class ATX2
31
+ include Origen::Model
32
+ include CrossOrigen
33
+
34
+ def initialize
35
+ cr_import(path: "#{Origen.root}/approved/ip_xact_sub_block.xml")
36
+ end
37
+ end
38
+
26
39
  class D_IP_ANA_TEST_ANNEX_SYN # rubocop:disable ClassAndModuleCamelCase
27
40
  include Origen::Model
28
41
  include CrossOrigen
@@ -0,0 +1 @@
1
+ <%= $dut.atx.to_ip_xact %>
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: <%= options[:title] || Origen.config.name %>
3
+ analytics: UA-64455560-1
3
4
  ---
4
5
  <%= render "templates/web/partials/navbar.html", tab: options[:tab] %>
5
6
 
@@ -9,5 +10,7 @@ title: <%= options[:title] || Origen.config.name %>
9
10
  <div class="span12" markdown="1">
10
11
  <%= yield %>
11
12
 
13
+ <%= disqus_comments %>
14
+
12
15
  </div>
13
16
  </div>
@@ -15,7 +15,7 @@
15
15
  <li class="<%= options[:tab] == :api ? 'active' : '' %>"><a href="<%= path "/api/" %>">API</a></li>
16
16
  <li class="<%= options[:tab] == :coverage ? 'active' : '' %>"><a href="<%= path "/coverage" %>">Coverage</a></li>
17
17
  <li class="<%= options[:tab] == :release ? 'active' : '' %>"><a href="<%= path "/release_notes" %>">Release Notes</a></li>
18
- <li><a href="https://github.com/Origen-SDK/origen_jtag">Github</a></li>
18
+ <li><a href="https://github.com/Origen-SDK/cross_origen">Github</a></li>
19
19
  </ul>
20
20
  <%= import "origen/web/logo.html" %>
21
21
  </div><!--/.nav-collapse -->
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cross_origen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-06 00:00:00.000000000 Z
11
+ date: 2016-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -79,6 +79,7 @@ files:
79
79
  - templates/test/default.ralf.erb
80
80
  - templates/test/headers_default.h.erb
81
81
  - templates/test/ip_xact.xml.erb
82
+ - templates/test/ip_xact_sub_block.xml.erb
82
83
  - templates/web/_history.md
83
84
  - templates/web/example.md.erb
84
85
  - templates/web/examples.md.erb
@@ -87,7 +88,6 @@ files:
87
88
  - templates/web/examples/ralf_export.md.erb
88
89
  - templates/web/index.md.erb
89
90
  - templates/web/layouts/_basic.html.erb
90
- - templates/web/layouts/_doc.html.erb
91
91
  - templates/web/partials/_navbar.html.erb
92
92
  - templates/web/release_notes.md.erb
93
93
  homepage: http://origen-sdk.org/cross_origen
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: 1.8.11
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.2.2
112
+ rubygems_version: 2.6.2
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Translators for importing and exporting Origen data to/from 3rd party formats
@@ -1,61 +0,0 @@
1
- ---
2
- title: <%= options[:title] || Origen.config.name %>
3
- ---
4
- <%= render "templates/web/partials/navbar.html", tab: :docs %>
5
-
6
- %# Add/edit sections here, the code below will expand this with the correct markup,
7
- %# pass in the topic you want selected via the :tab option.
8
- % s = {}
9
- % s["Environment"] = {
10
- % environment_introduction: "Introduction",
11
- % environment_installation: "Installation",
12
- % environment_definitions: "Definitions and Acronyms",
13
- % }
14
- % s["Targets"] = {
15
- % targets_introduction: "Introduction",
16
- % targets_supported: "Supported",
17
- % }
18
- % s["Developers"] = {
19
- % developers_branching: "Making Branches",
20
- % }
21
-
22
-
23
-
24
- <div class="row">
25
- <div class="span3">
26
- <div class="well sidebar-nav">
27
- <div class="accordion" id="sidebar-accordion">
28
-
29
- % s.each_with_index do |(subject, sections), i|
30
- <div class="accordion-group">
31
- <div class="accordion-heading">
32
- <a class="accordion-toggle" data-toggle="collapse" data-parent="#sidebar-accordion" href="#sidebar-collapse-<%= i %>">
33
- <%= subject %>
34
- </a>
35
- </div>
36
- <div id="sidebar-collapse-<%= i %>" class="accordion-body collapse <%= sections.has_key?(options[:tab]) ? 'in' : '' %>">
37
- <div class="accordion-inner">
38
- <ul class="nav nav-list">
39
- % sections.each do |tab, section|
40
- % paths = tab.to_s.split("_")
41
- <li class="<%= tab == options[:tab] ? 'active' : '' %>"><a href="<%= path "/docs/#{paths[0]}/#{paths[1]}" %>"><%= section %></a></li>
42
- % end
43
- </ul>
44
- </div>
45
- </div>
46
- </div>
47
- % end
48
-
49
- </div>
50
-
51
- </div>
52
- </div>
53
-
54
- %# The markdown attribute is important if you are going to include content written
55
- %# in markdown, without this is will be included verbatim
56
- <div class="span9" markdown="1">
57
- <%= yield %>
58
- %# Also important to avoid indentation on return here, since otherwise it could be interpreted
59
- %# as mardown code
60
- </div>
61
- </div>