origen_doc_helpers 0.8.0 → 0.8.5

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
  SHA256:
3
- metadata.gz: e38c7e090bcb00c720933266cbf06095d99d817206d105a88fa2a3792f9dfd71
4
- data.tar.gz: '076904f8fedfcbecab07c948341ffc529f68357d02106d235dbdebf8db6496d1'
3
+ metadata.gz: 40aaede1ff8ad4d6148ab8306512e8f80380f9f3682cea6077316f5a24d43092
4
+ data.tar.gz: 64f8b7f11de61649190d9d256b85bd5dd77f7f6f5f90df6ee620f1959098ec47
5
5
  SHA512:
6
- metadata.gz: 0bb5c8624309ad1e3d5f3261c0e9b5fecc6f30e899a45ef8694d24992b7f6813aadc29bfaebd3ca33bd3915cd44ab5e2319c7c92a300a9e93379fe2aeae8f1ee
7
- data.tar.gz: e6cc432dcef4200b37cbc045eec8c2777f327f055cb5e3d36366cefd0ee508996a5864a7a0c09c1f09c2f30c746c51f498e1fac13808dcce8730fb8ea2c79e6a
6
+ metadata.gz: 8984fa0e3c19a0a638b24d085f9ce304737418e7a35657c0d10a2ba94a4d614486f4b9de36403e5a5808272e6462438fb9b076610f5d1316aab4d2a607146ce7
7
+ data.tar.gz: 8924ae6bb9e10082e7c62153cfabb1615c6c367aa60e8cd74679311f74823daa9895196dd16b206279bb5dab233b09457ec3aca2f19f158562125b2d0f55fb72
@@ -8,7 +8,7 @@ class OrigenDocHelpersApplication < Origen::Application
8
8
  # To enable deployment of your documentation to a web server (via the 'origen web'
9
9
  # command) fill in these attributes.
10
10
  config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/doc_helpers"
11
- config.web_domain = "http://origen-sdk.org/doc_helpers"
11
+ config.web_domain = "https://origen-sdk.org/doc_helpers"
12
12
  config.disqus_shortname = "origen-sdk"
13
13
 
14
14
  config.semantically_version = true
data/config/version.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  module OrigenDocHelpers
2
2
  MAJOR = 0
3
3
  MINOR = 8
4
- BUGFIX = 0
4
+ BUGFIX = 5
5
5
  DEV = nil
6
-
7
6
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
7
  end
@@ -44,7 +44,11 @@ module OrigenDocHelpers
44
44
  end
45
45
 
46
46
  def index_page_template
47
- @index_page_template ||= "#{Origen.root!}/templates/flow_index.md.erb"
47
+ if File.exist?("#{Origen.root}/app/")
48
+ @index_page_template ||= "#{Origen.root!}/app/templates/flow_index.md.erb"
49
+ else
50
+ @index_page_template ||= "#{Origen.root!}/templates/flow_index.md.erb"
51
+ end
48
52
  end
49
53
  end
50
54
 
@@ -100,11 +104,19 @@ module OrigenDocHelpers
100
104
  end
101
105
 
102
106
  def flow_page_template
103
- @flow_page_template ||= "#{Origen.root!}/templates/flow_page.md.erb"
107
+ if File.exist?("#{Origen.root}/app/")
108
+ @flow_page_template ||= "#{Origen.root!}/app/templates/flow_page.md.erb"
109
+ else
110
+ @flow_page_template ||= "#{Origen.root!}/templates/flow_page.md.erb"
111
+ end
104
112
  end
105
113
 
106
114
  def flow_template
107
- @flow_template ||= "#{Origen.root!}/templates/shared/test/_flow.md.erb"
115
+ if File.exist?("#{Origen.root}/app/")
116
+ @flow_template ||= "#{Origen.root!}/app/templates/shared/test/_flow.md.erb"
117
+ else
118
+ @flow_template ||= "#{Origen.root!}/templates/shared/test/_flow.md.erb"
119
+ end
108
120
  end
109
121
  end
110
122
  end
@@ -1,7 +1,7 @@
1
1
  module OrigenDocHelpers
2
2
  # Provides an API to programatically construct an index hash as used
3
3
  # by the Searchable Documents helper -
4
- # http://origen-sdk.org/doc_helpers/helpers/searchable/intro/#The_Document_Index
4
+ # https://origen-sdk.org/doc_helpers/helpers/searchable/intro/#The_Document_Index
5
5
  class GuideIndex
