Class: Origen::Application

Inherits:
Object show all
Includes:
Users
Defined in:
lib/origen/application.rb,
lib/origen/application/lsf.rb,
lib/origen/application/runner.rb,
lib/origen/application/target.rb,
lib/origen/application/plugins.rb,
lib/origen/application/release.rb,
lib/origen/application/deployer.rb,
lib/origen/application/statistics.rb,
lib/origen/application/environment.rb,
lib/origen/application/lsf_manager.rb,
lib/origen/application/configuration.rb,
lib/origen/application/plugins_manager.rb,
lib/origen/application/version_tracker.rb,
lib/origen/application/workspace_manager.rb,
lib/origen/application/command_dispatcher.rb

Overview

In Origen v2 this class was introduced to formally co-ordinate application level configuration of Origen.

Configuration

See Origen::Application::Configuration for the available options.

Defined Under Namespace

Classes: CommandDispatcher, Configuration, Deployer, Environment, LSF, LSFManager, Plugins, PluginsManager, RakeLoader, Release, Runner, Statistics, Target, VersionTracker, WorkspaceManager

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Users

#admins, #app_users, #current_user

Instance Attribute Details

#current_jobObject

Returns the value of attribute current_job.



26
27
28
# File 'lib/origen/application.rb', line 26

def current_job
  @current_job
end

#nameObject

Returns the name of the given application, this is the name that will be used to refer to the application when it is used as a plugin



425
426
427
# File 'lib/origen/application.rb', line 425

def name
  @name
end

#namespaceObject

Returns the namespace used by the application as a string



175
176
177
# File 'lib/origen/application.rb', line 175

def namespace
  @namespace
end

Class Method Details

.inherited(base) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/origen/application.rb', line 31

def inherited(base)
  # Somehow using the old import system and version file format we can get in here when
  # loading the version, this can be removed in future when the imports API is retired
  unless caller[0] =~ /version.rb.*/
    root = Pathname.new(caller[0].sub(/(\\|\/)?config(\\|\/)application.rb.*/, '')).realpath
    app = base.instance
    app.root = root.to_s
    Origen.register_application(app)
    app.add_lib_to_load_path!
  end
end

.instanceObject



43
44
45
# File 'lib/origen/application.rb', line 43

def instance
  @instance ||= new
end

.respond_to?(*args) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/origen/application.rb', line 47

def respond_to?(*args)
  super || instance.respond_to?(*args)
end

Instance Method Details

#add_callback_listener(obj) ⇒ Object



531
532
533
# File 'lib/origen/application.rb', line 531

def add_callback_listener(obj)
  dynamic_resource(:callback_listeners, [], adding: true) << obj
end

#add_lib_to_load_path!Object

This method is called just after an application inherits from Origen::Application, allowing the developer to load classes in lib and use them during application configuration.

class MyApplication < Origen::Application
  require "my_backend" # in lib/my_backend
  config.i18n.backend = MyBackend
end


767
768
769
770
771
# File 'lib/origen/application.rb', line 767

def add_lib_to_load_path! #:nodoc:
  [root.join('lib'), root.join('vendor', 'lib')].each do |path|
    $LOAD_PATH.unshift(path.to_s) if File.exist?(path) && !$LOAD_PATH.include?(path.to_s)
  end
end

#add_persistant_callback_listener(obj) ⇒ Object



535
536
537
538
539
# File 'lib/origen/application.rb', line 535

def add_persistant_callback_listener(obj)
  @persistant_callback_listeners ||= []
  @persistant_callback_listeners << obj
  @persistant_callback_listeners.uniq!
end

#add_pin_to_pin_map(id, pin) ⇒ Object



586
587
588
589
590
591
592
593
594
# File 'lib/origen/application.rb', line 586

def add_pin_to_pin_map(id, pin)
  # If being added during target load...
  if @load_event
    pin_map[id] = pin
  # Being added late in the process...
  else
    @transient_resources[:pin_map][id] = pin
  end
end

#add_pingroup_to_pingroup_map(id, pins) ⇒ Object



600
601
602
603
604
605
606
607
608
# File 'lib/origen/application.rb', line 600

def add_pingroup_to_pingroup_map(id, pins)
  # If being added during target load...
  if @load_event
    pingroup_map[id] = pins
  # Being added late in the process...
  else
    @transient_resources[:pingroup_map][id] = pins
  end
end

#add_toplevel_listener(obj) ⇒ Object



