origen 0.4.0 → 0.4.1

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: cdf7248a1c3000a7ea31e2721bf61b28693c9222
4
- data.tar.gz: b264bd5d9bd97000e7a8d33d5231c90b858caad9
3
+ metadata.gz: 5fe0ad7591f9323eff79e183c8c5c8137b186fec
4
+ data.tar.gz: c595cfe53a37c4a736cb46f47902bdc57cc23e07
5
5
  SHA512:
6
- metadata.gz: 38b82c90dbba93819b9ea1aa8a02b383101e81a1e620fb54f388fdb64b26e8fc3674a00e73f6d57ae0a774aa133aa38fec2b80917ad7af80a7756214ee8c4a36
7
- data.tar.gz: 3aaedb9dcfb7f5c9dea81c494955bf5ed0c192c1eaa10d3d5212c3d3cab7791e6c6bed88c7ca6769a1bb91dea5f4c58504ce950bac38e440651ba39371f1db43
6
+ metadata.gz: d56224e505b1e7267486868b70501e04487c9b945a862fe41304c5357b2aba21242d3b36bdd6f8745f64de161ca6cc6e5ef50b53df52eb6735b663aed5dff2a0
7
+ data.tar.gz: 33cdd8e0f5f62a14cdb8914b7358bcce28e71a7b9f29e2f9bcd709fc6d93b4dbb3def50815be0af3d88b4760e7e2ee925cf033a6e8960d52602c90b4df621adc
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
3
  MINOR = 4
4
- BUGFIX = 0
4
+ BUGFIX = 1
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
data/lib/origen.rb CHANGED
@@ -565,11 +565,11 @@ unless defined? RGen::ORIGENTRANSITION
565
565
  # Returns an object tracking the Origen execution mode/configuration, an
566
566
  # instance of Origen::Mode
567
567
  def mode
568
- application.config.mode
568
+ @mode ||= Origen::Mode.new
569
569
  end
570
570
 
571
571
  def mode=(val)
572
- application.config.mode = val
572
+ mode.set(val)
573
573
  end
574
574
 
575
575
  # Returns the current top-level (DUT) object if one has been defined (by
@@ -13,7 +13,6 @@ module Origen
13
13
  autoload :Plugins, 'origen/application/plugins'
14
14
  autoload :LSF, 'origen/application/lsf'
15
15
  autoload :Runner, 'origen/application/runner'
16
- autoload :ConfigurationManager, 'origen/application/configuration_manager'
17
16
  autoload :LSFManager, 'origen/application/lsf_manager'
18
17
  autoload :Release, 'origen/application/release'
19
18
  autoload :Deployer, 'origen/application/deployer'
@@ -468,21 +467,11 @@ module Origen
468
467
  @db ||= Database::KeyValueStores.new(self)
469
468
  end
470
469
 
471
- def session
470
+ def session(reload = false)
471
+ @session = nil if reload
472
472
  @session ||= Database::KeyValueStores.new(self, persist: false)
473
473
  end
474
474
 
475
- def pdm_component
476
- return @pdm_component if @pdm_component
477
- require "#{Origen.root}/config/pdm_component"
478
- begin
479
- @pdm_component = (eval "#{Origen.app.class}::PDMComponent").new
480
- rescue
481
- # Try legacy case where the namespace was just Application
482
- @pdm_component = ::Application::PDMComponent.new
483
- end
484
- end
485
-
486
475
  def versions
487
476
  version_tracker.versions
488
477
  end
@@ -497,11 +486,6 @@ module Origen
497
486
  end
498
487
  alias_method :stats, :statistics
499
488
 
500
- def configuration_manager
501
- @cm ||= ConfigurationManager.new
502
- end
503
- alias_method :cm, :configuration_manager
504
-
505
489
  def pattern_iterators
506
490
  @pattern_iterators ||= []
507
491
  end
@@ -644,7 +628,7 @@ module Origen
644
628
  # declares here, the objects registered with origen should be refreshed accordingly
645
629
  clear_dynamic_resources
646
630
  load_event(:transient) do
647
- Origen.config.mode = :production # Important since a production target may rely on the default
631
+ Origen.mode = Origen.app.session.origen_core[:mode] || :production # Important since a production target may rely on the default
648
632
  begin
649
633
  $_target_options = @target_load_options
650
634
  Origen.target.set_signature(@target_load_options)
@@ -659,7 +643,7 @@ module Origen
659
643
  $_target_options = nil
660
644
  end
661
645
  @target_instantiated = true
662
- Origen.config.mode = :debug if options[:force_debug]
646
+ Origen.mode = :debug if options[:force_debug]
663
647
  listeners_for(:on_create).each(&:on_create)
664
648
  # Keep this within the load_event to ensure any objects that are further instantiated objects
665
649
  # will be associated with (and cleared out upon reload of) the current target
@@ -8,7 +8,7 @@ module Origen
8
8
 
9
9
  attr_accessor :name, :initials, :instructions,
10
10
  :history_file, :release_directory, :release_email_subject,
11
- :production_targets, :mode,
11
+ :production_targets,
12
12
  :vault, :output_directory, :reference_directory,
13
13
  :semantically_version, :log_directory, :pattern_name_translator,
14
14
  :pattern_directory, :pattern_output_directory, :pattern_prefix, :pattern_postfix,
@@ -59,7 +59,6 @@ module Origen
59
59
 
60
60
  def initialize(app)
61
61
  @app = app
62
- @mode = Origen::Mode.new
63
62
  @name = 'Unknown'
64
63
  @initials = 'NA'
65
64
  @semantically_version = false
@@ -174,10 +173,6 @@ module Origen
174
173
  yield Origen.generator.create_iterator