6
6
  def initialize
7
7
  @index = {}
@@ -257,7 +257,11 @@ END
257
257
  @_doc_root_dirs ||= {}
258
258
  return @_doc_root_dirs[f] if @_doc_root_dirs[f]
259
259
  unless File.exist?(f)
260
- f = Pathname.new("#{Origen.root}/templates/web/#{f}")
260
+ if File.exist?("#{Origen.root}/app/")
261
+ f = Pathname.new("#{Origen.root}/app/templates/web/#{f}")
262
+ else
263
+ f = Pathname.new("#{Origen.root}/templates/web/#{f}")
264
+ end
261
265
  unless f.exist?
262
266
  fail "#{options[:root]} does not exist!"
263
267
  end
@@ -272,7 +276,11 @@ END
272
276
  if options[:tab]
273
277
  options[:tab]
274
278
  else
275
- rel = options[:top_level_file].relative_path_from(_doc_root_dir(options)).sub_ext('').sub_ext('').to_s
279
+ rel = begin
280
+ options[:top_level_file].relative_path_from(_doc_root_dir(options)).sub_ext('').sub_ext('').to_s
281
+ rescue
282
+ '..'
283
+ end
276
284
  # If the file lives outside of the current app (e.g. it comes from a plugin), then the above approach
277
285
  # doesn't work, so let's just take the last dirname and the filename
278
286
  if rel =~ /\.\./
@@ -285,7 +293,11 @@ END
285
293
  end
286
294
 
287
295
  def _root_path(options)
288
- root = Pathname.new("#{Origen.root}/templates/web")
296
+ if File.exist?("#{Origen.root}/app/templates/web")
297
+ root = Pathname.new("#{Origen.root}/app/templates/web")
298
+ else
299
+ root = Pathname.new("#{Origen.root}/templates/web")
300
+ end
289
301
  _doc_root_dir(options).relative_path_from(root)
290
302
  end
291
303
  end
@@ -1,7 +1,11 @@
1
- require 'atp'
1
+ begin
2
+ require 'origen_testers/atp'
3
+ rescue LoadError
4
+ require 'atp'
5
+ end
2
6
  require 'kramdown'
3
7
  module OrigenDocHelpers
4
- class HtmlFlowFormatter < ATP::Formatter
8
+ class HtmlFlowFormatter < (defined?(OrigenTesters::ATP) ? OrigenTesters::ATP::Formatter : ATP::Formatter)
5
9
  include Origen::Generator::Compiler::DocHelpers::TestFlowHelpers
6
10
 
7
11
  attr_reader :html
@@ -1,6 +1,10 @@
1
- require 'atp'
1
+ begin
2
+ require 'origen_testers/atp'
3
+ rescue LoadError
4
+ require 'atp'
5
+ end
2
6
  module OrigenDocHelpers
3
- class ListFlowFormatter < ATP::Formatter
7
+ class ListFlowFormatter < (defined?(OrigenTesters::ATP) ? OrigenTesters::ATP::Formatter : ATP::Formatter)
4
8
  attr_reader :html
5
9
 
6
10
  def format(node, options = {})
@@ -4,6 +4,7 @@ module OrigenDocHelpers
4
4
  attr_accessor :layout_options
5
5
  attr_accessor :layout
6
6
  attr_reader :pages
7
+ attr_accessor :target_as_id
7
8
 
8
9
  def run(options)
9
10
  @pages = {}
@@ -43,7 +44,11 @@ module OrigenDocHelpers
43
44
  end
44
45
 
45
46
  def index_page_template
46
- @index_page_template ||= "#{Origen.root!}/templates/model_index.md.erb"
47
+ if File.exist?("#{Origen.root}/app/")
48
+ @index_page_template ||= "#{Origen.root!}/app/templates/model_index.md.erb"
49
+ else
50
+ @index_page_template ||= "#{Origen.root!}/templates/model_index.md.erb"
51
+ end
47
52
  end
48
53
  end
49
54
 
@@ -144,11 +149,19 @@ module OrigenDocHelpers
144
149
  end
145
150
 
146
151
  def id
147
- @id ||= model.class.to_s.symbolize.to_s.gsub('::', '_')
152
+ if :target_as_id
153
+ @id ||= "#{Origen.target.name.downcase}" # _#{model.class.to_s.symbolize.to_s.gsub('::', '_')}"
154
+ else
155
+ @id ||= model.class.to_s.symbolize.to_s.gsub('::', '_')
156
+ end
148
157
  end