541
542
543
544
545
546
547
548
# File 'lib/origen/application.rb', line 541

def add_toplevel_listener(obj)
  if Origen.top_level
    puts "Attempt to set an instance of #{obj.class} as the top level when there is already an instance of #{Origen.top_level.class} defined as the top-level!"
    fail 'Only one object that include the Origen::TopLevel module can be instantiated per target!'
  end
  $dut = obj
  dynamic_resource(:toplevel_listeners, [], adding: true) << obj
end

#author(version = Origen.app.version.prefixed) ⇒ Object

Returns the author (committer) for the current or given application version

If the user can be found in the directory then a user object will be returned, otherwise the name will be returned as a String



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/origen/application.rb', line 347

def author(version = Origen.app.version.prefixed)
  version = VersionString.new(version)
  version = version.prefixed if version.semantic?
  capture = false
  File.readlines("#{Origen.root}/doc/history").each do |line|
    line = line.strip
    if capture
      if capture && line =~ /^#+ by (.*) on (.*(AM|PM))/
        user = Origen.fsl.find_by_name(Regexp.last_match(1))
        return user if user
        return Regexp.last_match(1)
      end
    else
      if line =~ /Tag:/
        line = line.gsub('\\', '')
        if line =~ /^#+ Tag: #{version}$/ ||
           line =~ />Tag: #{version}</
          capture = true
        end
      end
    end
  end
  nil
end

#branch(version = Origen.app.version.prefixed) ⇒ Object Also known as: selector

Returns the branch for the current or given application version



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/origen/application.rb', line 373

def branch(version = Origen.app.version.prefixed)
  version = VersionString.new(version)
  version = version.prefixed if version.semantic?
  capture = false
  File.readlines("#{Origen.root}/doc/history").each do |line|
    line = line.strip
    if capture
      if capture && line =~ /^#+ .*(Selector|Branch): '(.*)'/
        return Regexp.last_match(2).gsub('\\', '')
      end
    else
      if line =~ /Tag:/
        line = line.gsub('\\', '')
        if line =~ /^#+ Tag: #{version}$/ ||
           line =~ />Tag: #{version}</
          capture = true
        end
      end
    end
  end
  nil
end

#callback_listenersObject



516
517
518
519
520
521
# File 'lib/origen/application.rb', line 516

def callback_listeners
  current = Origen.app.plugins.current
  applications = [self]
  applications << current if current
  applications + instantiated_callback_listeners
end

#clear_dynamic_resources(type = :transient) ⇒ Object



740
741
742
743
744
745
746
747
# File 'lib/origen/application.rb', line 740

def clear_dynamic_resources(type = :transient)
  @top_level = nil
  if type == :transient
    @transient_resources = nil
  else
    @static_resources = nil
  end
end

#configObject



419
420
421
# File 'lib/origen/application.rb', line 419

def config
  @config ||= Configuration.new(self)
end

#contributorsObject



409
410
411
412
413
414
415
416
417
# File 'lib/origen/application.rb', line 409

def contributors
  c = []
  File.readlines("#{Origen.root}/doc/history").each do |line|
    if line =~ /^#+ by (.*) on /
      c << Regexp.last_match(1)
    end
  end
  c.uniq
end

#current?Boolean

Returns true if the given application instance is the current top level application

Returns:

  • (Boolean)


211
212
213
# File 'lib/origen/application.rb', line 211

def current?
  Origen.app == self
end

#current_plugin?Boolean

Returns true if the given application instance is the current plugin

Returns:

  • (Boolean)


217
218
219
# File 'lib/origen/application.rb', line 217

def current_plugin?
  Origen.app.plugins.current == self
end

#dbObject



480
481
482
# File 'lib/origen/application.rb', line 480

def db
  @db ||= Database::KeyValueStores.new(self)
end

#deployerObject



460
461
462
# File 'lib/origen/application.rb', line 460

def deployer
  @deployer ||= Deployer.new
end

#dynamic_resource(name, default, options = {}) ⇒ Object

Enable for debugging to see what the currently tracked objects are def object_store

[@load_event, @static_resources, @transient_resources]

end



713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
# File 'lib/origen/application.rb', line 713

