origen_doc_helpers 0.7.1 → 0.7.2

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
- SHA1:
3
- metadata.gz: c9913b384df5e46cc7aaa1a413e4bdebf5707074
4
- data.tar.gz: 0eec0a9f93a7760a5d19a833f12d4aa88c3221bf
2
+ SHA256:
3
+ metadata.gz: 1d338032f14e42458a138b9b188701a0b5914ee3e9ab5ff8990d683911ffffcf
4
+ data.tar.gz: f0613005c722f92600e8633b8ede68a638dcf68b5361cbd2c8f12c98fc616564
5
5
  SHA512:
6
- metadata.gz: 201b1b79b0c2ca2b556536ca635c1602154901fd25511f43a576f14ad805c7d5bc50dc97464c3229f4eed04ea2c966b581327618aaf2c2aa214f66a87c0123fc
7
- data.tar.gz: 60ec544a89a90dfb5a3a040a2f7ca747f7d51e12ed488c58f0bcbd95187cea043243d1d9b4d1b3c47c0288f0df81647e047090c92999d33fdd2ccc4fe2306107
6
+ metadata.gz: e413e7c44118ac002618c54dbd7e926c49aec0602e2af86cf0f6eaa4f8182cb934c400b8a245b6576e9452da56454b0a17a4ac83c350e209c29b36ac4007ba47
7
+ data.tar.gz: b69b7a92e04b5b2ac0030998ffa9aca87e784050da0d9f798fb7b97114c28f21102d081840cd4b0d779bce7f402c52622d45455087b2758c486d8d5fdf21c7ba
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module OrigenDocHelpers
2
2
  MAJOR = 0
3
3
  MINOR = 7
4
- BUGFIX = 1
4
+ BUGFIX = 2
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -78,6 +78,21 @@ module OrigenDocHelpersDev
78
78
  reg :debug_22, 0xf54, 32, bit_order: 'lsb0', ip_base_address: 0x1080000, description: '' do
79
79
  bit 31..0, :placeholder, reset: 0b0, access: :rw
80
80
  end
81
+ reg :msb0_debug, 0xf58, 32, bit_order: 'msb0', ip_base_address: 0x1080000, description: '' do
82
+ bit 31..0, :placeholder, reset: 0b0, access: :rw
83
+ end
84
+ reg :lsb0_non_byte_aligned, 0xf5c, 9, bit_order: 'lsb0', ip_base_address: 0x1080000, description: '' do
85
+ bit 8..0, :placeholder, reset: 0b0, access: :rw
86
+ end
87
+ reg :msb0_non_byte_aligned, 0xf60, 9, bit_order: :msb0, ip_base_address: 0x1080000, description: '' do
88
+ bit 8..0, :placeholder, reset: 0b0, access: :rw
89
+ end
90
+ reg :lsb0_tiny, 0xf64, 3, bit_order: :lsb0, ip_base_address: 0x1080000, description: '' do
91
+ bit 2..0, :placeholder, reset: 0b0, access: :rw
92
+ end
93
+ reg :msb0_tiny, 0xf68, 3, bit_order: :msb0, ip_base_address: 0x1080000, description: '' do
94
+ bit 2..0, :placeholder, reset: 0b0, access: :rw
95
+ end
81
96
  end
82
97
  end
83
98
 
@@ -1,4 +1,6 @@
1
1
  % reg = options[:reg]
2
+ % order_is_lsb0 = true
3
+ % order_is_lsb0 = false if reg.bit_order == :msb0 || reg.bit_order == 'msb0'
2
4
  % include_data = false
3
5
 
4
6
  <div class="register">
@@ -43,19 +45,29 @@
43
45
  % num_bytes.times do |byte_index|
44
46
  % # Need to add support for little endian regs here?
45
47
  % byte_number = num_bytes - byte_index
46
- % max_bit = (byte_number * 8) - 1
47
- % min_bit = max_bit - 8 + 1
48
+ % if order_is_lsb0
49
+ % max_bit = (byte_number * 8) - 1
50
+ % min_bit = max_bit - 8 + 1
51
+ % else
52
+ % min_bit = (byte_index * 8)
53
+ % max_bit = min_bit + 7
54
+ % end
55
+ % partial_byte = max_bit > (reg.size - 1)
48
56
 
