origen 0.33.3 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df84c7214237f807371534766be022afc95ba8fe
4
- data.tar.gz: 98751baf8dc8fa699ed55fada8c0b347a9b5a07d
3
+ metadata.gz: c0607d958ddc8e398df2a7272ac4adf9655c6e78
4
+ data.tar.gz: dfe13eb62b19e431b6cd3de07afb48aa4fddf1af
5
5
  SHA512:
6
- metadata.gz: dc012d1ca8883e85b04019b3e09355864169da0eb166049053b708abc758c3fab872eeb205aa53d492c36cbd05cc875753b641d5828ebfe21e488e89646aae31
7
- data.tar.gz: a206be55eab62f8babecfb3394e0871db316addea6549c4a5d32a7e1743358f5c4bc76f7d54b119e6a531880c142cc96bd186a1aadf2fef4e5b8b23d8fb80c89
6
+ metadata.gz: 0298c4113fc30bd3e4911710092853158bfe14a37f6a077312df8936f669ca5f1ed52e3b40c2d87388b628cd1a87eaa4fe78764f240da4e56f5f07c50020006d
7
+ data.tar.gz: e2bb350fc891d8fea28d82e72b47cf462c9f94468cdccb19e8c477cf09bdfcaf78e33644a03004a6e84c89dd96c9a1aa3d00c8b042b6e86c90874a95108e677f
@@ -43,8 +43,8 @@ class OrigenCoreApplication < Origen::Application
43
43
 
44
44
  config.pattern_prefix = "nvm"
45
45
 
46
- config.pattern_header do
47
- cc "This is a dummy pattern created by the Origen test environment"
46
+ config.application_pattern_header do |options|
47
+ "This is a dummy pattern created by the Origen test environment"
48
48
  end
49
49
 
50
50
  # Add any directories or files not intended to be under change management control
@@ -109,6 +109,16 @@ class OrigenCoreApplication < Origen::Application
109
109
  end
110
110
  end
111
111
 
112
+ def after_web_compile(options)
113
+ Origen.app.plugins.each do |plugin|
114
+ if plugin.config.shared && plugin.config.shared[:origen_guides]
115
+ Origen.app.runner.launch action: :compile,
116
+ files: File.join(plugin.root, plugin.config.shared[:origen_guides]),
117
+ output: File.join('web', 'content', 'guides')
118
+ end
119
+ end
120
+ end
121
+
112
122
  # Ensure that all tests pass before allowing a release to continue
113
123
  def validate_release
114
124
  if !system("origen specs") || !system("origen examples")
data/config/commands.rb CHANGED
@@ -16,7 +16,79 @@ when "tags"
16
16
 
17
17
  when "specs"
18
18
  require "rspec"
19
- exit RSpec::Core::Runner.run(['spec'])
19
+
20
+ options = {}
21
+ opt_parser = OptionParser.new do |opts|
22
+ opts.banner = [
23
+ 'Run the specs unit tests',
24
+ 'Usage: origen specs [filename_substrings...] [options]',
25
+ "Note: all files must reside in #{Origen.app.root}/specs for filename substrings",
26
+ "E.g.: origen specs site_config #=> runs only specs in filenames matching 'site_config'"
27
+ ].join("\n")
28
+ opts.on('-h', '--help', 'Show this help message') do |h|
29
+ puts opt_parser
30
+ exit!
31
+ end
32
+ end
33
+ opt_parser.parse! ARGV
34
+
35
+ # Search for the filenames given.
36
+ spec_files = ARGV.map do |file|
37
+ f = Pathname.new(file)
38
+ dir = Origen.app.root.join('spec')
39
+
40
+ # Find any files that match the name. Include all these files.
41
+ # Note that this will map a string to an array, so we'll flatten the array later.
42
+ # Also, we'll only search for .rb files in spec. Append that to the glob if no file ext is provided.
43
+ if f.exist? && f.extname == '.rb'
44
+ # This is a hard-coded path. Don't glob this, just make sure its witin the spec directory.
45
+ File.expand_path(f)
46
+ elsif f.extname == '.rb'
47
+ # Search includes the extension, so don't add it.
48
+ # (limited to .rb files)
49
+ Dir.glob(dir.join("**/*#{f}"))
50
+ else
51
+ # Search for matching ruby files.
52
+ # (limited to .rb files)
53
+ Dir.glob(dir.join("**/*#{f}*.rb"))
54
+ end
55
+ end
56
+ spec_files.flatten!
57
+
58
+ if ARGV.empty?
59
+ # No filename substrings given. Run all *_spec files in spec/ directory
60
+ spec_files = ['spec']
61
+ elsif spec_files.empty? && !ARGV.empty?
62
+ # The spec files to run is empty, but file substring were given.
63
+ # Report that no files were found and exit.
64
+ Origen.app!.fail!(message: "No matching spec files could be found at #{Origen.app.root}/spec for patterns: #{ARGV.join(', ')}")
65
+ else
66
+ # Filename substrings were given and matching files were found. List the files just for user awareness.
67
+ Origen.log.info "Found matching specs files for patterns: #{ARGV.join(', ')}"
68
+ spec_files.each { |f| Origen.log.info(f) }
69
+ end
70
+
71
+ current_mode = Origen.mode.instance_variable_get(:@current_mode)
72
+ Origen.mode = :debug
73
+ Origen.app.session.origen_core[:mode] = Origen.mode.to_s
74
+ begin
75
+ status = RSpec::Core::Runner.run(spec_files)
76
+ rescue SystemExit => e
77
+ Origen.log.error "Unexpected SystemExit reached. Reporting failure status..."
78
+ status = 1
79
+ end
80
+ Origen.mode = current_mode
81
+ Origen.app.session.origen_core[:mode] = Origen.mode.to_s
82
+
83
+ # One kind of confusing thing is that Specs can still print the 'pass'/'success' verbiage even when it actually failed.
84
+ # This is due to rspec itself catching the errors, so there's no exception to catch from outside Rspec.
85
+ # Most likely the user will see red and see that nothing was actually run, but print a reassuring message from Origen saying that the specs actually failed,
86
+ # despite what Rspec's verbiage says.
87
+ if status == 1
88
+ Origen.log.error "Some errors occurred outside of the examples: received exit status 1 (failure). Please review RSpec output for details."
89
+ end
90
+
91
+ exit(status)
20
92
 