def dynamic_resource(name, default, options = {})
  @static_resources ||= {}
  @transient_resources ||= {}
  if @load_event == :static ||
     (!@load_event && options[:adding])
    if options[:set]
      @static_resources[name] = default
    else
      @static_resources[name] ||= default
    end
  elsif @load_event == :transient
    if options[:set]
      @transient_resources[name] = default
    else
      @transient_resources[name] ||= default
    end
  else
    static = @static_resources[name] ||= default
    transient = @transient_resources[name] ||= default
    if static.respond_to?('+')
      static + transient
    else
      static.merge(transient)
    end
  end
end

#environmentObject



448
449
450
# File 'lib/origen/application.rb', line 448

def environment
  @environment ||= Environment.new
end

#gem_nameObject



429
430
431
# File 'lib/origen/application.rb', line 429

def gem_name
  (Origen.app.config.gem_name || name).to_s.underscore.symbolize
end

#imports_directoryObject Also known as: imports_dir

Returns a path to the imports directory (e.g. used by the remotes and similar features) for the application. e.g. if the app live at /home/thao/my_app, then the imports directory will typically be /home/thao/.my_app_imports_DO_NOT_HAND_MODIFY

Origen will ensure that this directory is outside of the scope of the current application’s revision control system. This prevents conflicts with the revision control system for the application and those used to import 3rd party dependencies



169
170
171
# File 'lib/origen/application.rb', line 169

def imports_directory
  workspace_manager.imports_directory
end

#inspectObject



142
143
144
# File 'lib/origen/application.rb', line 142

def inspect
  "<Origen app (#{name}):#{object_id}>"
end

#instantiated_callback_listenersObject



523
524
525
# File 'lib/origen/application.rb', line 523

def instantiated_callback_listeners
  dynamic_resource(:callback_listeners, []) + (@persistant_callback_listeners || [])
end

#listeners_for(*args) ⇒ Object



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/origen/application.rb', line 229

def listeners_for(*args)
  callback = args.shift
  max = args.first.is_a?(Numeric) ? args.shift : nil
  options = args.shift || {}
  options = {
    top_level: :first
  }.merge(options)
  listeners = callback_listeners
  if Origen.top_level
    listeners -= [Origen.top_level.model]
    if options[:top_level]
      if options[:top_level] == :last
        listeners = listeners + [Origen.top_level]
      else
        listeners = [Origen.top_level] + listeners
      end
    end
  end
  listeners = listeners.select { |l| l.respond_to?(callback) }.map do |l|
    if l.try(:is_an_origen_model?)
      l.respond_to_directly?(callback) ? l : l.controller
    else
      l
    end
  end
  if max && listeners.size > max
    fail "You can only define a #{callback} callback #{max > 1 ? (max.to_s + 'times') : 'once'}, however you have declared it #{listeners.size} times for instances of: #{listeners.map(&:class)}"
  end
  listeners
end

#load_consoleObject



634
635
636
# File 'lib/origen/application.rb', line 634

def load_console
  load_target!
end

#load_event(type) ⇒ Object



749
750
751
752
753
# File 'lib/origen/application.rb', line 749

def load_event(type)
  @load_event = type
  yield
  @load_event = nil
end

#load_target!(options = {}) ⇒ Object



638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
# File 'lib/origen/application.rb', line 638

def load_target!(options = {})
  options = {
    force_debug: false
  }.merge(options)
  if options[:reload]
    @target_load_count = 0
  else
    @target_load_count ||= 0
    @target_load_count += 1
  end
  listeners_for(:before_load_target).each(&:before_load_target)
  # Remember these if the target has to be reloaded
  @target_load_options = options.merge({})
  # Since this is a load it will re-instantiate any objects that the application
  # declares here, the objects registered with origen should be refreshed accordingly
  clear_dynamic_resources
  load_event(:transient) do
    Origen.mode = Origen.app.session.origen_core[:mode] || :production  # Important since a production target may rely on the default
    begin
      $_target_options = @target_load_options
      Origen.target.set_signature(@target_load_options)
      $dut = nil
      load environment.file if environment.file
      if target.proc
        target.proc.call
      else
        load target.file!
      end
    ensure
      $_target_options = nil
    end
    @target_instantiated = true
    Origen.mode = :debug if options[:force_debug]
    listeners_for(:on_create).each(&:on_create)
    # Keep this within the load_event to ensure any objects that are further instantiated objects
    # will be associated with (and cleared out upon reload of) the current target
    listeners_for(:on_load_target).each(&:on_load_target)
  end
  listeners_for(:after_load_target).each(&:after_load_target)
  Origen.app.plugins.validate_production_status
  # @target_instantiated = true
end

#load_tasksObject

