origen_doc_helpers 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/config/boot.rb +19 -0
  3. data/config/version.rb +1 -1
  4. data/lib/origen_doc_helpers.rb +21 -1
  5. data/lib/origen_doc_helpers/flow_page_generator.rb +110 -0
  6. data/lib/{helpers.rb → origen_doc_helpers/helpers.rb} +0 -0
  7. data/lib/origen_doc_helpers/model_page_generator.rb +151 -0
  8. data/templates/flow_index.md.erb +19 -0
  9. data/templates/flow_page.md.erb +4 -0
  10. data/templates/model_index.md.erb +24 -0
  11. data/templates/model_page.md.erb +125 -0
  12. data/templates/shared/_register.html.erb +51 -7
  13. data/templates/shared/_searchable.html.erb +1 -1
  14. data/templates/shared/test/_flow.md.erb +3 -230
  15. data/templates/web/helpers.md.erb +25 -0
  16. data/templates/web/{examples → helpers}/disqus.md.erb +3 -3
  17. data/templates/web/helpers/flow.md.erb +113 -0
  18. data/templates/web/helpers/model.md.erb +81 -0
  19. data/templates/web/{examples → helpers}/register.md.erb +5 -5
  20. data/templates/web/{examples → helpers}/searchable/intro.md.erb +4 -4
  21. data/templates/web/{examples → helpers}/searchable/page2.md.erb +0 -0
  22. data/templates/web/{examples → helpers}/searchable/topic1/item1.md.erb +0 -0
  23. data/templates/web/{examples → helpers}/searchable/topic1/item2.html.erb +0 -0
  24. data/templates/web/{examples → helpers}/spec.md.erb_NOT_WORKING +2 -2
  25. data/templates/web/{examples → helpers}/yammer.md.erb +1 -1
  26. data/templates/web/index.md.erb +1 -1
  27. data/templates/web/layouts/_doc.html.erb +2 -2
  28. data/templates/web/layouts/{_examples.html.erb → _helpers.html.erb} +1 -1
  29. data/templates/web/partials/_navbar.html.erb +1 -1
  30. metadata +27 -26
  31. data/config/development.rb +0 -16
  32. data/config/environment.rb +0 -32
  33. data/lib/origen_doc_helpers/doc_interface.rb +0 -74
  34. data/program/_func.rb +0 -12
  35. data/program/_hvst.rb +0 -12
  36. data/program/_para.rb +0 -26
  37. data/program/probe_1.rb +0 -7
  38. data/templates/web/examples.md.erb +0 -20
  39. data/templates/web/examples/test/flow.md.erb +0 -35
@@ -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
@@ -1,4 +1,4 @@
1
- % render "../layouts/examples.html" do
1
+ % render "../layouts/helpers.html" do
2
2
 
3
3
  # Register Helpers
4
4
 
@@ -56,8 +56,6 @@ end
56
56
 
57
57
  ### Basic Register Diagram
58
58
 
59
- <%= render "templates/shared/register", :reg => $dut.reg(:mclkdiv) %>
60
-
61
59
  Here is an example of how to insert a basic register diagram in
62
60
  a document:
63
61
 
@@ -71,9 +69,9 @@ a document:
71
69
  <%= "%" %> end
72
70
  ~~~
73
71
 
74
- ### Register Diagram with Descriptions
72
+ <%= render "templates/shared/register", :reg => $dut.reg(:mclkdiv) %>
75
73
 
76
- <%= render "templates/shared/register", :reg => $dut.reg(:mclkdiv), :descriptions => true %>
74
+ ### Register Diagram with Descriptions
77
75
 
78
76
  Set the <code>:descriptions</code> switch to true to include the register and
79
77
  bit descriptions:
@@ -88,6 +86,8 @@ bit descriptions:
88
86
  <%= "%" %> end
89
87
  ~~~
90
88
 
89
+ <%= render "templates/shared/register", :reg => $dut.reg(:mclkdiv), :descriptions => true %>
90
+
91
91
  ### Additional Test Cases
92
92
 
93
93
  <%= render "templates/shared/register", :reg => $dut.reg(:proth) %>
@@ -72,7 +72,7 @@ As an example here is the actual layout that has been used to generate this page
72
72
  ---
73
73
  title: <%= options[:title] || Origen.config.name %>