21
93
  when "examples", "test"
22
94
  Origen.load_application
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
- MINOR = 33
4
- BUGFIX = 3
3
+ MINOR = 34
4
+ BUGFIX = 0
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
data/lib/origen.rb CHANGED
@@ -660,6 +660,12 @@ unless defined? RGen::ORIGENTRANSITION
660
660
  @running_remotely = val
661
661
  end
662
662
 
663
+ # Returns true if Origen is running interactively. That is, the command was 'origen i'
664
+ def running_interactively?
665
+ !!@running_interactively
666
+ end
667
+ alias_method :interactive?, :running_interactively?
668
+
663
669
  # Returns true if Origen is running with the -d or --debug switches enabled
664
670
  def debug?
665
671
  @debug || false
@@ -671,7 +677,7 @@ unless defined? RGen::ORIGENTRANSITION
671
677
  end
672
678
 
673
679
  def debugger_enabled?
674
- @debug
680
+ debug?
675
681
  end
676
682
 
677
683
  def development?
@@ -900,6 +900,53 @@ END
900
900
  @target_instantiated
901
901
  end
902
902
 
903
+ # Prepends the application name to the fail message and throws a RuntimeError exception.
904
+ # Very similar to the plain <code>fail</code> method with the addition of prepending the application name.
905
+ # Prepended message: 'Fail in app.name: '
906
+ # If no message if provided, message is set to 'Fail in app.name'
907
+ # @param message [String] Message to print with the exception. If the message option is nil, a default message will be used instead.
908
+ # @param exception_class [Class] Custom Exception class to throw. May require the full namespace, e.g. <code>Origen::OrigenError</code> instead of just <code>OrigenError</code>.
909
+ # @raise [RuntimeError, exception_class] Option exception_class is raised, defaulting to <code>RuntimeError</code>.
910
+ def fail(message: nil, exception_class: RuntimeError)
911
+ message.nil? ? message = "Fail in #{name}" : message = "Fail in #{name}: #{message}"
912
+ e = exception_class.new(message)
913
+
914
+ # If the caller is Origen.app.fail!, remove this caller from the backtrace, leaving where Origen.app.fail! was called.
915
+ # As an aside, if there's an exception raised in Origen.app.fail!, then that would actually raise a Kernel.fail, so there's no concern with masking
916
+ # out a problem with Origen.app.fail! by doing this.
917
+ if caller[0] =~ (/lib\/origen\/application.rb:\d+:in `fail!'/)
918
+ e.set_backtrace(caller[1..-1])
919
+ else
920
+ e.set_backtrace(caller)
921
+ end
922
+ Kernel.fail(e)
923
+ end
924
+
925
+ # Similar to Origen.app.fail, but will instead print the message using Origen.log.error and exit the current process (using <code>exit 1</code>)
926
+ # UNLESS --debug is used. In those cases, <code>exit</code> will not be used and instead this will behave the same as {Origen::Application#fail}.
927
+ # Purpose here is to allow fail! for normal usage, but provide more details as to where fail! was used when running in debug.
928
+ # @param message [String] Message to print with the exception. If the message option is nil, a default message will be used instead.
929
+ # @param exception_class [Class] Custom Exception class to throw. May require the full namespace.
930
+ # @param exit_status [Integer] Exit status to use when exiting the application.
931
+ # @raise [RuntimeError, SystemExit, exception_class] When debug is disabled, <code>SystemExit</code> will be raised.
932
+ # When debug is enabled, exception_class will be raised, defaulting to <code>RuntimeError</code>.
933
+ def fail!(message: nil, exception_class: RuntimeError, exit_status: 1)
934
+ if Origen.debug?
935
+ # rubocop:disable Style/RedundantSelf
936
+ self.fail(message: message, exception_class: exception_class)
937
+ # rubocop:enable Style/RedundantSelf
938
+ else
939
+ begin
940
+ # rubocop:disable Style/RedundantSelf
941
+ self.fail(message: message, exception_class: exception_class)
942
+ # rubocop:enable Style/RedundantSelf
943
+ rescue exception_class => e
944
+ Origen.log.error(e.message)
945
+ exit exit_status
946
+ end
947
+ end
948
+ end
949
+
903
950
  # This method is called just after an application inherits from Origen::Application,
904
951
  # allowing the developer to load classes in lib and use them during application
905
952
  # configuration.
@@ -29,7 +29,8 @@ module Origen
29
29
  # below for more details on this.
30
30
  ATTRS_THAT_DEPEND_ON_TARGET = [
31
31
  :output_directory, :reference_directory, :pattern_postfix, :pattern_prefix,
32
- :pattern_header, :release_directory, :pattern_name_translator, :pattern_directory, :pattern_output_directory,
32
+ :pattern_header, :current_plugin_pattern_header, :application_pattern_header, :shared_pattern_header,
33
+ :release_directory, :pattern_name_translator, :pattern_directory, :pattern_output_directory,
33
34
  :proceed_with_pattern, :test_program_output_directory, :test_program_source_directory,
34
35
  :test_program_template_directory, :referenced_pattern_list, :program_prefix, :web_directory,
35
36
  :web_domain
@@ -51,6 +52,10 @@ module Origen
51
52
  :test_program_template_directory, :referenced_pattern_list
52
53
  ]
53
54
 
55
+ ATTRS_THAT_ARE_SET_TO_A_BLOCK = [
56
+ :current_plugin_pattern_header, :application_pattern_header, :shared_pattern_header, #:pattern_footer
57
+ ]
58
+
54
59
  def log_deprecations
55
60
  # unless imports.empty?
56
61
  # Origen.deprecate "App #{app.name} uses config.imports this will be removed in Origen V3 and a Gemfile/.gemspec should be used instead"
@@ -146,7 +151,9 @@ module Origen
146
151
  fail "You have attempted to access Origen.config.#{name} before instantiating the target"
147
152
  end
148
153
  end
149
- var.call
154
+
155
+ # Some config variables should be left as a block/proc object. If this is one of those, just return the var.
156
+ ATTRS_THAT_ARE_SET_TO_A_BLOCK.include?(name) ? var : var.call
150
157
  else
151
158
  var
152
159
  end
@@ -52,6 +52,8 @@ Usage: origen i [options]
52
52
  Origen.target.temporary = options[:target] if options[:target]
53
53
  Origen.app.load_target!
54
54
  Origen.app.runner.prepare_directories # Ensure tmp et all exist
55
+
56
+ Origen.instance_variable_set(:@running_interactively, true)
55
57
  listeners_for(:interactive_startup).each(&:interactive_startup)
56
58
 
57
59
  begin
@@ -50,6 +50,7 @@ The following options are available:
50
50
  opts.on('-m', '--mode MODE', Origen::Mode::MODES, 'Force the Origen operating mode:', ' ' + Origen::Mode::MODES.join(', ')) { |_m| }
51
51
  opts.on('--no-serve', "Don't serve the website after compiling without the remote option") { options[:no_serve] = true }
52
52
  opts.on('-c', '--comment COMMENT', String, 'Supply a commit comment when deploying to Git') { |o| options[:comment] = o }
53
+
53
54
  # Apply any application option extensions to the OptionParser
54
55
  Origen::CommandHelpers.extend_options(opts, app_options, options)
55
56
  opts.separator ''
@@ -73,14 +74,10 @@ The following options are available:
73
74
 
74
75
  def self._start_server
75
76
  # Get the current host
76
- host = `hostname`.strip.downcase
77
- if Origen.running_on_windows?
78
- domain = 'fsl.freescale.net'
79
- else
80
- domain = `dnsdomainname`.strip
81
- end
82
- # Get a free port
83
77
  require 'socket'
78
+ host = Socket.gethostbyname(Socket.gethostname).first.downcase
79
+
80
+ # Get a free port
84
81
  port = 8000 # preferred port
85
82
  begin
86
83
  server = TCPServer.new('127.0.0.1', port)
@@ -92,11 +89,7 @@ The following options are available:
92
89
  server.close
93
90
  # Start the server
94
91
  puts ''
95
- if host.include? domain
96
- puts "Point your browser to this address: http://#{host}:#{port}"
97
- else
98
- puts "Point your browser to this address: http://#{host}#{domain.empty? ? '' : '.' + domain}:#{port}"
99
- end
92
+ puts "Point your browser to this address: http://#{host}:#{port}"
100
93
  puts ''
101
94
  puts 'To shut down the server use CTRL-C'
102
95
  puts ''
@@ -201,21 +201,22 @@ module Origen
201
201
 
202
202
  def header
203
203
  Origen.tester.pre_header if Origen.tester.doc?
204
- c2 '*' * 75
204
+ inject_separator
205
205
  if $desc
206
206
  c2 'DESCRIPTION:'
207
207
  $desc.split(/\n/).each { |line| cc line }
208
- c2 '*' * 75
208
+ inject_separator
209
209
  end
210
210
  c2 'GENERATED:'
211
211
  c2 " Time: #{Origen.launch_time}"
212
212
  c2 " By: #{Origen.current_user.name}"
213
+ c2 " Mode: #{Origen.mode}"
213
214
  l = " Command: origen g #{job.requested_pattern} -t #{Origen.target.file.basename}"
214
215
  if Origen.environment && Origen.environment.file
215
216
  l += " -e #{Origen.environment.file.basename}"
216
217
  end
217
218
  c2(l)
218
- c2 '*' * 75
219
+ inject_separator
219
220
  c2 'ENVIRONMENT:'
220
221
  c2 ' Application'
221
222
  if Origen.app.rc
@@ -251,13 +252,102 @@ module Origen
251
252
  c2 " #{plugin.name}:".ljust(30) + plugin.version
252
253
  end
253
254
  end
254
- c2 '*' * 75
255
+ inject_separator
256
+
257
+ unless Origen.app.plugins.empty?
258
+ # Plugins can use config.shared_pattern_header to inject plugin-specific comments into the patterns header
259
+ header_printed = false
260
+ Origen.app.plugins.sort_by { |p| p.name.to_s }.each do |plugin|
261
+ unless plugin.config.shared_pattern_header.nil?
262
+ unless header_printed
263
+ c2 'Header Comments From Shared Plugins:'
264
+ header_printed = true
265
+ end
266
+ inject_pattern_header(
267
+ config_loc: plugin,
268
+ scope: :shared_pattern_header,
269
+ message: "Header Comments From Shared Plugin: #{plugin.name}:",
270
+ message_spacing: 2,
271
+ line_spacing: 4,
272
+ no_separator: true
273
+ )
274
+ end
275
+ end
276
+ inject_separator if header_printed
277
+ end
278
+
279
+ if Origen.app.plugins.current && !Origen.app.plugins.current.config.send(:current_plugin_pattern_header).nil?
280
+ # The top level plugin (if one is set) can further inject plugin-specific comment into the header.
281
+ # These will only appear if the plugin is the top-level plugin though.
282
+ inject_pattern_header(
283
+ config_loc: Origen.app.plugins.current,
284
+ scope: :current_plugin_pattern_header,
285
+ message: "Header Comments From The Current Plugin: #{Origen.app.plugins.current.name}:"
286
+ )
287
+ end
288
+
289
+ unless Origen.app.config.send(:application_pattern_header).nil?
290
+ inject_pattern_header(
291
+ config_loc: Origen.app,
292
+ scope: :application_pattern_header,
293
+ message: "Header Comments From Application: #{Origen.app.name}:"
294
+ )
295
+ end
296
+
255
297
  if Origen.config.pattern_header
256
- c2 '*' * 75
298
+ Origen.log.deprecated 'Origen.config.pattern_header is deprecated.'
299
+ Origen.log.deprecated 'Please use config.shared_pattern_header, config.application_pattern_header, or config.current_plugin_pattern_header instead.'
300
+ inject_separator
257
301
  end
258
302
  Origen.tester.close_text_block if Origen.tester.doc?
259
303
  end
260
304
 
305
+ def inject_separator(options = {})
306
+ separator_length = options[:size] || 75
307
+ c2('*' * separator_length)
308
+ end
309
+
310
+ def inject_pattern_header(config_loc:, scope:, message:, **options)
311
+ message_spacing = options[:message_spacing] || 0
312
+ line_spacing = options[:line_spacing] || 2
313
+ no_separator = options[:no_separator] || false
314
+
315
+ # Print a warning if any of the pattern header configs have an arity greater than 1.
316
+ # Anything over 1 won't be used and may cause confusion.
317
+ if config_loc.config.send(scope).arity > 1
318
+ Origen.log.warning "Configuration in #{config_loc.name} has attribute ##{scope} whose block has an arity > 1"
319
+ Origen.log.warning 'Calls to this attribute from Origen are only given an options hash parameter. Any other arguments are extraneous'
320
+ end
321
+
322
+ # Inject the header based on these guidelines:
323
+ # 1. if pattern_header is nil, ignore all. Don't print he message, don't do anything.
324
+ # 2. if pattern header is a block, print the message, then call the block. This allows the user to format everything themselves.
325
+ # i.e., use of cc, ss, etc. is allowed here, at the expense of the user being responsible for the formatting.
326
+ # 3. if a string, print the message and format the string as 'cc'
327
+ # 4. if an array, print the message and format the array as a subsequent 'cc' calls.
328
+ injection = config_loc.config.send(scope).call({})
329
+ if injection.nil?
330
+ # Do nothing. It is assumed in this acase that the pattern header has not comments to add at this scope.
331
+ return
332
+ elsif injection.is_a?(String)
333
+ c2(' ' * message_spacing + message)
334
+ c2(' ' * line_spacing + injection.to_s)
335
+ inject_separator(options) unless no_separator
336
+ elsif injection.is_a?(Array)
337
+ c2(' ' * message_spacing + message)
338
+ injection.each do |line|
339
+ c2(' ' * line_spacing + line.to_s)
340
+ end
341
+ inject_separator(options) unless no_separator
342
+ elsif injection.respond_to?(:call)
343
+ c2(' ' * message_spacing + message)
344
+ injection.call
345
+ inject_separator(options) unless no_separator
346
+ else
347
+ Origen.app.fail!(message: "Unexpected object class returned by config.pattern_header from #{config_loc.name}: #{injection.class}", exception_class: TypeError)
348
+ end
349
+ end
350
+
261
351
  def pattern_open(options = {})
262
352
  options = {
263
353
  call_startup_callbacks: true
@@ -8,9 +8,9 @@ module Origen
8
8
  # it would cause a double cycle in the org file if also captured at the pin
9
9
  ORG_FILE_INTERCEPTED_METHODS = [
10
10
  :suspend, :resume, :repeat_previous=,
11
- :drive_hi, :drive_hi, :drive_very_hi, :drive_lo, :drive_lo, :drive_mem, :expect_mem,
12
- :assert_hi, :expect_hi, :compare_hi, :assert_lo, :expect_lo, :compare_lo, :dont_care,
13
- :drive, :assert, :compare, :expect, :assert_midband, :compare_midband, :expect_midband,
11
+ :drive_hi, :write_hi, :drive_very_hi, :drive_lo, :write_lo, :drive_mem, :expect_mem,
12
+ :assert_hi, :expect_hi, :compare_hi, :read_hi, :assert_lo, :expect_lo, :compare_lo, :read_lo, :dont_care,
13
+ :drive, :write, :assert, :compare, :expect, :read, :assert_midband, :compare_midband, :expect_midband, :read_midband,
14
14
  :toggle, :capture, :store
15
15
  ]
16
16
 
@@ -698,11 +698,13 @@ module Origen
698
698
  set_state(:drive)
699
699
  set_value(1)
700
700
  end
701
+ alias_method :write_hi, :drive_hi
701
702
 
702
703
  def drive_hi!
703
704
  drive_hi
704
705
  cycle
705
706
  end
707
+ alias_method :write_hi!, :drive_hi!
706
708
 
707
709
  # Set the pin to drive a high voltage on future cycles (if the tester supports it).
708
710
  # For example on a J750 high-voltage channel the pin state would be set to "2"
@@ -721,11 +723,13 @@ module Origen
721
723
  set_state(:drive)
722
724
  set_value(0)
723
725
  end
726
+ alias_method :write_lo, :drive_lo
724
727
 
725
728
  def drive_lo!
726
729
  drive_lo
727
730
  cycle
728
731
  end
732
+ alias_method :write_lo!, :drive_lo!
729
733
 
730
734
  def drive_mem
731
735
  set_state(:drive_mem)
@@ -752,6 +756,7 @@ module Origen
752
756
  end
753
757
  alias_method :expect_hi, :assert_hi
754
758
  alias_method :compare_hi, :assert_hi
759
+ alias_method :read_hi, :assert_hi
755
760
 
756
761
  def assert_hi!
757
762
  assert_hi
@@ -759,6 +764,7 @@ module Origen
759
764
  end
760
765
  alias_method :expect_hi!, :assert_hi!
761
766
  alias_method :compare_hi!, :assert_hi!
767
+ alias_method :read_hi!, :assert_hi!
762
768
 
763
769
  # Set the pin to expect a 0 on future cycles
764
770
  def assert_lo(_options = {})
@@ -775,6 +781,7 @@ module Origen
775
781
  end
776
782
  alias_method :expect_lo, :assert_lo
777
783
  alias_method :compare_lo, :assert_lo
784
+ alias_method :read_lo, :assert_lo
778
785
 
779
786
  def assert_lo!
780
787
  assert_lo
@@ -782,6 +789,7 @@ module Origen
782
789
  end
783
790
  alias_method :expect_lo!, :assert_lo!
784
791
  alias_method :compare_lo!, :assert_lo!
792
+ alias_method :read_lo!, :assert_lo!
785
793
 
786
794
  # Set the pin to X on future cycles
787
795
  def dont_care
@@ -803,11 +811,13 @@ module Origen
803
811
  set_state(:drive)
804
812
  set_value(value)
805
813
  end
814
+ alias_method :write, :drive
806
815
 
807
816
  def drive!(value)
808
817
  drive(value)
809
818
  cycle
810
819
  end
820
+ alias_method :write!, :drive!
811
821
 
812
822
  # Pass in 0 or 1 to have the pin expect_lo or expect_hi respectively.
813
823
  # This is useful when programatically setting the pin state.
@@ -821,6 +831,7 @@ module Origen
821
831
  end
822
832
  alias_method :compare, :assert
823
833
  alias_method :expect, :assert
834
+ alias_method :read, :assert
824
835
 
825
836
  def assert!(*args)
826
837
  assert(*args)
@@ -828,12 +839,14 @@ module Origen
828
839
  end
829
840
  alias_method :compare!, :assert!
830
841
  alias_method :expect!, :assert!
842
+ alias_method :read!, :assert!
831
843
 
832
844
  def assert_midband
833
845
  set_state(:compare_midband)
834
846
  end
835
847
  alias_method :compare_midband, :assert_midband
836
848
  alias_method :expect_midband, :assert_midband
849
+ alias_method :read_midband, :assert_midband
837
850
 
838
851
  def assert_midband!
839
852
  assert_midband
@@ -841,6 +854,7 @@ module Origen
841
854
  end
842
855
  alias_method :compare_midband!, :assert_midband!
843
856
  alias_method :expect_midband!, :assert_midband!
857
+ alias_method :read_midband!, :assert_midband!
844
858
 
845
859
  # Returns the state of invert
846
860
  def inverted?
@@ -8,9 +8,9 @@ module Origen
8
8
  include OrgFile::Interceptable
9
9
 
10
10
  ORG_FILE_INTERCEPTED_METHODS = [
11
- :drive, :drive_hi, :drive_lo, :drive_very_hi, :drive_mem, :expect_mem, :toggle,
12
- :repeat_previous=, :capture, :assert, :compare, :expect,
13
- :assert_hi, :expect_hi, :compare_hi, :assert_lo, :expect_lo, :compare_lo,
11
+ :drive, :write, :drive_hi, :write_hi, :drive_lo, :write_lo, :drive_very_hi, :drive_mem, :expect_mem, :toggle,
12
+ :repeat_previous=, :capture, :assert, :read, :compare, :expect,
13
+ :assert_hi, :expect_hi, :compare_hi, :read_hi, :assert_lo, :expect_lo, :compare_lo, :read_lo,
14
14
  :dont_care
15
15
  ]
16
16
 
@@ -234,33 +234,39 @@ module Origen
234
234
  end
235
235
  myself
236
236
  end
237
+ alias_method :write, :drive
237
238
 
238
239
  def drive!(val)
239
240
  drive(val)
240
241
  cycle
241
242
  end
243
+ alias_method :write!, :drive!
242
244
 
243
245
  # Set all pins in pin group to drive 1's on future cycles
244
246
  def drive_hi
245
247
  each(&:drive_hi)
246
248
  myself
247
249
  end
250
+ alias_method :write_hi, :drive_hi
248
251
 
249
252
  def drive_hi!
250
253
  drive_hi
251
254
  cycle
252
255
  end
256
+ alias_method :write_hi!, :drive_hi!
253
257
 
254
258
  # Set all pins in pin group to drive 0's on future cycles
255
259
  def drive_lo
256
260
  each(&:drive_lo)
257
261
  myself
258
262
  end
263
+ alias_method :write_lo, :drive_lo
259
264
 
260
265
  def drive_lo!
261
266
  drive_lo
262
267
  cycle
263
268
  end
269
+ alias_method :write_lo!, :drive_lo!
264
270
 
265
271
  # Set all pins in the pin group to drive a high voltage on future cycles (if the tester supports it).
266
272
  # For example on a J750 high-voltage channel the pin state would be set to "2"
@@ -377,6 +383,7 @@ module Origen
377
383
  end
378
384
  alias_method :compare, :assert
379
385
  alias_method :expect, :assert
386
+ alias_method :read, :assert
380
387
 
381
388
  def assert!(*args)
382
389
  assert(*args)
@@ -384,6 +391,7 @@ module Origen
384
391
  end
385
392
  alias_method :compare!, :assert!
386
393
  alias_method :expect!, :assert!
394
+ alias_method :read!, :assert!
387
395
 
388
396
  # Set all pins in the pin group to expect 1's on future cycles
389
397
  def assert_hi(options = {})
@@ -392,6 +400,7 @@ module Origen
392
400
  end
393
401
  alias_method :expect_hi, :assert_hi
394
402
  alias_method :compare_hi, :assert_hi
403
+ alias_method :read_hi, :assert_hi
395
404
 
396
405
  def assert_hi!
397
406
  assert_hi
@@ -399,6 +408,7 @@ module Origen
399
408
  end
400
409
  alias_method :expect_hi!, :assert_hi!
401
410
  alias_method :compare_hi!, :assert_hi!
411
+ alias_method :read_hi!, :assert_hi!
402
412
 
403
413
  # Set all pins in the pin group to expect 0's on future cycles
404
414
  def assert_lo(options = {})
@@ -407,6 +417,7 @@ module Origen
407
417
  end
408
418
  alias_method :expect_lo, :assert_lo
409
419
  alias_method :compare_lo, :assert_lo
420
+ alias_method :read_lo, :assert_lo
410
421
 
411
422
  def assert_lo!
412
423
  assert_lo
@@ -414,6 +425,7 @@ module Origen
414
425
  end
415
426
  alias_method :expect_lo!, :assert_lo!
416
427
  alias_method :compare_lo!, :assert_lo!
428
+ alias_method :read_lo!, :assert_lo!
417
429
 
418
430
  # Set all pins in the pin group to X on future cycles
419
431
  def dont_care
@@ -139,7 +139,7 @@ module Origen
139
139
  @owner = owner
140
140
  @name = name
141
141
  @attributes = attributes
142
- @feature = attributes[:feature] if attributes.key?(:feature)
142
+ @feature = attributes[:_feature] if attributes.key?(:_feature)
143
143
  end
144
144
 
145
145
  # Make this appear like a reg to any application code
@@ -313,12 +313,12 @@ module Origen
313
313
  local_vars = {}
314
314
 
315
315
  Reg::REG_LEVEL_ATTRIBUTES.each do |attribute, meta|
316
- aliases = [attribute]
316
+ aliases = [attribute[1..-1].to_sym]
317
317
  aliases += meta[:aliases] if meta[:aliases]
318
- aliases.each { |_a| local_vars[attribute] = bit_info.delete(attribute) if bit_info.key?(attribute) }
318
+ aliases.each { |_a| local_vars[attribute] = bit_info.delete(_a) if bit_info.key?(_a) }
319
319
  end
320
320
 
321
- local_vars[:reset] ||= :memory if local_vars[:memory]
321
+ local_vars[:_reset] ||= :memory if local_vars[:_memory]
322
322
  @min_reg_address ||= address
323
323
  @max_reg_address ||= address
324
324
  # Must set an initial value, otherwise max_address_reg_size will be nil if a sub_block contains only
@@ -14,13 +14,13 @@ module Origen
14
14
  # to all of its contained bits unless a specific bit has its own definition of the same
15
15
  # attribute
16
16
  REG_LEVEL_ATTRIBUTES = {
17
- feature: {},
18
- reset: { aliases: [:res] },
19
- memory: {},
20
- path: { aliases: [:hdl_path] },
21
- abs_path: { aliases: [:absolute_path] },
22
- access: {},
23
- bit_order: {}
17
+ _feature: {},
18
+ _reset: { aliases: [:res] },
19
+ _memory: {},
20
+ _path: { aliases: [:hdl_path] },
21
+ _abs_path: { aliases: [:absolute_path] },
22
+ _access: {},
23
+ _bit_order: {}
24
24
  }
25
25
 
26
26
  # Returns the object that own the register.
@@ -69,7 +69,13 @@ module Origen
69
69
  @init_as_writable = options.delete(:init_as_writable)
70
70
  @define_file = options.delete(:define_file)
71
71
  REG_LEVEL_ATTRIBUTES.each do |attribute, _meta|
72
- instance_variable_set("@#{attribute}", options.delete(attribute))
72
+ if options[attribute[1..-1].to_sym]
73
+ # If register creation is coming directly from Reg.new, instead of Placeholder,
74
+ # it may not have attributes with '_' prefix
75
+ instance_variable_set("@#{attribute[1..-1]}", options.delete(attribute[1..-1].to_sym))
76
+ else
77
+ instance_variable_set("@#{attribute[1..-1]}", options.delete(attribute))
78
+ end
73
79
  end
74
80
  @description_from_api = {}
75
81
  description = options.delete(:description)
@@ -317,6 +317,7 @@ module Origen
317
317
  unless line =~ /^Logging/ || line == '' ||
318
318
  line =~ /V(\d+\.\d+-\d+|\d.\d+)/ || # Screen out something like "V5.1-1205" or "V6R2010"
319
319
  line =~ /^3DEXPERIENCER\d+x$/ || # Screen out something like '3DEXPERIENCER2016x'
320
+ line =~ /^3DEXPERIENCE R\d+x$/ || # Screen out something like '3DEXPERIENCE R2017x'
320
321
  line.strip.empty?
321
322
  output << line.strip
322
323
  end
@@ -39,18 +39,25 @@ module Origen
39
39
  end
40
40
 
41
41
  def eval_path(path, options = {})
42
- # Expand the first path. This will take care of replacing any leading ~/ with the home directory.
43
- if path.start_with?('\\')
44
- path[0] = ''
45
- else
46
- path = File.expand_path(path)
47
- end
42
+ # Any leading ~ should be expanded with whatever ~/ points to. This needs to be done now because later ~ will be replaced with just the username.
43
+ path = path.sub(/^~/, File.expand_path('~/'))
48
44
 
49
45
  # Gsub the remaining ~ that aren't escaped.
50
46
  # If it was escaped, eat the escape character
51
47
  path.gsub!(/(?<!\\|\A)~/, "#{Etc.getlogin}")
52
48
  path.gsub!(/\\(?=~)/, '')
53
49
 
50
+ # Now, expand the entire path for any other OS-specific symbols.
51
+ # One note, if we still have a leading '~', that means it was escaped at the beginning. So, what we'll do for this is let it expand
52
+ # then replace the leading File.expand_path('~/') with just '~', pretty much the opposite of path.sub(/^~/, File.expand_path('~/'))
53
+ # Note, we can't just take it out, expand, then add it back because expanding the path on Windows will expand to
54
+ # C:\, or D:\ or whatever, so need to do this 'expand, then unexpand' method.
55
+ if path.start_with?('~')
56
+ path = File.expand_path(path).sub(/^#{Regexp.quote(File.expand_path('~/'))}/, '~')
57
+ else
58
+ path = File.expand_path(path)
59
+ end
60
+
54
61
  append = find_val('append_dot_origen')
55
62
  append = '.origen' if append == true || append.nil?
56
63
 
@@ -1,15 +1,30 @@
1
1
  module Origen
2
2
  module Utility
3
3
  class Collector
4
+ # Returns the collector's hash. This is the same as calling {#to_h}
4
5
  attr_reader :_hash_
6
+
7
+ # Queries the current merge_method.
5
8
  attr_reader :merge_method
6
9
 
7
10
  # Need to keep a seperate methods list so we know what's been added by method missing instead of what's
8
11
  # been added either by the hash or by method missing.
9
12
  # Only overwriting a value in the block should cause an error. Overriding a value from the hash depends on
10
13
  # the merge method's setting.
14
+
15
+ # List of the currently seen method names.
11
16
  attr_reader :_methods_
12
17
 
18
+ # Creates a new Collector object and creates a Hash out of the methods names and values in the given block.
19
+ # @see http://origen-sdk.org/origen/guides/misc/utilities/#Collector
20
+ # @example Create a collector to transform a block into a Hash
21
+ # Origen::Utility::Collector.new { |c| c.my_param 'My Parameter'}.to_h #=> {my_param: 'My Parameter'}
22
+ # @yield [self] Passes the collector to the given block.
23
+ # @param options [Hash] Customization options.
24
+ # @option options [Hash] :hash Input, or starting, values that are set in the output hash prior to calling the given block.
25
+ # @option options [Symbol] :merge_method (:keep_hash) Indicates how arguments that exist in both the input hash and in the block should be handled.
26
+ # Accpeted values are :keep_hash, :keep_block, :fail.
27
+ # @raise [Origen::OrigenError] Raised when an unknown merge method is used.
13
28
  def initialize(options = {}, &block)
14
29
  @merge_method = options[:merge_method] || :keep_hash
15
30
  @fail_on_empty_args = options[:fail_on_empty_args]
@@ -25,18 +40,32 @@ module Origen
25
40
  end
26
41
  end
27
42
 
28
- # Legacy store method.
43
+ # Retrieve the collector's hash.
44
+ # @deprecated Use Ruby-centric {#to_hash} instead.
45
+ # @return [Hash] Hash representation of the collector.
29
46
  def store
30
47
  Origen.log.deprecate 'Collector::store method was used. Please use the Ruby-centric Collector::to_h or Collector::to_hash method instead' \
31
48
  " Called from: #{caller[0]}"
32
49
  @_hash_
33
50
  end
34
51
 
52
+ # Returns the collector, as a Hash.
53
+ # @return [Hash] Hash representation of the collector.
35
54
  def to_hash
36
55
  @_hash_
37
56
  end
38
57
  alias_method :to_h, :to_hash
39
58
 
59
+ # Using the method name, creates a key in the Collector with argument given to the method.
60
+ # @see http://origen-sdk.org/origen/guides/misc/utilities/#Collector
61
+ # @note If no args are given, the method key is set to <code>nil</code>.
62
+ # @raise [ArgumentError] Raised when a method attempts to use both arguments and a block in the same line.
63
+ # E.g.: <code>collector.my_param 'my_param' { 'MyParam' }</code>
64
+ # @raise [ArgumentError] Raised when a method attempts to use multiple input values.
65
+ # E.g.: <code>collector.my_param 'my_param', 'MyParam'</code>
66
+ # @raise [Origen::OrigenError] Raised when a method is set more than once. I.e., overriding values are not allowed.
67
+ # E.g.: <code>collector.my_param 'my_param'; collector.my_param 'MyParam'</code>
68
+ # @raise [Origen::OrigenError] Raised when the input hash and the block attempt to set the same method name and the merge method is set to <code>:fail</code>.
40
69
  def method_missing(method, *args, &_block)
41
70
  key = method.to_s.sub('=', '').to_sym
42
71
 
@@ -58,6 +58,9 @@ data_sources:
58
58
  # it will become /about.html/ instead.
59
59
  allow_periods_in_identifiers: false
60
60
 
61
+ # Force utf-8 encoding scheme.
62
+ encoding: utf-8
63
+
61
64
  # Configuration for the watch command, which watches a site for changes and
62
65
  # recompiles if necessary.
63
66
  watcher:
@@ -8,6 +8,7 @@ class SearchFilter < Nanoc::Filter
8
8
  def run(content, params={})
9
9
  doc = Nokogiri::HTML(content)
10
10
  url = assigns[:item_rep].path
11
+ encoding = params[:encoding] || 'UTF-8'
11
12
  #first_image = doc.xpath('//img/@src').to_a[0]
12
13
  document = {
13
14
  # See this next time you need to fix this: https://gist.github.com/LeCoupa/8c305ec8c713aad07b14
@@ -19,7 +20,7 @@ class SearchFilter < Nanoc::Filter
19
20
  }
20
21
 
21
22
  if File.exist?(search_file)
22
- documents = JSON.parse(File.read(search_file))
23
+ documents = JSON.parse(File.read(search_file, encoding: encoding))
23
24
  else
24
25
  documents = {}
25
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.33.3
4
+ version: 0.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2018-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '3.7'
131
+ version: 3.7.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '3.7'
138
+ version: 3.7.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: kramdown
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -644,7 +644,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
644
644
  version: 1.8.11
645
645
  requirements: []
646
646
  rubyforge_project:
647
- rubygems_version: 2.6.14.1
647
+ rubygems_version: 2.4.5.5
648
648
  signing_key:
649
649
  specification_version: 4
650
650
  summary: The Semiconductor Developer's Kit