Load all rake tasks defined in the application’s lib/task directory



94
95
96
# File 'lib/origen/application.rb', line 94

def load_tasks
  RakeLoader.new.load_tasks
end

#lsfObject



452
453
454
# File 'lib/origen/application.rb', line 452

def lsf
  @lsf ||= LSF.new
end

#lsf_managerObject



464
465
466
# File 'lib/origen/application.rb', line 464

def lsf_manager
  @lsf_manager ||= LSFManager.new
end

#mailerObject



476
477
478
# File 'lib/origen/application.rb', line 476

def mailer
  @mailer ||= Utility::Mailer.new
end

#on_loadedObject

This callback handler will fire once the main app and all of its plugins have been loaded



133
134
135
# File 'lib/origen/application.rb', line 133

def on_loaded
  config.log_deprecations
end

#origen_core?Boolean

Convenience method to check if the given application instance is Origen core

Returns:

  • (Boolean)


138
139
140
# File 'lib/origen/application.rb', line 138

def origen_core?
  name.to_s.symbolize == :origen_core
end

#pattern_iteratorsObject



512
513
514
# File 'lib/origen/application.rb', line 512

def pattern_iterators
  @pattern_iterators ||= []
end

#pin_mapObject



582
583
584
# File 'lib/origen/application.rb', line 582

def pin_map
  dynamic_resource(:pin_map, {})
end

#pin_namesObject



626
627
628
629
630
631
632
# File 'lib/origen/application.rb', line 626

def pin_names
  if @load_event
    dynamic_resource(:pin_names, {})
  else
    @transient_resources[:pin_names] ||= {}
  end
end

#pin_pattern_excludeObject



618
619
620
621
622
623
624
# File 'lib/origen/application.rb', line 618

def pin_pattern_exclude
  if @load_event
    dynamic_resource(:pin_pattern_exclude, [])
  else
    @transient_resources[:pin_pattern_exclude] ||= []
  end
end

#pin_pattern_orderObject



610
611
612
613
614
615
616
# File 'lib/origen/application.rb', line 610

def pin_pattern_order
  if @load_event
    dynamic_resource(:pin_pattern_order, [])
  else
    @transient_resources[:pin_pattern_order] ||= []
  end
end

#pingroup_mapObject



596
597
598
# File 'lib/origen/application.rb', line 596

def pingroup_map
  dynamic_resource(:pingroup_map, {})
end

#pluginsObject



433
434
435
# File 'lib/origen/application.rb', line 433

def plugins
  @plugins ||= Plugins.new
end

#plugins_managerObject Also known as: plugin_manager, current_plugin



437
438
439
440
# File 'lib/origen/application.rb', line 437

def plugins_manager
  Origen.deprecated 'Origen.app.plugins_manager and Origen.app.current_plugin are deprecated, use Origen.app.plugins instead'
  plugins
end

#previous_versionsObject



397
398
399
400
401
402
403
404
405
406
407
# File 'lib/origen/application.rb', line 397

def previous_versions
  versions = []
  File.readlines("#{Origen.root}/doc/history").each do |line|
    line = line.strip
    if line =~ /^#+ Tag: (.*)$/ ||
       line =~ />Tag: ([^<]*)</
      versions << Regexp.last_match(1).gsub('\\', '')
    end
  end
  versions.uniq
end

#release(options) ⇒ Object



502
503
504
505
# File 'lib/origen/application.rb', line 502

def release(options)
  @release ||= Release.new
  @release.run(options)
end

#release_date(version = Origen.app.version.prefixed) ⇒ Object

Returns the release date for the current or given application version



314
315
316
317
# File 'lib/origen/application.rb', line 314

def release_date(version = Origen.app.version.prefixed)
  time = release_time(version)
  time ? time.to_date : nil
end

#release_note(version = Origen.app.version.prefixed) ⇒ Object

Returns the release note for the current or given application version



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/origen/application.rb', line 277

def release_note(version = Origen.app.version.prefixed)
  version = VersionString.new(version)
  version = version.prefixed if version.semantic?
  capture = false
  note_started = false
  note = []
  File.readlines("#{Origen.root}/doc/history").each do |line|
    line = line.strip
    if capture
      if note_started
        if line =~ /^<a class="anchor release_tag/ || line =~ /^#+ Tag/
          note.pop while note.last && note.last.empty?
          return note
        end
        if line.empty? && note.empty?
          # Don't capture preceding blank lines
        else
          note << line
        end
      elsif line =~ /^#+ by/
        note_started = true
      end
    else
      if line =~ /Tag:/
        line = line.gsub('\\', '')
        if line =~ /^#+ Tag: #{version}$/ ||
           line =~ />Tag: #{version}</
          capture = true
        end
      end
    end
  end
  note.pop while note.last && note.last.empty?
  note
