origen_doc_helpers 0.5.2 → 0.6.0

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
  SHA1:
3
- metadata.gz: ebbd238b54a19683203a725637f6c2734b65c188
4
- data.tar.gz: b19db5c9ac282ad9cadccc0084969e58201b2bb5
3
+ metadata.gz: ddb0151af6cf74f9080784ce49f885fd55952d81
4
+ data.tar.gz: d18ecaa6b5e985b720082027f1377d442f3f26b0
5
5
  SHA512:
6
- metadata.gz: a132f22c09f808879511749593ac122e8ca918cd69ee7c1132edcf7713ec3a90cbe6f7b5e5545a0eedaef5774cae518bd63c7bc4727246d477cc22779da721a9
7
- data.tar.gz: ef35859c17efbc5c635a61606e11d8f73365e92fa71094691993ce6ed3b12458571928a6c75a43c251a3e66fccd332d2881c638929acddd67e0e883e5c9deac6
6
+ metadata.gz: 6339ee1a74d32e6073ad1e7a5f4483f9323ee08f6d73a348782902b104471a811ada5a40b0657e585bd671214729ba355410a9d66fa1ff83ce2b5426a6861bb9
7
+ data.tar.gz: 027348178efe90fac8e8f9ab8a623724c6beb119579f3ee438b71c8fcb9fed80c7f9158ab93e8bed5a62b0008cdc9d67fe816e5b3ed19070b43e1ad4f8283b21
@@ -32,4 +32,13 @@ class OrigenDocHelpersApplication < Origen::Application
32
32
  end
33
33
  end
34
34
 
35
+ def after_web_site_compile(options)
36
+ Origen.app.runner.launch action: :program, files: "program"
37
+ # Then the documentation
38
+ OrigenDocHelpers.generate_flow_docs layout: "#{Origen.root}/templates/web/layouts/_basic.html.erb", tab: :flows do |d|
39
+ d.page flow: :probe1,
40
+ name: "Probe 1 Flow",
41
+ target: "default.rb"
42
+ end
43
+ end
35
44
  end
data/config/boot.rb CHANGED
@@ -14,6 +14,5 @@ require "origen_doc_helpers"
14
14
  # and is required by some of our tests.
15
15
  # Normally such a class should not be exposed to 3rd party users of the plugin,
16
16
  # so we required it here rather than in lib/origen_doc_helpers.rb.
17
- module OrigenDocHelpers
18
- autoload :DUT, "origen_doc_helpers/dut"
19
- end
17
+ require "origen_doc_helpers_dev/dut"
18
+ require "origen_doc_helpers_dev/interface"
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module OrigenDocHelpers
2
2
  MAJOR = 0
3
- MINOR = 5
4
- BUGFIX = 2
3
+ MINOR = 6
4
+ BUGFIX = 0
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -50,8 +50,10 @@ module OrigenDocHelpers
50
50
  attr_reader :model
51
51
 
52
52
  def initialize(options)
53
+ options = { search_box: true }.merge(options)
53
54
  @options = options
54
55
  @model = options[:model]
56
+ @search_box = options[:search_box]
55
57
  end
56
58
 
57
59
  def run
@@ -72,12 +74,15 @@ module OrigenDocHelpers
72
74
  model: model,
73
75
  breadcrumbs: options[:breadcrumbs],
74
76
  path: options[:path],
75
- origen_path: options[:origen_path]
77
+ origen_path: options[:origen_path],
78
+ search_box: @search_box
76
79
 
77
80
  write_out(output_file, t)
78
- Origen.log.info "Building JSON page: #{json_file}"
79
- File.open(json_file, 'w') do |f|
80
- f.puts model.to_json
81
+ if @search_box
82
+ Origen.log.info "Building JSON page: #{json_file}"
83
+ File.open(json_file, 'w') do |f|
84
+ f.puts model.to_json
85
+ end
81
86
  end
82
87
 
