origen_testers 0.19.0 → 0.19.2
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 +4 -4
- data/config/application.rb +34 -1
- data/config/version.rb +1 -1
- data/lib/origen_testers/flow.rb +1 -0
- data/lib/origen_testers/interface.rb +28 -0
- data/lib/origen_testers/pattern_compilers/v93k.rb +3 -1
- data/lib/origen_testers/smartest_based_tester/base.rb +14 -1
- data/lib/origen_testers/smartest_based_tester/base/test_methods/ac_tml.rb +10 -10
- data/lib/origen_testers/test/interface.rb +3 -0
- data/pattern/tester_overlay.rb +12 -1
- data/program/_erase.rb +1 -1
- data/program/components/_prb1_main.rb +3 -3
- data/program/test.rb +2 -2
- data/templates/origen_guides/pattern/common.md.erb +376 -0
- data/templates/origen_guides/pattern/creating.md.erb +133 -0
- data/templates/origen_guides/pattern/custom.md.erb +5 -0
- data/templates/origen_guides/pattern/documenting.md.erb +431 -0
- data/templates/origen_guides/pattern/introduction.md.erb +38 -0
- data/templates/origen_guides/pattern/j750.md.erb +10 -0
- data/templates/origen_guides/pattern/name.md.erb +511 -0
- data/templates/origen_guides/pattern/pins.md.erb +125 -0
- data/templates/origen_guides/pattern/registers.md.erb +300 -0
- data/templates/origen_guides/pattern/running.md.erb +105 -0
- data/templates/origen_guides/pattern/timing.md.erb +281 -0
- data/templates/origen_guides/pattern/ultraflex.md.erb +10 -0
- data/templates/origen_guides/pattern/v93k.md.erb +41 -0
- data/templates/origen_guides/program/code.md.erb +78 -0
- data/templates/origen_guides/program/custom.md.erb +5 -0
- data/templates/origen_guides/program/doc.md.erb +402 -0
- data/templates/origen_guides/program/flowapi.md.erb +249 -0
- data/templates/origen_guides/program/flows.md.erb +429 -0
- data/templates/origen_guides/program/generating.md.erb +97 -0
- data/templates/origen_guides/program/interface.md.erb +248 -0
- data/templates/origen_guides/program/introduction.md.erb +56 -0
- data/templates/origen_guides/program/j750.md.erb +514 -0
- data/templates/origen_guides/program/philosophy.md.erb +99 -0
- data/templates/origen_guides/program/resources.md.erb +141 -0
- data/templates/origen_guides/program/ultraflex.md.erb +5 -0
- data/templates/origen_guides/program/v93k.md.erb +456 -0
- data/templates/web/layouts/_guides.html.erb +10 -0
- data/templates/web/partials/_placeholder.md.erb +10 -0
- metadata +33 -5
@@ -0,0 +1,133 @@
|
|
1
|
+
% render "layouts/guides.html" do
|
2
|
+
|
3
|
+
Patterns are generated by regular Ruby files that should live within the <code>pattern</code>
|
4
|
+
directory - a sub-directory within there is fine and is in fact encouraged to help
|
5
|
+
keep things organized as the number of patterns increases.
|
6
|
+
However keep in mind that each pattern should be uniquely named - i.e. no other files of the
|
7
|
+
same name should live in
|
8
|
+
any of the sub-directories of <code>pattern</code>.
|
9
|
+
|
10
|
+
Each pattern file should have the following structure:
|
11
|
+
|
12
|
+
~~~ruby
|
13
|
+
Pattern.create do
|
14
|
+
# Pattern specific content goes here
|
15
|
+
end
|
16
|
+
~~~
|
17
|
+
|
18
|
+
#### Startup and Shutdown Sequences
|
19
|
+
|
20
|
+
Startup and shutdown sequences will generally be the same for all patterns and these should
|
21
|
+
be implemented by using the [callbacks](<%= path "guides/misc/callbacks" %>) that support
|
22
|
+
[pattern generation](<%= path "guides/misc/callbacks/#pattern_generation" %>).
|
23
|
+
|
24
|
+
Any options supplied to <code>Pattern.create</code> will be passed into the <code>startup</code> and
|
25
|
+
<code>shutdown</code> methods when they are called, thereby providing a mechanism for per-pattern
|
26
|
+
customization of the startup/shutdown sequences.
|
27
|
+
|
28
|
+
Here is an example of an SoC controller with some startup and shutdown callbacks implemented:
|
29
|
+
|
30
|
+
~~~ruby
|
31
|
+
class MyDeviceController
|
32
|
+
include Origen::Controller
|
33
|
+
|
34
|
+
def startup(options)
|
35
|
+
options = {
|
36
|
+
mode: :functional_test,
|
37
|
+
}.merge(options)
|
38
|
+
if options[:mode] == :functional_test
|
39
|
+
enter_functional_test_mode
|
40
|
+
elsif options[:mode] == :bist
|
41
|
+
enter_bist_test_mode
|
42
|
+
else
|
43
|
+
raise "Unknown mode requested - #{options[:mode]}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def shutdown(options)
|
48
|
+
options = {
|
49
|
+
reset: true,
|
50
|
+
}.merge(options)
|
51
|
+
reset_device if options[:reset]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
~~~
|
55
|
+
|
56
|
+
So by default this pattern will enter functional test mode at the start and reset the device at the end:
|
57
|
+
|
58
|
+
~~~ruby
|
59
|
+
Pattern.create do
|
60
|
+
# Pattern specific content goes here
|
61
|
+
end
|
62
|
+
~~~
|
63
|
+
|
64
|
+
This one will enter BIST mode instead at the start:
|
65
|
+
|
66
|
+
~~~ruby
|
67
|
+
Pattern.create(mode: :bist) do
|
68
|
+
# Pattern specific content goes here
|
69
|
+
end
|
70
|
+
~~~
|
71
|
+
|
72
|
+
and this one would exit without resetting the device:
|
73
|
+
|
74
|
+
~~~ruby
|
75
|
+
Pattern.create(mode: :bist, reset: false) do
|
76
|
+
# Pattern specific content goes here
|
77
|
+
end
|
78
|
+
~~~
|
79
|
+
|
80
|
+
<div class="alert alert-info">
|
81
|
+
<strong>Note</strong> - The top-level is guaranteed to be called first and last for the startup and shutdown
|
82
|
+
callbacks respectively. However the calling order of lower level startup/shutdown listeners is undefined, if
|
83
|
+
you have multiple and care about the order you should designate one as the master which will be called by Origen, it
|
84
|
+
should then co-ordinate calling any additional startup/shutdown methods as required.
|
85
|
+
</div>
|
86
|
+
|
87
|
+
#### The Golden Rules for Building Maintainable Patterns
|
88
|
+
|
89
|
+
Origen provides a framework in which you can build very complex patterns that remain
|
90
|
+
easy to maintain, but as with any tool it is also possible to use it to create something
|
91
|
+
with which to hang yourself!
|
92
|
+
|
93
|
+
In order to avoid going down a path that will lead to an unmaintainable mess, it is
|
94
|
+
strongly recommended that the following rules are observed:
|
95
|
+
|
96
|
+
* Patterns should not talk to the current tester object directly
|
97
|
+
* Patterns should not attempt to control pin states
|
98
|
+
* Patterns should not attempt to access registers directly
|
99
|
+
|
100
|
+
Probably the most tempting one to break is the last one, however
|
101
|
+
generally manipulating register states outside of the owning model is a sign of poor
|
102
|
+
application design and breaking the encapsulation that should be provided by a model
|
103
|
+
representing a silicon module.
|
104
|
+
Instead the model's controller should provide an external interface which would remain constant even if the
|
105
|
+
internal operation of a given operation changes significantly from one silicon revision to the next.
|
106
|
+
See the [Controller guides](<%= path "guides/controllers/introduction" %>) for more.
|
107
|
+
|
108
|
+
If the above rules are followed pattern source files should typically be very small and should
|
109
|
+
generally only call a handful of methods on the target object(s), here are a few examples:
|
110
|
+
|
111
|
+
~~~ruby
|
112
|
+
# Pattern to measure the output of the Vreg module
|
113
|
+
Pattern.create do
|
114
|
+
$dut.vreg.measure
|
115
|
+
end
|
116
|
+
~~~
|
117
|
+
|
118
|
+
~~~ruby
|
119
|
+
# Pattern to measure the output of the Vreg module for a specific setting
|
120
|
+
Pattern.create do
|
121
|
+
$dut.vreg.measure(setting: 12)
|
122
|
+
end
|
123
|
+
~~~
|
124
|
+
|
125
|
+
~~~ruby
|
126
|
+
# Pattern to program a checkerboard and then read it
|
127
|
+
Pattern.create do
|
128
|
+
$dut.nvm.program(pattern: :ckbd)
|
129
|
+
$dut.nvm.read(pattern: :ckbd)
|
130
|
+
end
|
131
|
+
~~~
|
132
|
+
|
133
|
+
% end
|
@@ -0,0 +1,431 @@
|
|
1
|
+
% render "layouts/guides.html" do
|
2
|
+
|
3
|
+
Origen encourages an agile approach to documentation and pattern generation is
|
4
|
+
no exception.
|
5
|
+
Tools are provided to create test patterns that are self-documenting and by taking
|
6
|
+
a little care you can produce very detailed (and of course 100% accurate) documentation
|
7
|
+
of your test patterns for free.
|
8
|
+
|
9
|
+
The pattern generation command has the following switches:
|
10
|
+
|
11
|
+
~~~text
|
12
|
+
origen g bistcom # Generate a regular pattern
|
13
|
+
origen g bistcom --doc # Output documentation of that pattern to the terminal
|
14
|
+
origen g bistcom --html # Generate pre-formatted HTML documentation for inclusion in a web page
|
15
|
+
~~~
|
16
|
+
|
17
|
+
The following methods are available to control the documentation output from the pattern
|
18
|
+
generator...
|
19
|
+
|
20
|
+
#### Debug Documentation
|
21
|
+
|
22
|
+
Comments that may help with debug of patterns on the tester can be injected into
|
23
|
+
the pattern via the <code>cc</code> method, as with all methods related to
|
24
|
+
pattern documentation this is globally available.
|
25
|
+
|
26
|
+
~~~ruby
|
27
|
+
cc "Entering test mode now"
|
28
|
+
test.mode.write!(RAMBIST_MODE)
|
29
|
+
reset!
|
30
|
+
~~~
|
31
|
+
|
32
|
+
The method argument is a regular string and dynamic segments can be embedded and
|
33
|
+
formatted using any regular Ruby.
|
34
|
+
|
35
|
+
~~~ruby
|
36
|
+
delay_cycles = 100
|
37
|
+
cc "Wait for #{delay_cycles} cycles for the mode to latch"
|
38
|
+
|
39
|
+
address = 0x12
|
40
|
+
cc "Set the target address to: 0x%04X" % address
|
41
|
+
~~~
|
42
|
+
|
43
|
+
This will produce pattern output that looks like this:
|
44
|
+
|
45
|
+
~~~text
|
46
|
+
// Wait for 100 cycles for the mode to latch
|
47
|
+
// Set the target address to 0x0012
|
48
|
+
~~~
|
49
|
+
|
50
|
+
<code>c1</code> is an alias for <code>cc</code>.
|
51
|
+
|
52
|
+
These low level comments will appear in the pattern but they will not be included
|
53
|
+
when a document of the pattern is generated.
|
54
|
+
|
55
|
+
A <code>c2</code> method is available to elevate the importance of a subset of
|
56
|
+
these low level comments
|
57
|
+
such that they will be included in generated documentation.
|
58
|
+
|
59
|
+
~~~ruby
|
60
|
+
cc "You won't see me in the docs"
|
61
|
+
c1 "Or me"
|
62
|
+
c2 "But you will see me!"
|
63
|
+
~~~
|
64
|
+
|
65
|
+
#### Documenting Major Steps
|
66
|
+
|
67
|
+
Major steps in the pattern can be highlighted using the <code>ss</code> method.
|
68
|
+
|
69
|
+
~~~ruby
|
70
|
+
ss "Enter RAM BIST mode"
|
71
|
+
|
72
|
+
# A block form is also available
|
73
|
+
ss do
|
74
|
+
vdd_core = 1.7
|
75
|
+
cc "Enter RAM BIST mode with the following options:"
|
76
|
+
cc " Vdd core - #{vdd_core}v"
|
77
|
+
end
|
78
|
+
~~~
|
79
|
+
|
80
|
+
This will produce the following output in the pattern:
|
81
|
+
|
82
|
+
~~~text
|
83
|
+
// #######################################################################
|
84
|
+
// # Enter RAM BIST mode
|
85
|
+
// #######################################################################
|
86
|
+
|
87
|
+
// #######################################################################
|
88
|
+
// # Enter RAM BIST mode with the following options:
|
89
|
+
// # Vdd core - 1.7v
|
90
|
+
// #######################################################################
|
91
|
+
~~~
|
92
|
+
|
93
|
+
Any comments defined in this way are considered more important than the regular
|
94
|
+
<code>cc</code> comments and they will be automatically included in the
|
95
|
+
generated documentation.
|
96
|
+
|
97
|
+
#### Documenting Structure
|
98
|
+
|
99
|
+
When presenting documentation it is useful to know something about the structure
|
100
|
+
of the pattern, this allows vectors to be grouped into sections like 'startup',
|
101
|
+
'shutdown', etc.
|
102
|
+
|
103
|
+
Such structure can be described using the <code>pp</code> method:
|
104
|
+
|
105
|
+
~~~ruby
|
106
|
+
pp "Startup" do
|
107
|
+
$dut.enter_ram_bist_mode
|
108
|
+
$dut.ram.configure_for_test
|
109
|
+
end
|
110
|
+
|
111
|
+
def enter_ram_bist_mode
|
112
|
+
pp "Enter RAM BIST mode" do
|
113
|
+
# Mode entry code here...
|
114
|
+
end
|
115
|
+
end
|
116
|
+
~~~
|
117
|
+
|
118
|
+
This would produce comments in the pattern that look like this:
|
119
|
+
|
120
|
+
~~~text
|
121
|
+
// #######################################################################
|
122
|
+
// # Startup
|
123
|
+
// #######################################################################
|
124
|
+
|
125
|
+
// #######################################################################
|
126
|
+
// # Enter RAM BIST mode
|
127
|
+
// #######################################################################
|
128
|
+
~~~
|
129
|
+
|
130
|
+
However this difference vs. the <code>ss</code> method is that information about
|
131
|
+
the structure has been provided - it can be determined that the enter RAM bist
|
132
|
+
section is a sub-section of the wider startup sequence.
|
133
|
+
|
134
|
+
This comes into play when the pattern documentation is generated as HTML,
|
135
|
+
now we will see something like this (click to expand):
|
136
|
+
|
137
|
+
<div class="panel-group">
|
138
|
+
<div class="panel panel-default">
|
139
|
+
<div class="panel-heading clickable" data-toggle="collapse" data-parent="#panel2" href="#collapseComment1">
|
140
|
+
<a class="no-underline">
|
141
|
+
Startup
|
142
|
+
</a>
|
143
|
+
</div>
|
144
|
+
<div id="collapseComment1" class="panel-collapse collapse">
|
145
|
+
<div class="panel-body" markdown="1">
|
146
|
+
|
147
|
+
<div class="panel panel-default">
|
148
|
+
<div class="panel-heading clickable" data-toggle="collapse" data-parent="#panel2" href="#collapseComment2">
|
149
|
+
<a class="no-underline">
|
150
|
+
Enter RAM BIST mode
|
151
|
+
</a>
|
152
|
+
</div>
|
153
|
+
<div id="collapseComment2" class="panel-collapse collapse">
|
154
|
+
<div class="panel-body" markdown="1">
|
155
|
+
|
156
|
+
~~~text
|
157
|
+
# Some comments generated by the RAM BIST entry sequence
|
158
|
+
~~~
|
159
|
+
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
#### Adding Annotations
|
169
|
+
|
170
|
+
Sometimes it will be helpful to add some annotations to describe what sections
|
171
|
+
of the pattern are doing, this can be done via the <code>annotate</code>
|
172
|
+
method.
|
173
|
+
|
174
|
+
Any annotations will not be output in the actual pattern but will be included
|
175
|
+
in generated documentation.
|
176
|
+
|
177
|
+
Here is the above example with some annotations added:
|
178
|
+
|
179
|
+
~~~ruby
|
180
|
+
pp "Startup" do
|
181
|
+
annotate "Perform startup operations that are common to all patterns."
|
182
|
+
$dut.enter_ram_bist_mode
|
183
|
+
$dut.ram.configure_for_test
|
184
|
+
end
|
185
|
+
|
186
|
+
def enter_ram_bist_mode
|
187
|
+
pp "Enter RAM BIST mode" do
|
188
|
+
|
189
|
+
annotate <<-END
|
190
|
+
This is an example of a multi-line annotation. Anything you write here
|
191
|
+
will be parsed as markdown, so you can do things like:
|
192
|
+
|
193
|
+
* Create bullet
|
194
|
+
* Lists
|
195
|
+
|
196
|
+
~~~ruby
|
197
|
+
# Embed some code examples
|
198
|
+
$dut.enter_ram_bist_mode
|
199
|
+
~~~
|
200
|
+
|
201
|
+
Or create [links](http://origen.freescale.net)
|
202
|
+
END
|
203
|
+
|
204
|
+
# Mode entry code here...
|
205
|
+
end
|
206
|
+
end
|
207
|
+
~~~
|
208
|
+
|
209
|
+
This would produce the following snippet of documentation:
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<div class="panel-group">
|
214
|
+
<div class="panel panel-default">
|
215
|
+
<div class="panel-heading clickable" data-toggle="collapse" data-parent="#panel2" href="#collapseComment3">
|
216
|
+
<a class="no-underline">
|
217
|
+
Startup
|
218
|
+
</a>
|
219
|
+
</div>
|
220
|
+
<div id="collapseComment3" class="panel-collapse collapse">
|
221
|
+
<div class="panel-body" markdown="1">
|
222
|
+
|
223
|
+
Perform startup operations that are common to all patterns.
|
224
|
+
|
225
|
+
<div class="panel panel-default">
|
226
|
+
<div class="panel-heading clickable" data-toggle="collapse" data-parent="#panel2" href="#collapseComment4">
|
227
|
+
<a class="no-underline">
|
228
|
+
Enter RAM BIST mode
|
229
|
+
</a>
|
230
|
+
</div>
|
231
|
+
<div id="collapseComment4" class="panel-collapse collapse">
|
232
|
+
<div class="panel-body" markdown="1">
|
233
|
+
|
234
|
+
This is an example of a multi-line annotation. Anything you write here
|
235
|
+
will be parsed as markdown, so you can do things like:
|
236
|
+
|
237
|
+
* Create bullet
|
238
|
+
* Lists
|
239
|
+
|
240
|
+
~~~ruby
|
241
|
+
# Embed some code examples
|
242
|
+
$dut.enter_ram_bist_mode
|
243
|
+
~~~
|
244
|
+
|
245
|
+
Or create [links](http://origen.freescale.net)
|
246
|
+
|
247
|
+
~~~text
|
248
|
+
# Some comments generated by the RAM BIST entry sequence
|
249
|
+
~~~
|
250
|
+
|
251
|
+
</div>
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
</div>
|
257
|
+
</div>
|
258
|
+
|
259
|
+
|
260
|
+
#### Summarizing Long Sections
|
261
|
+
|
262
|
+
Sometimes it is not necessary to list out every comment or operation when documenting
|
263
|
+
a pattern. For example if the pattern downloads some functional code to be executing
|
264
|
+
on the chip it is not really necessary to include the entire code download in the
|
265
|
+
pattern document.
|
266
|
+
|
267
|
+
For these scenarios a <code>snip</code> method is available which will output the
|
268
|
+
given number of documentation lines and then enter a message to indicate that
|
269
|
+
the remainder of the output has been snipped for efficiency.
|
270
|
+
|
271
|
+
Here is an example of how to use it, here the comments generated by the contained
|
272
|
+
section will be limited to 10 lines:
|
273
|
+
|
274
|
+
~~~ruby
|
275
|
+
snip 10 do
|
276
|
+
# Download some verbose LRE code here
|
277
|
+
end
|
278
|
+
~~~
|
279
|
+
|
280
|
+
#### Pattern Headers
|
281
|
+
|
282
|
+
When you generate a pattern, you'll notice the top section contains some useful information, such as the user that generated the pattern, a
|
283
|
+
timestamp, the current environment, version of the application, the gems used, etc. This section is called the <code>pattern header</code> and may look something
|
284
|
+
like this:
|
285
|
+
|
286
|
+
~~~
|
287
|
+
// ***************************************************************************
|
288
|
+
// GENERATED:
|
289
|
+
// Time: 24-Jun-2018 10:06AM
|
290
|
+
// By: coreyeng
|
291
|
+
// Mode: debug
|
292
|
+
// Command: origen g iterator_postfix_test_x_bx -t debug.rb
|
293
|
+
// ***************************************************************************
|
294
|
+
// ENVIRONMENT:
|
295
|
+
// Application
|
296
|
+
// Source: git@github.com:Origen-SDK/origen.git
|
297
|
+
// Version: 0.33.1
|
298
|
+
// Branch: fixes(c4e8e1d0db0) (+local edits)
|
299
|
+
// Origen
|
300
|
+
// Source: https://github.com/Origen-SDK/origen
|
301
|
+
// Version: 0.33.1
|
302
|
+
// Plugins
|
303
|
+
// atp: 1.1.0
|
304
|
+
// origen_core_support: 0.2.3
|
305
|
+
// origen_debuggers: 0.6.0
|
306
|
+
// origen_doc_helpers: 0.5.2
|
307
|
+
// origen_testers: 0.16.1
|
308
|
+
// origen_updater: 0.7.0
|
309
|
+
// ***************************************************************************
|
310
|
+
~~~
|
311
|
+
|
312
|
+
The pattern header can also serve as place for the application, current plugin, or other shared plugins, to add specific comments that relate to
|
313
|
+
how that pattern was generated or how it should be used.
|
314
|
+
|
315
|
+
Three [configuration attributes](<%= path "guides/plugins/app/" %>)
|
316
|
+
exist that will inject additional comments into the pattern header: <code>shared_pattern_header</code>, <code>application_pattern_header</code>,
|
317
|
+
and <code>current_plugin_pattern_header</code>.
|
318
|
+
|
319
|
+
These configuration attributes should be <code>blocks</code> that accept an <code>options hash</code> and return either a <code>String</code>,
|
320
|
+
<code>Array of Strings</code>, or another <code>block</code>. <code>Strings</code> and <code>Arrays</code> will have the formatting handled
|
321
|
+
for you, but <code>blocks</code> can handle the formatting themselves and can provide custom header comment formatting.
|
322
|
+
|
323
|
+
Assume we have two plugins, <code>plugin1</code> and <code>plugin2</code> that are each needed to generate a pattern located in the
|
324
|
+
application <code>my_app</code>. With <u>no plugin set</u> and with the configuration attributes set as follows:
|
325
|
+
|
326
|
+
~~~ruby
|
327
|
+
# plugin1/config/application.rb
|
328
|
+
|
329
|
+
config.shared_pattern_header do
|
330
|
+
"Hi from shared #{Origen.app!.name}!"
|
331
|
+
end
|
332
|
+
|
333
|
+
config.current_plugin_pattern_header do
|
334
|
+
"Hi from current plugin: #{Origen.app!.name}!"
|
335
|
+
end
|
336
|
+
|
337
|
+
# plugin2/config/application.rb
|
338
|
+
|
339
|
+
config.shared_pattern_header do
|
340
|
+
"Hi from shared #{Origen.app!.name}!"
|
341
|
+
end
|
342
|
+
|
343
|
+
config.current_plugin_pattern_header do
|
344
|
+
"Hi from current plugin: #{Origen.app!.name}!"
|
345
|
+
end
|
346
|
+
|
347
|
+
# my_app/config/application.rb
|
348
|
+
|
349
|
+
config.shared_pattern_header do
|
350
|
+
"Hi from application #{Origen.app!.name}!"
|
351
|
+
end
|
352
|
+
~~~
|
353
|
+
|
354
|
+
generating a pattern, will yield the following appended to the pattern header:
|
355
|
+
|
356
|
+
~~~
|
357
|
+
// ***************************************************************************
|
358
|
+
// Header Comments From Shared Plugins:
|
359
|
+
// Header Comments From Shared Plugin: plugin1:
|
360
|
+
// Hi from shared plugin1!
|
361
|
+
// Header Comments From Shared Plugin: plugin2:
|
362
|
+
// Hi from shared plugin2!
|
363
|
+
// ***************************************************************************
|
364
|
+
// Header Comments From Application: my_app:
|
365
|
+
// Hi from application my_app!
|
366
|
+
// ***************************************************************************
|
367
|
+
~~~
|
368
|
+
|
369
|
+
You'll notice here that there's no <code>current_plugin_pattern_header</code> printed. This will be printed when
|
370
|
+
the current plugin is set to a plugin that has this configuration attribute. Setting the current plugin to
|
371
|
+
<code>plugin1</code>, you'll now get both shared headers, the current plugin's header, and the application header:
|
372
|
+
|
373
|
+
~~~
|
374
|
+
// ***************************************************************************
|
375
|
+
// Header Comments From Shared Plugins:
|
376
|
+
// Header Comments From Shared Plugin: plugin1:
|
377
|
+
// Hi from shared plugin1!
|
378
|
+
// Header Comments From Shared Plugin: plugin2:
|
379
|
+
// Hi from shared plugin2!
|
380
|
+
// ***************************************************************************
|
381
|
+
// Header Comments From The Current Plugin: plugin1:
|
382
|
+
// Hi from current plugin plugin1!
|
383
|
+
// ***************************************************************************
|
384
|
+
// Header Comments From Application: my_app:
|
385
|
+
// Hi from application my_app!
|
386
|
+
// ***************************************************************************
|
387
|
+
~~~
|
388
|
+
|
389
|
+
As previously said, you can provide either a <code>block, proc, or lambda</code> (anything that responds to <code>call</code> will work) and use
|
390
|
+
<code>cc, ss, c2</code>, etc. to handle arbitrary headers or formatting. For example, changing <code>shared_pattern_header</code> in <code>plugin2</code>:
|
391
|
+
|
392
|
+
~~~ruby
|
393
|
+
# plugin2/config/application.rb
|
394
|
+
|
395
|
+
config.shared_pattern_header do
|
396
|
+
proc do
|
397
|
+
c2 "Hi from block in #{Origen.app!.name}"
|
398
|
+
end
|
399
|
+
end
|
400
|
+
~~~
|
401
|
+
|
402
|
+
Will show the following in the pattern header:
|
403
|
+
|
404
|
+
~~~
|
405
|
+
// ***************************************************************************
|
406
|
+
// Header Comments From Shared Plugins:
|
407
|
+
// Header Comments From Shared Plugin: plugin1:
|
408
|
+
// Hi from shared plugin1!
|
409
|
+
// Header Comments From Shared Plugin: plugin2:
|
410
|
+
// Hi from block in plugin2!
|
411
|
+
// ***************************************************************************
|
412
|
+
// Header Comments From The Current Plugin: plugin1:
|
413
|
+
// Hi from current plugin plugin1!
|
414
|
+
// ***************************************************************************
|
415
|
+
// Header Comments From Application: my_app:
|
416
|
+
// Hi from application my_app!
|
417
|
+
// ***************************************************************************
|
418
|
+
~~~
|
419
|
+
|
420
|
+
<div class ="alert alert-info" role="alert">
|
421
|
+
<strong>Info:</strong> Although the guides here show an <code>option hash</code>, there are currently no options <i>actually</i> being passed in, i.e., its just
|
422
|
+
an empty hash. This is only because this is a new feature, and by using an options hash here, future versions of Origen will be able to add any options that should
|
423
|
+
go to the pattern header without affecting the method prototype.
|
424
|
+
</div>
|
425
|
+
|
426
|
+
<div class="alert alert-warning" role="alert">
|
427
|
+
<strong>Deprecated:</strong> You may see <code>config.pattern_header</code> in some legacy applications. <code>config.pattern_header</code> is limited to only the
|
428
|
+
current plugin and must handle formatting itself. This is now deprecated but is left in for legacy purposes.
|
429
|
+
</div>
|
430
|
+
|
431
|
+
% end
|