cross_origen 0.7.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a8a97d56c4be0c17d49a9486ec425b34eab92fc
4
- data.tar.gz: 19f08b7708edb0fd9b1b1da7bd2b7a0e59b98766
3
+ metadata.gz: 2d26f7c82e096e575a790df75455dfbf852566b2
4
+ data.tar.gz: 20b0f23e1252fbf6775945ad77a61ae9da871938
5
5
  SHA512:
6
- metadata.gz: de17ae91904278a13727d3ae7d2e1d3f48e1e45a29177e31155a6281a0d3623b17eaf33e7aabb9d13f553f337a37a205d9c00a02c4c12e2bae378f26a0ce9025
7
- data.tar.gz: e20b7196527a69f0bedacbe778843beb1dde1da11495405d820cb9a89d106c3f787f3e1e61d184106dc05e9bfbc54ee1aa293269a6a62a87d45307b359a30515
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.6.0'
5
+ $_fix_my_workspace_version = '0.7.0'
6
6
  else
7
- require 'origen'
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
- module CrossOrigen
14
- module Test
15
- autoload :DUT, "cross_origen/test/dut"
16
- end
17
- end
13
+ require "cross_origen_dev/dut"
@@ -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,6 +1,6 @@
1
1
  module CrossOrigen
2
- MAJOR = 0
3
- MINOR = 7
2
+ MAJOR = 1
3
+ MINOR = 0
4
4
  BUGFIX = 0
5
5
  DEV = nil
6
6
 
@@ -1,143 +1,155 @@
1
1
  module CrossOrigen
2
2
  class CMSISSVD < XMLDoc
3
3
  def import(file, options = {}) # rubocop:disable CyclomaticComplexity
4
- with_output_file(options) do |f|
5
- doc(file, options) do |doc|
6
- f.puts '# This file was automatically generated from a CMSIS-SVD input file'
7
- f.puts '# Name: ' + (fetch(doc.xpath('device/name'), get_text: true) || '')
8
- f.puts '# Version: ' + (fetch(doc.xpath('device/version'), get_text: true) || '')
9
- f.puts "# Created at #{Time.now.strftime('%e %b %Y %H:%M%p')} by #{User.current.name}"
10
- f.puts '# rubocop:disable all'
11
- f.puts 'module ImportedCMSISSVD'
12
- f.puts ' def initialize(*args)'
13
- f.puts ' instantiate_imported_cmsis_svd_data'
14
- f.puts ' end'
15
- f.puts ''
16
- f.puts ' def instantiate_imported_cmsis_svd_data'
17
-
18
- # Create sub-blocks
19
- indexes = {}
20
- doc.xpath('device/peripherals/peripheral').each do |p|
21
- name = fetch(p.xpath('groupName'), get_text: true)
22
- name = name.to_s.downcase.symbolize
23
- ba = extract(p, 'baseAddress', format: :integer, hex: true)
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
- f.puts ''
33
-
34
- # Add registers to each sub-block
35
- indexes = {}
36
- doc.xpath('device/peripherals/peripheral').each do |p|
37
- sb = fetch(p.xpath('groupName'), get_text: true)
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
- p.xpath('registers/register').each do |r|
47
- name = extract(r, 'name')
48
- di = extract(r, 'dim', format: :integer)
49
- dim = !!di
50
- if dim
51
- dinc = extract(r, 'dimIncrement', format: :integer)
52
- dvals = extract(r, 'dimIndex').split(',')
53
- else
54
- di = 1
55
- end
56
- offset = extract(r, 'addressOffset', format: :integer, hex: true)
57
- size = extract(r, 'size', format: :integer)
58
- reset = extract(r, 'resetValue', format: :integer, hex: true)
59
- desc = (extract(r, 'description') || '').gsub("'", %q(\\\'))
60
-
61
- di.times do |i|
62
- if dim
63
- n = name.sub('[%s]', dvals[i])
64
- addr = offset + (i * dinc)
65
- else
66
- n = name
67
- addr = offset
68
- end
69
- f.puts " #{sb}.add_reg :#{n.downcase.symbolize}, #{addr.to_hex}, size: #{size}#{reset ? ', reset: ' + reset.to_hex : ''}, description: '#{desc}' do |reg|"
70
- r.xpath('fields/field').each do |b|
71
- bn = extract(b, 'name')
72
- unless bn == 'RESERVED'
73
- bn = bn.to_s.downcase.symbolize
74
- lsb = extract(b, 'lsb', format: :integer)
75
- msb = extract(b, 'msb', format: :integer)
76
- access = extract(b, 'access')
77
- desc = (extract(r, 'description') || '').gsub("'", %q(\\\'))
78
- case access
79
- when 'read-only'
80
- ac = :ro
81
- else
82
- ac = :rw
83
- end
84
- if lsb == msb
85
- f.puts " reg.bit #{lsb}, :#{bn}, access: :#{ac}, description: '#{desc}'"
86
- else
87
- f.puts " reg.bit #{msb}..#{lsb}, :#{bn}, access: :#{ac}, description: '#{desc}'"
88
- end
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
- f.puts ' end'
92
- end
93
- end
94
- end
95
-
96
- f.puts ' end'
97
-
98
- # Create accessor methods to return an array of peripherals in the case
99
- # where there are many in a group
100
- peripheral_groups(doc).each do |name, size|
101
- name = name.to_s.downcase.symbolize
102
- if size > 1
103
- f.puts ''
104
- f.puts " def #{name}"
105
- f.print ' ['
106
- size.times do |i|
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
- f.print ", #{name}#{i}"
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 peripheral_groups(doc)
125
- @peripheral_groups ||= begin
126
- g = {}
127
- doc.xpath('device/peripherals/peripheral').each do |p|
128
- group = fetch(p.xpath('groupName'), get_text: true)
129
- group = group.to_s.downcase.symbolize
130
- g[group] ||= 0
131
- g[group] += 1
132
- end
133
- g
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 with_output_file(options = {})
138
- path = options[:output] || 'imported_cmsis_svd.rb'
139
- File.open(path, 'w') { |f| yield f }
140
- puts "Successfully imported to #{path}"
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
@@ -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.xpath('//spirit:memoryMaps/spirit:memoryMap').each do |mem_map|
23
- mem_map_name = fetch mem_map.at_xpath('spirit:name'), downcase: true, to_sym: true, get_text: true
24
- if mem_map_name.to_s.empty?
25
- mem_map_obj = owner
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
- owner.sub_block mem_map_name
28
- mem_map_obj = owner.send(mem_map_name)
41
+ mem_map_obj = model
42
+ addr_blocks = doc.xpath('//spirit:addressBlock')
29
43
  end
30
- mem_map.xpath('spirit:addressBlock').each do |addr_block|
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
@@ -83,7 +83,7 @@ module CrossOrigen
83
83
  end
84
84
 
85
85
  # This returns the doc wrapped by a Nokogiri doc
86
- def doc(path, _options = {})
86
+ def doc(path, options = {})
87
87
  require 'nokogiri'
88
88
 
89
89
  File.open(path) do |f|
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
- if RUBY_VERSION < '2.0.0'
7
- require 'scrub_rb'
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
- included do
12
- include Origen::Model
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, _options = {})
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
- fail "Unknown file format for file: #{file}"
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