175
174
  end
176
175
 
177
- def mode=(val)
178
- @mode.set(val)
179
- end
180
-
181
176
  def lsf
182
177
  app.lsf.configuration
183
178
  end
@@ -235,7 +235,13 @@ module Origen
235
235
  # The caller would have already verified the status before submission
236
236
  if Origen.running_locally?
237
237
  if Origen.mode.production?
238
- Origen.app.cm.ensure_workspace_unmodified!
238
+ unless Origen.app.rc.local_modifications.empty?
239
+ puts <<-EOT
240
+ Your workspace has local modifications that are preventing the requested action
241
+ - run 'origen rc mods' to see them.
242
+ EOT
243
+ exit 1
244
+ end
239
245
  end
240
246
  end
241
247
  end
@@ -12,14 +12,14 @@ ORIGEN_COMMAND_ALIASES = {
12
12
  '-t' => 'target', # For legacy reasons
13
13
  'e' => 'environment',
14
14
  '-e' => 'environment',
15
- 'mods' => 'modifications',
16
- '-o' => 'modifications', # Legacy
17
15
  'l' => 'lsf',
18
16
  'i' => 'interactive',
19
17
  'c' => 'compile',
20
18
  'pl' => 'plugin',
21
19
  '-v' => 'version',
22
- '--version' => 'version'
20
+ '--version' => 'version',
21
+ '-version' => 'version',
22
+ 'm' => 'mode'
23
23
  }
24
24
 
25
25
  @command = ARGV.shift
@@ -213,7 +213,7 @@ end
213
213
 
214
214
  case @command
215
215
  when 'generate', 'program', 'compile', 'merge', 'interactive', 'target', 'environment',
216
- 'save', 'lsf', 'web', 'time', 'dispatch', 'rc', 'lint', 'plugin', 'fetch' # , 'add'
216
+ 'save', 'lsf', 'web', 'time', 'dispatch', 'rc', 'lint', 'plugin', 'fetch', 'mode' # , 'add'
217
217
 
218
218
  require "origen/commands/#{@command}"
219
219
  exit 0 unless @command == 'interactive'
@@ -234,19 +234,21 @@ else
234
234
  Usage: origen COMMAND [ARGS]
235
235
 
236
236
  The core origen commands are:
237
- environment Display or set the default environment (short-cut alias: "e")
238
- target Display or set the default target (short-cut alias: "t")
237
+ environment Display or set the environment (short-cut alias: "e")
238
+ target Display or set the target (short-cut alias: "t")
239
+ mode Display or set the mode (short-cut alias: "m")
240
+ plugin Display or set the plugin (short-cut alias: "pl")
239
241
  generate Generate a test pattern (short-cut alias: "g")
240
242
  program Generate a test program (short-cut alias: "p")
241
243
  interactive Start an interactive Origen console (short-cut alias: "i")
242
244
  compile Compile a template file or directory (short-cut alias: "c")
245
+
243
246
  rc Revision control commands, see -h for details
244
247
  save Save the new or changed files from the last run or a given log file
245
248
  lsf Monitor and manage LSF jobs (short-cut alias: "l")
246
249
  web Web page tools, see -h for details
247
250
  time Tools for test time analysis and forecasting
248
251
  lint Lint and style check (and correct) your application code
249
- plugin Manage Origen plugins (short-cut alias: "pl")
250
252
 
251
253
  EOT
252
254
  if @application_commands && !@application_commands.empty?
@@ -0,0 +1,12 @@
1
+ module Origen
2
+ mode = ARGV.shift
3
+ if mode
4
+ Origen.mode = mode
5
+ Origen.app.session.origen_core[:mode] = Origen.mode.to_s
6
+ puts "Origen mode now set to: #{Origen.mode}"
7
+ else
8
+ puts Origen.app.session.origen_core[:mode] || 'production'
9
+ end
10
+
11
+ exit 0
12
+ end
data/lib/origen/mode.rb CHANGED
@@ -20,6 +20,10 @@ module Origen
20
20
  @current_mode = find_mode(val) unless @frozen
21
21
  end
22
22
 
23
+ def to_s
24
+ @current_mode ? @current_mode.to_s : ''
25
+ end
26
+
23
27
  def find_mode(name)
24
28
  name = name.to_s.downcase.to_sym
25
29
  if MODES.include?(name)
@@ -113,6 +113,70 @@ module Origen
113
113
  super
114
114
  end
115
115
 
