cross_origen 0.7.0 → 1.0.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 +4 -4
- data/bin/fix_my_workspace +10 -2
- data/config/{development.rb → boot.rb} +1 -5
- data/config/shared_commands.rb +10 -6
- data/config/version.rb +2 -2
- data/lib/cross_origen/cmsis_svd.rb +133 -121
- data/lib/cross_origen/ip_xact.rb +51 -7
- data/lib/cross_origen/xml_doc.rb +1 -1
- data/lib/cross_origen.rb +40 -28
- data/lib/cross_origen_dev/dut.rb +62 -0
- data/templates/web/index.md.erb +26 -9
- metadata +8 -12
- data/config/environment.rb +0 -36
- data/config/users.rb +0 -18
- data/lib/cross_origen/commands/import.rb +0 -32
- data/lib/cross_origen/origen_format.rb +0 -554
- data/lib/cross_origen/test/dut.rb +0 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d26f7c82e096e575a790df75455dfbf852566b2
|
4
|
+
data.tar.gz: 20b0f23e1252fbf6775945ad77a61ae9da871938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9735b99514ec7b4c0ba88af969195cc9323d2967636a6c4bc98b414bd7ebd2bd24afd84686c64df04b7cd11ff437f39258928a145a101126579ac7df5de99c24
|
7
|
+
data.tar.gz: a8bfaad922bf7fcaab7bb2b3f9ab526d2b63a775f3f75087f6052b8e0efc3a5788d2bd492ed5ebd8b238ab06e75f0d345ff5ea562cdb33db28e3c277f4d3ad2d
|
data/bin/fix_my_workspace
CHANGED
@@ -2,9 +2,17 @@
|
|
2
2
|
$VERBOSE = nil # Don't care about world writable dir warnings and the like
|
3
3
|
|
4
4
|
if $_fix_my_workspace_version_check
|
5
|
-
$_fix_my_workspace_version = '0.
|
5
|
+
$_fix_my_workspace_version = '0.7.0'
|
6
6
|
else
|
7
|
-
|
7
|
+
if File.exist?(File.expand_path('../../lib/origen.rb', __FILE__))
|
8
|
+
# If this script is being run from within an origen-core workspace, use that Origen-core,
|
9
|
+
# not the system-installed origen-core version.
|
10
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
11
|
+
require 'origen'
|
12
|
+
else
|
13
|
+
# Use system-installed Origen (the gem in system Ruby)
|
14
|
+
require 'origen'
|
15
|
+
end
|
8
16
|
|
9
17
|
if !Origen.site_config.gem_manage_bundler
|
10
18
|
puts 'Sorry but you have opted to manage Bundler yourself via your Origen site config, and this means'
|
@@ -10,8 +10,4 @@
|
|
10
10
|
# this would be used to load some dummy classes to instantiate
|
11
11
|
# your objects so that they can be tested and/or interacted with
|
12
12
|
# in the console.
|
13
|
-
|
14
|
-
module Test
|
15
|
-
autoload :DUT, "cross_origen/test/dut"
|
16
|
-
end
|
17
|
-
end
|
13
|
+
require "cross_origen_dev/dut"
|
data/config/shared_commands.rb
CHANGED
@@ -1,18 +1,22 @@
|
|
1
|
+
if ARGV.delete('--refresh') || ARGV.delete('-refresh')
|
2
|
+
CrossOrigen.instance_variable_set('@refresh', true)
|
3
|
+
end
|
4
|
+
|
1
5
|
# The requested command is passed in here as @command
|
2
6
|
case @command
|
3
7
|
|
4
8
|
when "cr:import"
|
5
|
-
require "cross_origen/commands/import"
|
6
|
-
# Important to exit when a command has been fulfilled or else Origen core will try and execute it
|
7
|
-
exit 0
|
9
|
+
# require "cross_origen/commands/import"
|
10
|
+
# # Important to exit when a command has been fulfilled or else Origen core will try and execute it
|
11
|
+
# exit 0
|
8
12
|
|
9
13
|
# Always leave an else clause to allow control to fall back through to the Origen command handler.
|
10
14
|
# You probably want to also add the command details to the help shown via 'origen -h',
|
11
15
|
# you can do this bb adding the required text to @plugin_commands before handing control back to
|
12
16
|
# Origen.
|
13
17
|
else
|
14
|
-
@plugin_commands << <<-EOT
|
15
|
-
cr:import Import peripheral and register data from 3rd party formats
|
16
|
-
EOT
|
18
|
+
# @plugin_commands << <<-EOT
|
19
|
+
# cr:import Import peripheral and register data from 3rd party formats
|
20
|
+
# EOT
|
17
21
|
|
18
22
|
end
|
data/config/version.rb
CHANGED
@@ -1,143 +1,155 @@
|
|
1
1
|
module CrossOrigen
|
2
2
|
class CMSISSVD < XMLDoc
|
3
3
|
def import(file, options = {}) # rubocop:disable CyclomaticComplexity
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
if j = peripheral_groups(doc)[name] > 1
|
25
|
-
indexes[name] ||= 0
|
26
|
-
f.puts " sub_block :#{name}#{indexes[name]}, base_address: #{ba.to_hex}"
|
27
|
-
indexes[name] += 1
|
28
|
-
else
|
29
|
-
f.puts " sub_block :#{name}, base_address: #{ba.to_hex}"
|
30
|
-
end
|
4
|
+
filename = Pathname.new(file).basename('.*').to_s
|
5
|
+
|
6
|
+
unless options[:refresh] || CrossOrigen.refresh?
|
7
|
+
return if owner.import(filename, allow_missing: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
model = CrossOrigen::Model.new
|
11
|
+
|
12
|
+
doc(file, options) do |doc|
|
13
|
+
peripherals = peripherals(doc)
|
14
|
+
groups = peripherals.values.map { |v| v[:group] }.uniq
|
15
|
+
|
16
|
+
groups.each { |group| model.sub_block group }
|
17
|
+
|
18
|
+
peripherals.each do |name, attrs|
|
19
|
+
base = attrs[:group] ? model.send(attrs[:group]) : model
|
20
|
+
block = base.sub_block name, base_address: attrs[:base_address]
|
21
|
+
|
22
|
+
if attrs[:parent]
|
23
|
+
add_registers(block, find_peripheral_by_name(doc, attrs[:parent]))
|
31
24
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
sb = sb.to_s.downcase.symbolize
|
39
|
-
if j = peripheral_groups(doc)[sb] > 1
|
40
|
-
indexes[sb] ||= 0
|
41
|
-
ix = indexes[sb]
|
42
|
-
indexes[sb] += 1
|
43
|
-
sb = "#{sb}#{ix}"
|
44
|
-
end
|
25
|
+
add_registers(block, find_peripheral_by_name(doc, name))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
model.export(filename, include_timestamp: CrossOrigen.include_timestamp?)
|
29
|
+
owner.import(filename)
|
30
|
+
end
|
45
31
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
32
|
+
private
|
33
|
+
|
34
|
+
def add_registers(model, peripheral)
|
35
|
+
peripheral.xpath('registers/register').each do |r|
|
36
|
+
name = extract(r, 'name')
|
37
|
+
di = extract(r, 'dim', format: :integer)
|
38
|
+
dim = !!di
|
39
|
+
if dim
|
40
|
+
dinc = extract(r, 'dimIncrement', format: :integer)
|
41
|
+
dvals = extract(r, 'dimIndex').split(',')
|
42
|
+
else
|
43
|
+
di = 1
|
44
|
+
end
|
45
|
+
offset = extract(r, 'addressOffset', format: :integer, hex: true)
|
46
|
+
size = extract(r, 'size', format: :integer)
|
47
|
+
reset = extract(r, 'resetValue', format: :integer, hex: true)
|
48
|
+
desc = (extract(r, 'description') || '').gsub("'", %q(\\\'))
|
49
|
+
|
50
|
+
di.times do |i|
|
51
|
+
if dim
|
52
|
+
n = name.sub('[%s]', dvals[i])
|
53
|
+
addr = offset + (i * dinc)
|
54
|
+
else
|
55
|
+
n = name
|
56
|
+
addr = offset
|
57
|
+
end
|
58
|
+
opts = {
|
59
|
+
size: size,
|
60
|
+
description: desc
|
61
|
+
}
|
62
|
+
opts[:reset] = reset if reset
|
63
|
+
reg_name = n.downcase.symbolize
|
64
|
+
# The register could already exist if it was added by a parent peripheral definition and now it
|
65
|
+
# is redefined/overridden by a descendent peripheral
|
66
|
+
model.del_reg(reg_name) if model.has_reg?(reg_name)
|
67
|
+
model.reg reg_name, addr, opts do |reg|
|
68
|
+
r.xpath('fields/field').each do |b|
|
69
|
+
bn = extract(b, 'name')
|
70
|
+
unless bn == 'RESERVED'
|
71
|
+
bn = bn.to_s.downcase.symbolize
|
72
|
+
lsb = extract(b, 'lsb', format: :integer)
|
73
|
+
msb = extract(b, 'msb', format: :integer)
|
74
|
+
unless lsb
|
75
|
+
lsb = extract(b, 'bitOffset', format: :integer)
|
76
|
+
if lsb
|
77
|
+
msb = lsb + extract(b, 'msb', format: :integer) - 1
|
89
78
|
end
|
90
79
|
end
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
if i == 0
|
108
|
-
f.print "#{name}0"
|
80
|
+
unless lsb
|
81
|
+
range = extract(b, 'bitRange')
|
82
|
+
range =~ /\[(\d+):(\d+)\]/
|
83
|
+
lsb = Regexp.last_match(2).to_i
|
84
|
+
msb = Regexp.last_match(1).to_i
|
85
|
+
end
|
86
|
+
access = extract(b, 'access')
|
87
|
+
desc = (extract(r, 'description') || '').gsub("'", %q(\\\'))
|
88
|
+
case access
|
89
|
+
when 'read-only'
|
90
|
+
ac = :ro
|
91
|
+
else
|
92
|
+
ac = :rw
|
93
|
+
end
|
94
|
+
if lsb == msb
|
95
|
+
reg.bit lsb, bn, access: ac, description: desc
|
109
96
|
else
|
110
|
-
|
97
|
+
reg.bit msb..lsb, bn, access: ac, description: desc
|
111
98
|
end
|
112
99
|
end
|
113
|
-
f.puts ']'
|
114
|
-
f.puts ' end'
|
115
100
|
end
|
116
101
|
end
|
117
|
-
|
118
|
-
f.puts 'end'
|
119
|
-
f.puts '# rubocop:enable all'
|
120
102
|
end
|
121
103
|
end
|
122
104
|
end
|
123
105
|
|
124
|
-
def
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
106
|
+
def find_peripheral_by_name(doc, pname)
|
107
|
+
doc.xpath('device/peripherals/peripheral').find do |peripheral|
|
108
|
+
pname == name(peripheral)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def clean_name(name)
|
113
|
+
name = name.to_s
|
114
|
+
unless name.empty?
|
115
|
+
name.downcase.symbolize
|
134
116
|
end
|
135
117
|
end
|
136
118
|
|
137
|
-
def
|
138
|
-
|
139
|
-
|
140
|
-
|
119
|
+
def name(peripheral)
|
120
|
+
clean_name(fetch(peripheral.xpath('name'), get_text: true))
|
121
|
+
end
|
122
|
+
|
123
|
+
def group_name(peripheral)
|
124
|
+
clean_name(fetch(peripheral.xpath('groupName'), get_text: true))
|
125
|
+
end
|
126
|
+
|
127
|
+
def parent(peripheral)
|
128
|
+
a = peripheral.attributes['derivedFrom']
|
129
|
+
a ? clean_name(a.value) : nil
|
130
|
+
end
|
131
|
+
|
132
|
+
def base_address(peripheral)
|
133
|
+
extract(peripheral, 'baseAddress', format: :integer, hex: true)
|
134
|
+
end
|
135
|
+
|
136
|
+
def peripherals(doc)
|
137
|
+
peripherals = {}
|
138
|
+
doc.xpath('device/peripherals/peripheral').each do |peripheral|
|
139
|
+
peripherals[name(peripheral)] = {
|
140
|
+
group: group_name(peripheral),
|
141
|
+
parent: parent(peripheral),
|
142
|
+
base_address: base_address(peripheral)
|
143
|
+
}
|
144
|
+
end
|
145
|
+
# Inherit missing values from parents...
|
146
|
+
p = {}
|
147
|
+
peripherals.each do |k, v|
|
148
|
+
v[:group] ||= peripherals[v[:parent]][:group]
|
149
|
+
v[:base_address] ||= peripherals[v[:parent]][:base_address]
|
150
|
+
p[k] = v
|
151
|
+
end
|
152
|
+
p
|
141
153
|
end
|
142
154
|
end
|
143
155
|
end
|
data/lib/cross_origen/ip_xact.rb
CHANGED
@@ -10,6 +10,14 @@ module CrossOrigen
|
|
10
10
|
def import(file, options = {}) # rubocop:disable CyclomaticComplexity
|
11
11
|
require 'kramdown'
|
12
12
|
|
13
|
+
filename = Pathname.new(file).basename('.*').to_s
|
14
|
+
|
15
|
+
unless options[:refresh] || CrossOrigen.refresh?
|
16
|
+
return if owner.import(filename, allow_missing: true)
|
17
|
+
end
|
18
|
+
|
19
|
+
model = CrossOrigen::Model.new
|
20
|
+
|
13
21
|
address_spaces = {}
|
14
22
|
|
15
23
|
doc(file, options) do |doc|
|
@@ -19,15 +27,21 @@ module CrossOrigen
|
|
19
27
|
width = fetch addr_space.at_xpath('spirit:width'), get_text: true, to_i: true
|
20
28
|
address_spaces[name] = AddressSpace.new(name, range, width)
|
21
29
|
end
|
22
|
-
doc
|
23
|
-
|
24
|
-
|
25
|
-
|
30
|
+
open_memory_map(doc) do |mem_map|
|
31
|
+
if mem_map
|
32
|
+
mem_map_name = fetch mem_map.at_xpath('spirit:name'), downcase: true, to_sym: true, get_text: true
|
33
|
+
if mem_map_name.to_s.empty?
|
34
|
+
mem_map_obj = model
|
35
|
+
else
|
36
|
+
model.sub_block mem_map_name
|
37
|
+
mem_map_obj = model.send(mem_map_name)
|
38
|
+
end
|
39
|
+
addr_blocks = mem_map.xpath('spirit:addressBlock')
|
26
40
|
else
|
27
|
-
|
28
|
-
|
41
|
+
mem_map_obj = model
|
42
|
+
addr_blocks = doc.xpath('//spirit:addressBlock')
|
29
43
|
end
|
30
|
-
|
44
|
+
addr_blocks.each do |addr_block|
|
31
45
|
name = fetch addr_block.at_xpath('spirit:name'), downcase: true, to_sym: true, get_text: true
|
32
46
|
base_address = fetch addr_block.at_xpath('spirit:baseAddress'), get_text: true, to_dec: true
|
33
47
|
range = fetch addr_block.at_xpath('spirit:range'), get_text: true, to_dec: true
|
@@ -78,6 +92,28 @@ module CrossOrigen
|
|
78
92
|
end
|
79
93
|
end
|
80
94
|
end
|
95
|
+
model.export(filename, include_timestamp: CrossOrigen.include_timestamp?)
|
96
|
+
owner.import(filename)
|
97
|
+
end
|
98
|
+
|
99
|
+
def doc(path, options = {})
|
100
|
+
# If a fragment of IP-XACT is given, then wrap it with a valid header and we will try our best
|
101
|
+
if options[:fragment]
|
102
|
+
require 'nokogiri'
|
103
|
+
|
104
|
+
content = %(
|
105
|
+
<?xml version="1.0"?>
|
106
|
+
<spirit:component xmlns:spirit="http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.4"
|
107
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
108
|
+
xsi:schemaLocation="$REGMEM_HOME/builder/ipxact/schema/ipxact
|
109
|
+
$REGMEM_HOME/builder/ipxact/schema/ipxact/index.xsd">
|
110
|
+
#{File.read(path)}
|
111
|
+
</spirit:component>
|
112
|
+
)
|
113
|
+
yield Nokogiri::XML(content)
|
114
|
+
else
|
115
|
+
super
|
116
|
+
end
|
81
117
|
end
|
82
118
|
|
83
119
|
# Returns a string representing the owner object in IP-XACT XML
|
@@ -191,6 +227,14 @@ module CrossOrigen
|
|
191
227
|
|
192
228
|
private
|
193
229
|
|
230
|
+
def open_memory_map(doc)
|
231
|
+
maps = doc.xpath('//spirit:memoryMaps/spirit:memoryMap')
|
232
|
+
maps = [nil] if maps.empty?
|
233
|
+
maps.each do |mem_map|
|
234
|
+
yield mem_map
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
194
238
|
def reg_description(register)
|
195
239
|
fetch register.at_xpath('spirit:description'), get_text: true, whitespace: true
|
196
240
|
end
|
data/lib/cross_origen/xml_doc.rb
CHANGED
data/lib/cross_origen.rb
CHANGED
@@ -1,15 +1,31 @@
|
|
1
1
|
require 'origen'
|
2
2
|
require_relative '../config/application.rb'
|
3
|
-
require_relative '../config/environment.rb'
|
4
3
|
|
5
4
|
module CrossOrigen
|
6
|
-
|
7
|
-
|
5
|
+
autoload :XMLDoc, 'cross_origen/xml_doc'
|
6
|
+
autoload :Headers, 'cross_origen/headers'
|
7
|
+
autoload :Ralf, 'cross_origen/ralf'
|
8
|
+
autoload :IpXact, 'cross_origen/ip_xact'
|
9
|
+
autoload :DesignSync, 'cross_origen/design_sync'
|
10
|
+
autoload :CMSISSVD, 'cross_origen/cmsis_svd'
|
11
|
+
|
12
|
+
# Basic object that is used to capture imported data and then export/save
|
13
|
+
# it to Origen format
|
14
|
+
class Model
|
15
|
+
include Origen::Model
|
8
16
|
end
|
9
|
-
extend ActiveSupport::Concern
|
10
17
|
|
11
|
-
|
12
|
-
|
18
|
+
# Returns true if the --refresh switch was passed to the current Origen command
|
19
|
+
def self.refresh?
|
20
|
+
@refresh || false
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.include_timestamp?
|
24
|
+
instance_variable_defined?(:@include_timestamp) ? @include_timestamp : true
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.include_timestamp=(val)
|
28
|
+
@include_timestamp = val
|
13
29
|
end
|
14
30
|
|
15
31
|
def instance_respond_to?(method_name)
|
@@ -17,6 +33,10 @@ module CrossOrigen
|
|
17
33
|
end
|
18
34
|
|
19
35
|
def cr_import(options = {})
|
36
|
+
options = {
|
37
|
+
include_timestamp: true
|
38
|
+
}.merge(options)
|
39
|
+
CrossOrigen.include_timestamp = options[:include_timestamp]
|
20
40
|
file = cr_file(options)
|
21
41
|
cr_translator(file, options).import(file, options)
|
22
42
|
end
|
@@ -30,11 +50,6 @@ module CrossOrigen
|
|
30
50
|
end
|
31
51
|
alias_method :to_ipxact, :to_ip_xact
|
32
52
|
|
33
|
-
def to_origen(options = {})
|
34
|
-
options[:obj] = self
|
35
|
-
cr_to_origen(options)
|
36
|
-
end
|
37
|
-
|
38
53
|
def to_header(options = {})
|
39
54
|
cr_headers.owner_to_header(options)
|
40
55
|
end
|
@@ -60,21 +75,6 @@ module CrossOrigen
|
|
60
75
|
@cr_headers ||= Headers.new(self)
|
61
76
|
end
|
62
77
|
|
63
|
-
# Creates Ruby files necessary to model all sub_blocks and registers found (recursively) owned by options[:obj]
|
64
|
-
# The Ruby files are created at options[:path] (app output directory by default)
|
65
|
-
def cr_to_origen(options = {})
|
66
|
-
options = {
|
67
|
-
obj: $dut,
|
68
|
-
path: Origen.app.config.output_directory,
|
69
|
-
instantiate_level: :top
|
70
|
-
}.update(options)
|
71
|
-
# This method assumes and checks for $self to contain Origen::Model
|
72
|
-
error "ERROR: #{options[:obj].class} does not contain Origen::Model as required" unless options[:obj].class < Origen::Model
|
73
|
-
# Check to make sure there are sub_blocks or regs directly under $dut
|
74
|
-
error "ERROR: options[:obj]ect #{options[:obj].object_id} of class #{options[:obj].class} does not contain registers or sub_blocks" unless options[:obj].owns_registers? || options[:obj].instance_respond_to?(:sub_blocks)
|
75
|
-
OrigenFormat.new(options).export
|
76
|
-
end
|
77
|
-
|
78
78
|
def cr_ralf
|
79
79
|
@cr_ralf ||= Ralf.new(self)
|
80
80
|
end
|
@@ -83,16 +83,28 @@ module CrossOrigen
|
|
83
83
|
@cr_ip_xact ||= IpXact.new(self)
|
84
84
|
end
|
85
85
|
|
86
|
+
def cr_cmsis_svd
|
87
|
+
@cr_cmsis_svd ||= CMSISSVD.new(self)
|
88
|
+
end
|
89
|
+
|
86
90
|
private
|
87
91
|
|
88
92
|
# Returns an instance of the translator for the format of the given file
|
89
|
-
def cr_translator(file,
|
93
|
+
def cr_translator(file, options = {})
|
90
94
|
snippet = IO.read(file, 2000) # Read first 2000 characters
|
91
95
|
case snippet
|
92
96
|
when /spiritconsortium/
|
93
97
|
cr_ip_xact
|
98
|
+
when /CMSIS-SVD.xsd/
|
99
|
+
cr_cmsis_svd
|
94
100
|
else
|
95
|
-
|
101
|
+
# Give IP-XACT another opportunity if it looks like partial IP-XACT doc
|
102
|
+
if snippet =~ /<spirit:register>/
|
103
|
+
options[:fragment] = true
|
104
|
+
cr_ip_xact
|
105
|
+
else
|
106
|
+
fail "Unknown file format for file: #{file}"
|
107
|
+
end
|
96
108
|
end
|
97
109
|
end
|
98
110
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module CrossOrigenDev
|
2
|
+
# Simple DUT class used for testing
|
3
|
+
class DUT
|
4
|
+
include Origen::TopLevel
|
5
|
+
include CrossOrigen
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@path = :hidden
|
9
|
+
sub_block :atx, class_name: 'D_IP_ANA_TEST_ANNEX_SYN', base_address: 0x4000_0000
|
10
|
+
|
11
|
+
# Register defined solely to test out the top level register export
|
12
|
+
reg :dut_top_level_reg, 0x0, size: 32, bit_order: :msb0, lau: 8 do
|
13
|
+
bit 15, :pls_work, reset: 1, access: :rw
|
14
|
+
bit 14, :second_bit, reset: 0, access: :rw
|
15
|
+
end
|
16
|
+
# Register defined solely to test out the top level register export
|
17
|
+
reg :dut_top_level_reg_number_two, 0x10, size: 32, bit_order: :lsb0, lau: 16 do
|
18
|
+
bit 0, :pls_work, reset: 0, access: :ro
|
19
|
+
bit 1, :second_bit, reset: 1, access: :rw
|
20
|
+
end
|
21
|
+
# Import some data from IP-XACT
|
22
|
+
cr_import(path: "#{Origen.root}/imports/ipxact.xml")
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_atx2
|
26
|
+
sub_block :atx2, class_name: 'ATX2', base_address: 0x6000_0000
|
27
|
+
end
|
28
|
+
|
29
|
+
class ATX2
|
30
|
+
include Origen::Model
|
31
|
+
include CrossOrigen
|
32
|
+
|
33
|
+
def initialize
|
34
|
+
cr_import(path: "#{Origen.root}/approved/ip_xact_sub_block.xml")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class D_IP_ANA_TEST_ANNEX_SYN # rubocop:disable ClassAndModuleCamelCase
|
39
|
+
include Origen::Model
|
40
|
+
include CrossOrigen
|
41
|
+
|
42
|
+
def initialize
|
43
|
+
# A manually defined register for testing the conversion of any specific attributes
|
44
|
+
|
45
|
+
# ** MGATE Clock Divider Register **
|
46
|
+
# The MCLKDIV register is used to divide down the frequency of the HBOSCCLK input. If the MCLKDIV
|
47
|
+
# register is set to value "N", then the output (beat) frequency of the clock divider is OSCCLK / (N+1). The
|
48
|
+
# resulting beats are, in turn, counted by the PTIMER module to control the duration of Flash high-voltage
|
49
|
+
# operations.
|
50
|
+
# This is a test of potentially problematic characters ' " \' \" < >
|
51
|
+
reg :mclkdiv, 0x0, size: 16, bit_order: 'decrement' do
|
52
|
+
# **Oscillator (Hi)** - Firmware FMU clk source selection. (Note that in addition to this firmware-controlled bit, the
|
53
|
+
# FMU clock source is also dependent on test and power control discretes).
|
54
|
+
#
|
55
|
+
# 0 | FMU clock is the externally supplied bus clock ipg_clk
|
56
|
+
# 1 | FMU clock is the internal oscillator from the TFS hardblock
|
57
|
+
bit 15, :osch, reset: 1, access: :rw
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|