83
88
  model.sub_blocks.each do |name, block|
@@ -1,4 +1,4 @@
1
- module OrigenDocHelpers
1
+ module OrigenDocHelpersDev
2
2
  class DUT
3
3
  include Origen::TopLevel
4
4
 
@@ -0,0 +1,69 @@
1
+ module LinkDemo
2
+ module TestProgram
3
+ class Interface
4
+ include OrigenTesters::ProgramGenerators
5
+
6
+ def instance_name(name, options = {})
7
+ name = pattern_name(name)
8
+ if options[:vdd] || options[:vdd] != :nom
9
+ name += "_#{options[:vdd]}"
10
+ end
11
+ name
12
+ end
13
+
14
+ def pattern_name(name, options = {})
15
+ options[:pattern] || name.to_s
16
+ end
17
+
18
+ def vdd_loop(options)
19
+ [options[:vdd]].flatten.each do |vdd|
20
+ yield options.merge(vdd: vdd)
21
+ end
22
+ end
23
+
24
+ def func(name, options = {})
25
+ options = {
26
+ vdd: [:min, :max],
27
+ type: :functional
28
+ }.merge(options)
29
+ vdd_loop(options) do |options|
30
+ test = test_instances.functional(instance_name(name, options), options)
31
+ test.pattern = pattern_name(name, options)
32
+ apply_levels(test, options)
33
+ add_flow_entry(test, options)
34
+ end
35
+ end
36
+
37
+ def para(name, options = {})
38
+ options = {
39
+ vdd: [:min, :max],
40
+ type: :parametric
41
+ }.merge(options)
42
+ unless options[:cz]
43
+ vdd_loop(options) do |options|
44
+ test = test_instances.ppmu(instance_name(name, options), options)
45
+ test.pattern = pattern_name(name, options)
46
+ test.lo_limit = options[:lo]
47
+ test.hi_limit = options[:hi]
48
+ test.force_cond = options[:force] || 0
49
+ apply_levels(test, options)
50
+ add_flow_entry(test, options)
51
+ end
52
+ end
53
+ end
54
+
55
+ def apply_levels(test, options)
56
+ test.dc_category = 'spec'
57
+ test.dc_selector = options[:vdd] || :nom
58
+ end
59
+
60
+ def add_flow_entry(test, options)
61
+ options = {
62
+ number: options[:bin] * 1000,
63
+ soft_bin: options[:bin]
64
+ }.merge(options)
65
+ flow.test test, options
66
+ end
67
+ end
68
+ end
69
+ 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_loaded, vdd: :min, bin: 105, force: 5.mA, lo: 1.10, hi: 1.34, pattern: "vreg_meas"
24
+
25
+ para :vreg_meas_loaded, vdd: :max, bin: 105, force: 5.mA, lo: 1.12, hi: 1.34, pattern: "vreg_meas"
26
+ end
data/program/probe1.rb ADDED
@@ -0,0 +1,9 @@
1
+ Flow.create interface: "LinkDemo::TestProgram::Interface" do
2
+ log "Vreg test module"
3
+
4
+ import "func"
5
+
6
+ import "para"
7
+
8
+ pass 1, sofbin: 55
9
+ end
@@ -23,6 +23,7 @@
23
23
  <img src="http://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
+ % if opts[:search_box]
26
27
  <div id="search" class="col-md-3" style="margin-top: 20px;">
27
28
  <form style="margin-bottom: 15px;">
28
29
  <div class="input-group">
@@ -33,6 +34,7 @@
33
34
  </div>
34
35
  </form>
35
36
  </div>
37
+ % end
36
38
  </div>
37
39
 
38
40
  <div class="row">
@@ -101,7 +103,9 @@
101
103
  <hr>
102
104
  <div class="row">
103
105
  <div class="col-md-12">
106
+ % if opts[:search_box]
104
107
  <article>