116
+ # Returns the trace_matrix name. The Trace Matrix Name is composed of
117
+ # * @name
118
+ # * @type
119
+ # * @subtype
120
+ # * @mode
121
+ def trace_matrix_name
122
+ name_set = trace_matrix_name_choose
123
+ ret_name = ''
124
+ case name_set
125
+ when 0
126
+ ret_name = ''
127
+ when 1
128
+ ret_name = "#{@mode}"
129
+ when 2
130
+ ret_name = "#{@sub_type}"
131
+ when 3
132
+ ret_name = "#{@sub_type}_#{@mode}"
133
+ when 4
134
+ ret_name = "#{@type}"
135
+ when 5
136
+ ret_name = "#{@type}_#{@mode}"
137
+ when 6
138
+ ret_name = "#{@type}_#{@sub_type}"
139
+ when 7
140
+ ret_name = "#{@type}_#{@sub_type}_#{@mode}"
141
+ when 8
142
+ ret_name = "#{small_name}"
143
+ when 9
144
+ ret_name = "#{small_name}_#{@mode}"
145
+ when 10
146
+ ret_name = "#{small_name}_#{@sub_type}"
147
+ when 11
148
+ ret_name = "#{small_name}_#{@sub_type}_#{@mode}"
149
+ when 12
150
+ ret_name = "#{small_name}_#{@type}"
151
+ when 13
152
+ ret_name = "#{small_name}_#{@type}_#{@mode}"
153
+ when 14
154
+ ret_name = "#{small_name}_#{@type}_#{@sub_type}"
155
+ when 15
156
+ ret_name = "#{small_name}_#{@type}_#{@sub_type}_#{@mode}"
157
+ else
158
+ ret_name = 'Bad trace matrix code'
159
+ end
160
+ ret_name
161
+ end
162
+
163
+ # This will create the trace matrix name to be placed into a dita phrase element
164
+ # End goal will be
165
+ # {code:xml}
166
+ # <ph audience="internal">trace_matrix_name</ph>
167
+ # {code}
168
+ def trace_matrix_name_to_dita
169
+ tmp_doc = Nokogiri::XML('<foo><bar /></foo>', nil, 'EUC-JP')
170
+
171
+ tmp_node = Nokogiri::XML::Node.new('lines', tmp_doc)
172
+ tmp_node1 = Nokogiri::XML::Node.new('i', tmp_doc)
173
+ tmp_node.set_attribute('audience', 'trace-matrix-id')
174
+ text_node1 = Nokogiri::XML::Text.new("[#{trace_matrix_name}]", tmp_node)
175
+ tmp_node1 << text_node1
176
+ tmp_node << tmp_node1
177
+ tmp_node.at_xpath('.').to_xml
178
+ end
179
+
116
180
  def method_missing(method, *args, &block)
117
181
  ivar = "@#{method.to_s.gsub('=', '')}"
118
182
  ivar_sym = ":#{ivar}"
@@ -206,6 +270,16 @@ module Origen
206
270
 
207
271
  private
208
272
 
273
+ def small_name
274
+ if @name.to_s[0..@ip_name.to_s.length].include? @ip_name.to_s
275
+ ret_name = @name.to_s[@ip_name.to_s.length + 1..-1]
276
+ else
277
+ ret_name = @name.to_s
278
+ end
279
+ ret_name = ret_name.partition('-').last if ret_name.include? '-'
280
+ ret_name
281
+ end
282
+
209
283
  # This assumes the limit objects are Structs
210
284
  def diff_limits(limit_one, limit_two = nil)
211
285
  diff_results = Hash.new do |h, k|
@@ -228,6 +302,19 @@ module Origen
228
302
  end
229
303
  diff_results
230
304
  end
305
+
306
+ def trace_matrix_name_choose
307
+ name_set = 0
308
+ name_set = 8 unless @name.nil?
309
+ name_set += 4 unless @type.nil?
310
+ name_set += 2 unless @sub_type.nil?
311
+ unless @mode.nil?
312
+ unless (@mode.to_s.include? 'local') || (@mode.to_s.include? 'global')
313
+ name_set += 1
314
+ end
315
+ end
316
+ name_set
317
+ end
231
318
  end
232
319
  end
233
320
  end
@@ -2,7 +2,6 @@ module Origen
2
2
  module Utility
3
3
  autoload :Diff, 'origen/utility/diff'
4
4
  autoload :Mailer, 'origen/utility/mailer'
5
- autoload :SRecord, 'origen/utility/s_record'
6
5
  autoload :CSV, 'origen/utility/csv_data'
7
6
  autoload :TimeAndDate, 'origen/utility/time_and_date'
8
7
  autoload :InputCapture, 'origen/utility/input_capture'
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-02 00:00:00.000000000 Z
11
+ date: 2015-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -386,14 +386,14 @@ dependencies:
386
386
  requirements:
387
387
  - - "~>"
388
388
  - !ruby/object:Gem::Version
389
- version: '0.5'
389
+ version: '0'
390
390
  type: :development
391
391
  prerelease: false
392
392
  version_requirements: !ruby/object:Gem::Requirement
393
393
  requirements:
394
394
  - - "~>"
395
395
  - !ruby/object:Gem::Version
396
- version: '0.5'
396
+ version: '0'
397
397
  - !ruby/object:Gem::Dependency
398
398
  name: origen_debuggers
399
399
  requirement: !ruby/object:Gem::Requirement
@@ -401,9 +401,6 @@ dependencies:
401
401
  - - "~>"
402
402
  - !ruby/object:Gem::Version
403
403
  version: '0'
404
- - - ">="
405
- - !ruby/object:Gem::Version
406
- version: 0.5.1
407
404
  type: :development
408
405
  prerelease: false
409
406
  version_requirements: !ruby/object:Gem::Requirement
@@ -411,9 +408,6 @@ dependencies:
411
408
  - - "~>"
412
409
  - !ruby/object:Gem::Version
413
410
  version: '0'
414
- - - ">="
415
- - !ruby/object:Gem::Version
416
- version: 0.5.1
417
411
  description:
418
412
  email:
419
413
  - stephen.f.mcginty@gmail.com
@@ -445,7 +439,6 @@ files:
445
439
  - lib/origen/application.rb
446
440
  - lib/origen/application/command_dispatcher.rb
447
441
  - lib/origen/application/configuration.rb
448
- - lib/origen/application/configuration_manager.rb
449
442
  - lib/origen/application/deployer.rb
450
443
  - lib/origen/application/environment.rb
451
444
  - lib/origen/application/lsf.rb
@@ -481,15 +474,13 @@ files:
481
474
  - lib/origen/commands.rb
482
475
  - lib/origen/commands/add.rb
483
476
  - lib/origen/commands/compile.rb
484
- - lib/origen/commands/dispatch.rb
485
477
  - lib/origen/commands/environment.rb
