Sha256: 3c85e6f741a94005b941a0dca643f1d4789164a0e81e02c043ead4ccf06f8f1b

Contents?: true

Size: 1.67 KB

Versions: 62

Compression:

Stored size: 1.67 KB

Contents

module Origen
  class Generator
    class Flow
      attr_accessor :top_level

      def create(options = {}, &block)
        # Refresh the target to start all settings from scratch each time
        # This is an easy way to reset all registered values
        Origen.app.reload_target!
        Origen.tester.generating = :program
        # Make the top level flow globally available, this helps to assign test descriptions
        # to the correct flow whenever tests are instantiated from sub-flows
        if Origen.interface_loaded? && Origen.interface.top_level_flow
          sub_flow = true
          if Origen.tester.doc?
            Origen.interface.flow.start_section
          end
        else
          sub_flow = false
        end
        job.output_file_body = options.delete(:name).to_s if options[:name]
        if sub_flow
          interface = Origen.interface
          opts = Origen.generator.option_pipeline.pop || {}
          interface.instance_exec(opts, &block)
          if Origen.tester.doc?
            Origen.interface.flow.stop_section
          end
          interface.close(flow: true, sub_flow: true)
        else
          Origen.log.info "Generating... #{Origen.file_handler.current_file.basename}"
          interface = Origen.reset_interface(options)
          Origen.interface.set_top_level_flow
          Origen.interface.flow_generator.set_flow_description(Origen.interface.consume_comments)
          interface.instance_eval(&block)
          interface.close(flow: true)
        end
      end

      def reset
        Origen.interface.clear_top_level_flow if Origen.interface_loaded?
      end

      def job
        Origen.app.current_job
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
origen-0.7.13 lib/origen/generator/flow.rb
origen-0.7.12 lib/origen/generator/flow.rb
origen-0.7.11 lib/origen/generator/flow.rb
origen-0.7.10 lib/origen/generator/flow.rb
origen-0.7.9 lib/origen/generator/flow.rb
origen-0.7.8 lib/origen/generator/flow.rb
origen-0.7.7 lib/origen/generator/flow.rb
origen-0.7.6 lib/origen/generator/flow.rb
origen-0.7.5 lib/origen/generator/flow.rb
origen-0.7.4 lib/origen/generator/flow.rb
origen-0.7.3 lib/origen/generator/flow.rb
origen-0.7.2 lib/origen/generator/flow.rb
origen-0.7.1 lib/origen/generator/flow.rb
origen-0.7.0 lib/origen/generator/flow.rb
origen-0.6.12 lib/origen/generator/flow.rb
origen-0.6.11 lib/origen/generator/flow.rb
origen-0.6.10 lib/origen/generator/flow.rb
origen-0.6.9 lib/origen/generator/flow.rb
origen-0.6.8 lib/origen/generator/flow.rb
origen-0.6.7 lib/origen/generator/flow.rb