Class: Origen::Tester::Ultraflex::Generator::Flow

Inherits:
Object
  • Object
show all
Includes:
Generator, Generator::FlowControlAPI
Defined in:
lib/origen/tester/ultraflex/generator/flow.rb

Constant Summary

TEMPLATE =
"#{Origen.top}/lib/origen/tester/ultraflex/generator/templates/flow.txt.erb"
OUTPUT_POSTFIX =
'flow'

Constants included from Generator::FlowControlAPI

Generator::FlowControlAPI::FLOW_METHODS, Generator::FlowControlAPI::RELATION_METHODS

Instance Method Summary (collapse)

Methods included from Generator::FlowControlAPI

#apply_current_context!, #apply_relationships, #at_run_start, #conditionally_deactivated?, #confirm_valid_context, #context_changed?, #current_context, #extract_flow_control_options!, #extract_relation_options!, #finalize, #find_by_id, #generate_unique_label, #identity_map, #if_all_failed, #if_all_passed, #if_any_failed, #if_any_passed, #if_enable, #if_failed, #if_job, #if_passed, #if_ran, #record_id, #replace_context_with_current, #save_context, #summarize_context, #track_relationships, #unless_job, #unless_ran

Methods included from Generator

#close, #collection, #collection=, #compiler, #current_dir, #dont_diff=, execute_source, #file_extension, #file_pipeline, #filename, #filename=, #finalize, #identity_map, #import, #inhibit_output, #on_close, #output_file, #output_inhibited?, #reference_file, #render, #set_flow_description, #stats, #to_be_written?, #write_from_template, #write_to_file

Instance Method Details

- (Object) add(type, options = {})



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 12

def add(type, options = {})
  ins = false
  options = save_context(options) if [:test, :cz].include?(type)
  branch_unless_enabled(options) do |options|
    ins = track_relationships(options) do |options|
      FlowLine.new(type, options)
    end
    collection << ins unless Origen.interface.resources_mode?
    if ins.test?
      c = Origen.interface.consume_comments
      unless Origen.interface.resources_mode?
        Origen.interface.descriptions.add_for_test_usage(ins.parameter, Origen.interface.top_level_flow, c)
      end
    else
      Origen.interface.discard_comments
    end
  end
  ins
end

- (Object) cz(instance, cz_setup, options = {})



41
42
43
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 41

def cz(instance, cz_setup, options = {})
  add(:cz, options.merge(parameter: instance, cz_setup: cz_setup))
end

- (Object) disable_flow_word(word, options = {})



61
62
63
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 61

def disable_flow_word(word, options = {})
  add(:disable_flow_word, options.merge(parameter: word))
end

- (Object) enable_flow_word(word, options = {})



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

def enable_flow_word(word, options = {})
  add(:enable_flow_word, options.merge(parameter: word))
end

- (Object) goto(label, options = {})



45
46
47
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 45

def goto(label, options = {})
  add(:goto, options.merge(parameter: label))
end

- (Object) logprint(message, options = {})



32
33
34
35
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 32

def logprint(message, options = {})
  message.gsub!(/\s/, '_')
  add(:logprint, options.merge(parameter: message))
end

- (Object) nop(options = {})



49
50
51
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 49

def nop(options = {})
  add(:nop, options.merge(parameter: nil))
end

- (Object) set_device(options = {})



53
54
55
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 53

def set_device(options = {})
  add(:set_device, options)
end

- (Object) skip(identifier = nil, options = {})



89
90
91
92
93
94
95
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 89

def skip(identifier = nil, options = {})
  identifier, options = nil, identifier if identifier.is_a?(Hash)
  identifier = generate_unique_label(identifier)
  goto(identifier, options)
  yield
  nop(label: identifier)
end

- (Object) start_flow_branch(identifier, options = {})



85
86
87
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 85

def start_flow_branch(identifier, options = {})
  goto(identifier, options)
end

- (Object) test(instance, options = {})



37
38
39
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 37

def test(instance, options = {})
  add(:test, options.merge(parameter: instance))
end

- (Object) unless_enable(word, options = {}) Also known as: unless_enabled

All tests generated will not run unless the given enable word is asserted.

This is specially implemented for Ultraflex since it does not have a native support for flow word not enabled. It will generate a goto branch around the tests contained with the block if the given flow word is enabled.



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/origen/tester/ultraflex/generator/flow.rb', line 71

def unless_enable(word, options = {})
  if options[:or]
    yield
  else
    @unless_enable_block = word
    options = options.merge(unless_enable: word)
    branch_unless_enabled(options.merge(_force_unless_enable: true)) do
      yield
    end
    @unless_enable_block = nil
  end
end