origen_doc_helpers 0.1.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 +7 -0
- data/config/application.rb +34 -0
- data/config/commands.rb +42 -0
- data/config/development.rb +16 -0
- data/config/environment.rb +30 -0
- data/config/users.rb +19 -0
- data/config/version.rb +8 -0
- data/lib/helpers.rb +234 -0
- data/lib/origen_doc_helpers.rb +2 -0
- data/lib/origen_doc_helpers/doc_interface.rb +74 -0
- data/lib/origen_doc_helpers/dut.rb +194 -0
- data/lib/origen_doc_helpers/pdf.rb +122 -0
- data/program/_func.rb +12 -0
- data/program/_hvst.rb +12 -0
- data/program/_para.rb +26 -0
- data/program/probe_1.rb +7 -0
- data/templates/pdf/topic_wrapper.html +21 -0
- data/templates/shared/_register.html.erb +207 -0
- data/templates/shared/_searchable.html.erb +86 -0
- data/templates/shared/_spec.html.erb +20 -0
- data/templates/shared/test/_flow.md.erb +227 -0
- data/templates/web/examples.md.erb +19 -0
- data/templates/web/examples/register.md.erb +101 -0
- data/templates/web/examples/searchable/intro.md.erb +128 -0
- data/templates/web/examples/searchable/page2.md.erb +5 -0
- data/templates/web/examples/searchable/topic1/item1.md.erb +5 -0
- data/templates/web/examples/searchable/topic1/item2.html.erb +7 -0
- data/templates/web/examples/spec.md.erb_NOT_WORKING +42 -0
- data/templates/web/examples/test/flow.md.erb +35 -0
- data/templates/web/examples/yammer.md.erb +28 -0
- data/templates/web/index.md.erb +40 -0
- data/templates/web/layouts/_basic.html.erb +13 -0
- data/templates/web/layouts/_doc.html.erb +22 -0
- data/templates/web/layouts/_examples.html.erb +5 -0
- data/templates/web/partials/_navbar.html.erb +21 -0
- data/templates/web/release_notes.md.erb +5 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d89354a4f13aed042c3fdbb0fb42ef325db4612f
|
4
|
+
data.tar.gz: 19c9c7af0631ba313222d0d485b8e8707b7bdf0f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 278a9668b54e8a4bd8243be6e994bc168c23130d5b31025c3c26b28051ab521c6d843e6c52337895f80b2d98dce79725400c24dea783f368907e37a3d45b17bc
|
7
|
+
data.tar.gz: 4ec1d7913206ac96248ebe5cc602d7c8c5d1be984dedf28f316c2ffa880c350833be4fb768830a82a442da689a5658a79b5f3ff5aa553abf58d6c89ace470c8e
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "origen"
|
2
|
+
class OrigenDocHelpersApplication < Origen::Application
|
3
|
+
|
4
|
+
config.name = "Origen Documentation Helpers"
|
5
|
+
config.initials = "OrigenDocHelpers"
|
6
|
+
config.rc_url = "git@github.com:Origen-SDK/origen_doc_helpers"
|
7
|
+
config.release_externally = true
|
8
|
+
# To enable deployment of your documentation to a web server (via the 'origen web'
|
9
|
+
# command) fill in these attributes.
|
10
|
+
config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/doc_helpers"
|
11
|
+
config.web_domain = "http://origen-sdk.org/doc_helpers"
|
12
|
+
|
13
|
+
config.semantically_version = true
|
14
|
+
|
15
|
+
config.lint_test = {
|
16
|
+
# Require the lint tests to pass before allowing a release to proceed
|
17
|
+
:run_on_tag => true,
|
18
|
+
# Auto correct violations where possible whenever 'origen lint' is run
|
19
|
+
:auto_correct => true,
|
20
|
+
# Limit the testing for large legacy applications
|
21
|
+
#:level => :easy,
|
22
|
+
# Run on these directories/files by default
|
23
|
+
#:files => ["lib", "config/application.rb"],
|
24
|
+
}
|
25
|
+
|
26
|
+
# To automatically deploy your documentation after every tag use this code
|
27
|
+
def after_release_email(tag, note, type, selector, options)
|
28
|
+
command = "origen web compile --remote"
|
29
|
+
Dir.chdir Origen.root do
|
30
|
+
system command
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/config/commands.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# This file should be used to extend the origen command line tool with tasks
|
2
|
+
# specific to your application.
|
3
|
+
# The comments below should help to get started and you can also refer to
|
4
|
+
# lib/origen/commands.rb in your Origen core workspace for more examples and
|
5
|
+
# inspiration.
|
6
|
+
#
|
7
|
+
# Also see the official docs on adding commands:
|
8
|
+
# http://origen.freescale.net/origen/latest/guides/custom/commands/
|
9
|
+
|
10
|
+
# Map any command aliases here, for example to allow origen -x to refer to a
|
11
|
+
# command called execute you would add a reference as shown below:
|
12
|
+
aliases ={
|
13
|
+
# "-x" => "execute",
|
14
|
+
}
|
15
|
+
|
16
|
+
# The requested command is passed in here as @command, this checks it against
|
17
|
+
# the above alias table and should not be removed.
|
18
|
+
@command = aliases[@command] || @command
|
19
|
+
|
20
|
+
# Now branch to the specific task code
|
21
|
+
case @command
|
22
|
+
|
23
|
+
# Here is an example of how to implement a command, the logic can go straight
|
24
|
+
# in here or you can require an external file if preferred.
|
25
|
+
when "execute"
|
26
|
+
puts "Executing something..."
|
27
|
+
require "commands/execute" # Would load file lib/commands/execute.rb
|
28
|
+
# You must always exit upon successfully capturing a command to prevent
|
29
|
+
# control flowing back to Origen
|
30
|
+
exit 0
|
31
|
+
|
32
|
+
# Always leave an else clause to allow control to fall back through to the
|
33
|
+
# Origen command handler.
|
34
|
+
# You probably want to also add the command details to the help shown via
|
35
|
+
# origen -h, you can do this be assigning the required text to @application_commands
|
36
|
+
# before handing control back to Origen. Un-comment the example below to get started.
|
37
|
+
else
|
38
|
+
# @application_commands = <<-EOT
|
39
|
+
# execute Execute something I guess
|
40
|
+
# EOT
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,16 @@
|
|
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"
|
@@ -0,0 +1,30 @@
|
|
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
|
+
end
|
30
|
+
require "helpers"
|
data/config/users.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# This file defines the users associated with your project, it is basically the
|
2
|
+
# mailing list for release notes.
|
3
|
+
#
|
4
|
+
# You can split your users into "admin" and "user" groups, the main difference
|
5
|
+
# between the two is that admin users will get all tag emails, users will get
|
6
|
+
# emails on external/official releases only.
|
7
|
+
#
|
8
|
+
# Users are also prohibited from running the "origen tag" task, but this is
|
9
|
+
# really just to prevent a casual user from executing it inadvertently and is
|
10
|
+
# not intended to be a serious security gate.
|
11
|
+
module Origen
|
12
|
+
module Users
|
13
|
+
def users
|
14
|
+
@users ||= [
|
15
|
+
|
16
|
+
]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/config/version.rb
ADDED
data/lib/helpers.rb
ADDED
@@ -0,0 +1,234 @@
|
|
1
|
+
module Origen
|
2
|
+
class Generator
|
3
|
+
class Compiler
|
4
|
+
module DocHelpers
|
5
|
+
# Helpers to create Yammer widgets
|
6
|
+
module Yammer
|
7
|
+
def yammer_comments(options = {})
|
8
|
+
options = {
|
9
|
+
prompt: 'Comment on this page'
|
10
|
+
}.merge(options)
|
11
|
+
|
12
|
+
options[:group_id] ||= Origen.app.config.yammer_group
|
13
|
+
|
14
|
+
<<END
|
15
|
+
<div style="position: relative">
|
16
|
+
<hr>
|
17
|
+
<h4>Comments</h4>
|
18
|
+
|
19
|
+
<div id="embedded-follow" style="position:absolute; top: 18px; left: 100px;"></div>
|
20
|
+
<div id="embedded-feed" style="height:800px;width:600px;"></div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<script type="text/javascript" src="https://c64.assets-yammer.com/assets/platform_embed.js"></script>
|
24
|
+
|
25
|
+
<script>
|
26
|
+
yam.connect.actionButton({
|
27
|
+
container: "#embedded-follow",
|
28
|
+
network: "freescale.com",
|
29
|
+
action: "follow"
|
30
|
+
});
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<script>
|
34
|
+
yam.connect.embedFeed({
|
35
|
+
container: "#embedded-feed",
|
36
|
+
feedType: "open-graph",
|
37
|
+
config: {
|
38
|
+
header: false,
|
39
|
+
footer: false,
|
40
|
+
defaultGroupId: '#{options[:group_id]}',
|
41
|
+
promptText: '#{options[:prompt]}'
|
42
|
+
},
|
43
|
+
objectProperties: {
|
44
|
+
type: 'page',
|
45
|
+
url: '#{current_latest_url}'
|
46
|
+
}
|
47
|
+
});
|
48
|
+
</script>
|
49
|
+
END
|
50
|
+
end
|
51
|
+
end
|
52
|
+
include Yammer
|
53
|
+
|
54
|
+
# Helpers for the register diagrams
|
55
|
+
module RegisterHelpers
|
56
|
+
# Returns true if some portion of the given bits falls
|
57
|
+
# within the given range
|
58
|
+
def _bit_in_range?(bits, max, min)
|
59
|
+
upper = bits.position + bits.size - 1
|
60
|
+
lower = bits.position
|
61
|
+
!((lower > max) || (upper < min))
|
62
|
+
end
|
63
|
+
|
64
|
+
# Returns the number of bits from the given bits that
|
65
|
+
# fall within the given range
|
66
|
+
def _num_bits_in_range(bits, max, min)
|
67
|
+
upper = bits.position + bits.size - 1
|
68
|
+
lower = bits.position
|
69
|
+
[upper, max].min - [lower, min].max + 1
|
70
|
+
end
|
71
|
+
|
72
|
+
# Returns true if the given number is is the
|
73
|
+
# given range
|
74
|
+
def _index_in_range?(i, max, min)
|
75
|
+
!((i > max) || (i < min))
|
76
|
+
end
|
77
|
+
|
78
|
+
def _bit_rw(bits)
|
79
|
+
str = ''
|
80
|
+
if bits.readable?
|
81
|
+
str += 'readable'
|
82
|
+
else
|
83
|
+
str += 'not-readable'
|
84
|
+
end
|
85
|
+
if bits.writable?
|
86
|
+
str += ' writable'
|
87
|
+
else
|
88
|
+
str += ' not-writable'
|
89
|
+
end
|
90
|
+
str.strip
|
91
|
+
end
|
92
|
+
|
93
|
+
def _max_bit_in_range(bits, max, _min)
|
94
|
+
upper = bits.position + bits.size - 1
|
95
|
+
[upper, max].min - bits.position
|
96
|
+
end
|
97
|
+
|
98
|
+
def _min_bit_in_range(bits, _max, min)
|
99
|
+
lower = bits.position
|
100
|
+
[lower, min].max - bits.position
|
101
|
+
end
|
102
|
+
end
|
103
|
+
include RegisterHelpers
|
104
|
+
|
105
|
+
# Helpers for the test flow documentation
|
106
|
+
module TestFlowHelpers
|
107
|
+
def _test_to_local_link(test)
|
108
|
+
name = _test_name(test)
|
109
|
+
number = _test_number(test)
|
110
|
+
"<a href='##{name}_#{number}'>#{name}</a>"
|
111
|
+
end
|
112
|
+
|
113
|
+
def _test_name(test)
|
114
|
+
test[:flow][:name] || test[:instance].first[:name]
|
115
|
+
end
|
116
|
+
|
117
|
+
def _test_number(test)
|
118
|
+
flow = test[:flow]
|
119
|
+
flow[:number] || flow[:test_number] || flow[:tnum]
|
120
|
+
end
|
121
|
+
|
122
|
+
def _bin_number(test)
|
123
|
+
flow = test[:flow]
|
124
|
+
flow[:bin] || flow[:hard_bin] || flow[:hardbin] || flow[:soft_bin] || flow[:softbin]
|
125
|
+
end
|
126
|
+
|
127
|
+
def _sbin_number(test)
|
128
|
+
flow = test[:flow]
|
129
|
+
flow[:soft_bin] || flow[:softbin]
|
130
|
+
end
|
131
|
+
|
132
|
+
def _start_accordion(heading, _options = {})
|
133
|
+
@_accordion_index ||= 0
|
134
|
+
@_accordion_index += 1
|
135
|
+
<<-END
|
136
|
+
<div class="panel panel-default">
|
137
|
+
<a href="#_" class="expandcollapse btn btn-xs pull-right btn-default" state="0"><i class='fa fa-plus'></i></a>
|
138
|
+
<div class="panel-heading clickable" style="background:whitesmoke" data-toggle="collapse" data-parent="#blah2" href="#collapseAccordion#{@_accordion_index}">
|
139
|
+
<a class="no-underline">
|
140
|
+
#{heading}
|
141
|
+
</a>
|
142
|
+
</div>
|
143
|
+
<div id="collapseAccordion#{@_accordion_index}" class="panel-collapse collapse">
|
144
|
+
<div class="panel-body" markdown="1">
|
145
|
+
|
146
|
+
END
|
147
|
+
end
|
148
|
+
|
149
|
+
def _stop_accordion
|
150
|
+
<<-END
|
151
|
+
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
END
|
156
|
+
end
|
157
|
+
|
158
|
+
def _start_test_flow_table
|
159
|
+
if @_test_flow_table_open
|
160
|
+
''
|
161
|
+
else
|
162
|
+
@_test_flow_table_open = true
|
163
|
+
<<-END
|
164
|
+
<table class="table table-condensed table-bordered flow-table">
|
165
|
+
|
166
|
+
<thead>
|
167
|
+
<tr>
|
168
|
+
<th class="col1">Test</th>
|
169
|
+
<th class="col2">Number</th>
|
170
|
+
<th class="col3">HBin</th>
|
171
|
+
<th class="col3">SBin</th>
|
172
|
+
<th class="col5">Attributes</th>
|
173
|
+
<th class="col6">Description</th>
|
174
|
+
</tr>
|
175
|
+
</thead>
|
176
|
+
|
177
|
+
<tbody>
|
178
|
+
END
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def _stop_test_flow_table
|
183
|
+
if @_test_flow_table_open
|
184
|
+
@_test_flow_table_open = false
|
185
|
+
<<-END
|
186
|
+
|
187
|
+
</tbody>
|
188
|
+
</table>
|
189
|
+
END
|
190
|
+
else
|
191
|
+
''
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
include TestFlowHelpers
|
196
|
+
|
197
|
+
# Helpers for the searchable doc layout
|
198
|
+
module SearchableHelpers
|
199
|
+
def _doc_root_dir(options)
|
200
|
+
f = options[:root]
|
201
|
+
@_doc_root_dirs ||= {}
|
202
|
+
return @_doc_root_dirs[f] if @_doc_root_dirs[f]
|
203
|
+
unless File.exist?(f)
|
204
|
+
f = Pathname.new("#{Origen.root}/templates/web/#{f}")
|
205
|
+
unless f.exist?
|
206
|
+
fail "#{options[:root]} does not exist!"
|
207
|
+
end
|
208
|
+
end
|
209
|
+
f = Pathname.new(f) if f.is_a?(String)
|
210
|
+
@_doc_root_dirs[options[:root]] = f
|
211
|
+
end
|
212
|
+
|
213
|
+
def _resolve_tab(options)
|
214
|
+
tab = tab.to_s.downcase
|
215
|
+
active = false
|
216
|
+
if options[:tab]
|
217
|
+
options[:tab]
|
218
|
+
else
|
219
|
+
rel = options[:top_level_file].relative_path_from(_doc_root_dir(options)).sub_ext('').sub_ext('').to_s
|
220
|
+
rel.gsub(/(\/|\\)/, '_').downcase.to_sym
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
def _root_path(options)
|
225
|
+
root = Pathname.new("#{Origen.root}/templates/web")
|
226
|
+
_doc_root_dir(options).relative_path_from(root)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
include SearchableHelpers
|
230
|
+
end
|
231
|
+
include DocHelpers
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module OrigenDocHelpers
|
2
|
+
class DocInterface
|
3
|
+
include Origen::Tester::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
|