74
74
  ---
75
- <%= "<" + "%= render \"partials/navbar.html\", tab: :examples %" + ">" %>
75
+ <%= "<" + "%= render \"partials/navbar.html\", tab: :helpers %" + ">" %>
76
76
 
77
77
  <%= "%" %> index = {}
78
78
  <%= "%" %> index[nil] = {
@@ -84,8 +84,8 @@ title: <%= options[:title] || Origen.config.name %>
84
84
  <%= "%" %> topic1_item2: "Second Item",
85
85
  <%= "%" %> }
86
86
 
87
- %#<%= "%" %> opts = options.merge(index: index, root: "examples/searchable", pdf_title: "Doc Helpers Searchable Guide")
88
- <%= "%" %> opts = options.merge(index: index, root: "examples/searchable")
87
+ %#<%= "%" %> opts = options.merge(index: index, root: "helpers/searchable", pdf_title: "Doc Helpers Searchable Guide")
88
+ <%= "%" %> opts = options.merge(index: index, root: "helpers/searchable")
89
89
  <%= "%" %> render "doc_helpers/searchable.html", options.merge(opts) do
90
90
 
91
91
  <%= "<" + "%= yield %" + ">" %>
@@ -114,7 +114,7 @@ The top-level header size in your document should be <code>h3</code> or <code>##
114
114
 
115
115
  <code>.html.erb</code> files will also work if you want to use them.
116
116
 
117
- Here is the actual code used behind the [Topic 1 - First Item](<%= path "examples/searchable/topic1/item1" %>)
117
+ Here is the actual code used behind the [Topic 1 - First Item](<%= path "helpers/searchable/topic1/item1" %>)
118
118
  page (where the layout being rendered is the one above):
119
119
 
120
120
 
@@ -1,10 +1,10 @@
1
- % render "../layouts/examples.html" do
1
+ % render "../layouts/helpers.html" do
2
2
 
3
3
  # Specification Helpers
4
4
 
5
5
  Use the [Origen specification API](http://origen.freescale.net/origen/latest/guides/models/specs)
6
6
  to define specifications in the normal way,
7
- all of the examples shown here are based on this specification definition:
7
+ all of the helpers shown here are based on this specification definition:
8
8
 
9
9
  ~~~ruby
10
10
  spec :soc_vdd do
@@ -1,4 +1,4 @@
1
- % render "../layouts/examples.html" do
1
+ % render "../layouts/helpers.html" do
2
2
 
3
3
  # Yammer Comments
4
4
 
@@ -28,7 +28,7 @@ spec.add_development_dependency "origen_doc_helpers", ">= <%= Origen.app.version
28
28
 
29
29
  ### How To Use
30
30
 
31
- See the [Examples](<%= path "examples" %>) to see what is available
31
+ See the [Available Helpers](<%= path "helpers" %>) page to see the current list of helpers
32
32
  and how to use them.
33
33
 
34
34
  ### How To Setup a Development Environment
@@ -2,7 +2,7 @@
2
2
  title: <%= options[:title] || Origen.config.name %>
3
3
  analytics: UA-64455560-1
4
4
  ---
5
- <%= render "partials/navbar.html", :tab => :examples %>
5
+ <%= render "partials/navbar.html", :tab => :helpers %>
6
6
 
7
7
  %# Add/edit sections here, the code below will expand this with the correct markup,
8
8
  %# pass in the topic you want selected via the :tab option.
@@ -16,7 +16,7 @@ analytics: UA-64455560-1
16
16
  % :topic1_item2 => "Second Item",
17
17
  % }
18
18
 
19
- % render "templates/shared/searchable.html", options.merge(:index => s, :root => "examples/searchable") do
19
+ % render "templates/shared/searchable.html", options.merge(:index => s, :root => "helpers/searchable") do
20
20
 
21
21
  <%= yield %>
22
22
 
@@ -1,4 +1,4 @@
1
- % render "basic.html", :tab => :examples do
1
+ % render "basic.html", :tab => :helpers do
2
2
 
3
3
  <%= yield %>
4
4
 
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  <div id="navbar" class="collapse navbar-collapse">
13
13
  <ul class="nav navbar-nav">
