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,86 @@
1
+ % options[:root] ||= "docs"
2
+ % pdf_filename = ::OrigenDocHelpers::PDF.register(options)
3
+
4
+ <div class="row">
5
+ <div class="col-md-3 sidebar-nav-container">
6
+ <div class="well sidebar-nav" style="margin-top: 20px;">
7
+ <div id="search">
8
+ <form style="margin-bottom: 15px;">
9
+ <div class="input-group">
10
+ <input class="form-control" type="search" placeholder="Search these docs..."/>
11
+ <span class="input-group-btn">
12
+ <button type="submit" class="btn btn-search">GO!</button>
13
+ </span>
14
+ </div>
15
+ </form>
16
+ </div>
17
+ <div class="panel-group" id="sidebar-accordion">
18
+
19
+ % options[:index].each_with_index do |(subject, sections), i|
20
+ % if subject
21
+ <div class="panel panel-default">
22
+ <div class="panel-heading clickable" data-toggle="collapse" data-parent="#sidebar-accordion" href="#sidebar-collapse-<%= i %>">
23
+ <a class="no-underline">
24
+ <%= subject %>
25
+ </a>
26
+ </div>
27
+ <div id="sidebar-collapse-<%= i %>" class="panel-collapse collapse <%= sections.has_key?(_resolve_tab(options)) ? 'in' : '' %>">
28
+ <div class="panel-body">
29
+ <ul class="nav nav-list">
30
+ % sections.each do |tab, section|
31
+ % paths = tab.to_s.split("_")
32
+ <li class="<%= tab == _resolve_tab(options) ? 'active' : '' %>"><a href="<%= path "/#{_root_path(options)}/#{paths[0]}/#{paths[1]}" %>"><%= section %></a></li>
33
+ % end
34
+ </ul>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ % else
39
+ <ul class="nav nav-list">
40
+ % sections.each do |tab, section|
41
+ % paths = tab.to_s.split("_")
42
+ <li class="<%= tab == _resolve_tab(options) ? 'active' : '' %>"><a href="<%= path "/#{_root_path(options)}/#{paths[0]}/#{paths[1]}" %>"><%= section %></a></li>
43
+ % end
44
+ </ul>
45
+ % end
46
+ % end
47
+
48
+ % if pdf_filename
49
+ <div style="text-align: right; margin-top: 20px;">
50
+ <a href="<%= path "doc_helpers/pdfs/#{pdf_filename}" %>"><i class="fa fa-file-pdf-o"></i> Download PDF</a>
51
+ </div>
52
+ % end
53
+
54
+ </div>
55
+
56
+ </div>
57
+ </div>
58
+
59
+ %# The markdown attribute is important if you are going to include content written
60
+ %# in markdown, without this is will be included verbatim
61
+ <div class="col-md-9 nav-page-container" markdown="1">
62
+ <article markdown="1">
63
+
64
+ % found = options[:index].find{ |k,v| v.has_key?(_resolve_tab(options)) }
65
+ % topic_key = found ? found[0] : nil
66
+ % topic = options[:topic] || topic_key
67
+ % if topic
68
+ <h3 class="topic-title"><%= topic %></h3>
69
+ % end
70
+
71
+ % heading = options[:heading] || (options[:index][topic_key] ? options[:index][topic_key][_resolve_tab(options)] : nil)
72
+ % if heading
73
+ <h2 class="topic-subtitle"><%= heading %></h2>
74
+ % end
75
+
76
+ <hr>
77
+
78
+ <%= yield %>
79
+
80
+ %# Also important to avoid indentation on return here, since otherwise it could be interpreted
81
+ %# as markdown code
82
+ </article>
83
+ </div>
84
+ </div>
85
+
86
+ <script src="<%= path "search.js" %>"></script>
@@ -0,0 +1,20 @@
1
+ # % specs = []
2
+ # % if options[:spec].class == Origen::Specs::Spec # Found an individual spec
3
+ # % specs << options[:spec]
4
+ # % elsif options[:spec].class == Hash && options[:spec].values.first.class == Origen::Specs::Spec # Found all specs for the owner
5
+ # % specs = options[:spec].values
6
+ # % elsif options[:spec].respond_to?(:specs) && options[:spec].send(:specs) # Found an IP so just see if it has specs and get them if so
7
+ # % specs = options[:spec].send(:specs).values
8
+ # % else
9
+ # % fail "'spec' option must point to an indv. spec or a block that has specs."
10
+ # % end
11
+
12
+ # % include_data = false
13
+
14
+ # % specs.each do |s|
15
+ # <div class="specification">
16
+ # <a class="anchor" name="<%= "#{s.owner.ip_name}, mode = #{s.mode}" %>"></a>
17
+ # <a href='#<%= "#{s.owner.ip_name}, mode = #{s.mode}" %>'>
18
+ # </a>
19
+ # % end
20
+
@@ -0,0 +1,227 @@
1
+ %# This is a template to create a test flow document like this one:
2
+ %# http://origen.freescale.net/tfs/latest/flows/low_cost/sort1/
3
+ % program = options[:program]
4
+ % flows = options[:flow] || options[:flows]
5
+ % flows = flows ? [flows].flatten : nil
6
+
7
+ <div class="row">
8
+ %# The markdown attribute is important if you are going to include content written
9
+ %# in markdown, without this is will be included verbatim
10
+ %# One downside is that html cannot be indented here, otherwise it will be parsed
11
+ %# as a code block.
12
+ <div class="col-md-12" markdown="1">
13
+ <div class="panel-group" id="test_flow">
14
+
15
+ <a href="#_" class="expandcollapse btn btn-xs pull-right btn-default" state="0"><i class='fa fa-plus'></i></a>
16
+
17
+ <h2><%= options[:heading] %> <span style="font-size: 14px">(generated for target '<%= program.target %>')</span></h2>
18
+
19
+ % program.each_in_flow(flows, :context => options[:context]) do |t|
20
+ % type = t[:type]
21
+ % instances = t[:instance]
22
+ % i = instances
23
+ % flow = t[:flow]
24
+ % f = flow
25
+ % context = t[:context]
26
+ % c = context
27
+ % description = t[:description]
28
+
29
+ % if type == :label || type == :branch
30
+ % # Need to decide how to deal with label based jumps
31
+
32
+ % elsif type == :section_start
33
+
34
+ <%= _stop_test_flow_table %>
35
+ <%= _start_accordion(description.first) %>
36
+
37
+ % description.each_with_index do |line, ix|
38
+ % unless ix == 0
39
+ <%= line %>
40
+ % end
41
+ % end
42
+
43
+ % elsif type == :section_stop
44
+
45
+ <%= _stop_test_flow_table %>
46
+ <%= _stop_accordion %>
47
+
48
+ % else
49
+
50
+ % unless flow[:name] == "power_cycle_ti"
51
+ <%= _start_test_flow_table %>
52
+
53
+ <tr>
54
+ <td class="col1">
55
+ <a class="anchor" name="<%= "#{_test_name(t)}_#{_test_number(t)}" %>"></a>
56
+ <div><%= _test_to_local_link(t) %></div>
57
+
58
+ % if f[:id]
59
+ % dependents = program.dependents_of(f[:id], flows, :context => options[:context])
60
+ % unless dependents.empty?
61
+ <div class="alert alert-info">
62
+ % if dependents[:if_failed]
63
+ <p><strong>Note</strong>
64
+ - This test does not bin out as later tests are dependent on it.
65
+ </p>
66
+ <p>These tests will run if this test FAILS:
67
+ <ul>
68
+ % dependents[:if_failed].each do |dependent|
69
+ <li><%= _test_to_local_link(dependent) %></li>
70
+ % end
71
+ </ul></p>
72
+ % end
73
+ % if dependents[:if_passed]
74
+ <p><strong>Note</strong>
75
+ - This test does not bin out as later tests are dependent on it.
76
+ </p>
77
+ <p>These tests will run if this test PASSES:
78
+ <ul>
79
+ % dependents[:if_passed].each do |dependent|
80
+ <li><%= _test_to_local_link(dependent) %></li>
81
+ % end
82
+ </ul></p>
83
+ % end
84
+ % if dependents[:if_ran]
85
+ <p><strong>Note</strong> - These tests will run if this test RUNS:
86
+ <ul>
87
+ <ul>
88
+ % dependents[:if_ran].each do |dependent|
89
+ <li><%= _test_to_local_link(dependent) %></li>
90
+ % end
91
+ </ul></p>
92
+ % end
93
+ % if dependents[:unless_ran]
94
+ <p><strong>Note</strong> - These tests will run if this test DOES NOT RUN:
95
+ <ul>
96
+ % dependents[:unless_ran].each do |dependent|
97
+ <li><%= _test_to_local_link(dependent) %></li>
98
+ % end
99
+ </ul></p>
100
+ % end
101
+ </div>
102
+ % end
103
+ % end
104
+
105
+ % if c[:if_enable]
106
+ <div class="alert alert-success">
107
+ <strong>Note</strong>
108
+ - This test will only run when '<%= c[:if_enable] %>' is enabled.
109
+ </div>
110
+ % end
111
+
112
+ % if c[:unless_enable]
113
+ <div class="alert alert-success">
114
+ <strong>Note</strong>
115
+ - This test will NOT run when '<%= c[:unless_enable] %>' is enabled.
116
+ </div>
117
+ % end
118
+
119
+ % if f[:continue]
120
+ <div class="alert alert-danger">
121
+ <strong>Warning!</strong>
122
+ - This test does not bin out when failed.
123
+ </div>
124
+ % end
125
+
126
+ % if c[:if_passed]
127
+ <div class="alert alert-success">
128
+ <p><strong>Note</strong>
129
+ - This test will only run if this test PASSED:
130
+ <ul><li><%= _test_to_local_link(program.find_by_id(c[:if_passed], flows, :context => options[:context])) %></li></ul>
131
+ </p>
132
+ </div>
133
+ % end
134
+
135
+ % if c[:if_failed]
136
+ <div class="alert alert-success">
137
+ <p><strong>Note</strong>
138
+ - This test will only run if this test FAILED:
139
+ <ul><li><%= _test_to_local_link(program.find_by_id(c[:if_failed], flows, :context => options[:context])) %></li></ul>
140
+ </p>
141
+ </div>
142
+ % end
143
+
144
+ % if c[:if_ran]
145
+ <div class="alert alert-success">
146
+ <p><strong>Note</strong>
147
+ - This test will only run if this test RAN:
148
+ <ul><li><%= _test_to_local_link(program.find_by_id(c[:if_ran], flows, :context => options[:context])) %></li></ul>
149
+ </p>
150
+ </div>
151
+ % end
152
+
153
+ % if c[:unless_ran]
154
+ <div class="alert alert-success">
155
+ <p><strong>Note</strong>
156
+ - This test will only run if this test DID NOT RUN:
157
+ <ul><li><%= _test_to_local_link(program.find_by_id(c[:unless_ran], flows, :context => options[:context])) %></li></ul>
158
+ </p>
159
+ </div>
160
+ % end
161
+
162
+
163
+ </td>
164
+ <td class="col2">#<%= _test_number(t) %></td>
165
+ <td class="col3">B<%= _bin_number(t) %></td>
166
+ <td class="col4">B<%= _sbin_number(t) %></td>
167
+ <td class="col5 attributes" markdown="1">
168
+
169
+ % instances.each_with_index do |instance, i|
170
+ % if i > 0
171
+
172
+ ***
173
+
174
+ % end
175
+ % instance.each do |key, val|
176
+ % unless [:patterns, :pattern, :by_block, :name, :id].include?(key)
177
+ %# if val.is_a?(Numeric)
178
+ %# if val > 1000000
179
+ %# val =
180
+ %# if val > 1000000
181
+ %# end
182
+ * **<%= key.to_s.capitalize.gsub("_", " ") %>**: <%= val %>
183
+ % end
184
+ % end
185
+ % patterns = [instance[:pattern], instance[:patterns]].flatten.compact
186
+ % unless patterns.empty?
187
+ % if options[:link_to_pattern_docs]
188
+
189
+ <div class="pattern-links">
190
+ % patterns.each_with_index do |pattern, i|
191
+ % if patterns.size > 1
192
+ % txt = "Pattern #{i}"
193
+ % else
194
+ % txt = "Pattern"
195
+ % end
196
+ <a href="<%= path "/patterns/#{pattern}" %>" role="button" class="btn btn-primary btn-small"><%= txt %></a>
197
+ % end
198
+ </div>
199
+ % else
200
+ * **Patterns**:
201
+ % patterns.each_with_index do |pattern, i|
202
+ * <%= pattern %>
203
+ % end
204
+
205
+ % end
206
+ %
207
+ % end
208
+ % end
209
+ </td>
210
+
211
+ <td class="col6" markdown="1">
212
+
213
+ % description.each do |line|
214
+ <%= line %>
215
+ % end
216
+
217
+ </td>
218
+ </tr>
219
+ % end
220
+ % end
221
+ % end
222
+
223
+ <%= _stop_test_flow_table %>
224
+
225
+ </div>
226
+ </div>
227
+ </div>
@@ -0,0 +1,19 @@
1
+ % render "layouts/basic.html", :tab => :examples do
2
+
3
+ # Examples
4
+
5
+ The available helpers are split by engineering function below, click the
6
+ helper of interest to see a live example of it and the application code
7
+ that should be used to generate it.
8
+
9
+ ### General
10
+
11
+ * [Searchable Documents](<%= path "/examples/searchable/intro" %>)
12
+ * [Register Descriptions](<%= path "/examples/register" %>)
13
+ * [Yammer Widgets](<%= path "/examples/yammer" %>)
14
+
15
+ ### Test Engineering
16
+
17
+ * [Test Flow](<%= path "/examples/test/flow" %>)
18
+
19
+ % end
@@ -0,0 +1,101 @@
1
+ % render "../layouts/examples.html" do
2
+
3
+ # Register Helpers
4
+
5
+ Use the [Origen register API](http://origen-sdk.org/origen/guides/models/registers)
6
+ to define registers in the normal way,
7
+ all of the examples are here are based on this register definition:
8
+
9
+ ~~~ruby
10
+ # **The Long Name of the Reg**
11
+ #
12
+ # The MCLKDIV register is used to divide down the frequency of the HBOSCCLK input. If the MCLKDIV
13
+ # register is set to value "N", then the output (beat) frequency of the clock divider is OSCCLK / (N+1). The
14
+ # resulting beats are, in turn, counted by the PTIMER module to control the duration of Flash high-voltage
15
+ # operations.
16
+ #
17
+ # This is just a test that paragraphs work.
18
+ add_reg :mclkdiv, 0x0003, :size => 16 do
19
+ # **Oscillator (Hi)** - Firmware FMU clock source selection. (Note that in addition to this firmware-controlled bit, the
20
+ # FMU clock source is also dependent on test and power control discretes).
21
+ #
22
+ # 0 | FMU clock is the externally supplied bus clock ipg_clk
23
+ # 1 | FMU clock is the internal oscillator from the TFS hardblock
24
+ bit 15, :osch, :reset => 1
25
+ # **Mode Ready** - A Synchronized version of the *ftf_mode_ready[1:0]* output from the flash analog hard block.
26
+ # See the TFL3 Hard Block Creation Guide for more details.
27
+ #
28
+ # 0 | Analog voltages have not reached target levels for the specified mode of operation
29
+ # 1 | Analog voltages have reached target levels for the specified mode of operation
30
+ bit 13..12, :mode_rdy, :writable => false
31
+ # **IFR and FW ECC Enable for LDM** - On / off control for UIFR, RIFR, and FW when reading with the MGATE's
32
+ # Load Memory (LDM) instruction. The setting of this bit only makes a difference when reading with LDM, all other
33
+ # MGATE reads from UIFR/RIFR will always have ECC disabled and reads from FW will have ECC enabled.
34
+ #
35
+ # 0 | ECC is disabled for UIFR, RIFR, and FW reads when using the LDM instruction
36
+ # 1 | ECC is enabled for all UIFR, RIFR, and FW reads when using the LDM instruction
37
+ bit 10, :eccen, :reset => 1
38
+ # **MGATE Command Location Code** - A 2-bit code that tells the MGATE where to go for its instruction fetches
39
+ # (location of command definitions). These bits are used to form different MGATE command request IDs from a
40
+ # falling CCIF, one request ID for each of the possible locations of the MGATE executable. If this field is changed,
41
+ # all subsequent command launches (falling CCIF) will execute from the new area. Note that the MGATE also has
42
+ # a reset request ID. The reset request ID always targets the Boot Code and is unaffected by the CMDLOC setting.
43
+ #
44
+ # 00 | Execute from the Beginning of the MGRAM + 256B (the normal location)
45
+ # 01 | Execute from the Beginning of the MGRAM
46
+ # 10 | Execute from the Stack start at the end of MGRAM
47
+ # 11 | Reserved
48
+ bit 9..7, :cmdloc, :reset => :undefined
49
+ # **Clock Divider Bits** - DIV[7:0] must be set to effectively divide HBOSCCLK down to a known beat frequency
50
+ # having acceptable resolution and dynamic range for timing high-voltage operations on the Flash hardblocks
51
+ # during algorithms with timed events. Table 1-50 shows the range of timed events (i.e. pulse widths) that can be
52
+ # achieved with 8-bit and 16-bit PTIMER loads for various input clock frequencies and clock divider settings.
53
+ bit 6..2, :div, :reset => :memory
54
+ end
55
+ ~~~
56
+
57
+ ### Basic Register Diagram
58
+
59
+ <%= render "templates/shared/register", :reg => $dut.reg(:mclkdiv) %>
60
+
61
+ Here is an example of how to insert a basic register diagram in
62
+ a document:
63
+
64
+ ~~~eruby
65
+ ## Register Map
66
+
67
+ <%= "%" %> $dut.regs.each do |name, reg|
68
+
69
+ <%= "<" + "%= render \"doc_helpers/register.html\", reg: reg, preserve_target: true %" + ">" %>
70
+
71
+ <%= "%" %> end
72
+ ~~~
73
+
74
+ ### Register Diagram with Descriptions
75
+
76
+ <%= render "templates/shared/register", :reg => $dut.reg(:mclkdiv), :descriptions => true %>
77
+
78
+ Set the <code>:descriptions</code> switch to true to include the register and
79
+ bit descriptions:
80
+
81
+ ~~~eruby
82
+ ## Register Map
83
+
84
+ <%= "%" %> $dut.regs.each do |name, reg|
85
+
86
+ <%= "<" + "%= render \"doc_helpers/register.html\", reg: reg, preserve_target: true, descriptions: true %" + ">" %>
87
+
88
+ <%= "%" %> end
89
+ ~~~
90
+
91
+ ### Additional Test Cases
92
+
93
+ <%= render "templates/shared/register", :reg => $dut.reg(:proth) %>
94
+
95
+ <%= render "templates/shared/register", :reg => $dut.reg(:protl) %>
96
+
97
+ % $dut.sub_module.regs.each do |name, reg|
98
+ <%= render "templates/shared/register", :reg => reg, :descriptions => true %>
99
+ % end
100
+
101
+ % end