149
158
 
150
159
  def heading
151
- model.class.to_s
160
+ if :target_as_id
161
+ @id.upcase
162
+ else
163
+ model.class.to_s
164
+ end
152
165
  end
153
166
 
154
167
  def output_path
@@ -156,7 +169,11 @@ module OrigenDocHelpers
156
169
  end
157
170
 
158
171
  def model_page_template
159
- @model_page_template ||= "#{Origen.root!}/templates/model_page.md.erb"
172
+ if File.exist?("#{Origen.root}/app/")
173
+ @model_page_template ||= "#{Origen.root!}/app/templates/model_page.md.erb"
174
+ else
175
+ @model_page_template ||= "#{Origen.root!}/templates/model_page.md.erb"
176
+ end
160
177
  end
161
178
  end
162
179
  end
@@ -25,7 +25,11 @@ module OrigenDocHelpers
25
25
  @index = options[:index]
26
26
  @root = Pathname.new(options[:root])
27
27
  if @root.absolute?
28
- @root = @root.relative_path_from(Pathname.new("#{Origen.root}/templates/web"))
28
+ if File.exist?("#{Origen.root}/app/")
29
+ @root = @root.relative_path_from(Pathname.new("#{Origen.root}/app/templates/web"))
30
+ else
31
+ @root = @root.relative_path_from(Pathname.new("#{Origen.root}/templates/web"))
32
+ end
29
33
  end
30
34
  require 'nokogiri'
31
35
  end
@@ -116,7 +120,11 @@ module OrigenDocHelpers
116
120
  end
117
121
 
118
122
  def topic_wrapper_string
119
- @topic_wrapper_string ||= File.read("#{Origen.root!}/templates/pdf/topic_wrapper.html")
123
+ if File.exist?("#{Origen.root}/app/")
124
+ @topic_wrapper_string ||= File.read("#{Origen.root!}/app/templates/pdf/topic_wrapper.html")
125
+ else
126
+ @topic_wrapper_string ||= File.read("#{Origen.root!}/templates/pdf/topic_wrapper.html")
127
+ end
120
128
  end
121
129
  end
122
130
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="row" style="margin-top: 10px; margin-bottom: 15px;">
5
5
  <div class="col-md-9">
6
- <img src="http://origen-sdk.org/img/origen-device.png" style="float: left; height:50px; width: 50px; margin-top: 14px;">
6
+ <img src="https://origen-sdk.org/img/origen-device.png" style="float: left; height:50px; width: 50px; margin-top: 14px;">
7
7
  <h1 style="float: left; margin-left: 10px;">Models</h1>
8
8
  </div>
9
9
  </div>
@@ -20,7 +20,7 @@
20
20
 
21
21
  <div class="row" style="margin-top: 10px; margin-bottom: 15px;">
22
22
  <div class="col-md-9">
23
- <img src="http://origen-sdk.org/img/origen-device.png" style="float: left; height:50px; width: 50px; margin-top: 14px;">
23
+ <img src="https://origen-sdk.org/img/origen-device.png" style="float: left; height:50px; width: 50px; margin-top: 14px;">
24
24
  <h1 style="float: left; margin-left: 10px;"><%= opts[:heading] %></h1>
25
25
  </div>
26
26
  % if opts[:search_box]
@@ -16,7 +16,7 @@ These helpers will generate complete web pages for you.
16
16
 
17
17
  The following are components that you can embed within your own web pages.
18
18
 