49
- <table class="reg table table-condensed" style="margin-bottom: 0; table-layout: fixed;">
57
+ <table class="reg table table-condensed <%= order_is_lsb0 ? 'rjust' : 'ljust' %><%= partial_byte ? ' partial' : '' %>" style="margin-bottom: 0; table-layout: fixed;">
50
58
  <thead>
51
59
  <tr class="bit-positions">
52
60
  <th class="spacer"></th>
53
61
  % 8.times do |i|
54
- % bit_num = (byte_number * 8) - i - 1
62
+ % if order_is_lsb0
63
+ % bit_num = (byte_number * 8) - i - 1
64
+ % else
65
+ % bit_num = (byte_index * 8) + i
66
+ % end
55
67
  % if bit_num > reg.size - 1
56
68
  <th class="spacer"></th>
57
69
  % else
58
- <th class="bit-position"><%= bit_num %></th>
70
+ <th class="bit-position<%= !order_is_lsb0 && bit_num == reg.size - 1 ? ' last' : '' %>"><%= bit_num %></th>
59
71
  % end
60
72
  % end
61
73
  </tr>
@@ -67,12 +79,12 @@
67
79
  %#############################################
68
80
  <tr class="read">
69
81
  <td class="heading">R</td>
70
- % alignment_done = false
82
+ % alignment_done = !order_is_lsb0
71
83
  % reg.named_bits :include_spacers => true do |name, bit|
72
84
  % if _bit_in_range?(bit, max_bit, min_bit)
73
85
  % if max_bit > (reg.size - 1) && !alignment_done
74
86
  % (max_bit - (reg.size - 1)).times do
75
- <td class="spacer"></td>
87
+ <td class="spacer"></td>
76
88
  % end
77
89
  % alignment_done = true
78
90
  % end
@@ -133,7 +145,7 @@
133
145
  %#############################################
134
146
  <tr class="write">
135
147
  <td class="heading">W</td>
136
- % alignment_done = false
148
+ % alignment_done = !order_is_lsb0
137
149
  % reg.named_bits :include_spacers => true do |name, bit|
138
150
  % if _bit_in_range?(bit, max_bit, min_bit)
139
151
  % if max_bit > (reg.size - 1) && !alignment_done
@@ -191,7 +203,7 @@
191
203
  % if options[:current_value]
192
204
  <tr class="current_value">
193
205
  <td class="heading">Current Value (Hex)</td>
194
- % alignment_done = false
206
+ % alignment_done = !order_is_lsb0
195
207
  % reg.named_bits :include_spacers => true do |name, bit|
196
208
  % if _bit_in_range?(bit, max_bit, min_bit)
197
209
  % if max_bit > (reg.size - 1) && !alignment_done
@@ -234,7 +246,7 @@
234
246
  %#############################################
235
247
  <tr class="reset">
236
248
  <td class="heading">Reset</td>
237
- % alignment_done = false
249
+ % alignment_done = !order_is_lsb0
238
250
  % reg.named_bits :include_spacers => true do |name, bit|
239
251
  % if _bit_in_range?(bit, max_bit, min_bit)
240
252
  % if max_bit > (reg.size - 1) && !alignment_done
