origen_doc_helpers 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/config/application.rb +34 -0
  3. data/config/commands.rb +42 -0
  4. data/config/development.rb +16 -0
  5. data/config/environment.rb +30 -0
  6. data/config/users.rb +19 -0
  7. data/config/version.rb +8 -0
  8. data/lib/helpers.rb +234 -0
  9. data/lib/origen_doc_helpers.rb +2 -0
  10. data/lib/origen_doc_helpers/doc_interface.rb +74 -0
  11. data/lib/origen_doc_helpers/dut.rb +194 -0
  12. data/lib/origen_doc_helpers/pdf.rb +122 -0
  13. data/program/_func.rb +12 -0
  14. data/program/_hvst.rb +12 -0
  15. data/program/_para.rb +26 -0
  16. data/program/probe_1.rb +7 -0
  17. data/templates/pdf/topic_wrapper.html +21 -0
  18. data/templates/shared/_register.html.erb +207 -0
  19. data/templates/shared/_searchable.html.erb +86 -0
  20. data/templates/shared/_spec.html.erb +20 -0
  21. data/templates/shared/test/_flow.md.erb +227 -0
  22. data/templates/web/examples.md.erb +19 -0
  23. data/templates/web/examples/register.md.erb +101 -0
  24. data/templates/web/examples/searchable/intro.md.erb +128 -0
  25. data/templates/web/examples/searchable/page2.md.erb +5 -0
  26. data/templates/web/examples/searchable/topic1/item1.md.erb +5 -0
  27. data/templates/web/examples/searchable/topic1/item2.html.erb +7 -0
  28. data/templates/web/examples/spec.md.erb_NOT_WORKING +42 -0
  29. data/templates/web/examples/test/flow.md.erb +35 -0
  30. data/templates/web/examples/yammer.md.erb +28 -0
  31. data/templates/web/index.md.erb +40 -0
  32. data/templates/web/layouts/_basic.html.erb +13 -0
  33. data/templates/web/layouts/_doc.html.erb +22 -0
  34. data/templates/web/layouts/_examples.html.erb +5 -0
  35. data/templates/web/partials/_navbar.html.erb +21 -0
  36. data/templates/web/release_notes.md.erb +5 -0
  37. metadata +94 -0
