Module: Origen::Tester::Doc::Generator

Extended by:
ActiveSupport::Concern
Defined in:
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

Defined Under Namespace

Classes: Flow, FlowLine, Test, TestGroup, Tests

Instance Method Summary (collapse)

Instance Method Details

- (Object) at_flow_start

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



45
46
# File 'lib/origen/tester/doc/generator.rb', line 45

def at_flow_start
end

- (Object) at_run_start Also known as: reset_globals

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



49
50
51
52
53
# File 'lib/origen/tester/doc/generator.rb', line 49

def at_run_start
  flow.at_run_start
  @@tests = nil
  @@flows = nil
end

- (Object) doc_comments



110
111
112
# File 'lib/origen/tester/doc/generator.rb', line 110

def doc_comments
  @doc_comments ||= []
end

- (Object) doc_comments_capture(comment)



106
107
108
# File 'lib/origen/tester/doc/generator.rb', line 106

def doc_comments_capture(comment)
  doc_comments << "#{comment}"
end

- (Object) doc_comments_consume



114
115
116
117
118
# File 'lib/origen/tester/doc/generator.rb', line 114

def doc_comments_consume
  c = doc_comments
  doc_comments_discard
  c
end

- (Object) doc_comments_discard



120
121
122
# File 'lib/origen/tester/doc/generator.rb', line 120

def doc_comments_discard
  @doc_comments = []
end

- (Object) filter_source(source)

The source of all program files is passed in here before executing. This will replace all comments with a method call containing the comment so that they can be captured.



93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/origen/tester/doc/generator.rb', line 93

def filter_source(source) # :nodoc:
  src = ''
  source.split(/\r?\n/).each do |line|
    if line !~ /^\s*#-/ && line =~ /^\s*#(.*)/
      comment = Regexp.last_match[1].gsub("'", "\\\\'")
      src << "Origen.interface.doc_comments_capture('#{comment}')\n"
    else
      src << "#{line}\n"
    end
  end
  src
end

- (Object) flow(filename = nil)

Returns the current flow (as defined by the name of the current top level flow source file).

Pass in a filename argument to have a specific flow returned instead.

If the flow does not exist yet it will be created.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/origen/tester/doc/generator.rb', line 28

def flow(filename = nil)
  unless filename
    if Origen.file_handler.current_file
      filename = Origen.file_handler.current_file.basename('.rb').to_s
    else
      filename = 'anonymous'
    end
  end
  f = filename.to_sym
  return flows[f] if flows[f]
  p = Flow.new
  p.inhibit_output if Origen.interface.resources_mode?
  p.filename = f
  flows[f] = p
end

- (Object) flow_generators

Returns an array containing all flow generators. All Origen program generators must implement this method



82
83
84
85
86
87
88
# File 'lib/origen/tester/doc/generator.rb', line 82

def flow_generators
  g = []
  flows.each do |_name, sheet|
    g << sheet
  end
  g
end

- (Object) flows

Returns a hash containing all flows



63
64
65
# File 'lib/origen/tester/doc/generator.rb', line 63

def flows
  @@flows ||= {}
end

- (Object) sheet_generators

Returns an array containing all sheet generators where a sheet generator is a flow, test instance, patset or pat group sheet. All Origen program generators must implement this method



70
71
72
73
74
75
76
77
78
# File 'lib/origen/tester/doc/generator.rb', line 70

def sheet_generators # :nodoc:
  g = []
  [flows].each do |sheets|
    sheets.each do |_name, sheet|
      g << sheet
    end
  end
  g
end

- (Object) tests Also known as: test_instances

Returns a container for all generated tests.



57
58
59
# File 'lib/origen/tester/doc/generator.rb', line 57

def tests
  @@tests ||= Tests.new
end