19
- | [Searchable Documents](<%= path "/helpers/searchable/intro" %>) | Provides a layout for a guides section of your website, complete with search box (the [Origen Guides](http://origen-sdk.org/guides) uses this)
19
+ | [Searchable Documents](<%= path "/helpers/searchable/intro" %>) | Provides a layout for a guides section of your website, complete with search box (the [Origen Guides](https://origen-sdk.org/guides) uses this)
20
20
  | [Register Descriptions](<%= path "/helpers/register" %>) | Create a tabular register view, similar to that used in device reference manuals
21
21
  | [Yammer Comments](<%= path "/helpers/yammer" %>) | Embed a comments section at the bottom of your page using Yammer
22
22
  | [Disqus Comments](<%= path "/helpers/disqus" %>) | Embed a comments section at the bottom of your page using Disqus
@@ -5,9 +5,9 @@
5
5
  This helper will build a collection of web pages that document a model's attributes,
6
6
  currently this includes its sub-blocks and registers.
7
7
 
8
- [Here is an example](http://origen-sdk.org/link_demo/models/linkdemo_toplevel/).
8
+ [Here is an example](https://origen-sdk.org/link_demo/models/linkdemo_toplevel/).
9
9
 
10
- Multiple models can be supplied and an [index page like this](http://origen-sdk.org/link_demo/models)
10
+ Multiple models can be supplied and an [index page like this](https://origen-sdk.org/link_demo/models)
11
11
  is generated to help locate the documentation for a given model.
12
12
 
13
13
  The collection of pages associated with a particular model is also fully searchable via
@@ -79,6 +79,9 @@ end
79
79
 
80
80
  * <code>:model</code> - **Required**, supply an instance of the model
81
81
  * <code>:group</code> - Optional, a heading to group similar models under on the index page, e.g. "Production", "In Development"
82
+ * <code>:target_as_id</code> - Optional, causes the target name to be used for model page headings instead of the top-level model class name,
83
+ e.g. "Eagle" instead of "MyApp::ModelA". This is particularly useful if multiple targets instantiate the same top-level model with different
84
+ options or attributes that lead to differentiation.
82
85
 
83
86
  ## Website Integration
84
87
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Register Helpers
4
4
 
5
- Use the [Origen register API](http://origen-sdk.org/origen/guides/models/registers)
5
+ Use the [Origen register API](https://origen-sdk.org/origen/guides/models/registers)
6
6
  to define registers in the normal way,
7
7
  all of the examples are here are based on this register definition:
8
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_doc_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-13 00:00:00.000000000 Z
11
+ date: 2021-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -31,7 +31,6 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - bin/fix_my_workspace
35
34
  - config/application.rb
36
35
  - config/boot.rb
37
36
  - config/commands.rb
@@ -57,7 +56,6 @@ files:
57
56
  - templates/model_page.md.erb
58
57
  - templates/pdf/topic_wrapper.html
59
58
  - templates/shared/_register.html.erb
60
- - templates/shared/_register.html.erb~
61
59
  - templates/shared/_searchable.html.erb
62
60
  - templates/shared/_spec.html.erb
63
61
  - templates/shared/test/_flow.md.erb
@@ -78,7 +76,7 @@ files:
78
76
  - templates/web/layouts/_helpers.html.erb
79
77
  - templates/web/partials/_navbar.html.erb
80
78
  - templates/web/release_notes.md.erb
81
- homepage: http://origen-sdk.org/doc_helpers
79
+ homepage: https://origen-sdk.org/doc_helpers
82
80
  licenses:
83
81
  - MIT
84
82
  metadata: {}
@@ -97,8 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
95
  - !ruby/object:Gem::Version
98
96
  version: 1.8.11
99
97
  requirements: []
100
- rubyforge_project:
101
- rubygems_version: 2.7.7
98
+ rubygems_version: 3.1.4
102
99
  signing_key:
103
100
  specification_version: 4
104
101
  summary: Snippets and helpers for creating Origen web documents
data/bin/fix_my_workspace DELETED
@@ -1,100 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $VERBOSE = nil # Don't care about world writable dir warnings and the like
3
-
4
- if $_fix_my_workspace_version_check
5
- $_fix_my_workspace_version = '0.7.0'
6
- else
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
16
-
17
- if !Origen.site_config.gem_manage_bundler
18
- puts 'Sorry but you have opted to manage Bundler yourself via your Origen site config, and this means'
19
- puts 'that I cannot make certain assumptions about how your workspace is configured.'
20
- puts 'You will need to either resolve this problem yourself, or else change the value of'
21
- puts 'gem_mange_bundler to true.'
22
- puts 'See here for more details on how to do that: http://origen-sdk.org/origen/guides/starting/company/'
23
-
24
- else
25
- ENV['BUNDLE_GEMFILE'] = File.join(Origen.root, 'Gemfile')
26
- ENV['BUNDLE_PATH'] = File.expand_path(Origen.site_config.gem_install_dir)
27
- ENV['BUNDLE_BIN'] = File.join(Origen.root, 'lbin')
28
-
29
- # Force copy system gems to local gems
30
- if Origen.site_config.gem_use_from_system
31
- local_gem_dir = "#{ENV['BUNDLE_PATH']}/ruby/#{Pathname.new(Gem.dir).basename}"
32
- gem_dir = Pathname.new(Gem.dir)
33
-
34
- Origen.site_config.gem_use_from_system.each do |gem, version|
35
- begin
36
- # This will raise an error if the system doesn't have this gem installed, that
37
- # will be rescued below
38
- spec = Gem::Specification.find_by_name(gem, version)
39
-
40
- local_dir = File.join(local_gem_dir, Pathname.new(spec.gem_dir).relative_path_from(gem_dir))
41
- FileUtils.mkdir_p local_dir
42
- FileUtils.cp_r("#{spec.gem_dir}/.", local_dir)
43
-
44
- local_file = Pathname.new(File.join(local_gem_dir, Pathname.new(spec.cache_file).relative_path_from(gem_dir)))
45
- FileUtils.mkdir_p local_file.dirname
46
- FileUtils.cp(spec.cache_file, local_file)
47
-
48
- if spec.extension_dir && File.exist?(spec.extension_dir)
49
- local_dir = File.join(local_gem_dir, Pathname.new(spec.extension_dir).relative_path_from(gem_dir))
50
- FileUtils.mkdir_p local_dir
51
- FileUtils.cp_r("#{spec.extension_dir}/.", local_dir)
52
- end
53
-
54
- local_file = Pathname.new(File.join(local_gem_dir, Pathname.new(spec.spec_file).relative_path_from(gem_dir)))
55
- FileUtils.mkdir_p local_file.dirname
56
- FileUtils.cp(spec.spec_file, local_file)
57
-
58
- rescue Gem::LoadError
59
- # This just means that one of the gems that should be copied from the system
60
- # was not actually installed in the system, so nothing we can do about that here
61
- end
62
- end
63
- end
64
-
65
- # Delete lbin
66
- FileUtils.rm_rf(ENV['BUNDLE_BIN']) if File.exist?(ENV['BUNDLE_BIN'])
67
-
68
- # Run bundler with correct switches
69
- cmd = "bundle install --gemfile #{ENV['BUNDLE_GEMFILE']} --binstubs #{ENV['BUNDLE_BIN']} --path #{ENV['BUNDLE_PATH']}"
70
- `chmod o-w #{Origen.root}` # Stops some annoying world writable warnings during install
71
- `chmod o-w #{Origen.root}/bin` if File.exist?("#{Origen.root}/bin")
72
- `chmod o-w #{Origen.root}/.bin` if File.exist?("#{Origen.root}/.bin")
73
-
74
- # Try again, this time updating the bundle
75
- if system(cmd)
76
- fixed = true
77
- elsif system 'bundle update'
78
- fixed = true
79
- end
80
-
81
- if File.exist?(ENV['BUNDLE_BIN'])
82
- `chmod o-w #{ENV['BUNDLE_BIN']}`
83
-
84
- # Make .bat versions of all executables, Bundler should really be doing this when running
85
- # on windows
86
- if Origen.os.windows?
87
- Dir.glob("#{ENV['BUNDLE_BIN']}/*").each do |bin|
88
- unless bin =~ /.bat$/
89
- bat = "#{bin}.bat"
90
- unless File.exist?(bat)
91
- File.open(bat, 'w') { |f| f.write('@"ruby.exe" "%~dpn0" %*') }
92
- end
93
- end
94
- end
95
- end
96
- end
97
-
98
- system 'origen -v' if fixed
99
- end
100
- end
@@ -1,368 +0,0 @@
1
- % reg = options[:reg]
2
- % order_is_lsb0 = true
3
- % order_is_lsb0 = false if reg.bit_order == :msb0 || reg.bit_order == 'msb0'
4
- % include_data = false
5
-
6
- <div class="register">
7
- <a class="anchor" name="<%= "#{reg.name}" %>"></a>
8
-
9
- <a href='#<%= reg.name %>'>
10
- % if options[:origen_path] && !options[:origen_path].empty?
11
- % reg_path = options[:origen_path] + "." + reg.name.to_s
12
- % reg_path = "#{reg.name} - #{reg_path}"
13
- % else
14
- % reg_path = reg.name
15
- % end
16
- % if reg.full_name
17
- <h4>0x<%= reg.address.to_s(16).upcase %> - <%= reg.full_name %> (<%= reg_path %>)</h4>
18
- % else
19
- <h4>0x<%= reg.address.to_s(16).upcase %> - <%= reg_path %></h4>
20
- % end
21
- </a>
22
-
23
- % if options[:current_value]
24
- % if reg.size <= 8
25
- <h4><font style="background-color: #66FF66">Current Value: <%= sprintf("0x%02X",reg.value) %></font></h4>
26
- % elsif reg.size <= 16
27
- <h4><font style="background-color: #66FF66">Current Value: <%= sprintf("0x%04X",reg.value) %></font></h4>
28
- % elsif reg.size <= 24
29
- <h4><font style="background-color: #66FF66">Current Value: <%= sprintf("0x%06X",reg.value) %></font></h4>
30
- % elsif reg.size <= 32
31
- <h4><font style="background-color: #66FF66">Current Value: <%= sprintf("0x%08X",reg.value) %></font></h4>
32
- % end
33
- % end
34
-
35
- % if options[:descriptions]
36
- <div markdown="1" style="margin: 0 0 20px 0">
37
-
38
- % reg.description(:include_name => false).each do |line|
39
- <%= line.gsub("\\'", "'") %>
40
- % end
41
-
42
- </div>
43
- % end
44
-
45
- % if !order_is_lsb0
46
- <table class="reg table table-condensed ljust" style="margin-bottom: 0; table-layout: fixed;">
47
- <thead>
48
- <tr class="bit-positions">
49
- <b><tr class = "heading"><%= reg_path%> <span class="msb0_specific" style="color:gray;">(<%= reg_path %>.with_msb0)</span></tr></b>
50
- </tr>
51
- </thead>
52
- </table>
53
- % end
54
-
55
- % num_bytes = (reg.size / 8.0).ceil
56
- % num_bytes.times do |byte_index|
57
- % # Need to add support for little endian regs here?
58
- % byte_number = num_bytes - byte_index
59
- % max_bit = (byte_number * 8) - 1
60
- % min_bit = max_bit - 8 + 1
61
- % partial_byte = max_bit > (reg.size - 1)
62
-
63
- <table class="reg table table-condensed <%= 'rjust' %><%= partial_byte ? ' partial' : '' %>" style="margin-bottom: 0; table-layout: fixed;">
64
- <thead>
65
- <tr class="bit-positions">
66
- % if order_is_lsb0
67
- <th class="spacer"></th>
68
- % else
69
- <td class="heading">LSB0<span class="msb0_specific" style="color:gray;"> (MSB0)</span></td>
70
- % end
71
-
72
- % 8.times do |i|
73
- % bit_num = (byte_number * 8) - i - 1
74
- % if bit_num > reg.size - 1
75
- <th class="spacer"></th>
76
- % else
77
- % if order_is_lsb0
78
- <th class="bit-position"><%= bit_num %></th>
79
- % else
80
- <th class="bit-position"><%= bit_num %><span class="msb0_specific" style="color:gray;"> (<%= reg.size - bit_num -1%>)</span></th>
81
- % end
82
- % end
83
- % end
84
- </tr>
85
- </thead>
86
- <tbody>
87
-
88
- %#############################################
89
- %# Read Row
90
- %#############################################
91
- <tr class="read">
92
- % if order_is_lsb0
93
- <td class="heading">R</td>
94
- % else
95
- <td class="heading"><span class="msb0_specific" style="color:gray;">[LSB0] </span>R</td>
96
- % end
97
-
98
- % alignment_done = false
99
- % reg.named_bits :include_spacers => true do |name, bit|
100
- % if _bit_in_range?(bit, max_bit, min_bit)
101
- % if max_bit > (reg.size - 1) && !alignment_done
102
- % (max_bit - (reg.size - 1)).times do
103
- <td class="spacer"></td>
104
- % end
105
- % alignment_done = true
106
- % end
107
- % if bit.size > 1
108
- % if name
109
- % if bit.readable?
110
- % bit_name = "#{name}[#{bit.size - 1}:0]"
111
- <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">
112
- % if options[:descriptions] && !bit.description.empty?
113
- <span title="<%= name %>"><a href="#<%= "#{reg.name}_#{name}_#{bit.position}" %>"><%= bit_name %></a></span>
114
- % else
115
- <span title="<%= name %>"><%= bit_name %></span>
116
- % end
117
- </td>
118
- % else
119
- % if bit.access == :worz
120
- <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">
121
- <span>0</span>
122
- </td>
123
- % else
124
- <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>"></td>
125
- % end
126
- % end
127
- % else
128
- % bit.shift_out_left do |bit|
129
- % if _index_in_range?(bit.position, max_bit, min_bit)
130
- <td>0</td>
131
- % end
132
- % end
133
- % end
134
- % else
135
- % if name
136
- % if bit.readable?
137
- % if name.size > 10
138
- % bit_name = "#{name[0..2]}...#{name[-3..-1]}"
139
- %# bit_name = "bit#{bit.position}*"
140
- % else
141
- % bit_name = name
142
- % end
143
- % if options[:descriptions] && !bit.description.empty?
144
- <td class="<%= _bit_rw(bit) %>"><span title="<%= name %>"><a href="#<%= "#{reg.name}_#{name}_#{bit.position}" %>"><%= bit_name %></a></span></td>
145
- % else
146
- <td class="<%= _bit_rw(bit) %>"><span title="<%= name %>"><%= bit_name %></span></td>
147
- % end
148
- % else
149
- <td class="<%= _bit_rw(bit) %>"></td>
150
- % end
151
- % else
152
- <td>0</td>
153
- % end
154
- % end
155
- % end
156
- % end
157
- </tr>
158
-
159
- %#############################################
160
- %# Write Row
161
- %#############################################
162
- <tr class="write">
163
- <td class="heading">W</td>
164
- % alignment_done = false
165
- % reg.named_bits :include_spacers => true do |name, bit|
166
- % if _bit_in_range?(bit, max_bit, min_bit)
167
- % if max_bit > (reg.size - 1) && !alignment_done
168
- % (max_bit - (reg.size - 1)).times do
169
- <td class="spacer"></td>
170
- % end
171
- % alignment_done = true
172
- % end
173
- % if bit.size > 1
174
- % if name
175
- % if !bit.readable?
176
- % bit_name = "#{name}[#{bit.size - 1}:0]"
177
- <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">
178
- % if options[:descriptions] && !bit.description.empty?
179
- <span title="<%= name %>"><a href="#<%= "#{reg.name}_#{name}_#{bit.position}" %>"><%= bit_name %></a></span>
180
- % else
181
- <span title="<%= name %>"><%= bit_name %></span>
182
- % end
183
- </td>
184
- % else
185
- <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>"></td>
186
- % end
187
- % else
188
- % bit.shift_out_left do |bit|
189
- % if _index_in_range?(bit.position, max_bit, min_bit)
190
- <td class="not-writable"></td>
191
- % end
192
- % end
193
- % end
194
- % else
195
- % if name
196
- % if !bit.readable?
197
- % if name.size > 10
198
- % bit_name = "#{name[0..2]}...#{name[-3..-1]}"
199
- %# bit_name = "bit#{bit.position}*"
200
- % else
201
- % bit_name = name
202
- % end
203
- % if options[:descriptions] && !bit.description.empty?
204
- <td class="<%= _bit_rw(bit) %>"><span title="<%= name %>"><a href="#<%= "#{reg.name}_#{name}_#{bit.position}" %>"><%= bit_name %></a></span></td>
205
- % else
206
- <td class="<%= _bit_rw(bit) %>"><span title="<%= name %>"><%= bit_name %></span></td>
207
- % end
208
- % else
209
- <td class="<%= _bit_rw(bit) %>"></td>
210
- % end
211
- % else
212
- <td class="not-writable"></td>
213
- % end
214
- % end
215
- % end
216
- % end
217
- </tr>
218
-
219
- % if options[:current_value]
220
- <tr class="current_value">
221
- <td class="heading">Current Value (Hex)</td>
222
- % alignment_done = !order_is_lsb0
223
- % reg.named_bits :include_spacers => true do |name, bit|
224
- % if _bit_in_range?(bit, max_bit, min_bit)
225
- % if max_bit > (reg.size - 1) && !alignment_done
226
- % (max_bit - (reg.size - 1)).times do
227
- <td class="spacer"></td>
228
- % end
229
- % alignment_done = true
230
- % end
231
- % if bit.size > 1
232
- % if name
233
- % if bit.nvm_dep != 0 || bit.data == :memory
234
- <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">M</td>
235
- % elsif bit.data == :undefined
236
- <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">X</td>
237
- % else
238
- <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>"><%= bit.data[_max_bit_in_range(bit, max_bit, min_bit).._min_bit_in_range(bit, max_bit, min_bit)].to_s(16).upcase %></td>
239
- % end
240
- % else
241
- % bit.shift_out_left do |bit|
242
- % if _index_in_range?(bit.position, max_bit, min_bit)
243
- <td></td>
244
- % end
245
- % end
246
- % end
247
- % else
248
- % if bit.nvm_dep != 0 || bit.reset_val == :memory
249
- <td>M</td>
250
- % elsif bit.data == :undefined
251
- <td>X</td>
252
- % else
253
- <td><%= bit.data.to_s(16).upcase %></td>
254
- % end
255
- % end
256
- % end
257
- % end
258
- </tr>
259
- % else
260
- %#############################################
261
- %# Reset Row
262
- %#############################################
263
- <tr class="reset">
264
- <td class="heading">Reset</td>
265
- % alignment_done = false
266
- % reg.named_bits :include_spacers => true do |name, bit|
267
- % if _bit_in_range?(bit, max_bit, min_bit)
268
- % if max_bit > (reg.size - 1) && !alignment_done
269
- % (max_bit - (reg.size - 1)).times do
270
- <td class="spacer"></td>
271
- % end
272
- % alignment_done = true
273
- % end
274
- % if bit.size > 1
275
- % if name
276
- % if bit.nvm_dep != 0 || bit.reset_val == :memory
277
- <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">M</td>
278
- % elsif bit.reset_val == :undefined
279
- <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">X</td>
280
- % else
281
- <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>"><%= bit.reset_val[_max_bit_in_range(bit, max_bit, min_bit).._min_bit_in_range(bit, max_bit, min_bit)].to_s(16).upcase %></td>
282
- % end
283
- % else
284
- % bit.shift_out_left do |bit|
285
- % if _index_in_range?(bit.position, max_bit, min_bit)
286
- <td></td>
287
- % end
288
- % end
289
- % end
290
- % else
291
- % if bit.nvm_dep != 0 || bit.reset_val == :memory
292
- <td>M</td>
293
- % elsif bit.reset_val == :undefined
294
- <td>X</td>
295
- % else
296
- <td><%= bit.reset_val.to_s(16).upcase %></td>
297
- % end
298
- % end
299
- % end
300
- % end
301
- </tr>
302
- % end
303
- </tbody>
304
- </table>
305
-
306
- % end # Byte index loop
307
-
308
- % if options[:descriptions] && reg.named_bits.any? { |name, bits| !bits.description.empty? }
309
- <table class="bit-descriptions table table-condensed table-bordered" style="margin: 20px 0 0 0">
310
- <thead>
311
- <tr>
312
- <th>Bit</th>
313
- <th>Description</th>
314
- </tr>
315
- </thead>
316
- <tbody>
317
- % reg.named_bits do |name, bits|
318
- <tr>
319
- <td>
320
- <p>
321
- <a class="anchor" name="<%= "#{reg.name}_#{name}_#{bits.position}" %>"></a>
322
- % if bits.size == 1
323
- <%= bits.position %><%= order_is_lsb0 ? '' : "<span class="msb0_specific" style="color:gray;"> (#{reg.size - bits.position - 1})</span>" %>
324
- % else
325
- <%= bits.position + bits.size - 1 %>-<%= bits.position %><%= order_is_lsb0 ? '' : "<span class="msb0_specific" style="color:gray;"> (#{reg.size - bits.position - bits.size}-#{reg.size - bits.position - 1})</span>" %>
326
- % end
327
- </p>
328
- <p>
329
- % if bits.size == 1
330
- <%= name %>
331
- % else
332
- <%= name %>[<%= bits.size - 1 %>:0]<%= order_is_lsb0 ? '' : "<span class="msb0_specific" style="color:gray;"> ([0:#{bits.size - 1}])</span>" %>
333
- % end
334
- </p>
335
- </td>
336
- <td markdown="1">
337
- % bit_val_str = ''
338
- % start_bit = bits.position
339
- % end_bit = bits.position + bits.size - 1
340
- % (start_bit..end_bit).each do |b|
341
- % bit_val_str << reg.bits[b].data.to_s
342
- % end
343
- % bit_val_str.reverse!
344
- % bits.description.each do |line|
345
- % if options[:current_value]
346
- % if line =~ /^\d{#{bit_val_str.length}}/
347
- % if line =~ /^#{bit_val_str}/
348
- <span style="background-color: #66FF66"> <%= line.gsub("\\'", "'") %>
349
- </span><br/>
350
- % else
351
- <%= line.gsub("\\'", "'") %><br/>
352
- % end
353
- % else
354
- <%= line.gsub("\\'", "'") %>
355
- % end
356
- % else
357
- <%= line.gsub("\\'", "'") %>
358
- % end
359
- % end
360
-
361
- </td>
362
- </tr>
363
- % end
364
- </tbody>
365
- </table>
366
- % end
367
-
368
- </div>