end

#release_time(version = Origen.app.version.prefixed) ⇒ Object

Returns the release time for the current or given application version



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/origen/application.rb', line 320

def release_time(version = Origen.app.version.prefixed)
  version = VersionString.new(version)
  version = version.prefixed if version.semantic?
  capture = false
  File.readlines("#{Origen.root}/doc/history").each do |line|
    line = line.strip
    if capture
      if capture && line =~ /^#+ by .* on (.*(AM|PM))/
        return Time.parse(Regexp.last_match(1))
      end
    else
      if line =~ /Tag:/
        line = line.gsub('\\', '')
        if line =~ /^#+ Tag: #{version}$/ ||
           line =~ />Tag: #{version}</
          capture = true
        end
      end
    end
  end
  nil
end

#reload_target!(options = {}) ⇒ Object

Equivalent to load_target! except that any options that were passed to load_target! the last time it was called will be re-applied when (re)loading the target.



694
695
696
697
698
699
700
701
702
# File 'lib/origen/application.rb', line 694

def reload_target!(options = {})
  old_options = @target_load_options || {}
  options = (@target_load_options || {}).merge(options)
  if options[:skip_first_time] && @target_load_count == 1
    @target_load_count += 1
  else
    load_target!(options.merge(reload: true))
  end
end

#require_environment!Object



150
151
152
# File 'lib/origen/application.rb', line 150

def require_environment!
  Origen.deprecate 'Calling app.require_environment! is no longer required, the app environment is now automtically loaded when Origen.app is called'
end

#revision_controllerObject Also known as: rc

Returns a revision controller instance (e.g. Origen::RevisionControl::Git) which has been configured to point to the local workspace and the remote repository as defined by Origen.app.config.rc_url. If the revision control URL has not been defined, or it does not resolve to a recognized revision control system, then this method will return nil.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/origen/application.rb', line 103

def revision_controller
  if current?
    if config.rc_url
      if config.rc_url =~ /^sync:/
        @revision_controller ||= RevisionControl::DesignSync.new(
          local:  root,
          remote: config.rc_url
        )
      elsif config.rc_url =~ /git/
        @revision_controller ||= RevisionControl::Git.new(
          local:  root,
          # If a workspace is based on a fork of the master repo, config.rc_url may not
          # be correct
          remote: RevisionControl::Git.origin || config.rc_url
        )

      end
    elsif config.vault
      @revision_controller ||= RevisionControl::DesignSync.new(
        local:  root,
        remote: config.vault
      )
    end
  else
    fail "Only the top-level application has a revision controller! #{name} is a plugin"
  end
end

#rootObject

Returns a full path to the root directory of the given application

If the application instance is a plugin then this will point to where the application is installed within the imports directory



158
159
160
# File 'lib/origen/application.rb', line 158

def root
  @root
end

#root=(val) ⇒ Object



146
147
148
# File 'lib/origen/application.rb', line 146

def root=(val)
  @root = Pathname.new(val)
end

#runnerObject



456
457
458
# File 'lib/origen/application.rb', line 456

def runner
  @runner ||= Runner.new
end

#server_dataObject

Returns the server data packet available for the given application, returns nil if none is found



201
202
203
204
205
206
207
# File 'lib/origen/application.rb', line 201

def server_data
  if name == :origen
    @server_data ||= Origen.client.origen
  else
    @server_data ||= Origen.client.plugins.find { |p| p[:origen_name].downcase == name.to_s.downcase }
  end
end

#session(reload = false) ⇒ Object



484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/origen/application.rb', line 484

def session(reload = false)
  if current?
    @session = nil if reload
    @session ||= Database::KeyValueStores.new(self, persist: false)
  else
    puts "All plugins should use the top-level application's session store, i.e. use:"
    puts "  Origen.app.session.#{name}"
    puts 'instead of:'
    puts '  Origen.app!.session'
    puts
    exit 1
  end
end

#set_dynamic_resource(name, value) ⇒ Object



704
705
706
# File 'lib/origen/application.rb', line 704

def set_dynamic_resource(name, value)
  dynamic_resource(name, value, set: true)