@@ -0,0 +1,194 @@
1
+ module OrigenDocHelpers
2
+ class DUT
3
+ include Origen::TopLevel
4
+
5
+ # Example to test a real life use case with backslashes in the descriptions which
6
+ # led to rendering issues
7
+ class SubModule
8
+ include Origen::Model
9
+
10
+ def initialize
11
+ reg :debug_18, 0xf44, 32, bit_order: 'lsb0', ip_base_address: 0x1080000, description: '' do
12
+ bit 31..0, :placeholder, reset: 0b0, access: :rw
13
+ end
14
+ reg :debug_19, 0xF48, size: 32, bit_order: :lsb0 do |reg|
15
+ # When this bit is set, the controller\'s state machines and queues will be reset. Software then needs to clear this bit to allow the controller to function. This bit can only be set when DDR\_SDRAM\_CFG\[MEM\_EN\] is cleared.
16
+ #
17
+ # 0 | Memory controller is not reset.
18
+ # 1 | Memory controller is reset.
19
+ reg.bit 31, :mcsr, reset: 0b0, access: :rw
20
+ # These are spare configuration bits that can be written or read. However, they are not currently used by the controller.
21
+ reg.bit 30, :spare_cnfg3, reset: 0b0, access: :rw
22
+ # This bit can be set to force the controller to start write leveling. This bit will be cleared by hardware after write leveling is complete.
23
+ reg.bit 29, :frc_wrlvl, reset: 0b0, access: :rw
24
+ # If this bit is cleared and automatic CAS to Preamble is used, then the DDR controller will calculate the write leveling start values for DQS\[1:8\] based on the CAS to Preamble results and the start value for DQS\[0\]. If this bit is set, then the automatic calculation of the start value is disabled.
25
+ reg.bit 28, :wrc_dis, reset: 0b0, access: :rw
26
+ # These are spare configuration bits that can be written or read. However, they are not currently used by the controller.
27
+ reg.bit 27, :spare_cnfg2, reset: 0b0, access: :rw
28
+ # If this bit is set, then the chip select specified by CSWL will be used during write leveling.
29
+ reg.bit 26, :cswlo, reset: 0b0, access: :rw
30
+ # This field represents the chip select that will be used during write leveling if CSWLO is set.
31
+ reg.bit 25..24, :cswl, reset: 0b0, access: :rw
32
+ # This can be set to use an internally generated VRef.
33
+ #
34
+ # 0 | Default.
35
+ # 1 | Use internal VRef.
36
+ reg.bit 23, :int_ref_sel, reset: 0b0, access: :rw
37
+ reg.bit 22, :ign_cas_full, reset: 0b0, access: :rw
38
+ # This bit can be set to override the perfmon enable to the controller.
39
+ #
40
+ # 0 | Use ipm_plus_perfmon_en.
41
+ # 1 | Ignore ipm_plus_perfmon_en and collect perfmon events.
42
+ reg.bit 21, :perf_en_ovrd, reset: 0b0, access: :rw
43
+ # If this bit is set, then the bit deskew results will not be averaged across the enabled ranks. Instead, the address determined by DDR\_INIT\_ADDR will be used for bit deskew.
44
+ reg.bit 20, :bdad, reset: 0b0, access: :rw
45
+ # This field specifies how many taps will be incremented for each sample during RX bit deskew training. Note that this can be used to improve simulation times when validating the DDR controller RX deskew training.
46
+ #
47
+ # 000 | Increment 1 tap at a time
48
+ # 001 | Increment 2 taps at a time
49
+ # 010 | Increment 4 taps at a time
50
+ # 011 | Increment 6 taps at a time
51
+ # 100 | Increment 8 taps at a time
52
+ # 101 | Increment 10 taps at a time
53
+ # 110 | Increment 12 taps at a time
54
+ # 111 | Increment 14 taps at a time
55
+ reg.bit 19..17, :rx_skip_tap, reset: 0b0, access: :rw
56
+ # If this bit is set, then the MCK gating during self refresh will be disabled.
57
+ reg.bit 16, :mck_dis, reset: 0b0, access: :rw
58
+ # This is the value sent to the IOs for the p\_gnd\_curr\_adj\[0:1\] and n\_gnd\_curr\_adj\[0:1\]
59
+ reg.bit 15..12, :curr_adj, reset: 0b0, access: :rw
60
+ # This is the enable for the TPA pin.
61
+ reg.bit 11, :en_tpa, reset: 0b0, access: :rw
62
+ # This 4-bit value represents the 4-bit MUX select to the TPA pin for.
63
+ reg.bit 10..6, :tpa_mux_sel, reset: 0b0, access: :rw
64
+ # This bit can be set to override the counter free-list group. It can be used to force a certain group only to be enabled.
65
+ reg.bit 5, :cntr_ovrd, reset: 0b0, access: :rw
66
+ # This is the value that will be overridden to the counter logic if CNTR\_OVRD is set. Note that values of 3\'b110 and 3\'b111 are illegal, and the will prevent the controller from finding an available counter to use.
67
+ reg.bit 4..2, :cntr_ovrd_val, reset: 0b0, access: :rw
68
+ # This bit can be set to force the transmit bit deskew to be enabled, regardless of the value of SLOW\_EN.
69
+ reg.bit 1, :tx_bd_en, reset: 0b0, access: :rw
70
+ reg.bit 0, :spare_cnfg, reset: 0b1, access: :rw
71
+ end
72
+ reg :debug_20, 0xf4c, 32, bit_order: 'lsb0', ip_base_address: 0x1080000, description: '' do
73
+ bit 31..0, :placeholder, reset: 0b0, access: :rw
74
+ end
75
+ reg :debug_21, 0xf50, 32, bit_order: 'lsb0', ip_base_address: 0x1080000, description: '' do
76
+ bit 31..0, :placeholder, reset: 0b0, access: :rw
77
+ end
78
+ reg :debug_22, 0xf54, 32, bit_order: 'lsb0', ip_base_address: 0x1080000, description: '' do
79
+ bit 31..0, :placeholder, reset: 0b0, access: :rw
80
+ end
81
+ end
82
+ end
83
+
84
+ def initialize(_options = {})
85
+ sub_block :sub_module, class_name: 'SubModule'
86
+
87
+ # **The Long Name of the Reg**
88
+ #
89
+ # The MCLKDIV register is used to divide down the frequency of the HBOSCCLK input. If the MCLKDIV
90
+ # register is set to value "N", then the output (beat) frequency of the clock divider is OSCCLK / (N+1). The
91
+ # resulting beats are, in turn, counted by the PTIMER module to control the duration of Flash high-voltage
92
+ # operations.
93
+ #
94
+ # This is just a test that paragraphs work.
95
+ add_reg :mclkdiv, 0x0003, size: 16 do
96
+ # **Oscillator (Hi)** - Firmware FMU clock source selection. (Note that in addition to this firmware-controlled bit, the
97
+ # FMU clock source is also dependent on test and power control discretes).
98
+ #
99
+ # 0 | FMU clock is the externally supplied bus clock ipg_clk
100
+ # 1 | FMU clock is the internal oscillator from the TFS hardblock
101
+ bit 15, :osch, reset: 1
102
+ # **Mode Ready** - A Synchronized version of the *ftf_mode_ready[1:0]* output from the flash analog hard block.
103
+ # See the TFL3 Hard Block Creation Guide for more details.
104
+ #
105
+ # 0 | Analog voltages have not reached target levels for the specified mode of operation
106
+ # 1 | Analog voltages have reached target levels for the specified mode of operation
107
+ bit 13..12, :mode_rdy, writable: false
108
+ # **IFR and FW ECC Enable for LDM** - On / off control for UIFR, RIFR, and FW when reading with the MGATE's
109
+ # Load Memory (LDM) instruction. The setting of this bit only makes a difference when reading with LDM, all other
110
+ # MGATE reads from UIFR/RIFR will always have ECC disabled and reads from FW will have ECC enabled.
111
+ #
112
+ # 0 | ECC is disabled for UIFR, RIFR, and FW reads when using the LDM instruction
113
+ # 1 | ECC is enabled for all UIFR, RIFR, and FW reads when using the LDM instruction
114
+ bit 10, :eccen, reset: 1
115
+ # **MGATE Command Location Code** - A 2-bit code that tells the MGATE where to go for its instruction fetches
116
+ # (location of command definitions). These bits are used to form different MGATE command request IDs from a
117
+ # falling CCIF, one request ID for each of the possible locations of the MGATE executable. If this field is changed,
118
+ # all subsequent command launches (falling CCIF) will execute from the new area. Note that the MGATE also has
119
+ # a reset request ID. The reset request ID always targets the Boot Code and is unaffected by the CMDLOC setting.
120
+ #
121
+ # 00 | Execute from the Beginning of the MGRAM + 256B (the normal location)
122
+ # 01 | Execute from the Beginning of the MGRAM
123
+ # 10 | Execute from the Stack start at the end of MGRAM
124
+ # 11 | Reserved
125
+ bit 9..7, :cmdloc, reset: :undefined
126
+ # **Clock Divider Bits** - DIV[7:0] must be set to effectively divide HBOSCCLK down to a known beat frequency
127
+ # having acceptable resolution and dynamic range for timing high-voltage operations on the Flash hardblocks
128
+ # during algorithms with timed events. Table 1-50 shows the range of timed events (i.e. pulse widths) that can be
129
+ # achieved with 8-bit and 16-bit PTIMER loads for various input clock frequencies and clock divider settings.
130
+ bit 6..2, :div, reset: :memory
131
+ end
132
+
133
+ # **Protection High**
134
+ #
135
+ # A simple register definition to test that reset values assigned to bytes
136
+ # of a 32-bit register work
137
+ reg :proth, 0x0024 do
138
+ bits 31..24, :fprot7, reset: 0xFF
139
+ bits 23..16, :fprot6, reset: 0xEE
140
+ bits 15..8, :fprot5, reset: 0xDD
141
+ bits 7..0, :fprot4, reset: 0x11
142
+ end
143
+
144
+ # **Protection Low**
145
+ #
146
+ # A simple register definition to test that memory dependent bits display
147
+ # correctly
148
+ reg :protl, 0x0028 do
149
+ bits 31..24, :fprot3, nvm_dep: true
150
+ bits 23..16, :fprot2, reset: :memory
151
+ bits 15..8, :fprot1, nvm_dep: true
152
+ bits 7..0, :fprot0, nvm_dep: true
153
+ end
154
+
155
+ add_mode :default
156
+ add_mode :low_power
157
+ add_mode :high_performance
158
+
159
+ # SMcG, removing as does not work with latest Origen, can be reintroduced
160
+ # when the Origen spec API is stable
161
+ # modes.each do |mode|
162
+ # case mode
163
+ # when :default
164
+ # vdd_nom = 1.0.V
165
+ # when :low_power
166
+ # vdd_nom = 0.95.V
167
+ # when :high_performance
168
+ # vdd_nom = 1.05.V
169
+ # end
170
+ # spec :soc_vdd, mode do
171
+ # symbol 'Vdd'
172
+ # description 'Soc Core Power Supply'
173
+ # min "#{vdd_nom} - 50.mV"
174
+ # max "#{vdd_nom} + 50.mV"
175
+ # audience :external
176
+ # end
177
+ # end
178
+ # spec :soc_io_vdd do
179
+ # symbol 'GVdd'
180
+ # description 'Soc IO Power Supply'
181
+ # min 1.35.v
182
+ # max '1.50.v + 150.mv'
183
+ # audience :external
184
+ # end
185
+ # spec :soc_pll_vdd do
186
+ # symbol 'AVdd'
187
+ # description 'Soc PLL Power Supply'
188
+ # min :soc_vdd
189
+ # max :soc_vdd
190
+ # audience :external
191
+ # end
192
+ end
193
+ end
194
+ end
@@ -0,0 +1,122 @@
1
+ module OrigenDocHelpers
2
+ class PDF
3
+ include Origen::Callbacks
4
+
5
+ attr_reader :filename, :index, :root, :title
6
+
7
+ WKHTMLTOPDF = '/run/pkg/wkhtmltopdf-/0.12.1/bin/wkhtmltopdf'
8
+
9
+ # This is called by the searchable doc layout template
10
+ def self.register(options)
11
+ if options[:pdf_title] && enabled?
12
+ @doc_pdfs ||= {}
13
+ name = options[:pdf_title].to_s.symbolize
14
+ @doc_pdfs[name] ||= new(options)
15
+ @doc_pdfs[name].filename
16
+ end
17
+ end
18
+
19
+ def self.enabled?
20
+ Origen.running_on_linux? && File.exist?(WKHTMLTOPDF)
21
+ end
22
+
23
+ def initialize(options)
24
+ @title = options[:pdf_title]
25
+ @index = options[:index]
26
+ @root = Pathname.new(options[:root])
27
+ if @root.absolute?
28
+ @root = @root.relative_path_from(Pathname.new("#{Origen.root}/templates/web"))
29
+ end
30
+ require 'nokogiri'
31
+ end
32
+
33
+ # This is a callback handler to have the PDF creation invoked prior
34
+ # to deploying a pre-built website
35
+ def before_deploy_site
36
+ create
37
+ end
38
+
39
+ def filename
40
+ "#{title.to_s.symbolize}-#{version}.pdf"
41
+ end
42
+
43
+ def create
44
+ puts ''
45
+ puts "Generating PDF: #{filename}..."
46
+ puts ''
47
+ create_topic_pages
48
+ generate_pdf
49
+ delete_topic_pages
50
+ end
51
+
52
+ def version
53
+ Origen.app.name == :origen ? Origen.version : Origen.app.version
54
+ end
55
+
56
+ def generate_pdf
57
+ cmd = "#{WKHTMLTOPDF} --print-media-type "
58
+ cmd += "--footer-line --footer-font-size 8 --footer-left 'Freescale Internal Use Only' --footer-right [page] "
59
+ cmd += "--header-left '#{title} (#{version})' --header-line --header-font-size 8 "
60
+ index.each do |topic, pages|
61
+ dir = "#{Origen.root}/web/output/#{root}"
62
+ if topic
63
+ topic_dir = pages.keys.first.to_s.split('_').first
64
+ file = "#{dir}/#{topic_dir}/topic_page.html"
65
+ cmd += "#{file} "
66
+ else
67
+ pages.each do |page_path, _page_heading|
68
+ file = "#{dir}/#{page_path}/index.html"
69
+ cmd += "#{file} "
70
+ end
71
+ end
72
+ end
73
+ cmd += "#{pdf_output_dir}/#{filename}"
74
+ system cmd
75
+ end
76
+
77
+ def pdf_output_dir
78
+ @pdf_output_dir ||= begin
79
+ dir = "#{Origen.root}/web/output/doc_helpers/pdfs"
80
+ FileUtils.mkdir_p(dir) unless File.exist?(dir)
81
+ dir
82
+ end
83
+ end
84
+
85
+ def create_topic_pages
86
+ topic_dirs do |topic, pages, topic_dir|
87
+ topic_page = "#{topic_dir}/topic_page.html"
88
+ page_str = "<h1>#{topic}</h1>\n"
89
+ pages.each do |page_path, _page_heading|
90
+ page_file = page_path.to_s.split('_').last
91
+ page_file = "#{topic_dir}/#{page_file}/index.html"
92
+ doc = Nokogiri::HTML(File.read(page_file))
93
+ page_str += doc.xpath('//article').to_html
94
+ page_str += "\n"
95
+ end
96
+ File.open(topic_page, 'w') do |file|
97
+ file.puts topic_wrapper_string.sub('SUB_TOPIC_CONTENT_HERE', page_str)
98
+ end
99
+ end
100
+ end
101
+
102
+ def delete_topic_pages
103
+ topic_dirs do |_topic, _pages, topic_dir|
104
+ FileUtils.rm_f("#{topic_dir}/topic_page.html")
105
+ end
106
+ end
107
+
108
+ def topic_dirs
109
+ index.each do |topic, pages|
110
+ if topic
111
+ topic_dir = pages.keys.first.to_s.split('_').first
112
+ topic_dir = "#{Origen.root}/web/output/#{root}/#{topic_dir}"
113
+ yield topic, pages, topic_dir
114
+ end
115
+ end
116
+ end
117
+
118
+ def topic_wrapper_string
119
+ @topic_wrapper_string ||= File.read("#{Origen.root!}/templates/pdf/topic_wrapper.html")
120
+ end
121
+ end
122
+ end
data/program/_func.rb ADDED
@@ -0,0 +1,12 @@
1
+ # Functional test of the Vreg
2
+ Flow.create do
3
+ # This test verifies that the following things work:
4
+ #
5
+ # * The vreg can be disabled
6
+ # * The trim register can be written to and read from
7
+ func :vreg_functional, vdd: :min, bin: 101
8
+
9
+ func :vreg_functional, vdd: :max, bin: 101, continue: true
10
+
11
+ import "hvst"
12
+ end
data/program/_hvst.rb ADDED
@@ -0,0 +1,12 @@
1
+ # HVST
2
+ Flow.create do
3
+ # Check if this device has already had the Vreg HVST
4
+ func :rd_vreg_hvst_passcode, bin: 50, vdd: :nom, id: :vreg_hvst_done
5
+
6
+ # Apply HVST to the vreg module
7
+ func :vreg_hvst, bin: 101, hv: 10.V, vdd: :max, unless_passed: :vreg_hvst_done
8
+
9
+ # Program a passcode to the device to record that the HVST
10
+ # has been applied
11
+ func :pgm_vreg_hvst_passcode, bin: 51, vdd: :nom, unless_passed: :vreg_hvst_done
12
+ end
data/program/_para.rb ADDED
@@ -0,0 +1,26 @@
1
+ # Parametric flow
2
+ #
3
+ # Blah blah, this is marked down:
4
+ #
5
+ # * blah
6
+ # * blah
7
+ Flow.create do
8
+ # Measure the output of the vreg under no load, this is a simple
9
+ # test to catch any gross defects that prevent the vreg from working
10
+ #
11
+ # Blah blah, this is marked down:
12
+ #
13
+ # * blah
14
+ # * blah
15
+ pp "No load tests" do
16
+ para :vreg_meas, bin: 105, lo: 1.12, hi: 1.34
17
+
18
+ para :vreg_meas, bin: 105, cz: true, if_enable: "vreg_cz"
19
+ end
20
+
21
+ # Measure the output of the vreg under the given load, this is approximately
22
+ # equivalent to 1.5x the maximum load anticipated in a customer application.
23
+ para :vreg_meas, vdd: :min, bin: 105, load: 5.mA, lo: 1.10, hi: 1.34
24
+
25
+ para :vreg_meas, vdd: :max, bin: 105, load: 5.mA, lo: 1.12, hi: 1.34
26
+ end
@@ -0,0 +1,7 @@
1
+ Flow.create do
2
+ log "Vreg test module"
3
+
4
+ import "func"
5
+
6
+ import "para"
7
+ end
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+
7
+ <!-- Le styles -->
8
+ <link href="http://origen.freescale.net/css/bootstrap.min.css" rel="stylesheet">
9
+ <link href="http://origen.freescale.net/css/bootstrap_custom.css" rel="stylesheet">
10
+
11
+ <!-- Fav and touch icons -->
12
+ <link rel="shortcut icon" href="http://origen.freescale.net/favicon.ico"/>
13
+ <link rel="icon" type="image/ico" href="http://origen.freescale.net/favicon.ico"/>
14
+ <script src="http://origen.freescale.net/js/jquery.min.js"></script>
15
+ <script src="http://origen.freescale.net/js/bootstrap.min.js"></script>
16
+ </head>
17
+
18
+ <body class="freescale">
19
+ SUB_TOPIC_CONTENT_HERE
20
+ </body>
21
+ </html>
@@ -0,0 +1,207 @@
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 reg.full_name
9
+ <h4>0x<%= reg.address.to_s(16).upcase %> - <%= reg.full_name %> (<%= reg.name %>)</h4>
10
+ % else
11
+ <h4>0x<%= reg.address.to_s(16).upcase %> - <%= reg.name %></h4>
12
+ % end
13
+ </a>
14
+
15
+ % if options[:descriptions]
16
+ <div markdown="1" style="margin: 0 0 20px 0">
17
+
18
+ % reg.description(:include_name => false).each do |line|
19
+ <%= line.gsub("\\'", "'") %>
20
+ % end
21
+
22
+ </div>
23
+ % end
24
+
25
+ % (reg.size / 8).times do |byte_index|
26
+ % # Need to add support for little endian regs here?
27
+ % byte_number = (reg.size / 8) - byte_index
28
+ % max_bit = reg.size - (byte_index * 8) - 1
29
+ % min_bit = max_bit - 8 + 1
30
+
31
+ <table class="reg table table-condensed" style="margin-bottom: 0; table-layout: fixed;">
32
+ <thead>
33
+ <tr class="bit-positions">
34
+ <th class="spacer"></th>
35
+ % 8.times do |i|
36
+ <th class="bit-position"><%= reg.size - i - 1 - (byte_index * 8) %></th>
37
+ % end
38
+ </tr>
39
+ </thead>
40
+ <tbody>
41
+
42
+ %#############################################
43
+ %# Read Row
44
+ %#############################################
45
+ <tr class="read">
46
+ <td class="heading">R</td>
47
+ % reg.named_bits :include_spacers => true do |name, bit|
48
+ % if _bit_in_range?(bit, max_bit, min_bit)
49
+ % if bit.size > 1
50
+ % if name
51
+ % if bit.readable?
52
+ % bit_name = "#{name}[#{bit.size - 1}:0]"
53
+ <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">
54
+ <span><%= bit_name %></span>
55
+ </td>
56
+ % else
57
+ % if bit.access == :worz
58
+ <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">
59
+ <span>0</span>
60
+ </td>
61
+ % else
62
+ <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>"></td>
63
+ % end
64
+ % end
65
+ % else
66
+ % bit.shift_out_left do |bit|
67
+ % if _index_in_range?(bit.position, max_bit, min_bit)
68
+ <td>0</td>
69
+ % end
70
+ % end
71
+ % end
72
+ % else
73
+ % if name
74
+ % if bit.readable?
75
+ <td class="<%= _bit_rw(bit) %>"><span><%= name %></span></td>
76
+ % else
77
+ <td class="<%= _bit_rw(bit) %>"></td>
78
+ % end
79
+ % else
80
+ <td>0</td>
81
+ % end
82
+ % end
83
+ % end
84
+ % end
85
+ </tr>
86
+
87
+ %#############################################
88
+ %# Write Row
89
+ %#############################################
90
+ <tr class="write">
91
+ <td class="heading">W</td>
92
+ % reg.named_bits :include_spacers => true do |name, bit|
93
+ % if _bit_in_range?(bit, max_bit, min_bit)
94
+ % if bit.size > 1
95
+ % if name
96
+ % if !bit.readable?
97
+ % bit_name = "#{name}[#{bit.size - 1}:0]"
98
+ <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">
99
+ <span><%= bit_name %></span>
100
+ </td>
101
+ % else
102
+ <td class="<%= _bit_rw(bit) %>" colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>"></td>
103
+ % end
104
+ % else
105
+ % bit.shift_out_left do |bit|
106
+ % if _index_in_range?(bit.position, max_bit, min_bit)
107
+ <td class="not-writable"></td>
108
+ % end
109
+ % end
110
+ % end
111
+ % else
112
+ % if name
113
+ % if !bit.readable?
114
+ <td class="<%= _bit_rw(bit) %>"><span><%= name %></span></td>
115
+ % else
116
+ <td class="<%= _bit_rw(bit) %>"></td>
117
+ % end
118
+ % else
119
+ <td class="not-writable"></td>
120
+ % end
121
+ % end
122
+ % end
123
+ % end
124
+ </tr>
125
+
126
+ %#############################################
127
+ %# Reset Row
128
+ %#############################################
129
+ <tr class="reset">
130
+ <td class="heading">Reset</td>
131
+ % reg.named_bits :include_spacers => true do |name, bit|
132
+ % if _bit_in_range?(bit, max_bit, min_bit)
133
+ % if bit.size > 1
134
+ % if name
135
+ % if bit.nvm_dep != 0 || bit.reset_val == :memory
136
+ <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">M</td>
137
+ % elsif bit.reset_val == :undefined
138
+ <td colspan="<%= _num_bits_in_range(bit, max_bit, min_bit) %>">X</td>
139
+ % else
140
+ <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>
141
+ % end
142
+ % else
143
+ % bit.shift_out_left do |bit|
144
+ % if _index_in_range?(bit.position, max_bit, min_bit)
145
+ <td></td>
146
+ % end
147
+ % end
148
+ % end
149
+ % else
150
+ % if bit.nvm_dep != 0 || bit.reset_val == :memory
151
+ <td>M</td>
152
+ % elsif bit.reset_val == :undefined
153
+ <td>X</td>
154
+ % else
155
+ <td><%= bit.reset_val.to_s(16).upcase %></td>
156
+ % end
157
+ % end
158
+ % end
159
+ % end
160
+ </tr>
161
+
162
+ </tbody>
163
+ </table>
164
+
165
+ % end # Byte index loop
166
+
167
+ % if options[:descriptions]
168
+ <table class="bit-descriptions table table-condensed table-bordered" style="margin: 20px 0 0 0">
169
+ <thead>
170
+ <tr>
171
+ <th>Bit</th>
172
+ <th>Description</th>
173
+ </tr>
174
+ </thead>
175
+ <tbody>
176
+ % reg.named_bits do |name, bits|
177
+ <tr>
178
+ <td>
179
+ <p>
180
+ % if bits.size == 1
181
+ <%= bits.position %>
182
+ % else
183
+ <%= bits.position + bits.size - 1 %>-<%= bits.position %>
184
+ % end
185
+ </p>
186
+ <p>
187
+ % if bits.size == 1
188
+ <%= name %>
189
+ % else
190
+ <%= name %>[<%= bits.size - 1 %>:0]
191
+ % end
192
+ </p>
193
+ </td>
194
+ <td markdown="1">
195
+
196
+ % bits.description.each do |line|
197
+ <%= line.gsub("\\'", "'") %>
198
+ % end
199
+
200
+ </td>
201
+ </tr>
202
+ % end
203
+ </tbody>
204
+ </table>
205
+ % end
206
+
207
+ </div>