486
478
  - lib/origen/commands/fetch.rb
487
479
  - lib/origen/commands/generate.rb
488
480
  - lib/origen/commands/interactive.rb
489
481
  - lib/origen/commands/lint.rb
490
482
  - lib/origen/commands/lsf.rb
491
- - lib/origen/commands/merge.rb
492
- - lib/origen/commands/modifications.rb
483
+ - lib/origen/commands/mode.rb
493
484
  - lib/origen/commands/new.rb
494
485
  - lib/origen/commands/plugin.rb
495
486
  - lib/origen/commands/program.rb
@@ -544,7 +535,6 @@ files:
544
535
  - lib/origen/parameters/live.rb
545
536
  - lib/origen/parameters/missing.rb
546
537
  - lib/origen/parameters/set.rb
547
- - lib/origen/pdm.rb
548
538
  - lib/origen/pins.rb
549
539
  - lib/origen/pins/function_proxy.rb
550
540
  - lib/origen/pins/ground_pin.rb
@@ -583,7 +573,6 @@ files:
583
573
  - lib/origen/specs/spec.rb
584
574
  - lib/origen/specs/version_history.rb
585
575
  - lib/origen/sub_blocks.rb
586
- - lib/origen/tester/command_based_tester.rb
587
576
  - lib/origen/top_level.rb
588
577
  - lib/origen/users.rb
589
578
  - lib/origen/users/ldap.rb
@@ -595,7 +584,6 @@ files:
595
584
  - lib/origen/utility/file_diff.rb
596
585
  - lib/origen/utility/input_capture.rb
597
586
  - lib/origen/utility/mailer.rb
598
- - lib/origen/utility/s_record.rb
599
587
  - lib/origen/utility/time_and_date.rb
600
588
  - lib/origen/version_string.rb
601
589
  - lib/tasks/gem.rake
