Module: Origen
- Extended by:
- Utility::TimeAndDate
- Includes:
- ConsoleMethods
- Defined in:
- lib/origen.rb,
lib/origen/log.rb,
lib/origen/nvm.rb,
lib/origen/pdm.rb,
lib/origen/bugs.rb,
lib/origen/mode.rb,
lib/origen/pins.rb,
lib/origen/model.rb,
lib/origen/specs.rb,
lib/origen/users.rb,
lib/origen/client.rb,
lib/origen/tester.rb,
lib/origen/utility.rb,
lib/origen/bugs/bug.rb,
lib/origen/database.rb,
lib/origen/features.rb,
lib/origen/location.rb,
lib/origen/pins/pin.rb,
lib/origen/callbacks.rb,
lib/origen/chip_mode.rb,
lib/origen/encodings.rb,
lib/origen/generator.rb,
lib/origen/pins/port.rb,
lib/origen/registers.rb,
lib/origen/top_level.rb,
lib/origen/controller.rb,
lib/origen/parameters.rb,
lib/origen/specs/note.rb,
lib/origen/specs/spec.rb,
lib/origen/sub_blocks.rb,
lib/origen/tester/api.rb,
lib/origen/users/ldap.rb,
lib/origen/users/user.rb,
lib/origen/application.rb,
lib/origen/commands/rc.rb,
lib/origen/site_config.rb,
lib/origen/tester/time.rb,
lib/origen/chip_package.rb,
lib/origen/commands/web.rb,
lib/origen/file_handler.rb,
lib/origen/location/map.rb,
lib/origen/utility/diff.rb,
lib/origen/generator/job.rb,
lib/origen/location/base.rb,
lib/origen/pins/pin_bank.rb,
lib/origen/registers/bit.rb,
lib/origen/registers/reg.rb,
lib/origen/specs/exhibit.rb,
lib/origen/tester/parser.rb,
lib/origen/tester/timing.rb,
lib/origen/tester/vector.rb,
lib/origen/generator/flow.rb,
lib/origen/global_methods.rb,
lib/origen/import_manager.rb,
lib/origen/logger_methods.rb,
lib/origen/parameters/set.rb,
lib/origen/pins/pin_clock.rb,
lib/origen/pins/power_pin.rb,
lib/origen/remote_manager.rb,
lib/origen/specs/override.rb,
lib/origen/tester/bdm/bdm.rb,
lib/origen/tester/doc/doc.rb,
lib/origen/utility/mailer.rb,
lib/origen/version_string.rb,
lib/origen/application/lsf.rb,
lib/origen/code_generators.rb,
lib/origen/commands/target.rb,
lib/origen/generator/stage.rb,
lib/origen/nvm/block_array.rb,
lib/origen/parameters/live.rb,
lib/origen/pins/ground_pin.rb,
lib/origen/pins/pin_common.rb,
lib/origen/version_checker.rb,
lib/origen/features/feature.rb,
lib/origen/registers/domain.rb,
lib/origen/revision_control.rb,
lib/origen/tester/doc/model.rb,
lib/origen/tester/generator.rb,
lib/origen/tester/interface.rb,
lib/origen/tester/j750/j750.rb,
lib/origen/tester/v93k/v93k.rb,
lib/origen/utility/csv_data.rb,
lib/origen/utility/s_record.rb,
lib/origen/generator/pattern.rb,
lib/origen/model_initializer.rb,
lib/origen/specs/mode_select.rb,
lib/origen/tester/j750/files.rb,
lib/origen/application/runner.rb,
lib/origen/application/target.rb,
lib/origen/generator/compiler.rb,
lib/origen/generator/renderer.rb,
lib/origen/parameters/missing.rb,
lib/origen/regression_manager.rb,
lib/origen/specs/doc_resource.rb,
lib/origen/specs/power_supply.rb,
lib/origen/tester/j750/parser.rb,
lib/origen/tester/jlink/jlink.rb,
lib/origen/utility/block_args.rb,
lib/origen/application/release.rb,
lib/origen/generator/resources.rb,
lib/origen/pins/function_proxy.rb,
lib/origen/pins/pin_collection.rb,
lib/origen/registers/container.rb,
lib/origen/specs/creation_info.rb,
lib/origen/utility/design_sync.rb,
lib/origen/application/deployer.rb,
lib/origen/code_generators/base.rb,
lib/origen/code_generators/rake.rb,
lib/origen/commands/environment.rb,
lib/origen/commands/interactive.rb,
lib/origen/generator/comparator.rb,
lib/origen/revision_control/git.rb,
lib/origen/tester/doc/generator.rb,
lib/origen/tester/j750/j750_hpt.rb,
lib/origen/code_generators/rspec.rb,
lib/origen/revision_control/base.rb,
lib/origen/specs/version_history.rb,
lib/origen/tester/j750/generator.rb,
lib/origen/tester/v93k/generator.rb,
lib/origen/utility/input_capture.rb,
lib/origen/utility/time_and_date.rb,
lib/origen/application/statistics.rb,
lib/origen/code_generators/semver.rb,
lib/origen/commands/modifications.rb,
lib/origen/tester/ultraflex/files.rb,
lib/origen/tester/vector_pipeline.rb,
lib/origen/application/environment.rb,
lib/origen/application/lsf_manager.rb,
lib/origen/code_generators/actions.rb,
lib/origen/code_generators/bundler.rb,
lib/origen/code_generators/timever.rb,
lib/origen/tester/j750/parser/flow.rb,
lib/origen/tester/ultraflex/parser.rb,
lib/origen/tester/vector_generator.rb,
lib/origen/database/key_value_store.rb,
lib/origen/generator/pattern_finder.rb,
lib/origen/registers/bit_collection.rb,
lib/origen/registers/reg_collection.rb,
lib/origen/tester/j750/parser/flows.rb,
lib/origen/application/configuration.rb,
lib/origen/code_generators/gem_setup.rb,
lib/origen/database/key_value_stores.rb,
lib/origen/tester/doc/generator/flow.rb,
lib/origen/tester/doc/generator/test.rb,
lib/origen/generator/pattern_iterator.rb,
lib/origen/tester/doc/generator/tests.rb,
lib/origen/tester/j750/generator/flow.rb,
lib/origen/tester/j750/parser/ac_spec.rb,
lib/origen/tester/j750/parser/dc_spec.rb,
lib/origen/tester/j750/parser/timeset.rb,
lib/origen/tester/ultraflex/generator.rb,
lib/origen/tester/ultraflex/ultraflex.rb,
lib/origen/tester/v93k/generator/flow.rb,
lib/origen/application/plugins_manager.rb,
lib/origen/application/version_tracker.rb,
lib/origen/revision_control/subversion.rb,
lib/origen/tester/command_based_tester.rb,
lib/origen/tester/j750/parser/dc_specs.rb,
lib/origen/revision_control/design_sync.rb,
lib/origen/tester/generator/placeholder.rb,
lib/origen/tester/j750/generator/patset.rb,
lib/origen/tester/j750/parser/flow_line.rb,
lib/origen/tester/ultraflex/parser/flow.rb,
lib/origen/application/workspace_manager.rb,
lib/origen/tester/generator/identity_map.rb,
lib/origen/tester/j750/generator/patsets.rb,
lib/origen/tester/parser/searchable_hash.rb,
lib/origen/tester/ultraflex/parser/flows.rb,
lib/origen/tester/v93k/generator/pattern.rb,
lib/origen/application/command_dispatcher.rb,
lib/origen/tester/doc/generator/flow_line.rb,
lib/origen/tester/generator/test_numberer.rb,
lib/origen/tester/j750/generator/patgroup.rb,
lib/origen/tester/j750/parser/pattern_set.rb,
lib/origen/tester/parser/searchable_array.rb,
lib/origen/tester/doc/generator/test_group.rb,
lib/origen/tester/j750/generator/flow_line.rb,
lib/origen/tester/j750/generator/patgroups.rb,
lib/origen/tester/j750/parser/descriptions.rb,
lib/origen/tester/j750/parser/pattern_sets.rb,
lib/origen/tester/ultraflex/generator/flow.rb,
lib/origen/tester/ultraflex/parser/ac_spec.rb,
lib/origen/tester/ultraflex/parser/dc_spec.rb,
lib/origen/tester/ultraflex/parser/timeset.rb,
lib/origen/tester/v93k/generator/flow_node.rb,
lib/origen/tester/j750/parser/test_instance.rb,
lib/origen/tester/parser/description_lookup.rb,
lib/origen/tester/ultraflex/parser/dc_specs.rb,
lib/origen/tester/v93k/generator/test_suite.rb,
lib/origen/application/configuration_manager.rb,
lib/origen/tester/generator/flow_control_api.rb,
lib/origen/tester/j750/parser/test_instances.rb,
lib/origen/tester/ultraflex/generator/patset.rb,
lib/origen/tester/ultraflex/parser/flow_line.rb,
lib/origen/tester/v93k/generator/test_method.rb,
lib/origen/tester/v93k/generator/test_suites.rb,
lib/origen/tester/ultraflex/generator/patsets.rb,
lib/origen/tester/v93k/generator/test_methods.rb,
lib/origen/tester/j750/generator/test_instance.rb,
lib/origen/tester/ultraflex/generator/patgroup.rb,
lib/origen/tester/ultraflex/parser/pattern_set.rb,
lib/origen/tester/v93k/generator/test_function.rb,
lib/origen/tester/j750/generator/test_instances.rb,
lib/origen/tester/ultraflex/generator/flow_line.rb,
lib/origen/tester/ultraflex/generator/patgroups.rb,
lib/origen/tester/ultraflex/parser/descriptions.rb,
lib/origen/tester/ultraflex/parser/pattern_sets.rb,
lib/origen/tester/v93k/generator/pattern_master.rb,
lib/origen/tester/v93k/generator/test_functions.rb,
lib/origen/tester/ultraflex/parser/test_instance.rb,
lib/origen/tester/v93k/generator/flow_node/print.rb,
lib/origen/tester/ultraflex/parser/test_instances.rb,
lib/origen/tester/ultraflex/generator/test_instance.rb,
lib/origen/tester/j750/generator/test_instance_group.rb,
lib/origen/tester/ultraflex/generator/test_instances.rb,
lib/origen/tester/ultraflex/generator/test_instance_group.rb
Defined Under Namespace
Modules: Bugs, Callbacks, CodeGenerators, ConsoleMethods, Controller, Database, Features, GlobalMethods, Location, LoggerMethods, Model, ModelInitializer, NVM, PDM, Parameters, PersistentCallbacks, Pins, Registers, RevisionControl, Specs, SubBlocks, Tester, TopLevel, Users, Utility Classes: Application, ChipMode, ChipPackage, Client, DesignSyncError, FileHandler, Generator, GitError, ImportManager, Log, Mode, OrigenError, RegressionManager, RemoteManager, SiteConfig, SubBlock, VersionChecker, VersionString
Constant Summary collapse
- APP_CONFIG =
File.join('config', 'application.rb')
- IPBlock =
Legacy API
Model- CoreCallbacks =
PersistentCallbacks- ENCODINGS =
{ utf8: { inverted_exclamation_mark: "\u00A1", cent_sign: "\u00A2", pound_sign: "\u00A3", currency_sign: "\u00A4", yen_sign: "\u00A5", broken_bar: "\u00A6", section_sign: "\u00A7", diaeresis: "\u00A8", copyright_sign: "\u00A9", feminine_ordinal_indicator: "\u00AA", left_pointing_double_angle_quotation_mark: "\u00AB", not_sign: "\u00AC", soft_hyphen: "\u00AD", registered_sign: "\u00AE ", macron: "\u00AF", degree_sign: "\u00B0", plus_minus_sign: "\u00B1", superscript_two: "\u00B2", superscript_three: "\u00B3", acute_accent: "\u00B4", micro_sign: "\u00B5", pilcrow_sign: "\u00B6", middle_dot: "\u00B7", cedilla: "\u00B8", superscript_one: "\u00B9", masculine_ordinal_indicator: "\u00BA", right_pointing_double_angle_quotation_mark: "\u00BB", vulgar_fraction_one_quarter: "\u00BC", vulgar_fraction_one_half: "\u00BD", vulgar_fraction_three_quarters: "\u00BE", inverted_question_mark: "\u00BF", latin_capital_letter_a_with_grave: "\u00C0", latin_capital_letter_a_with_acute: "\u00C1", latin_capital_letter_a_with_circumflex: "\u00C2", latin_capital_letter_a_with_tilde: "\u00C3", latin_capital_letter_a_with_diaeresis: "\u00C4", latin_capital_letter_a_with_ring_above: "\u00C5", latin_capital_letter_ae: "\u00C6", latin_capital_letter_c_with_cedilla: "\u00C7", latin_capital_letter_e_with_grave: "\u00C8", latin_capital_letter_e_with_acute: "\u00C9", latin_capital_letter_e_with_circumflex: "\u00CA", latin_capital_letter_e_with_diaeresis: "\u00CB", latin_capital_letter_i_with_grave: "\u00CC", latin_capital_letter_i_with_acute: "\u00CD", latin_capital_letter_i_with_circumflex: "\u00CE", latin_capital_letter_i_with_diaeresis: "\u00CF", latin_capital_letter_eth: "\u00D0", latin_capital_letter_n_with_tilde: "\u00D1", latin_capital_letter_o_with_grave: "\u00D2", latin_capital_letter_o_with_acute: "\u00D3", latin_capital_letter_o_with_circumflex: "\u00D4", latin_capital_letter_o_with_tilde: "\u00D5", latin_capital_letter_o_with_diaeresis: "\u00D6", multiplication_sign: "\u00D7", latin_capital_letter_o_with_stroke: "\u00D8", latin_capital_letter_u_with_grave: "\u00D9", latin_capital_letter_u_with_acute: "\u00DA", latin_capital_letter_u_with_circumflex: "\u00DB", latin_capital_letter_u_with_diaeresis: "\u00DC", latin_capital_letter_y_with_acute: "\u00DD", latin_capital_letter_thorn: "\u00DE", latin_small_letter_sharp_s: "\u00DF", latin_small_letter_a_with_grave: "\u00E0", latin_small_letter_a_with_acute: "\u00E1", latin_small_letter_a_with_circumflex: "\u00E2", latin_small_letter_a_with_tilde: "\u00E3", latin_small_letter_a_with_diaeresis: "\u00E4", latin_small_letter_a_with_ring_above: "\u00E5", latin_small_letter_ae: "\u00E6", latin_small_letter_c_with_cedilla: "\u00E7", latin_small_letter_e_with_grave: "\u00E8", latin_small_letter_e_with_acute: "\u00E9", latin_small_letter_e_with_circumflex: "\u00EA", latin_small_letter_e_with_diaeresis: "\u00EB", latin_small_letter_i_with_grave: "\u00EC", latin_small_letter_i_with_acute: "\u00ED", latin_small_letter_i_with_circumflex: "\u00EE", latin_small_letter_i_with_diaeresis: "\u00EF", latin_small_letter_eth: "\u00F0", latin_small_letter_n_with_tilde: "\u00F1", latin_small_letter_o_with_grave: "\u00F2", latin_small_letter_o_with_acute: "\u00F3", latin_small_letter_o_with_circumflex: "\u00F4", latin_small_letter_o_with_tilde: "\u00F5", latin_small_letter_o_with_diaeresis: "\u00F6", division_sign: "\u00F7", latin_small_letter_o_with_stroke: "\u00F8", latin_small_letter_u_with_grave: "\u00F9", latin_small_letter_u_with_acute: "\u00FA", latin_small_letter_u_with_circumflex: "\u00FB", latin_small_letter_u_with_diaeresis: "\u00FC", latin_small_letter_y_with_acute: "\u00FD", latin_small_letter_thorn: "\u00FE", latin_small_letter_y_with_diaeresis: "\u00FF", ohm_sign: "\u03A9" } }
Class Method Summary collapse
- ._applications_lookup ⇒ Object private
- ._build_web_dir ⇒ Object
- ._deployer ⇒ Object
- ._require_web_directory ⇒ Object
- ._start_server ⇒ Object
- .add_interface(interface_class) ⇒ Object
-
.app(plugin = nil, _options = {}) ⇒ Object
(also: application)
Returns the current (top-level) application instance.
-
.app! ⇒ Object
(also: application!)
Equivalent to application except that if called from code in a plugin this will return that plugin’s application instance.
- .app_loaded? ⇒ Boolean
- .client ⇒ Object
- .command_dispatcher ⇒ Object
-
.compile(file, options = {}) ⇒ Object
Compile the given file and return the result as a string.
- .configuration ⇒ Object (also: config)
- .controllers ⇒ Object
-
.current_command ⇒ Object
Returns the name of the currently executing Origen command (a String), e.g.
-
.current_user ⇒ Object
private
Use User.current to retrieve the current user, this is an internal API that will be cleaned up (removed) in future.
-
.debug? ⇒ Boolean
(also: debugger?)
Returns true if Origen is running with the -d or –debug switches enabled.
- .debugger_enabled? ⇒ Boolean
- .deprecate(*msgs) ⇒ Object (also: deprecated)
- .development? ⇒ Boolean
- .disable_profiling ⇒ Object
- .enable_debugger ⇒ Object
- .enable_profiling ⇒ Object
- .environment ⇒ Object
- .file_handler ⇒ Object
-
.find_app_by_root(path_to_origen_root, options = {}) ⇒ Object
(also: application_instance, app_instance)
private
Return the application instance from the given path to an Origen application workspace, i.e.
- .flow ⇒ Object
- .generator ⇒ Object
- .import_manager ⇒ Object (also: imports_manager)
-
.in_app_workspace? ⇒ Boolean
Returns true if Origen is running in an application workspace.
-
.interface(options = {}) ⇒ Object
Returns the (application defined) test program interface for the given tester if one has been defined, otherwise returns nil.
- .interface_loaded? ⇒ Boolean
-
.interface_present? ⇒ Boolean
Returns true if an interface is defined for the current tester.
- .interfaces ⇒ Object
- .launch_time ⇒ Object
-
.ldap ⇒ Object
Returns an instance of Origen::Users::LDAP which provides methods to query and authorize users against a company’s LDAP-based employee directory.
-
.listeners_for(*args) ⇒ Object
This is the application-facing API for implementing custom callbacks, the top-level application, all plugin application instances, and any application objects that include the Origen::Callbacks module will be returned.
-
.load_application(check_version = true) ⇒ Object
Loads the top-level application and all of its plugins, but not the target.
- .load_target(t, options = {}) ⇒ Object
- .log ⇒ Object
- .lsf ⇒ Object
- .mailer ⇒ Object
-
.mode ⇒ Object
Returns an object tracking the Origen execution mode/configuration, an instance of Origen::Mode.
- .mode=(val) ⇒ Object
- .pattern ⇒ Object
- .pin_bank ⇒ Object
-
.plugins ⇒ Object
Returns an array containing the application instances of all plugins.
- .plugins_manager ⇒ Object (also: plugin_manager, current_plugin)
- .profile(message) ⇒ Object
- .register_application(app) ⇒ Object
- .regression_manager ⇒ Object
- .remote_manager ⇒ Object (also: remotes_manager)
-
.reset_interface(options = {}) ⇒ Object
Resets the tester interface (instantiates a new one).
- .resources ⇒ Object
- .root(plugin = nil) ⇒ Object (also: app_root)
-
.root! ⇒ Object
Like Origen.root but this will return the plugin root if called by plugin code.
- .running_locally? ⇒ Boolean
- .running_on_linux? ⇒ Boolean
- .running_on_windows? ⇒ Boolean
- .running_remotely=(val) ⇒ Object
- .running_remotely? ⇒ Boolean (also: running_remotely)
- .set_development_mode ⇒ Object
- .site_config ⇒ Object
- .target ⇒ Object
- .tester ⇒ Object
- .time ⇒ Object
-
.top ⇒ Object
Returns the full path to the Origen core top-level directory.
-
.top_level ⇒ Object
Returns the current top-level (DUT) object if one has been defined (by instantiating an object that includes Origen::TopLevel).
-
.validate_origen_dev_configuration! ⇒ Object
private
Validates that when the current app is OrigenCore then the origen executable is coming from the same workspace.
- .version(options = {}) ⇒ Object
-
.version_checker ⇒ Object
Returns an instance of Origen::VersionChecker.
-
.with_boot_environment ⇒ Object
private
Turns off bundler and all plugins if the app is loaded within this block.
- .with_disable_origen_version_check(*args, &block) ⇒ Object (also: disable_origen_version_check)
-
.with_origen_root(path) ⇒ Object
private
Ugly hack to force Origen.root references to the plugin’s top-level when loading the environment.rb of the plugin.
- .with_source_file(file) ⇒ Object private
Methods included from Utility::TimeAndDate
Methods included from ConsoleMethods
Class Method Details
._applications_lookup ⇒ 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.
174 175 176 |
# File 'lib/origen.rb', line 174 def _applications_lookup @_applications_lookup ||= { name: {}, root: {} } end |
._build_web_dir ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/origen/commands/web.rb', line 96 def self._build_web_dir _deployer.create_web_server_dir dir = Pathname.new(_deployer.web_server_dir).relative_path_from(Pathname.pwd) puts "Web server directory created at: #{dir}" puts '' puts "Compile any files you want to test into the #{dir}/content directory, e.g.:" puts " origen c templates/file.md.erb -o #{dir}/content" puts '' puts 'To turn them into web pages:' puts " cd #{dir}" if Origen.running_on_windows? puts ' nanoc' else puts ' env LANG=en_US.UTF-8 nanoc' end puts '' puts 'To start a web server for remote viewing:' puts " cd #{dir}/output" puts ' origen web serve' end |
._deployer ⇒ Object
119 120 121 122 123 |
# File 'lib/origen/commands/web.rb', line 119 def self._deployer @_deployer ||= Origen.app.deployer @_deployer.test = true @_deployer end |
._require_web_directory ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/origen/commands/web.rb', line 58 def self._require_web_directory unless Origen.config.web_directory puts 'To run that command you must specify the location of your webserver, for example:' puts '' puts '# config/application.rb' puts 'config.web_directory = "/proj/.web_origen/html/origen"' exit 1 end end |
._start_server ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/origen/commands/web.rb', line 68 def self._start_server # Get the current host host = `hostname`.strip.downcase if Origen.running_on_windows? domain = 'fsl.freescale.net' else domain = `dnsdomainname`.strip end # Get a free port require 'socket' port = 8000 # preferred port begin server = TCPServer.new('127.0.0.1', port) rescue Errno::EADDRINUSE # port = rand(65000 - 1024) + 1024 port += 1 retry end server.close # Start the server puts '' puts "Point your browser to this address: http://#{host}#{domain.empty? ? '' : '.' + domain}:#{port}" puts '' puts 'To shut down the server use CTRL-C' puts '' system "ruby -run -e httpd . -p #{port}" end |
.add_interface(interface_class) ⇒ Object
472 473 474 |
# File 'lib/origen.rb', line 472 def add_interface(interface_class) interfaces << interface_class end |
.app(plugin = nil, _options = {}) ⇒ Object Also known as: application
Returns the current (top-level) application instance
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/origen.rb', line 110 def app(plugin = nil, = {}) plugin, = nil, plugin if plugin.is_a?(Hash) if plugin load_application app = _applications_lookup[:name][plugin.to_sym] if app app else puts "Couldn't find application instance called #{plugin}, known names are:" puts " #{_applications_lookup[:name].keys.join(', ')}" puts fail 'Origen.root lookup error!' end else load_application end end |
.app! ⇒ Object Also known as: application!
Equivalent to application except that if called from code in a plugin this will return that plugin’s application instance
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/origen.rb', line 131 def app! file = caller[0] path = @current_source_dir || Pathname.new(file).dirname until File.exist?(File.join(path, APP_CONFIG)) || path.root? path = path.parent end if path.root? fail "Something went wrong resoving Origen.app! from: #{caller[0]}" end find_app_by_root(path) end |
.app_loaded? ⇒ Boolean
105 106 107 |
# File 'lib/origen.rb', line 105 def app_loaded? @application_loaded end |
.command_dispatcher ⇒ Object
220 221 222 |
# File 'lib/origen.rb', line 220 def command_dispatcher @command_dispatcher ||= Application::CommandDispatcher.new end |
.compile(file, options = {}) ⇒ Object
Compile the given file and return the result as a string
464 465 466 |
# File 'lib/origen.rb', line 464 def compile(file, = {}) Origen::Generator::Compiler.new.compile_inline(file, ) end |
.configuration ⇒ Object Also known as: config
224 225 226 |
# File 'lib/origen.rb', line 224 def configuration app.config end |
.controllers ⇒ Object
396 397 398 |
# File 'lib/origen.rb', line 396 def controllers @controllers ||= [] end |
.current_command ⇒ Object
Returns the name of the currently executing Origen command (a String), e.g. ‘generate’, ‘program’, ‘compile’, etc.
623 624 625 |
# File 'lib/origen.rb', line 623 def current_command @current_command end |
.current_user ⇒ 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.
Use User.current to retrieve the current user, this is an internal API that will be cleaned up (removed) in future
520 521 522 523 524 525 526 |
# File 'lib/origen.rb', line 520 def current_user if app_loaded? || in_app_workspace? application.current_user else User.new(User.current_user_id) end end |
.debug? ⇒ Boolean Also known as: debugger?
Returns true if Origen is running with the -d or –debug switches enabled
554 555 556 |
# File 'lib/origen.rb', line 554 def debug? @debug || false end |
.debugger_enabled? ⇒ Boolean
563 564 565 |
# File 'lib/origen.rb', line 563 def debugger_enabled? @debug end |
.deprecate(*msgs) ⇒ Object Also known as: deprecated
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
# File 'lib/origen.rb', line 594 def deprecate(*msgs) _deprecate(*msgs) if Origen.app # If an app deprecation return the caller who called the deprecated method if caller[0] =~ /#{Origen.root}/ c = caller[1] # If an Origen deprecation then return the first caller from the current app else c = caller.find { |line| line =~ /#{Origen.root}/ } end else c = caller[1] end c =~ /(.*):(\d+):.*/ begin _deprecate "Called by #{Regexp.last_match[1]}:#{Regexp.last_match[2]}", rescue # For this to fail it means the deprecated method was called by IRB or similar # and in that case there is no point advising who called anyway end end |
.development? ⇒ Boolean
567 568 569 570 |
# File 'lib/origen.rb', line 567 def development? # This should be integrated with Origen.config.mode in the future @development end |
.disable_profiling ⇒ Object
67 68 69 |
# File 'lib/origen.rb', line 67 def disable_profiling @profiling = false end |
.enable_debugger ⇒ Object
559 560 561 |
# File 'lib/origen.rb', line 559 def enable_debugger @debug = true end |
.enable_profiling ⇒ Object
63 64 65 |
# File 'lib/origen.rb', line 63 def enable_profiling @profiling = true end |
.environment ⇒ Object
243 244 245 |
# File 'lib/origen.rb', line 243 def environment application.environment end |
.file_handler ⇒ Object
356 357 358 |
# File 'lib/origen.rb', line 356 def file_handler @file_handler ||= FileHandler.new end |
.find_app_by_root(path_to_origen_root, options = {}) ⇒ Object Also known as: application_instance, app_instance
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.
Return the application instance from the given path to an Origen application workspace, i.e. Origen.app conventionally returns the current application instance, this method returns the same thing that would be returned from the given remote workspace.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/origen.rb', line 190 def find_app_by_root(path_to_origen_root, = {}) app = _applications_lookup[:root][Pathname.new(path_to_origen_root).realpath.to_s] if !app || [:reload] # If the application is already defined then un-define it, this is to allow it to # be reloaded. # This option feels like it doesn't belong here, but is part of the legacy import # require system. When that has been removed in future so can this reload system, under # bundler app versions will be resolved before loading them so there will be no need # for this if app begin Object.send(:remove_const, app.class.to_s) rescue # Nothing to do here end end require File.join(path_to_origen_root, APP_CONFIG) app = _applications_lookup[:root][Pathname.new(path_to_origen_root).realpath.to_s] end return app if app puts "Couldn't find application instance with root #{path_to_origen_root}, known roots are:" _applications_lookup[:root].keys.each do |key| puts " #{key}" end puts fail 'Application lookup error!' end |
.flow ⇒ Object
384 385 386 |
# File 'lib/origen.rb', line 384 def flow generator.flow end |
.generator ⇒ Object
340 341 342 |
# File 'lib/origen.rb', line 340 def generator @generator ||= Generator.new end |
.import_manager ⇒ Object Also known as: imports_manager
364 365 366 |
# File 'lib/origen.rb', line 364 def import_manager @import_manager ||= ImportManager.new end |
.in_app_workspace? ⇒ Boolean
Returns true if Origen is running in an application workspace
248 249 250 251 252 253 254 |
# File 'lib/origen.rb', line 248 def in_app_workspace? path = Pathname.new(Dir.pwd) until path.root? || File.exist?(File.join(path, APP_CONFIG)) path = path.parent end !path.root? end |
.interface(options = {}) ⇒ Object
Returns the (application defined) test program interface for the given tester if one has been defined, otherwise returns nil
508 509 510 |
# File 'lib/origen.rb', line 508 def interface( = {}) @interface || reset_interface() end |
.interface_loaded? ⇒ Boolean
502 503 504 |
# File 'lib/origen.rb', line 502 def interface_loaded? !!@interface end |
.interface_present? ⇒ Boolean
Returns true if an interface is defined for the current tester
513 514 515 |
# File 'lib/origen.rb', line 513 def interface_present? !!interface(silence_no_interface_error: true) end |
.interfaces ⇒ Object
468 469 470 |
# File 'lib/origen.rb', line 468 def interfaces @interfaces ||= [] end |
.launch_time ⇒ Object
449 450 451 |
# File 'lib/origen.rb', line 449 def launch_time @launch_time ||= time_now end |
.ldap ⇒ Object
Returns an instance of Origen::Users::LDAP which provides methods to query and authorize users against a company’s LDAP-based employee directory
180 181 182 |
# File 'lib/origen.rb', line 180 def ldap @ldap ||= Origen::Users::LDAP.new end |
.listeners_for(*args) ⇒ Object
This is the application-facing API for implementing custom callbacks, the top-level application, all plugin application instances, and any application objects that include the Origen::Callbacks module will be returned
Origen system callbacks should use Origen.app.listeners_for instead, that version will return only the current plugin instance instead of them all (yes we need to make the API more obvious).
328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/origen.rb', line 328 def listeners_for(*args) callback = args.shift max = args.first.is_a?(Numeric) ? args.shift : nil listeners = [Origen.app] + Origen.plugins + Origen.app.instantiated_callback_listeners listeners = listeners.select { |l| l.respond_to?(callback) } 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_application(check_version = true) ⇒ Object
Loads the top-level application and all of its plugins, but not the target
In most cases this should never need to be called directly and will be called automatically the first time the application is referenced via Origen.app
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/origen.rb', line 413 def load_application(check_version = true) @application ||= begin # This flag is set so that when a thread starts with no app it remains with no app. This # was an issue when building a new app with the fetch command and when the thread did a # chdir to the new app directory (to fetch it) Origen.log would try to load the partial app. @running_outside_an_app = true unless in_app_workspace? return nil if @running_outside_an_app require File.join(root, APP_CONFIG) @application = _applications_lookup[:root][root.to_s] if File.exist?(File.join(root, 'Gemfile')) && !@with_boot_environment # Don't understand the rules here, belt and braces approach for now to make # sure that all Origen plugins are auto-required (otherwise Origen won't know # about them to plug them into the application) Bundler.require Bundler.require(:development) Bundler.require(:runtime) Bundler.require(:default) end if @with_boot_environment @application.current_plugin.disable else Origen.import_manager.require! Origen.remote_manager.require! end env = File.join(root, 'config', 'environment.rb') require env if File.exist?(env) dev = File.join(root, 'config', 'development.rb') require dev if File.exist?(dev) version_checker.check! if check_version validate_origen_dev_configuration! ([@application] + Origen.plugins).each(&:on_loaded) @application_loaded = true @application end end |
.load_target(t, options = {}) ⇒ Object
237 238 239 240 241 |
# File 'lib/origen.rb', line 237 def load_target(t, = {}) target.temporary = t application.load_target!() application.runner.prepare_and_validate_workspace end |
.lsf ⇒ Object
528 529 530 |
# File 'lib/origen.rb', line 528 def lsf application.lsf_manager end |
.mailer ⇒ Object
229 230 231 |
# File 'lib/origen.rb', line 229 def mailer application.mailer end |
.mode ⇒ Object
Returns an object tracking the Origen execution mode/configuration, an instance of Origen::Mode
578 579 580 |
# File 'lib/origen.rb', line 578 def mode application.config.mode end |
.mode=(val) ⇒ Object
582 583 584 |
# File 'lib/origen.rb', line 582 def mode=(val) application.config.mode = val end |
.pattern ⇒ Object
380 381 382 |
# File 'lib/origen.rb', line 380 def pattern generator.pattern end |
.pin_bank ⇒ Object
352 353 354 |
# File 'lib/origen.rb', line 352 def pin_bank @pin_bank ||= Pins::PinBank.new end |
.plugins ⇒ Object
Returns an array containing the application instances of all plugins
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/origen.rb', line 94 def plugins @plugins ||= begin top = Origen.app plugins = [] Origen._applications_lookup[:name].each do |_name, app| plugins << app unless app == top end plugins end end |
.plugins_manager ⇒ Object Also known as: plugin_manager, current_plugin
369 370 371 |
# File 'lib/origen.rb', line 369 def plugins_manager application.plugins_manager end |
.profile(message) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/origen.rb', line 71 def profile() if @profiling caller[0] =~ /.*\/(\w+\.rb):(\d+).*/ if block_given? start = Time.now yield duration_in_ms = ((Time.now - start) * 1000).round puts "#{duration_in_ms}ms".ljust(10) + "#{Regexp.last_match[1]}:#{Regexp.last_match[2]} '#{}'" else puts "#{Time.now} - #{Regexp.last_match[1]}:#{Regexp.last_match[2]} #{}" end else yield if block_given? end end |
.register_application(app) ⇒ Object
87 88 89 90 91 |
# File 'lib/origen.rb', line 87 def register_application(app) _applications_lookup[:name][app.name] = app _applications_lookup[:root][app.root.to_s] = app @plugins = nil end |
.regression_manager ⇒ Object
360 361 362 |
# File 'lib/origen.rb', line 360 def regression_manager @regression_manager ||= RegressionManager.new end |
.remote_manager ⇒ Object Also known as: remotes_manager
375 376 377 |
# File 'lib/origen.rb', line 375 def remote_manager @remote_manager ||= RemoteManager.new end |
.reset_interface(options = {}) ⇒ Object
Resets the tester interface (instantiates a new one). Any supplied options are passed to the interface initialization.
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/origen.rb', line 478 def reset_interface( = {}) # The doc interface should in future be phased out, but for now assume that an explicitly # declared interface is for the non-doc case if [:interface] && !Origen.tester.doc? @interface = eval([:interface]).new() else int = interfaces.find { |i| i.supports?(Origen.tester) } if int @interface = int.new() else unless .delete(:silence_no_interface_error) fail "No interface has been defined for tester: #{Origen.tester.class}" end end end @interface._load_generator if @interface.respond_to?(:_load_generator) if @interface.respond_to?(:at_flow_start) @interface.at_flow_start else @interface.reset_globals if @interface.respond_to?(:reset_globals) end @interface end |
.resources ⇒ Object
388 389 390 |
# File 'lib/origen.rb', line 388 def resources generator.resources end |
.root(plugin = nil) ⇒ Object Also known as: app_root
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/origen.rb', line 256 def root(plugin = nil) if plugin app(plugin).root else if @root_fudge_active app.root else @root ||= begin path = Pathname.new(Dir.pwd) until path.root? || File.exist?(File.join(path, APP_CONFIG)) path = path.parent end if path.root? fail 'Something went wrong resolving the application root!' end path end end end end |
.root! ⇒ Object
Like Origen.root but this will return the plugin root if called by plugin code
279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/origen.rb', line 279 def root! file = caller[0] path = Pathname.new(file).dirname until path.root? || File.exist?(File.join(path, APP_CONFIG)) path = path.parent end if path.root? fail "Something went wrong resolving Origen.root! from: #{caller[0]}" end path.realpath end |
.running_locally? ⇒ Boolean
545 546 547 |
# File 'lib/origen.rb', line 545 def running_locally? !running_remotely? end |
.running_on_linux? ⇒ Boolean
536 537 538 |
# File 'lib/origen.rb', line 536 def running_on_linux? !running_on_windows? end |
.running_on_windows? ⇒ Boolean
532 533 534 |
# File 'lib/origen.rb', line 532 def running_on_windows? RUBY_PLATFORM == 'i386-mingw32' end |
.running_remotely=(val) ⇒ Object
549 550 551 |
# File 'lib/origen.rb', line 549 def running_remotely=(val) @running_remotely = val end |
.running_remotely? ⇒ Boolean Also known as: running_remotely
540 541 542 |
# File 'lib/origen.rb', line 540 def running_remotely? @running_remotely end |
.set_development_mode ⇒ Object
572 573 574 |
# File 'lib/origen.rb', line 572 def set_development_mode @development = true end |
.site_config ⇒ Object
58 59 60 |
# File 'lib/origen/site_config.rb', line 58 def self.site_config @site_config ||= SiteConfig.new end |
.target ⇒ Object
233 234 235 |
# File 'lib/origen.rb', line 233 def target application.target end |
.tester ⇒ Object
348 349 350 |
# File 'lib/origen.rb', line 348 def tester application && application.tester end |
.time ⇒ Object
392 393 394 |
# File 'lib/origen.rb', line 392 def time @time ||= Origen::Tester::Time.new end |
.top ⇒ Object
Returns the full path to the Origen core top-level directory
459 460 461 |
# File 'lib/origen.rb', line 459 def top @origen_top ||= Pathname.new(File.dirname(__FILE__)).parent end |
.top_level ⇒ Object
Returns the current top-level (DUT) object if one has been defined (by instantiating an object that includes Origen::TopLevel).
588 589 590 591 592 |
# File 'lib/origen.rb', line 588 def top_level # TODO: This is called a lot and should probably be cached and expired # on before_target_load application.top_level end |
.validate_origen_dev_configuration! ⇒ 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.
Validates that when the current app is OrigenCore then the origen executable is coming from the same workspace
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/origen.rb', line 155 def validate_origen_dev_configuration! if Origen.app.name == :origen_core if Origen.root != Origen.top puts 'It looks like you are trying to develop Origen core, but you are running an Origen' puts 'executable from another workspace!' if Origen.running_on_windows? puts 'To resolve this error you must add the following directory to your Windows PATH:' puts " #{Origen.root}\\bin" else puts 'To resolve this error run:' puts " cd #{Origen.root}" puts ' source source_setup' end exit 1 end end end |
.version(options = {}) ⇒ Object
400 401 402 403 404 405 406 407 |
# File 'lib/origen.rb', line 400 def version( = {}) @version = nil if [:refresh] return @version if @version && ![:refresh] if [:refresh] || !defined?(Origen::VERSION) load File.join(Pathname.new(File.dirname(__FILE__)).parent, 'config', 'version.rb') end @version = Origen::VersionString.new(Origen::VERSION) end |
.version_checker ⇒ Object
Returns an instance of Origen::VersionChecker
454 455 456 |
# File 'lib/origen.rb', line 454 def version_checker @version_checker ||= VersionChecker.new end |
.with_boot_environment ⇒ 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.
Turns off bundler and all plugins if the app is loaded within this block
309 310 311 312 313 |
# File 'lib/origen.rb', line 309 def with_boot_environment @with_boot_environment = true yield @with_boot_environment = false end |
.with_disable_origen_version_check(*args, &block) ⇒ Object Also known as: disable_origen_version_check
315 316 317 |
# File 'lib/origen.rb', line 315 def with_disable_origen_version_check(*args, &block) version_checker.with_disable_origen_version_check(*args, &block) end |
.with_origen_root(path) ⇒ 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.
Ugly hack to force Origen.root references to the plugin’s top-level when loading the environment.rb of the plugin
References to Origen.root in a plugin environment.rb is deprecated and this will be removed in future once all plugins load through bundler
298 299 300 301 302 303 304 305 |
# File 'lib/origen.rb', line 298 def with_origen_root(path) orig = app.root @root_fudge_active = true app.root = Pathname.new(path) yield app.root = orig @root_fudge_active = false end |
.with_source_file(file) ⇒ 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.
145 146 147 148 149 |
# File 'lib/origen.rb', line 145 def with_source_file(file) @current_source_dir = Pathname.new(file).dirname yield @current_source_dir = nil end |