14
- <li class="<%= options[:tab] == :examples ? 'active' : '' %>"><a href="<%= path "/examples" %>">Examples</a></li>
14
+ <li class="<%= options[:tab] == :helpers ? 'active' : '' %>"><a href="<%= path "/helpers" %>">Helpers</a></li>
15
15
  <li class="<%= options[:tab] == :release ? 'active' : '' %>"><a href="<%= path "/release_notes" %>">Release Notes</a></li>
16
16
  <li><a href="https://github.com/Origen-SDK/origen_doc_helpers">Github</a></li>
17
17
  </ul>
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_doc_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.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: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.6'
19
+ version: 0.7.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.6'
26
+ version: 0.7.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: origen_testers
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -46,41 +46,42 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - config/application.rb
49
+ - config/boot.rb
49
50
  - config/commands.rb
50
- - config/development.rb
51
- - config/environment.rb
52
51
  - config/users.rb
53
52
  - config/version.rb
54
- - lib/helpers.rb
55
53
  - lib/origen_doc_helpers.rb
56
- - lib/origen_doc_helpers/doc_interface.rb
57
54
  - lib/origen_doc_helpers/dut.rb
55
+ - lib/origen_doc_helpers/flow_page_generator.rb
56
+ - lib/origen_doc_helpers/helpers.rb
58
57
  - lib/origen_doc_helpers/html_flow_formatter.rb
59
58
  - lib/origen_doc_helpers/list_flow_formatter.rb
59
+ - lib/origen_doc_helpers/model_page_generator.rb
60
60
  - lib/origen_doc_helpers/pdf.rb
61
- - program/_func.rb
62
- - program/_hvst.rb
63
- - program/_para.rb
64
- - program/probe_1.rb
61
+ - templates/flow_index.md.erb
62
+ - templates/flow_page.md.erb
63
+ - templates/model_index.md.erb
64
+ - templates/model_page.md.erb
65
65
  - templates/pdf/topic_wrapper.html
66
66
  - templates/shared/_register.html.erb
67
67
  - templates/shared/_searchable.html.erb
68
68
  - templates/shared/_spec.html.erb
69
69
  - templates/shared/test/_flow.md.erb
70
- - templates/web/examples.md.erb
71
- - templates/web/examples/disqus.md.erb
72
- - templates/web/examples/register.md.erb
73
- - templates/web/examples/searchable/intro.md.erb
74
- - templates/web/examples/searchable/page2.md.erb
75
- - templates/web/examples/searchable/topic1/item1.md.erb
76
- - templates/web/examples/searchable/topic1/item2.html.erb
77
- - templates/web/examples/spec.md.erb_NOT_WORKING
78
- - templates/web/examples/test/flow.md.erb
79
- - templates/web/examples/yammer.md.erb
70
+ - templates/web/helpers.md.erb
71
+ - templates/web/helpers/disqus.md.erb
72
+ - templates/web/helpers/flow.md.erb
73
+ - templates/web/helpers/model.md.erb
74
+ - templates/web/helpers/register.md.erb
75
+ - templates/web/helpers/searchable/intro.md.erb
76
+ - templates/web/helpers/searchable/page2.md.erb
77
+ - templates/web/helpers/searchable/topic1/item1.md.erb
78
+ - templates/web/helpers/searchable/topic1/item2.html.erb
79
+ - templates/web/helpers/spec.md.erb_NOT_WORKING
80
+ - templates/web/helpers/yammer.md.erb
80
81
  - templates/web/index.md.erb
81
82
  - templates/web/layouts/_basic.html.erb
82
83
  - templates/web/layouts/_doc.html.erb
83
- - templates/web/layouts/_examples.html.erb
84
+ - templates/web/layouts/_helpers.html.erb
84
85
  - templates/web/partials/_navbar.html.erb
85
86
  - templates/web/release_notes.md.erb
86
87
  homepage: http://origen-sdk.org/doc_helpers
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
104
  version: 1.8.11
104
105
  requirements: []
105
106
  rubyforge_project:
106
- rubygems_version: 2.2.2
107
+ rubygems_version: 2.6.2
107
108
  signing_key:
108
109
  specification_version: 4
109
110
  summary: Snippets and helpers for creating Origen web documents