@@ -1,78 +0,0 @@
1
- module Origen
2
- class Application
3
- # All access to the configuration management system should be done
4
- # through methods of this class, an instance of which is accessible via
5
- # Origen.app.cm
6
- #
7
- # Where possible external arguments relating to the underlying CM tool should
8
- # not be used, try and keep method names and arguments generic.
9
- #
10
- # Right now it supports Design Sync only, but by eliminating interaction
11
- # with DS outside of this class it means that a future change to the CM
12
- # system should be easily handled by simply swapping in a new ConfigurationManager
13
- # class.
14
- class ConfigurationManager
15
- def initialize
16
- @cm = Origen::Utility::DesignSync.new
17
- end
18
-
19
- def modified_objects_in_workspace?
20
- @cm.modified_objects?(workspace_dirs, rec: true, fullpath: true)
21
- end
22
-
23
- def modified_objects_in_workspace_list
24
- @cm.modified_objects(workspace_dirs, rec: true, fullpath: true)
25
- end
26
-
27
- def unmanaged_objects_in_workspace?
28
- @cm.modified_objects?(workspace_dirs, rec: true, unmanaged: true, managed: false, fullpath: true)
29
- end
30
-
31
- def unmanaged_objects_in_workspace_list
32
- @cm.modified_objects(workspace_dirs, rec: true, unmanaged: true, managed: false, fullpath: true)
33
- end
34
-
35
- def modified_objects_in_repository?
36
- @cm.modified_objects?(workspace_dirs, rec: true, fullpath: true, remote: true)
37
- end
38
-
39
- def modified_objects_in_repository_list
40
- @cm.modified_objects(workspace_dirs, rec: true, fullpath: true, remote: true)
41
- end
42
-
43
- def workspace_dirs
44
- "#{Origen.root} " + Origen.app.config.external_app_dirs.join(' ')
45
- end
46
-
47
- # Fetch the latest version of the application
48
- def fetch_latest(options = {})
49
- options = {
50
- force: false
51
- }.merge(options)
52
- @cm.populate(workspace_dirs, rec: true, verbose: true, force: options[:force])
53
- end
54
-
55
- def diff_cmd(options = {})
56
- @cm.diff_cmd(options)
57
- end
58
-
59
- def import(*args)
60
- @cm.import(*args)
61
- end
62
-
63
- def ensure_workspace_unmodified!
64
- if modified_objects_in_workspace?
65
- puts <<-EOT
66
- Your workspace has local modifications that are preventing the requested action
67
- - run 'origen rc mods' to see them.
68
- EOT
69
- exit 1
70
- end
71
- end
72
-
73
- def method_missing(method, *args, &blk)
74
- @cm.send(method, *args, &blk)
75
- end
76
- end
77
- end
78
- end
@@ -1,22 +0,0 @@
1
- # begin
2
- if Origen.command_dispatcher.snapshots_exist?
3
- ix = ARGV.index('--snapshot_rev')
4
- if ix
5
- ARGV.delete_at(ix)
6
- version = ARGV[ix]
7
- ARGV.delete_at(ix)
8
- else
9
- version = :latest
10
- end
11
-
12
- Origen.command_dispatcher.create_workspace(version) do |workspace|
13
- workspace.execute(ARGV)
14
- end
15
-
16
- else
17
- fail 'Sorry no worker snapshots could be found!'
18
- end
19
-
20
- # rescue
21
- # Origen.command_dispatcher.record_error
22
- # end
@@ -1,55 +0,0 @@
1
- require 'optparse'
2
-
3
- options = {}
4
- Origen.log.deprecate <<-END
5
-
6
- ********************************************************************************************
7
- The 'merge' command has now been deprecated as the same functionality can be achieved by
8
- performing the following tasks:
9
-
10
- origen compile [COMPILE DIRECTORY/FILE] -r [DIRECTORY/FILE FOR COMPARISON]
11
-
12
- By using the -r switch, it overrides the default reference directory which origen uses,
13
- therefore essentially allowing origen to diff between your output directory and any directory
14
- of your choice (for example ASCII UTIL export directory)
15
- *********************************************************************************************
16
- END
17
- # App options are options that the application can supply to extend this command
18
- app_options = @application_options || []
19
- opt_parser = OptionParser.new do |opts|
20
- opts.banner = <<-EOT
21
- The reverse of 'origen compile' to help merge any changes made to compiled files back to the source.
22
- The arguments are the same as the compile command, so run the merge with the same arguments and it will merge instead of compile.
23
- Changes are processed as follows:
24
- * Any files with a non-erb source are simply copied back if they have changes.
25
- * Any files that don't have a source copy are ignored.
26
- * Any differences in files with an ERB source are left to the user to resolve. Origen tries to help by giving you the
27
- commands to execute to show the differences and the files that must be edited.
28
-
29
- Usage: origen merge [space separated files, lists or directories] [options]
30
- EOT
31
- opts.on('-t', '--target NAME', String, 'Override the default target, NAME can be a full path or a fragment of a target file name') { |t| options[:target] = t }
32
- opts.on('-c', '--continue', 'Continue on error (to the next file)') { options[:continue] = true }
33
- opts.on('-m', '--mode MODE', Origen::Mode::MODES, 'Force the Origen operating mode:', ' ' + Origen::Mode::MODES.join(', ')) { |_m| }
34
- opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
35
- opts.on('-f', '--file FILE', String, 'Override the default log file') { |o| options[:log_file] = o }
36
- opts.on('-o', '--output DIR', String, 'Override the default output directory') { |o| options[:output] = o }
37
- opts.on('-r', '--reference DIR', String, 'Override the default reference directory') { |o| options[:reference] = o }
38
- app_options.each do |app_option|
39
- opts.on(*app_option) {}
40
- end
41
- opts.separator ''
42
- opts.on('-h', '--help', 'Show this message') { puts opts; exit 0 }
43
- end
44
-
45
- opt_parser.parse! ARGV
46
- options[:patterns] = ARGV
47
- options[:job_type] = :merge # To let the generator know a merge job has been requested
48
-
49
- Origen.load_application
50
- Origen.target.temporary = options[:target] if options[:target]
51
- Origen.app.load_target!
52
-
53
- Origen.app.runner.generate(options)
54
-
55
- exit 0
@@ -1,12 +0,0 @@
1
- module Origen
2
- Origen.load_application
3
- if Origen.app.cm.modified_objects_in_workspace?
4
- puts 'Your workspace has the following modifications:'
5
- Origen.app.cm.modified_objects_in_workspace_list.each do |file|
6
- puts ' ' + Origen.app.cm.diff_cmd + ' ' + file
7
- end
8
- else
9
- puts 'Your workspace is clean!'
10
- end
11
- exit 0
12
- end
data/lib/origen/pdm.rb DELETED
@@ -1,218 +0,0 @@
1
- module Origen
2
- module PDM
3
- autoload :WebService, 'origen/pdm/web_service'
4
- autoload :PI, 'origen/pdm/pi'
5
- autoload :Tracker, 'origen/pdm/tracker'
6
-
7
- require 'origen/pdm/attributes'
8
-
9
- include Attributes
10
-
11
- # Set true to use the PDM test system rather than the live system.
12
- # The test system can be found at: http://designpdmtest.freescale.net/Agile
13
- attr_accessor :pdm_use_test_system
14
-
15
- # This should be set to the PDM version number that the current object represents.
16
- # For example if the object represents C90TFS_NVM_tester_010, then set this
17
- # attribute to 10.
18
- #
19
- # This attribute is required to be set when including a component in a BOM, otherwise
20
- # it is not required to be set when releasing a new version.
21
- #
22
- # It can also be set to :latest to pick up the latest version number for the component.
23
- attr_accessor :pdm_version_number
24
-
25
- # Set this attribute to create a branch point release from the given version. If this
26
- # attribute is not set then all releases will simply supercede the last release.
27
- attr_accessor :pdm_branch_version_number
28
-
29
- # Set this to specify which version the new release should supercede.
30
- # If un-specified the new release will automatically supercede the last version on the
31
- # trunk.
32
- attr_accessor :pdm_supercedes_version_number
33
-
34
- # Set this attribute to include components in the BOM, it should be set to an array
35
- # of objects, each of which must also include the Origen::PDM module and have the
36
- # pdm_version_number attribute set.
37
- attr_accessor :pdm_bom
38
-
39
- # If you begin automating PDM releases on a component that already exists on PDM, then
40
- # you must set this attribute to let Origen know what the latest part number is on PDM.
41
- #
42
- # For example if the latest component is called C90TFS_NVM_tester_010 at the time of
43
- # setting up the component in Origen then set this attribute to 10.
44
- #
45
- # If the object does not exist on PDM yet then you can leave this blank and Origen will
46
- # create and begin tracking the component from the initial version.
47
- attr_accessor :pdm_initial_version_number
48
-
49
- attr_accessor :pdm_meta_tags
50
-
51
- def self.update_ticket(tkt)
52
- pdm_pi.update_ticket(tkt)
53
- end
54
-
55
- def self.pdm_pi(_options = {})
56
- @pdm_pi ||= PI.new(use_test_system: true)
57
- end
58
-
59
- def pdm_base_url
60
- if pdm_use_test_system
61
- host = 'http://designpdmtest.freescale.net'
62
- else
63
- host = 'http://designpdm.freescale.net'
64
- end
65
- end
66
-
67
- # Returns the url for specific component version on PDM, i.e. if the model represents
68
- # pdm component C90TFS_NVM_tester_010 then the link to that component version will be
69
- # returned
70
- def pdm_url
71
- "#{pdm_base_url}/Agile/object/#{pdm_part_type}/#{pdm_part_number}"
72
- end
73
-
74
- # Returns the url for component's item group on PDM, i.e. if the model represents
75
- # pdm component C90TFS_NVM_tester_010 then the link to C90TFS_NVM_tester will be
76
- # returned
77
- def pdm_item_group_url
78
- "#{pdm_base_url}/Agile/object/Item Group/#{pdm_part_name}"
79
- end
80
-
81
- # The PI API, returns an instance of Origen::PDM::PI
82
- def pdm_pi
83
- @pdm_pi ||= PI.new(use_test_system: pdm_use_test_system)
84
- end
85
-
86
- # The PDM Web Service API, returns an instance of Origen::PDM::WebService
87
- def pdm_web_service
88
- @pdm_web_service ||= WebService.new
89
- end
90
-
91
- # When talking to PDM we need to use the 'Part Number' which is comprised
92
- # of the part name plus a numeric revision.
93
- #
94
- # For example 'C90TFS_NVM_tester' is the part name, 'C90TFS_NVM_tester_058' is a
95
- # possible part number.
96
- def pdm_part_number
97
- pdm_part_name + '_%03d' % _pdm_version_number
98
- end
99
-
100
- def pdm_branch_part_number
101
- if pdm_branch_version_number
102
- pdm_part_name + '_%03d' % pdm_branch_version_number
103
- end
104
- end
105
-
106
- # Returns the latest part number regardless of whether it is on a branch or not
107
- def pdm_latest_part_number
108
- if pdm_latest_version_number
109
- pdm_part_name + '_%03d' % pdm_latest_version_number
110
- end
111
- end
112
-
113
- # Returns the latest part number that is not on a branch
114
- def pdm_latest_trunk_part_number
115
- if pdm_latest_trunk_version_number
116
- pdm_part_name + '_%03d' % pdm_latest_trunk_version_number
117
- end
118
- end
119
-
120
- def pdm_supercedes_part_number
121
- if pdm_supercedes_version_number
122
- pdm_part_name + '_%03d' % pdm_supercedes_version_number
123
- end
124
- end
125
-
126
- def pdm_bom
127
- []
128
- end
129
-
130
- def pdm_meta_tags
131
- []
132
- end
133
-
134
- def _pdm_version_number
135
- if pdm_version_number && pdm_version_number != :latest
136
- pdm_version_number
137
- else
138
- pdm_latest_version_number ||
139
- fail("You must set the pdm_version_number attribute of #{self.class}")
140
- end
141
- end
142
-
143
- def pdm_latest_version_number
144
- if pdm_tracker.latest_version_number
145
- if pdm_initial_version_number &&
146
- pdm_initial_version_number > pdm_tracker.latest_version_number
147
- pdm_initial_version_number
148
- else
149
- pdm_tracker.latest_version_number
150
- end
151
- else
152
- pdm_initial_version_number
153
- end
154
- end
155
-
156
- def pdm_latest_trunk_version_number
157
- if pdm_tracker.latest_trunk_version_number
158
- if pdm_initial_version_number &&
159
- pdm_initial_version_number > pdm_tracker.latest_trunk_version_number
160
- pdm_initial_version_number
161
- else
162
- pdm_tracker.latest_trunk_version_number
163
- end
164
- else
165
- pdm_initial_version_number
166
- end
167
- end
168
-
169
- def pdm_supercedes_version_number
170
- @pdm_supercedes_version_number || pdm_latest_trunk_version_number
171
- end
172
-
173
- def pdm_component_binding
174
- binding
175
- end
176
-
177
- def pdm_tracker
178
- @pdm_tracker ||= Tracker.new(component: self)
179
- end
180
-
181
- # Pulls the BOM from PDM into an array of hashes with the following keys:
182
- #
183
- # * :pdm_part_name (e.g. C90TFS_NVM_tester)
184
- # * :pdm_version_number (e.g. 058 (actually returned as 58))
185
- # * :pdm_version (e.g. Rel20121002)
186
- def pdm_remote_bom
187
- pdm_pi.catbom(self)
188
- end
189
-
190
- # Release a new component version to PDM
191
- def pdm_release!(options = {})
192
- options = {
193
- release_bom: false
194
- }.merge(options)
195
- ret = pdm_pi.release!(self)
196
- pdm_tracker.release!
197
- ret
198
- end
199
-
200
- # This method is called before permanently saving a released component in the store,
201
- # override it to set instance variables for anything you wish to save.
202
- #
203
- # Normally it is best to assign the result of any pdm attributes that come from
204
- # methods as instance variables so that the current state of the component can
205
- # be reconstructed later.
206
- def freeze
207
- end
208
-
209
- def pdm_prepare_for_store
210
- freeze
211
- # Clear these so as not to waste effort Marshalling them
212
- @pdm_pi = nil
213
- @pdm_web_service = nil
214
- @pdm_tracker = nil
215
- @pi_attributes = nil
216
- end
217
- end
218
- end
@@ -1,46 +0,0 @@
1
- module Origen
2
- module Tester
3
- # A base class that can be used to model command-based, rather than
4
- # vector-based testers.
5
- class CommandBasedTester
6
- include Tester
7
-
8
- def initialize
9
- @vector_based = false
10
- end
11
-
12
- # Write a string directly to the output file without being processed
13
- # or modified in any way
14
- def direct_write(str)
15
- microcode str
16
- end
17
- alias_method :dw, :direct_write
18
-
19
- # Concept of a cycle not supported, print out an error to the output
20
- # file to alert the user that execution has hit code that is not
21
- # compatible with a command based tester.
22
- def cycle(*_args)
23
- microcode '*** Cycle called ***'
24
- end
25
-
26
- # Concept of a subroutine not supported, print out an error to the output
27
- # file to alert the user that execution has hit code that is not
28
- # compatible with a command based tester.
29
- def call_subroutine(sub)
30
- microcode "Call_subroutine called to #{sub}"
31
- end
32
-
33
- def format_vector(vec)
34
- vec.microcode
35
- end
36
-
37
- # Loop the content embedded in the supplied block
38
- def loop(_name = nil, number_of_loops)
39
- number_of_loops.times do
40
- yield
41
- end
42
- end
43
- alias_method :loop_vector, :loop
44
- end
45
- end
46
- end
@@ -1,205 +0,0 @@
1
- module Origen
2
- module Utility
3
- # A class to handle the parsing of S-records
4
- #
5
- # An S-record file consists of a sequence of specially formatted ASCII character strings. An S-record will
6
- # be less than or equal to 78 bytes in length.
7
- # The order of S-records within a file is of no significance and no particular order may be assumed.
8
- #
9
- # The general format of an S-record follows:
10
- #
11
- # +-------------------//------------------//-----------------------+
12
- # | type | count | address | data | checksum |
13
- # +-------------------//------------------//-----------------------+
14
- #
15
- # type -- A char[2] field. These characters describe the type of record (S0, S1, S2, S3, S5, S7, S8, or S9).
16
- # count -- A char[2] field. These characters when paired and interpreted as a hexadecimal value, display
17
- # the count of remaining character pairs in the record.
18
- #
19
- # address -- A char[4,6, or 8] field. These characters grouped and interpreted as a hexadecimal value,
20
- # display the address at which the data field is to be loaded into memory. The length of the field depends
21
- # on the number of bytes necessary to hold the address. A 2-byte address uses 4 characters, a 3-byte
22
- # address uses 6 characters, and a 4-byte address uses 8 characters.
23
- #
24
- # data -- A char [0-64] field. These characters when paired and interpreted as hexadecimal values represent
25
- # the memory loadable data or descriptive information.
26
- #
27
- # data -- A char [0-64] field. These characters when paired and interpreted as hexadecimal values represent
28
- # checksum -- A char[2] field. These characters when paired and interpreted as a hexadecimal value display
29
- # the least significant byte of the ones complement of the sum of the byte values represented by the pairs
30
- # of characters making up the count, the address, and the data fields.
31
- #
32
- # data -- A char [0-64] field. These characters when paired and interpreted as hexadecimal values represent
33
- # Each record is terminated with a line feed. If any additional or different record terminator(s) or delay
34
- # characters are needed during transmission to the target system it is the responsibility of the
35
- # transmitting program to provide them.
36
- #
37
- # data -- A char [0-64] field. These characters when paired and interpreted as hexadecimal values represent
38
- # S0 Record. The type of record is 'S0' (0x5330). The address field is unused and will be filled with zeros
39
- # (0x0000). The header information within the data field is divided into the following subfields.
40
- #
41
- # * mname is char[20] and is the module name.
42
- # * ver is char[2] and is the version number.
43
- # * rev is char[2] and is the revision number.
44
- # * description is char[0-36] and is a text comment.
45
- #
46
- # Each of the subfields is composed of ASCII bytes whose associated characters, when paired, represent one
47
- # byte hexadecimal values in the case of the version and revision numbers, or represent the hexadecimal
48
- # values of the ASCII characters comprising the module name and description.
49
- #
50
- # S1 Record. The type of record field is 'S1' (0x5331). The address field is intrepreted as a 2-byte
51
- # address. The data field is composed of memory loadable data.
52
- #
53
- # S2 Record. The type of record field is 'S2' (0x5332). The address field is intrepreted as a 3-byte
54
- # address. The data field is composed of memory loadable data.
55
- #
56
- # S3 Record. The type of record field is 'S3' (0x5333). The address field is intrepreted as a 4-byte
57
- # address. The data field is composed of memory loadable data.
58
- #
59
- # S5 Record. The type of record field is 'S5' (0x5335). The address field is intrepreted as a 2-byte value
60
- # and contains the count of S1, S2, and S3 records previously transmitted. There is no data field.
61
- #
62
- # S7 Record. The type of record field is 'S7' (0x5337). The address field contains the starting execution
63
- # address and is intrepreted as 4-byte address. There is no data field.
64
- #
65
- # S8 Record. The type of record field is 'S8' (0x5338). The address field contains the starting execution
66
- # address and is intrepreted as 3-byte address. There is no data field.
67
- #
68
- # S9 Record. The type of record field is 'S9' (0x5339). The address field contains the starting execution
69
- # address and is intrepreted as 2-byte address. There is no data field.
70
- #
71
- # EXAMPLE
72
- #
73
- # Shown below is a typical S-record format file.
74
- #
75
- # S00600004844521B
76
- # S1130000285F245F2212226A000424290008237C2A
77
- # S11300100002000800082629001853812341001813
78
- # S113002041E900084E42234300182342000824A952
79
- # S107003000144ED492
80
- # S5030004F8
81
- # S9030000FC
82
- #
83
- # The file consists of one S0 record, four S1 records, one S5 record and an S9 record.
84
- #
85
- # The S0 record is comprised as follows:
86
- #
87
- # * S0 S-record type S0, indicating it is a header record.
88
- # * 06 Hexadecimal 06 (decimal 6), indicating that six character pairs (or ASCII bytes) follow.
89
- # * 00 00 Four character 2-byte address field, zeroes in this example.
90
- # * 48 44 52 ASCII H, D, and R - "HDR".
91
- # * 1B The checksum.
92
- #
93
- # The first S1 record is comprised as follows:
94
- #
95
- # * S1 S-record type S1, indicating it is a data record to be loaded at a 2-byte address.
96
- # * 13 Hexadecimal 13 (decimal 19), indicating that nineteen character pairs, representing a 2 byte address,
97
- # * 16 bytes of binary data, and a 1 byte checksum, follow.
98
- # * 00 00 Four character 2-byte address field; hexidecimal address 0x0000, where the data which follows is to
99
- # be loaded.
100
- # * 28 5F 24 5F 22 12 22 6A 00 04 24 29 00 08 23 7C Sixteen character pairs representing the actual binary
101
- # data.
102
- # * 2A The checksum.
103
- # * The second and third S1 records each contain 0x13 (19) character pairs and are ended with checksums of 13
104
- # and 52, respectively. The fourth S1 record contains 07 character pairs and has a checksum of 92.
105
- #
106
- # The S5 record is comprised as follows:
107
- #
108
- # * S5 S-record type S5, indicating it is a count record indicating the number of S1 records
109
- # * 03 Hexadecimal 03 (decimal 3), indicating that three character pairs follow.
110
- # * 00 04 Hexadecimal 0004 (decimal 4), indicating that there are four data records previous to this record.
111
- # * F8 The checksum.
112
- #
113
- # The S9 record is comprised as follows:
114
- #
115
- # * S9 S-record type S9, indicating it is a termination record.
116
- # * 03 Hexadecimal 03 (decimal 3), indicating that three character pairs follow.
117
- # * 00 00 The address field, hexadecimal 0 (decimal 0) indicating the starting execution address.
118
- # * FC The checksum.
119
- #
120
- # --------------------------------------------------------------------------------
121
- #
122
- # Instructor Notes
123
- #
124
- # There isn't any evidence that Motorola ever has made use of the header information within the data field
125
- # of the S0 record, as described above. This must have been used by some third party vendors.
126
- # This is the only place that a 78-byte limit on total record length or 64-byte limit on data length is
127
- # documented. These values shouldn't be trusted for the general case.
128
- # The count field can have values in the range of 0x3 (2 bytes of address + 1 byte checksum = 3, a not
129
- # very useful record) to 0xff; this is the count of remaining character pairs, including checksum.
130
- # If you write code to convert S-Records, you should always assume that a record can be as long as 514
131
- # (decimal) characters in length (255 * 2 = 510, plus 4 characters for the type and count fields), plus
132
- # any terminating character(s). That is, in establishing an input buffer in C, you would declare it to be
133
- # an array of 515 chars, thus leaving room for the terminating null character.
134
- class SRecord
135
- # Supply a path to the S-record file, this should be a relative path from the top
136
- # level of your project workspace (Origen.root)
137
- def initialize(file)
138
- @file = file
139
- end
140
-
141
- # Parses the S-record and returns either an array of address and data values like this:
142
- # * \[addr, data, addr, data, addr, data\]
143
- # Or if a block is supplied it will pass back a single address and a single data value
144
- # in turn.
145
- # ==== Options
146
- # * :data_width_in_bytes - By default the returned data items will be 1 byte wide, set
147
- # this option to have it parsed and passed back in N byte wide packets
148
- # ==== Example
149
- # srec = SRecord.new("srecs/test_atd.abs.S19")
150
- # $top.write_addr_data(srec.parse) # Let write_addr_data handle the processing
151
- # # As above but pass the data to the top block in 16-bit packets
152
- # $top.write_addr_data(srec.parse(:data_width_in_bytes => 2))
153
- #
154
- # # Handle the processing from here...
155
- # srec.parse do |addr,data|
156
- # $top.write(addr, data)
157
- # end
158
- def parse(options = {})
159
- addr_data = extract_addr_data(options)
160
- if block_given?
161
- addr_data.each_slice(2) do |pair|
162
- yield pair[0], pair[1]
163
- end
164
- else
165
- addr_data
166
- end
167
- end
168
-
169
- private
170
-
171
- # Returns an array containing all address/data from the given s-record
172
- # No address manipulation is performed, that is left to the caller to apply
173
- # any scrambling as required by the target system
174
- def extract_addr_data(options = {}) # :nodoc:
175
- options = { data_width_in_bytes: 1
176
- }.merge(options)
177
-
178
- result = []
179
- File.readlines(Origen.file_handler.clean_path_to(@file)).each do |line|
180
- # Only if the line is an s-record with data...
181
- if line =~ /^S([1-3])/
182
- type = Regexp.last_match[1].to_i(16) # S-record type, 1-3
183
- # Set the matcher to capture x number of bytes dependent on the s-rec type
184
- addr_matcher = '\w\w' * (1 + type)
185
- line.strip =~ /^S\d\w\w(#{addr_matcher})(\w*)\w\w$/ # $1 = address, $2 = data
186
- addr = Regexp.last_match[1].to_i(16)
187
- data = Regexp.last_match[2]
188
- data_matcher = '\w\w' * options[:data_width_in_bytes]
189
- data.scan(/#{data_matcher}/).each do |data_packet|
190
- result << addr
191
- result << data_packet.to_i(16)
192
- addr += options[:data_width_in_bytes]
193
- end
194
- # If a partial word is left over
195
- if (remainder = data.length % (2 * options[:data_width_in_bytes])) > 0
196
- result << addr
197
- result << data[data.length - remainder..data.length].to_i(16)
198
- end
199
- end
200
- end
201
- result
202
- end
203
- end
204
- end
205
- end