108
+ % end
105
109
  <h3>Registers of <%= model.model.class%> <%= model.name ? "(#{model.name})" : model.try(:includes_origen_top_level?) ? "(dut)" : "" %></h3>
106
110
 
107
111
  % model.regs.sort_by { |name, reg| reg.offset }.each do |name, reg|
@@ -114,7 +118,9 @@
114
118
 
115
119
  % end
116
120
 
121
+ % if opts[:search_box]
117
122
  </article>
123
+ % end
118
124
  </div>
119
125
  </div>
120
126
 
@@ -0,0 +1,129 @@
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>
@@ -4,9 +4,9 @@
4
4
 
5
5
  This helper will build a web page to document a test program flow the has been created with Origen.
6
6
 
7
- [Here is an example](http://origen-sdk.org/link_demo/flows/probe_1_flow/).
7
+ [Here is an example](<%= path "flows/probe_1_flow" %>).
8
8
 
9
- Multiple flows can be supplied and an [index page like this](http://origen-sdk.org/link_demo/flows)
9
+ Multiple flows can be supplied and an [index page like this](<%= path "flows" %>)
10
10
  is generated to help locate the documentation for a given flow.
11
11
 
12
12
  ## How To Use
@@ -27,6 +27,19 @@ def after_web_site_compile(options)
27
27
  end
28
28
  ~~~
29
29
 
30
+ For very large models the model search feature may cause the model pages to load slowly. In this
31
+ case it may be desirable to disable the model search feature. You can do this by adding an optional
32
+ argument to the your application's callback handler like this:
33
+
34
+ ~~~ruby
35
+ def after_web_site_compile(options)
36
+ # Build the model documentation
37
+ OrigenDocHelpers.generate_model_docs layout: "#{Origen.root}/templates/web/layouts/_basic.html.erb", tab: :model do |d|
38
+ d.page model: $dut, search_box: false
39
+ end
40
+ end
41
+ ~~~
42
+
30
43
  To generate documentation for more than one model, call the page method multiple times like this:
31
44
 
32
45
  ~~~ruby
@@ -0,0 +1,81 @@
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
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.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-15 00:00:00.000000000 Z
11
+ date: 2018-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -51,17 +51,23 @@ files:
51
51
  - config/users.rb
52
52
  - config/version.rb
53
53
  - lib/origen_doc_helpers.rb
54
- - lib/origen_doc_helpers/dut.rb
55
54
  - lib/origen_doc_helpers/flow_page_generator.rb
56
55
  - lib/origen_doc_helpers/helpers.rb
57
56
  - lib/origen_doc_helpers/html_flow_formatter.rb
58
57
  - lib/origen_doc_helpers/list_flow_formatter.rb
59
58
  - lib/origen_doc_helpers/model_page_generator.rb
60
59
  - lib/origen_doc_helpers/pdf.rb
60
+ - lib/origen_doc_helpers_dev/dut.rb
61
+ - lib/origen_doc_helpers_dev/interface.rb
62
+ - program/_func.rb
63
+ - program/_hvst.rb
64
+ - program/_para.rb
65
+ - program/probe1.rb
61
66
  - templates/flow_index.md.erb
62
67
  - templates/flow_page.md.erb
63
68
  - templates/model_index.md.erb
64
69
  - templates/model_page.md.erb
70
+ - templates/model_page.md.erb~
65
71
  - templates/pdf/topic_wrapper.html
66
72
  - templates/shared/_register.html.erb
67
73
  - templates/shared/_searchable.html.erb
@@ -71,6 +77,7 @@ files:
71
77
  - templates/web/helpers/disqus.md.erb
72
78
  - templates/web/helpers/flow.md.erb
73
79
  - templates/web/helpers/model.md.erb
80
+ - templates/web/helpers/model.md.erb~
74
81
  - templates/web/helpers/register.md.erb
75
82
  - templates/web/helpers/searchable/intro.md.erb
76
83
  - templates/web/helpers/searchable/page2.md.erb