origen_doc_helpers 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/version.rb +1 -1
- data/templates/shared/_register.html.erb +98 -27
- data/templates/web/helpers/register.md.erb +16 -1
- metadata +2 -4
- data/templates/model_page.md.erb~ +0 -129
- data/templates/web/helpers/model.md.erb~ +0 -81
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f197ebf8b884da0d6aa316309bf03b18bcf2e5bd
|
4
|
+
data.tar.gz: 91ed5f470f146302befb1aeacb25b759dff6194e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58141e8f821a5b924c52cc8eae91899afb1c12a837ed9238fe6f7104bdfdad950bfa8f4d5281015c39387dd6531b907f73b7c45d3af1b059960830e0cacca81e
|
7
|
+
data.tar.gz: 3794c4cba5c64a35e63e33d175c741d9b1c827c5f170eb55ef814436261f31df05da5adeb34c41c9dc5fe2f7d070abdd033bdf884f352697a732bc84504a62f2
|
data/config/version.rb
CHANGED
@@ -17,7 +17,19 @@
|
|
17
17
|
<h4>0x<%= reg.address.to_s(16).upcase %> - <%= reg_path %></h4>
|
18
18
|
% end
|
19
19
|
</a>
|
20
|
+
% if options[:current_value]
|
21
|
+
% if reg.size <= 8
|
22
|
+
<h4><font style="background-color: #66FF66">Current Value: <%= sprintf("0x%02X",reg.value) %></font></h4>
|
23
|
+
% elsif reg.size <= 16
|
24
|
+
<h4><font style="background-color: #66FF66">Current Value: <%= sprintf("0x%04X",reg.value) %></font></h4>
|
25
|
+
% elsif reg.size <= 24
|
26
|
+
<h4><font style="background-color: #66FF66">Current Value: <%= sprintf("0x%06X",reg.value) %></font></h4>
|
27
|
+
% elsif reg.size <= 32
|
28
|
+
<h4><font style="background-color: #66FF66">Current Value: <%= sprintf("0x%08X",reg.value) %></font></h4>
|
29
|
+
% end
|
30
|
+
% end
|
20
31
|
|
32
|
+
% # binding.pry
|
21
33
|
% if options[:descriptions]
|
22
34
|
<div markdown="1" style="margin: 0 0 20px 0">
|
23
35
|
|
@@ -177,49 +189,90 @@
|
|
177
189
|
% end
|
178
190
|
</tr>
|
179
191
|
|
192
|
+
% if options[:current_value]
|
193
|
+
<tr class="current_value">
|
194
|
+
<td class="heading">Current Value</td>
|
195
|
+
% alignment_done = false
|
196
|
+
% reg.named_bits :include_spacers => true do |name, bit|
|
197
|
+
% if _bit_in_range?(bit, max_bit, min_bit)
|
198
|
+
% if max_bit > (reg.size - 1) && !alignment_done
|
199
|
+
% (max_bit - (reg.size - 1)).times do
|
200
|
+
<td class="spacer"></td>
|
201
|
+
% end
|
202
|
+
% alignment_done = true
|
203
|
+
% end
|
204
|
+
% if bit.size > 1
|
205
|
+
% if name
|
206
|
+
% if bit.nvm_dep != 0 || bit.data == :memory
|
207
|
+
<td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">M</td>
|
208
|
+
% elsif bit.data == :undefined
|
209
|
+
<td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">X</td>
|
210
|
+
% else
|
211
|
+
<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>
|
212
|
+
% end
|
213
|
+
% else
|
214
|
+
% bit.shift_out_left do |bit|
|
215
|
+
% if _index_in_range?(bit.position, max_bit, min_bit)
|
216
|
+
<td></td>
|
217
|
+
% end
|
218
|
+
% end
|
219
|
+
% end
|
220
|
+
% else
|
221
|
+
% if bit.nvm_dep != 0 || bit.reset_val == :memory
|
222
|
+
<td>M</td>
|
223
|
+
% elsif bit.data == :undefined
|
224
|
+
<td>X</td>
|
225
|
+
% else
|
226
|
+
<td><%= bit.data.to_s(16).upcase %></td>
|
227
|
+
% end
|
228
|
+
% end
|
229
|
+
% end
|
230
|
+
% end
|
231
|
+
</tr>
|
232
|
+
% else
|
180
233
|
%#############################################
|
181
234
|
%# Reset Row
|
182
235
|
%#############################################
|
183
236
|
<tr class="reset">
|
184
237
|
<td class="heading">Reset</td>
|
185
|
-
%
|
186
|
-
%
|
187
|
-
%
|
188
|
-
%
|
189
|
-
%
|
238
|
+
% alignment_done = false
|
239
|
+
% reg.named_bits :include_spacers => true do |name, bit|
|
240
|
+
% if _bit_in_range?(bit, max_bit, min_bit)
|
241
|
+
% if max_bit > (reg.size - 1) && !alignment_done
|
242
|
+
% (max_bit - (reg.size - 1)).times do
|
190
243
|
<td class="spacer"></td>
|
244
|
+
% end
|
245
|
+
% alignment_done = true
|
191
246
|
% end
|
192
|
-
%
|
193
|
-
%
|
194
|
-
%
|
195
|
-
|
196
|
-
%
|
197
|
-
|
198
|
-
%
|
199
|
-
|
247
|
+
% if bit.size > 1
|
248
|
+
% if name
|
249
|
+
% if bit.nvm_dep != 0 || bit.reset_val == :memory
|
250
|
+
<td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">M</td>
|
251
|
+
% elsif bit.reset_val == :undefined
|
252
|
+
<td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">X</td>
|
253
|
+
% else
|
254
|
+
<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>
|
255
|
+
% end
|
200
256
|
% else
|
201
|
-
|
202
|
-
%
|
203
|
-
% else
|
204
|
-
% bit.shift_out_left do |bit|
|
205
|
-
% if _index_in_range?(bit.position, max_bit, min_bit)
|
257
|
+
% bit.shift_out_left do |bit|
|
258
|
+
% if _index_in_range?(bit.position, max_bit, min_bit)
|
206
259
|
<td></td>
|
260
|
+
% end
|
207
261
|
% end
|
208
262
|
% end
|
209
|
-
%
|
210
|
-
%
|
211
|
-
% if bit.nvm_dep != 0 || bit.reset_val == :memory
|
263
|
+
% else
|
264
|
+
% if bit.nvm_dep != 0 || bit.reset_val == :memory
|
212
265
|
<td>M</td>
|
213
|
-
%
|
266
|
+
% elsif bit.reset_val == :undefined
|
214
267
|
<td>X</td>
|
215
|
-
%
|
268
|
+
% else
|
216
269
|
<td><%= bit.reset_val.to_s(16).upcase %></td>
|
270
|
+
% end
|
217
271
|
% end
|
218
|
-
%
|
219
|
-
% end
|
272
|
+
% end
|
220
273
|
% end
|
221
274
|
</tr>
|
222
|
-
|
275
|
+
% end
|
223
276
|
</tbody>
|
224
277
|
</table>
|
225
278
|
|
@@ -254,9 +307,27 @@
|
|
254
307
|
</p>
|
255
308
|
</td>
|
256
309
|
<td markdown="1">
|
257
|
-
|
310
|
+
% bit_val_str = ''
|
311
|
+
% start_bit = bits.position
|
312
|
+
% end_bit = bits.position + bits.size - 1
|
313
|
+
% (start_bit..end_bit).each do |b|
|
314
|
+
% bit_val_str << reg.bits[b].data.to_s
|
315
|
+
% end
|
258
316
|
% bits.description.each do |line|
|
317
|
+
% if options[:current_value]
|
318
|
+
% if line =~ /^\d{#{bit_val_str.length}}/
|
319
|
+
% if line =~ /^#{bit_val_str}/
|
320
|
+
<span style="background-color: #66FF66"> <%= line.gsub("\\'", "'") %>
|
321
|
+
</span><br/>
|
322
|
+
% else
|
323
|
+
<%= line.gsub("\\'", "'") %><br/>
|
324
|
+
% end
|
325
|
+
% else
|
326
|
+
<%= line.gsub("\\'", "'") %>
|
327
|
+
% end
|
328
|
+
% else
|
259
329
|
<%= line.gsub("\\'", "'") %>
|
330
|
+
% end
|
260
331
|
% end
|
261
332
|
|
262
333
|
</td>
|
@@ -86,7 +86,22 @@ bit descriptions:
|
|
86
86
|
<%= "%" %> end
|
87
87
|
~~~
|
88
88
|
|
89
|
-
|
89
|
+
~~~eruby
|
90
|
+
## Register Map with Current Value
|
91
|
+
|
92
|
+
<%= "%" %> $dut.regs.each do |name, reg|
|
93
|
+
|
94
|
+
<%= "<" + "%= render \"doc_helpers/register.html\", reg: reg, preserve_target: true, descriptions: true , current_value: true%" + ">" %>
|
95
|
+
|
96
|
+
<%= "%" %> end
|
97
|
+
~~~
|
98
|
+
|
99
|
+
Please note that the highlighting only works when the bit values match
|
100
|
+
explicitly. It will not match partial descriptions, e.g. value is 000
|
101
|
+
and bitfield description is 00.
|
102
|
+
|
103
|
+
|
104
|
+
<%= render "templates/shared/register", :reg => $dut.reg(:mclkdiv), :descriptions => true, current_value: true %>
|
90
105
|
|
91
106
|
### Additional Test Cases
|
92
107
|
|
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.6.
|
4
|
+
version: 0.6.1
|
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-
|
11
|
+
date: 2018-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: origen
|
@@ -67,7 +67,6 @@ files:
|
|
67
67
|
- templates/flow_page.md.erb
|
68
68
|
- templates/model_index.md.erb
|
69
69
|
- templates/model_page.md.erb
|
70
|
-
- templates/model_page.md.erb~
|
71
70
|
- templates/pdf/topic_wrapper.html
|
72
71
|
- templates/shared/_register.html.erb
|
73
72
|
- templates/shared/_searchable.html.erb
|
@@ -77,7 +76,6 @@ files:
|
|
77
76
|
- templates/web/helpers/disqus.md.erb
|
78
77
|
- templates/web/helpers/flow.md.erb
|
79
78
|
- templates/web/helpers/model.md.erb
|
80
|
-
- templates/web/helpers/model.md.erb~
|
81
79
|
- templates/web/helpers/register.md.erb
|
82
80
|
- templates/web/helpers/searchable/intro.md.erb
|
83
81
|
- templates/web/helpers/searchable/page2.md.erb
|
@@ -1,129 +0,0 @@
|
|
1
|
-
% opts = options
|
2
|
-
% model = options[:model]
|
3
|
-
% render options[:layout], options[:layout_options] do
|
4
|
-
|
5
|
-
<script type="text/javascript">
|
6
|
-
// Modified from: http://jsfiddle.net/jhfrench/mc4Qd/
|
7
|
-
window.onload = function() {
|
8
|
-
// Links to the top of the page
|
9
|
-
$('.top-link').click(function() {
|
10
|
-
jQuery('html,body').animate({scrollTop: 0}, 500);
|
11
|
-
return false;
|
12
|
-
});
|
13
|
-
};
|
14
|
-
</script>
|
15
|
-
|
16
|
-
<style>
|
17
|
-
tr.clickable td { padding: 0px !important; }
|
18
|
-
tr.clickable a { display: block; height: 100%; width: 100%; padding: 8px; text-decoration: none; }
|
19
|
-
</style>
|
20
|
-
|
21
|
-
<div class="row" style="margin-top: 10px; margin-bottom: 15px;">
|
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;">
|
24
|
-
<h1 style="float: left; margin-left: 10px;"><%= opts[:heading] %></h1>
|
25
|
-
</div>
|
26
|
-
% if opts[:search_box]
|
27
|
-
<div id="search" class="col-md-3" style="margin-top: 20px;">
|
28
|
-
<form style="margin-bottom: 15px;">
|
29
|
-
<div class="input-group">
|
30
|
-
<input class="form-control" type="search" placeholder="Search within this model..."/>
|
31
|
-
<span class="input-group-btn">
|
32
|
-
<button type="submit" class="btn btn-search">GO!</button>
|
33
|
-
</span>
|
34
|
-
</div>
|
35
|
-
</form>
|
36
|
-
</div>
|
37
|
-
% end
|
38
|
-
</div>
|
39
|
-
|
40
|
-
<div class="row">
|
41
|
-
<div class="col-md-12">
|
42
|
-
<ol class="breadcrumb">
|
43
|
-
% size = opts[:breadcrumbs].size
|
44
|
-
% opts[:breadcrumbs].each_with_index do |crumb, i|
|
45
|
-
% if i == size - 1
|
46
|
-
<li class="active"><%= crumb[0] %></li>
|
47
|
-
% else
|
48
|
-
<li><a href="<%= path crumb[1] %>"><%= crumb[0] %></a></li>
|
49
|
-
% end
|
50
|
-
% end
|
51
|
-
</ol>
|
52
|
-
</div>
|
53
|
-
</div>
|
54
|
-
|
55
|
-
<div class="row">
|
56
|
-
<div class="col-md-12 search-results">
|
57
|
-
</div>
|
58
|
-
</div>
|
59
|
-
|
60
|
-
<div class="row">
|
61
|
-
<div class="col-md-6">
|
62
|
-
<h3>Blocks</h3>
|
63
|
-
|
64
|
-
<table class="table table-hover">
|
65
|
-
<thead><tr>
|
66
|
-
<th>Address</th>
|
67
|
-
<th>Name</th>
|
68
|
-
</tr></thead>
|
69
|
-
<tbody>
|
70
|
-
% model.sub_blocks.sort_by { |name, block| block.base_address }.each do |name, block|
|
71
|
-
<tr class="clickable">
|
72
|
-
<td><a href="<%= path "#{opts[:path]}/#{name}" %>"><%= block.base_address.to_hex %></a></td>
|
73
|
-
<td><a href="<%= path "#{opts[:path]}/#{name}" %>"><%= name %></a></td>
|
74
|
-
</tr>
|
75
|
-
% end
|
76
|
-
</tbody>
|
77
|
-
</table>
|
78
|
-
</div>
|
79
|
-
|
80
|
-
<div class="col-md-6">
|
81
|
-
<h3>Registers</h3>
|
82
|
-
|
83
|
-
<table class="table table-hover">
|
84
|
-
<thead><tr>
|
85
|
-
<th>Address</th>
|
86
|
-
<th>Name</th>
|
87
|
-
</tr></thead>
|
88
|
-
<tbody>
|
89
|
-
% model.regs.sort_by { |name, reg| reg.offset }.each do |name, reg|
|
90
|
-
<tr class="clickable">
|
91
|
-
<td><a href="#<%= reg.name %>"><%= reg.address.to_hex %></a></td>
|
92
|
-
<td><a href="#<%= reg.name %>"><%= name %></a></td>
|
93
|
-
</tr>
|
94
|
-
% end
|
95
|
-
</tbody>
|
96
|
-
</table>
|
97
|
-
</div>
|
98
|
-
</div>
|
99
|
-
|
100
|
-
|
101
|
-
% if model.owns_registers?
|
102
|
-
|
103
|
-
<hr>
|
104
|
-
<div class="row">
|
105
|
-
<div class="col-md-12">
|
106
|
-
% if opts[:search_box]
|
107
|
-
<article>
|
108
|
-
% end
|
109
|
-
<h3>Registers of <%= model.model.class%> <%= model.name ? "(#{model.name})" : model.try(:includes_origen_top_level?) ? "(dut)" : "" %></h3>
|
110
|
-
|
111
|
-
% model.regs.sort_by { |name, reg| reg.offset }.each do |name, reg|
|
112
|
-
|
113
|
-
<div>
|
114
|
-
<span class="pull-right"><a class="top-link" href="#">back to top</a></span>
|
115
|
-
</div>
|
116
|
-
|
117
|
-
<%= render "doc_helpers/register.html", reg: reg, preserve_target: true, descriptions: true, origen_path: opts[:origen_path] %>
|
118
|
-
|
119
|
-
% end
|
120
|
-
|
121
|
-
</article>
|
122
|
-
</div>
|
123
|
-
</div>
|
124
|
-
|
125
|
-
% end
|
126
|
-
|
127
|
-
% end
|
128
|
-
<script>window.origen_search_id = "<%= opts[:search_id] %>";</script>
|
129
|
-
<script src="<%= path "search.js" %>"></script>
|
@@ -1,81 +0,0 @@
|
|
1
|
-
% render "../layouts/helpers.html" do
|
2
|
-
|
3
|
-
# Model Documentation
|
4
|
-
|
5
|
-
This helper will build a collection of web pages that document a model's attributes,
|
6
|
-
currently this includes its sub-blocks and registers.
|
7
|
-
|
8
|
-
[Here is an example](http://origen-sdk.org/link_demo/models/linkdemo_toplevel/).
|
9
|
-
|
10
|
-
Multiple models can be supplied and an [index page like this](http://origen-sdk.org/link_demo/models)
|
11
|
-
is generated to help locate the documentation for a given model.
|
12
|
-
|
13
|
-
The collection of pages associated with a particular model is also fully searchable via
|
14
|
-
the provided search box.
|
15
|
-
|
16
|
-
## How To Use
|
17
|
-
|
18
|
-
Call the helper from an <code>after_web_site_compile</code> callback handler in your
|
19
|
-
application's <code>config/application.rb</code> like this:
|
20
|
-
|
21
|
-
~~~ruby
|
22
|
-
def after_web_site_compile(options)
|
23
|
-
# Build the model documentation
|
24
|
-
OrigenDocHelpers.generate_model_docs layout: "#{Origen.root}/templates/web/layouts/_basic.html.erb", tab: :model do |d|
|
25
|
-
d.page model: $dut
|
26
|
-
end
|
27
|
-
end
|
28
|
-
~~~
|
29
|
-
|
30
|
-
To generate documentation for more than one model, call the page method multiple times like this:
|
31
|
-
|
32
|
-
~~~ruby
|
33
|
-
def after_web_site_compile(options)
|
34
|
-
# Build the model documentation
|
35
|
-
OrigenDocHelpers.generate_model_docs layout: "#{Origen.root}/templates/web/layouts/_basic.html.erb", tab: :model do |d|
|
36
|
-
d.page model: MyApp::ModelA.new
|
37
|
-
d.page model: MyApp::ModelB.new
|
38
|
-
d.page model: MyApp::ModelC.new
|
39
|
-
end
|
40
|
-
end
|
41
|
-
~~~
|
42
|
-
|
43
|
-
If the different models are all top-level instances (i.e. they include <code>Origen::TopLevel</code> and are
|
44
|
-
what is commonly referred to as <code>$dut</code>), then a target loop should be used like this:
|
45
|
-
|
46
|
-
~~~ruby
|
47
|
-
def after_web_site_compile(options)
|
48
|
-
# Build the model documentation
|
49
|
-
OrigenDocHelpers.generate_model_docs layout: "#{Origen.root}/templates/web/layouts/_basic.html.erb", tab: :model do |d|
|
50
|
-
Origen.target.loop targets: ["target_a", "target_b", "target_c"] do
|
51
|
-
d.page model: $dut
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
~~~
|
56
|
-
|
57
|
-
## Options
|
58
|
-
|
59
|
-
<code>OrigenDocHelpers.generate_model_docs</code>
|
60
|
-
|
61
|
-
* <code>:layout</code> - **Required**, supply a full path to your application's layout file
|
62
|
-
* Any other options will be passed to your layout file unmodified, e.g. to set the tab in the generated
|
63
|
-
pages in the above example
|
64
|
-
|
65
|
-
<code>page</code>
|
66
|
-
|
67
|
-
* <code>:model</code> - **Required**, supply an instance of the model
|
68
|
-
* <code>:group</code> - Optional, a heading to group similar models under on the index page, e.g. "Production", "In Development"
|
69
|
-
|
70
|
-
## Website Integration
|
71
|
-
|
72
|
-
The model index page will be generated at path <code>/models</code> within your application, and it is common
|
73
|
-
to create a "Model(s)" tab in your website's navigation bar to link to this.
|
74
|
-
|
75
|
-
If your application only has one model, then the navbar link should be setup to point directly to
|
76
|
-
that model's page.
|
77
|
-
|
78
|
-
The location of the pages for the individual models are based on the model name and will be unique to each application,
|
79
|
-
you can find them initially via the index page.
|
80
|
-
|
81
|
-
% end
|