Class: Origen::Tester::Doc
- Inherits:
-
Object
show all
- Includes:
- Origen::Tester
- Defined in:
- lib/origen/tester/doc/doc.rb,
lib/origen/tester/doc/model.rb,
lib/origen/tester/doc/generator.rb,
lib/origen/tester/doc/generator/flow.rb,
lib/origen/tester/doc/generator/test.rb,
lib/origen/tester/doc/generator/tests.rb,
lib/origen/tester/doc/generator/flow_line.rb,
lib/origen/tester/doc/generator/test_group.rb
Overview
Tester model to generate test program documentation from your pattern
sources. This is intended to be a drop in replacement for existing testers
and instead of generating patterns or test program sheets it will generate
a document object which you can then render out via a template or manually.
Defined Under Namespace
Modules: Generator
Classes: Model
Instance Attribute Summary (collapse)
Attributes included from API
#comment_level, #generating, #includes, #inhibit_comments, #inhibit_vectors
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
#register_tester
Methods included from API
#any_clocks_running?, #clocks_running, #comment_char, #generating_pattern?, #generating_program?, #ignore_fails, #import_test_time, #inhibit_vectors_and_comments, #is_command_based?, #is_vector_based?, #j750?, #j750_hpt?, #name, #pat_extension, #pattern_footer, #pattern_header, #pins_need_toggling, #pop_running_clock, #program_comment_char, #push_running_clock, #slice_repeats, #step_comment_prefix, #ultraflex?, #update_running_clocks, #v93k?
Methods included from Timing
#before_timeset_change, #called_timesets, #count, #current_period_in_ns, #current_timeset, #cycles_to_ms, #cycles_to_time, #cycles_to_ts, #cycles_to_us, #delay, #max_repeat_loop, #ms_to_cycles, #ns_to_cycles, #s_to_cycles, #set_timeset, #timeset_changed, #us_to_cycles, #wait
#_render, #add_microcode_to_last_or_cycle, #before_write_pattern_line, #compressable_vector?, #current_pin_vals, #cycle_count, #dec_vec_count, #dont_compress, #dont_compress=, #expand_vector, #format, #format_pin_state, #format_vector, #get_pingroup, #inc_cycle_count, #inc_vec_count, #inhibit_pin, #inhibited_pins, #last_object, #last_vector, #multi_mode_optimize, #optimize, #ordered_pins, #ordered_pins_cache, #pingroup_map, #pipeline, #preset_next_vector, #push_comment, #push_microcode, #push_vector, #render, #render_body, #render_footer, #render_header, #render_template, #reset_cycle_count, #stage, #track_and_format_vector, #update_pin_from_formatted_state, #update_vector, #update_vector_pin_val, #vec_count, #vector_group_size, #vector_group_size=, #with_vector_group_size
Constructor Details
- (Doc) initialize(*_args)
Returns a new instance of Doc
19
20
21
22
23
|
# File 'lib/origen/tester/doc/doc.rb', line 19
def initialize(*_args)
@pat_extension = 'md'
@indent = 0
@snip_counters = []
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(_method, *_args, &_block)
Ignore any tester-specific methods
219
220
221
222
223
|
# File 'lib/origen/tester/doc/doc.rb', line 219
def method_missing(_method, *_args, &_block)
if block_given?
yield
end
end
|
Instance Attribute Details
- (Object) html_mode
Returns the value of attribute html_mode
13
14
15
|
# File 'lib/origen/tester/doc/doc.rb', line 13
def html_mode
@html_mode
end
|
Class Method Details
+ (Object) generate_program_model(files, options = {})
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
# File 'lib/origen/tester/doc/doc.rb', line 188
def self.generate_program_model(files, options = {})
options = {
action: :program,
return_model: true,
skip_diff: true
}.merge(options)
Origen.app.with_doc_tester do
Origen.target.temporary = options[:target] if options[:target]
Origen.app.load_target!
Origen.interface.reset_globals
options[:files] = files
Origen.file_handler.preserve_and_clear_state do
Origen.app.runner.launch(options)
end
end
model.target = Origen.target.name
model
end
|
207
208
209
|
# File 'lib/origen/tester/doc/doc.rb', line 207
def self.model
@model ||= Model.new
end
|
Instance Method Details
- (Object) annotate(msg, _options)
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/origen/tester/doc/doc.rb', line 86
def annotate(msg, _options)
unless @inhibit_comments
if html_mode
pc ''
lines = msg.split("\n")
leading_spaces = lines.first[/\A */].size
lines.each do |line|
pc line.gsub(/^.{#{leading_spaces}}/, '')
end
pc ''
end
end
end
|
- (Object) c1(msg, options = {})
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/origen/tester/doc/doc.rb', line 52
def c1(msg, options = {})
if generating_program?
Origen.interface.(msg)
else
unless @inhibit_comments
options = {
prefix: true
}.merge(options)
if @step_comment_on
open_text_block
if options[:prefix]
pc "# #{msg}"
else
pc "#{msg}"
end
end
end
end
end
|
- (Object) c2(msg, options = {})
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/origen/tester/doc/doc.rb', line 72
def c2(msg, options = {})
unless @inhibit_comments
options = {
prefix: true
}.merge(options)
open_text_block
if options[:prefix]
pc "# #{msg}"
else
pc "#{msg}"
end
end
end
|
- (Object) close_text_block
110
111
112
113
114
115
116
117
118
|
# File 'lib/origen/tester/doc/doc.rb', line 110
def close_text_block
if html_mode
if @text_block_open
pc '~~~'
pc ''
@text_block_open = false
end
end
end
|
- (Object) cycle(_options = {})
215
216
|
# File 'lib/origen/tester/doc/doc.rb', line 215
def cycle(_options = {})
end
|
- (Boolean) doc?
211
212
213
|
# File 'lib/origen/tester/doc/doc.rb', line 211
def doc?
true
end
|
- (Boolean) generate?
15
16
17
|
# File 'lib/origen/tester/doc/doc.rb', line 15
def generate?
html_mode
end
|
- (Object) next_accordion_counter
171
172
173
174
|
# File 'lib/origen/tester/doc/doc.rb', line 171
def next_accordion_counter
@accordion_counter ||= 0
@accordion_counter += 1
end
|
- (Object) open_text_block
100
101
102
103
104
105
106
107
108
|
# File 'lib/origen/tester/doc/doc.rb', line 100
def open_text_block
if html_mode
unless @text_block_open
pc ''
pc '~~~text'
@text_block_open = true
end
end
end
|
- (Object) pattern_name
120
121
122
|
# File 'lib/origen/tester/doc/doc.rb', line 120
def pattern_name
Origen.app.current_job.output_pattern_filename.gsub('.md', '')
end
|
- (Object) pattern_section(msg)
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# File 'lib/origen/tester/doc/doc.rb', line 135
def pattern_section(msg)
unless @inhibit_comments
if generating_program?
Origen.interface.flow.start_section(name: msg)
yield
Origen.interface.flow.stop_section
else
if html_mode
counter = next_accordion_counter
close_text_block
pc ''
pc "<div class=\"accordion-group\">"
pc "<div class=\"accordion-heading\">"
pc "<a class=\"accordion-toggle\" data-toggle=\"collapse\" data-parent=\"#accordion2\" href=\"#collapseComment#{counter}\">"
pc "#{msg}"
pc '</a>'
pc '</div>'
pc "<div id=\"collapseComment#{counter}\" class=\"accordion-body collapse\">"
pc "<div class=\"accordion-inner\" markdown=\"1\">"
yield
close_text_block
pc '</div>'
pc '</div>'
pc '</div>'
else
pc ''
pc "#{msg}"
pc ''
@indent += 4
yield
@indent -= 4
end
end
end
end
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/origen/tester/doc/doc.rb', line 34
def pc(msg)
if @snip_counters.last
if @snip_counters.last == 1
@snip_counters[@snip_counters.size - 1] = 0
msg = ' ...snipped'
elsif @snip_counters.last == 0
return
else
@snip_counters[@snip_counters.size - 1] -= 1
end
end
if html_mode
(msg)
else
Origen.log.info((' ' * @indent) + msg)
end
end
|
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/origen/tester/doc/doc.rb', line 124
def
end
|
- (Object) snip(number, _options = {})
Snip the number of comment lines generated by the contained block to the
number given, this is useful for keeping files sizes down and is typically
used to snip sections like downloading LRE code.
28
29
30
31
32
|
# File 'lib/origen/tester/doc/doc.rb', line 28
def snip(number, _options = {})
@snip_counters.push number + 1
yield
@snip_counters.pop
end
|
- (Object) ss(msg = nil)
176
177
178
179
180
181
182
183
184
185
186
|
# File 'lib/origen/tester/doc/doc.rb', line 176
def ss(msg = nil)
unless @inhibit_comments
@step_comment_on = true
if block_given?
yield
else
c2(msg)
end
@step_comment_on = false
end
end
|