end

#statisticsObject Also known as: stats



507
508
509
# File 'lib/origen/application.rb', line 507

def statistics
  runner.statistics
end

#subscribers_devObject

Returns an array of users who have subscribed for development release notifications for the given application on the website



191
192
193
194
195
196
197
# File 'lib/origen/application.rb', line 191

def subscribers_dev
  if server_data
    @subscribers_dev ||= server_data[:subscribers_dev].map { |u| User.new(u[:core_id]) }
  else
    []
  end
end

#subscribers_prodObject

Returns an array of users who have subscribed for production release notifications for the given application on the website



181
182
183
184
185
186
187
# File 'lib/origen/application.rb', line 181

def subscribers_prod
  if server_data
    @subscribers_prod ||= server_data[:subscribers_prod].map { |u| User.new(u[:core_id]) }
  else
    []
  end
end

#targetObject



444
445
446
# File 'lib/origen/application.rb', line 444

def target
  @target ||= Target.new
end

#target_instantiated?Boolean

Returns:

  • (Boolean)


755
756
757
# File 'lib/origen/application.rb', line 755

def target_instantiated?
  @target_instantiated
end

#testerObject



570
571
572
# File 'lib/origen/application.rb', line 570

def tester
  dynamic_resource(:tester, []).first
end

#tester=(obj) ⇒ Object



574
575
576
577
578
579
580
# File 'lib/origen/application.rb', line 574

def tester=(obj)
  # if tester && obj
  #  raise "You can only instantiate 1 tester, you have already created an instance of #{tester.class}}"
  # end
  $tester = obj
  set_dynamic_resource(:tester, [obj])
end

#top_levelObject

Returns the current top-level object (the DUT)



222
223
224
225
226
227
# File 'lib/origen/application.rb', line 222

def top_level
  @top_level ||= begin
    t = toplevel_listeners.first
    t.controller ? t.controller : t if t
  end
end

#toplevel_listenersObject



527
528
529
# File 'lib/origen/application.rb', line 527

def toplevel_listeners
  dynamic_resource(:toplevel_listeners, [])
end

#unload_target!Object

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.

Not a clean unload, but allows objects to be re-instantiated for testing



683
684
685
686
687
688
689
# File 'lib/origen/application.rb', line 683

def unload_target!
  listeners_for(:before_load_target).each(&:before_load_target)
  clear_dynamic_resources
  clear_dynamic_resources(:static)
  Origen::Pins.clear_pin_aliases
  $dut = nil
end

#version(options = {}) ⇒ Object



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/origen/application.rb', line 260

def version(options = {})
  @version = nil if options[:refresh]
  return @version if @version
  load File.join(root, 'config', 'version.rb')
  if defined? eval(namespace)::VERSION
    @version = Origen::VersionString.new(eval(namespace)::VERSION)
  else
    # The eval of the class is required here as somehow when plugins are imported under the old
    # imports system and with the old version file format we can end up with two copies of the
    # same class constant. Don't understand it, but it is fixed with the move to gems and the
    # namespace-based version file format.
    @version = Origen::VersionString.new(eval(self.class.to_s)::VERSION)
  end
  @version
end

#version_trackerObject



468
469
470
# File 'lib/origen/application.rb', line 468

def version_tracker
  @version_tracker ||= VersionTracker.new
end

#versionsObject



498
499
500
# File 'lib/origen/application.rb', line 498

def versions
  version_tracker.versions
end

#with_doc_tester(options = {}) ⇒ Object

Any attempts to instantiate a test within the give block will be forced to instantiate an Origen::Tester::Doc instance



552
553
554
555
556
557
558
559
560
# File 'lib/origen/application.rb', line 552

def with_doc_tester(options = {})
  @with_doc_tester = true
  if options[:html]
    @with_html_doc_tester = true
  end
  yield
  @with_doc_tester = false
  @with_html_doc_tester = false
end

#with_doc_tester?Boolean

Returns:

  • (Boolean)


562
563
564
# File 'lib/origen/application.rb', line 562

def with_doc_tester?
  @with_doc_tester
end

#with_html_doc_tester?Boolean

Returns:

  • (Boolean)


566
567
568
# File 'lib/origen/application.rb', line 566

def with_html_doc_tester?
  @with_html_doc_tester
end

#workspace_managerObject



472
473
474
# File 'lib/origen/application.rb', line 472

def workspace_manager
  @workspace_manager ||= WorkspaceManager.new
end