Sha256: a5cbdf42d25872e34f3891efcf7f56b829ef770dc8818232420f97d50aae557c

Contents?: true

Size: 1.15 KB

Versions: 82

Compression:

Stored size: 1.15 KB

Contents

module Origen
  class Generator
    class Resources
      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
        sub_flow = @top_level
        @top_level = true unless @top_level
        job.output_file_body = options.delete(:name).to_s if options[:name]
        if sub_flow
          interface = Origen.interface
          interface.resources_mode do
            opts = Origen.generator.option_pipeline.pop || {}
            interface.instance_exec(opts, &block)
          end
          interface.close(sub_resource: true)
        else
          Origen.log.info "Generating... #{Origen.file_handler.current_file.basename}"
          interface = Origen.reset_interface(options)
          interface.resources_mode do
            interface.instance_eval(&block)
          end
          interface.close
        end
      end

      def reset
        @top_level = false
      end

      def job
        Origen.app.current_job
      end
    end
  end
end

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
origen-0.7.33 lib/origen/generator/resources.rb
origen-0.7.32 lib/origen/generator/resources.rb
origen-0.7.31 lib/origen/generator/resources.rb
origen-0.7.30 lib/origen/generator/resources.rb
origen-0.7.29 lib/origen/generator/resources.rb
origen-0.7.28 lib/origen/generator/resources.rb
origen-0.7.27 lib/origen/generator/resources.rb
origen-0.7.26 lib/origen/generator/resources.rb
origen-0.7.25 lib/origen/generator/resources.rb
origen-0.7.24 lib/origen/generator/resources.rb
origen-0.7.23 lib/origen/generator/resources.rb
origen-0.7.22 lib/origen/generator/resources.rb
origen-0.7.21 lib/origen/generator/resources.rb
origen-0.7.20 lib/origen/generator/resources.rb
origen-0.7.19 lib/origen/generator/resources.rb
origen-0.7.18 lib/origen/generator/resources.rb
origen-0.7.17 lib/origen/generator/resources.rb
origen-0.7.16 lib/origen/generator/resources.rb
origen-0.7.15 lib/origen/generator/resources.rb
origen-0.7.14 lib/origen/generator/resources.rb