@@ -0,0 +1,349 @@
1
+ % reg = options[:reg]
2
+ % include_data = false
3
+
4
+ <div class="register">
5
+ <a class="anchor" name="<%= "#{reg.name}" %>"></a>
6
+
7
+ <a href='#<%= reg.name %>'>
8
+ % if options[:origen_path] && !options[:origen_path].empty?
9
+ % reg_path = options[:origen_path] + "." + reg.name.to_s
10
+ % reg_path = "#{reg.name} - #{reg_path}"
11
+ % else
12
+ % reg_path = reg.name
13
+ % end
14
+ % if reg.full_name
15
+ <h4>0x<%= reg.address.to_s(16).upcase %> - <%= reg.full_name %> (<%= reg_path %>)</h4>
16
+ % else
17
+ <h4>0x<%= reg.address.to_s(16).upcase %> - <%= reg_path %></h4>
18
+ % end
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
31
+
32
+ % if options[:descriptions]
33
+ <div markdown="1" style="margin: 0 0 20px 0">
34
+
35
+ % reg.description(:include_name => false).each do |line|
36
+ <%= line.gsub("\\'", "'") %>
37
+ % end
38
+
39
+ </div>
40
+ % end
41
+
42
+ % num_bytes = (reg.size / 8.0).ceil
43
+ % num_bytes.times do |byte_index|
44
+ % # Need to add support for little endian regs here?
45
+ % byte_number = num_bytes - byte_index
46
+ % if reg.bit_order == :lsb0
47
+ % max_bit = (byte_number * 8) - 1
48
+ % min_bit = max_bit - 8 + 1
49
+ % else
50
+ % min_bit = (byte_index * 8)
51
+ % max_bit = min_bit + 7
52
+ % end
53
+
54
+ <table class="reg table table-condensed" style="margin-bottom: 0; table-layout: fixed;">
55
+ <thead>
56
+ <tr class="bit-positions">
57
+ <th class="spacer"></th>
58
+ % 8.times do |i|
59
+ % if reg.bit_order == :lsb0
60
+ % bit_num = (byte_number * 8) - i - 1
61
+ % else
62
+ % bit_num = (byte_index * 8) + i
63
+ % end
64
+ % if bit_num > reg.size - 1
65
+ <th class="spacer"></th>
66
+ % else
67
+ <th class="bit-position"><%= bit_num %></th>
68
+ % end
69
+ % end
70
+ </tr>
71
+ </thead>
72
+ <tbody>
73
+
74
+ %#############################################
75
+ %# Read Row
76
+ %#############################################
77
+ <tr class="read">
78
+ <td class="heading">R</td>
79
+ % alignment_done = reg.bit_order == :lsb0 ? false : true
80
+ % reg.named_bits :include_spacers => true do |name, bit|
81
+ % if _bit_in_range?(bit, max_bit, min_bit)
82
+ % if max_bit > (reg.size - 1) && !alignment_done
83
+ % (max_bit - (reg.size - 1)).times do
84
+ <td class="spacer"></td>
85
+ % end
86
+ % alignment_done = true
87
+ % end
88
+ % if bit.size > 1
89
+ % if name
90
+ % if bit.readable?
91
+ % bit_name = "#{name}[#{bit.size - 1}:0]"
92
+ <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">
93
+ % if options[:descriptions] && !bit.description.empty?
94
+ <span title="<%= name %>"><a href="#<%= "#{reg.name}_#{name}_#{bit.position}" %>"><%= bit_name %></a></span>
95
+ % else
96
+ <span title="<%= name %>"><%= bit_name %></span>
97
+ % end
98
+ </td>
99
+ % else
100
+ % if bit.access == :worz
101
+ <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">
102
+ <span>0</span>
103
+ </td>
104
+ % else
105
+ <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>"></td>
106
+ % end
107
+ % end
108
+ % else
109
+ % bit.shift_out_left do |bit|
110
+ % if _index_in_range?(bit.position, max_bit, min_bit)
111
+ <td>0</td>
112
+ % end
113
+ % end
114
+ % end
115
+ % else
116
+ % if name
117
+ % if bit.readable?
118
+ % if name.size > 10
119
+ % bit_name = "#{name[0..2]}...#{name[-3..-1]}"
120
+ %# bit_name = "bit#{bit.position}*"
121
+ % else
122
+ % bit_name = name
123
+ % end
124
+ % if options[:descriptions] && !bit.description.empty?
125
+ <td class="<%= _bit_rw(bit) %>"><span title="<%= name %>"><a href="#<%= "#{reg.name}_#{name}_#{bit.position}" %>"><%= bit_name %></a></span></td>
126
+ % else
127
+ <td class="<%= _bit_rw(bit) %>"><span title="<%= name %>"><%= bit_name %></span></td>
128
+ % end
129
+ % else
130
+ <td class="<%= _bit_rw(bit) %>"></td>
131
+ % end
132
+ % else
133
+ <td>0</td>
134
+ % end
135
+ % end
136
+ % end
137
+ % end
138
+ </tr>
139
+
140
+ %#############################################
141
+ %# Write Row
142
+ %#############################################
143
+ <tr class="write">
144
+ <td class="heading">W</td>
145
+ % alignment_done = reg.bit_order == :lsb0 ? false : true
146
+ % reg.named_bits :include_spacers => true do |name, bit|
147
+ % if _bit_in_range?(bit, max_bit, min_bit)
148
+ % if max_bit > (reg.size - 1) && !alignment_done
149
+ % (max_bit - (reg.size - 1)).times do
150
+ <td class="spacer"></td>
151
+ % end
152
+ % alignment_done = true
153
+ % end
154
+ % if bit.size > 1
155
+ % if name
156
+ % if !bit.readable?
157
+ % bit_name = "#{name}[#{bit.size - 1}:0]"
158
+ <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">
159
+ % if options[:descriptions] && !bit.description.empty?
160
+ <span title="<%= name %>"><a href="#<%= "#{reg.name}_#{name}_#{bit.position}" %>"><%= bit_name %></a></span>
161
+ % else
162
+ <span title="<%= name %>"><%= bit_name %></span>
163
+ % end
164
+ </td>
165
+ % else
166
+ <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>"></td>
167
+ % end
168
+ % else
169
+ % bit.shift_out_left do |bit|
170
+ % if _index_in_range?(bit.position, max_bit, min_bit)
171
+ <td class="not-writable"></td>
172
+ % end
173
+ % end
174
+ % end
175
+ % else
176
+ % if name
177
+ % if !bit.readable?
178
+ % if name.size > 10
179
+ % bit_name = "#{name[0..2]}...#{name[-3..-1]}"
180
+ %# bit_name = "bit#{bit.position}*"
181
+ % else
182
+ % bit_name = name
183
+ % end
184
+ % if options[:descriptions] && !bit.description.empty?
185
+ <td class="<%= _bit_rw(bit) %>"><span title="<%= name %>"><a href="#<%= "#{reg.name}_#{name}_#{bit.position}" %>"><%= bit_name %></a></span></td>
186
+ % else
187
+ <td class="<%= _bit_rw(bit) %>"><span title="<%= name %>"><%= bit_name %></span></td>
188
+ % end
189
+ % else
190
+ <td class="<%= _bit_rw(bit) %>"></td>
191
+ % end
192
+ % else
193
+ <td class="not-writable"></td>
194
+ % end
195
+ % end
196
+ % end
197
+ % end
198
+ </tr>
199
+
200
+ % if options[:current_value]
201
+ <tr class="current_value">
202
+ <td class="heading">Current Value (Hex)</td>
203
+ % alignment_done = reg.bit_order == :lsb0 ? false : true
204
+ % reg.named_bits :include_spacers => true do |name, bit|
205
+ % if _bit_in_range?(bit, max_bit, min_bit)
206
+ % if max_bit > (reg.size - 1) && !alignment_done
207
+ % (max_bit - (reg.size - 1)).times do
208
+ <td class="spacer"></td>
209
+ % end
210
+ % alignment_done = true
211
+ % end
212
+ % if bit.size > 1
213
+ % if name
214
+ % if bit.nvm_dep != 0 || bit.data == :memory
215
+ <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">M</td>
216
+ % elsif bit.data == :undefined
217
+ <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">X</td>
218
+ % else
219
+ <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>
220
+ % end
221
+ % else
222
+ % bit.shift_out_left do |bit|
223
+ % if _index_in_range?(bit.position, max_bit, min_bit)
224
+ <td></td>
225
+ % end
226
+ % end
227
+ % end
228
+ % else
229
+ % if bit.nvm_dep != 0 || bit.reset_val == :memory
230
+ <td>M</td>
231
+ % elsif bit.data == :undefined
232
+ <td>X</td>
233
+ % else
234
+ <td><%= bit.data.to_s(16).upcase %></td>
235
+ % end
236
+ % end
237
+ % end
238
+ % end
239
+ </tr>
240
+ % else
241
+ %#############################################
242
+ %# Reset Row
243
+ %#############################################
244
+ <tr class="reset">
245
+ <td class="heading">Reset</td>
246
+ % alignment_done = reg.bit_order == :lsb0 ? false : true
247
+ % reg.named_bits :include_spacers => true do |name, bit|
248
+ % if _bit_in_range?(bit, max_bit, min_bit)
249
+ % if max_bit > (reg.size - 1) && !alignment_done
250
+ % (max_bit - (reg.size - 1)).times do
251
+ <td class="spacer"></td>
252
+ % end
253
+ % alignment_done = true
254
+ % end
255
+ % if bit.size > 1
256
+ % if name
257
+ % if bit.nvm_dep != 0 || bit.reset_val == :memory
258
+ <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">M</td>
259
+ % elsif bit.reset_val == :undefined
260
+ <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">X</td>
261
+ % else
262
+ <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>
263
+ % end
264
+ % else
265
+ % bit.shift_out_left do |bit|
266
+ % if _index_in_range?(bit.position, max_bit, min_bit)
267
+ <td></td>
268
+ % end
269
+ % end
270
+ % end
271
+ % else
272
+ % if bit.nvm_dep != 0 || bit.reset_val == :memory
273
+ <td>M</td>
274
+ % elsif bit.reset_val == :undefined
275
+ <td>X</td>
276
+ % else
277
+ <td><%= bit.reset_val.to_s(16).upcase %></td>
278
+ % end
279
+ % end
280
+ % end
281
+ % end
282
+ </tr>
283
+ % end
284
+ </tbody>
285
+ </table>
286
+
287
+ % end # Byte index loop
288
+
289
+ % if options[:descriptions] && reg.named_bits.any? { |name, bits| !bits.description.empty? }
290
+ <table class="bit-descriptions table table-condensed table-bordered" style="margin: 20px 0 0 0">
291
+ <thead>
292
+ <tr>
293
+ <th>Bit</th>
294
+ <th>Description</th>
295
+ </tr>
296
+ </thead>
297
+ <tbody>
298
+ % reg.named_bits do |name, bits|
299
+ <tr>
300
+ <td>
301
+ <p>
302
+ <a class="anchor" name="<%= "#{reg.name}_#{name}_#{bits.position}" %>"></a>
303
+ % if bits.size == 1
304
+ <%= bits.position %>
305
+ % else
306
+ <%= bits.position + bits.size - 1 %>-<%= bits.position %>
307
+ % end
308
+ </p>
309
+ <p>
310
+ % if bits.size == 1
311
+ <%= name %>
312
+ % else
313
+ <%= name %>[<%= bits.size - 1 %>:0]
314
+ % end
315
+ </p>
316
+ </td>
317
+ <td markdown="1">
318
+ % bit_val_str = ''
319
+ % start_bit = bits.position
320
+ % end_bit = bits.position + bits.size - 1
321
+ % (start_bit..end_bit).each do |b|
322
+ % bit_val_str << reg.bits[b].data.to_s
323
+ % end
324
+ % bit_val_str.reverse!
325
+ % bits.description.each do |line|
326
+ % if options[:current_value]
327
+ % if line =~ /^\d{#{bit_val_str.length}}/
328
+ % if line =~ /^#{bit_val_str}/
329
+ <span style="background-color: #66FF66"> <%= line.gsub("\\'", "'") %>
330
+ </span><br/>
331
+ % else
332
+ <%= line.gsub("\\'", "'") %><br/>
333
+ % end
334
+ % else
335
+ <%= line.gsub("\\'", "'") %>
336
+ % end
337
+ % else
338
+ <%= line.gsub("\\'", "'") %>
339
+ % end
340
+ % end
341
+
342
+ </td>
343
+ </tr>
344
+ % end
345
+ </tbody>
346
+ </table>
347
+ % end
348
+
349
+ </div>
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.7.1
4
+ version: 0.7.2
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-08-16 00:00:00.000000000 Z
11
+ date: 2018-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -57,6 +57,7 @@ files:
57
57
  - templates/model_page.md.erb
58
58
  - templates/pdf/topic_wrapper.html
59
59
  - templates/shared/_register.html.erb
60
+ - templates/shared/_register.html.erb~
60
61
  - templates/shared/_searchable.html.erb
61
62
  - templates/shared/_spec.html.erb
62
63
  - templates/shared/test/_flow.md.erb
@@ -97,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
98
  version: 1.8.11
98
99
  requirements: []
99
100
  rubyforge_project:
100
- rubygems_version: 2.6.14.1
101
+ rubygems_version: 2.7.7
101
102
  signing_key:
102
103
  specification_version: 4
103
104
  summary: Snippets and helpers for creating Origen web documents