@@ -1,16 +0,0 @@
1
- # This file is similar to environment.rb and will be loaded
2
- # automatically at the start of each invocation of Origen.
3
- #
4
- # However the major difference is that it will not be loaded
5
- # if the application is imported by a 3rd party app - in that
6
- # case only environment.rb is loaded.
7
- #
8
- # Therefore this file should be used to load anything you need
9
- # to setup a development environment for this app, normally
10
- # this would be used to load some dummy classes to instantiate
11
- # your objects so that they can be tested and/or interacted with
12
- # in the console.
13
- module OrigenDocHelpers
14
- autoload :DUT, "origen_doc_helpers/dut"
15
- end
16
- require "origen_doc_helpers/doc_interface"
@@ -1,32 +0,0 @@
1
- # This file will be required by Origen before your target is loaded, you
2
- # can use this to require all of your files, which is the easiest way
3
- # to get started. As your experience grows you may wish to require only the
4
- # minimum files required to allow the target to be initialized and let
5
- # each class require its own dependencies.
6
- #
7
- # It is recommended that you keep all of your application logic in lib/
8
- # The lib directory has already been added to the search path and so any files
9
- # in there can be referenced from here with a relative path.
10
- #
11
- # Note that pattern files do not need to be referenced from here and these
12
- # will be located automatically by origen.
13
-
14
- # This says load the file "lib/pioneer.rb" the first time anyone makes a
15
- # reference to the class name 'Pioneer'.
16
- #autoload :Pioneer, "pioneer"
17
- # This is generally preferable to using require which will load the file
18
- # regardless of whether it is needed by the current target or not:
19
- #require "pioneer"
20
- # Sometimes you have to use require however:-
21
- # 1. When defining a test program interface:
22
- #require "interfaces/j750"
23
- # 2. If you want to extend a class defined by an imported application, in
24
- # this case your must use required and supply a full path (to distinguish
25
- # it from the one in the parent application):
26
- #require "#{Origen.root}/c90_top_level/p2"
27
- module OrigenDocHelpers
28
- autoload :PDF, "origen_doc_helpers/pdf"
29
- autoload :HtmlFlowFormatter, "origen_doc_helpers/html_flow_formatter"
30
- autoload :ListFlowFormatter, "origen_doc_helpers/list_flow_formatter"
31
- end
32
- require "helpers"
@@ -1,74 +0,0 @@
1
- module OrigenDocHelpers
2
- class DocInterface
3
- include OrigenTesters::Doc::Generator
4
-
5
- def initialize(_options = {})
6
- end
7
-
8
- def log(_msg)
9
- end
10
-
11
- def instance_name(name, options = {})
12
- name = pattern_name(name)
13
- if options[:vdd] || options[:vdd] != :nom
14
- name += "_#{options[:vdd]}"
15
- end
16
- name
17
- end
18
-
19
- def pattern_name(name, _options = {})
20
- name.to_s
21
- end
22
-
23
- def vdd_loop(options)
24
- [options[:vdd]].flatten.each do |vdd|
25
- yield options.merge(vdd: vdd)
26
- end
27
- end
28
-
29
- def func(name, options = {})
30
- options = {
31
- vdd: [:min, :max],
32
- type: :functional
33
- }.merge(options)
34
- vdd_loop(options) do |options|
35
- test = add_test name, options
36
- add_flow_entry(test, options)
37
- end
38
- end
39
-
40
- def para(name, options = {})
41
- options = {
42
- vdd: [:min, :max],
43
- type: :parametric
44
- }.merge(options)
45
- vdd_loop(options) do |options|
46
- test = add_test name, options
47
- add_flow_entry(test, options)
48
- end
49
- end
50
-
51
- def add_pattern(name, options = {})
52
- options[:pattern] = pattern_name(name, options)
53
- options
54
- end
55
-
56
- def add_test(name, options)
57
- options = {
58
- }.merge(options)
59
- # Delete any keys that we don't want to assign to the instance, this keeps
60
- # the attributes efficient, flow control keys will be screened by Origen
61
- [:bin, :tnum, :tname, :continue
62
- ].each { |k| options.delete(k) }
63
- tests.add(instance_name(name, options), add_pattern(name, options))
64
- end
65
-
66
- def add_flow_entry(test, options)
67
- options = {
68
- number: options[:bin] * 1000,
69
- soft_bin: options[:bin]
70
- }.merge(options)
71
- flow.test test, options
72
- end
73
- end
74
- end