origen 0.34.3 → 0.52.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. checksums.yaml +5 -5
  2. data/bin/origen +1 -231
  3. data/config/application.rb +12 -3
  4. data/config/boot.rb +2 -7
  5. data/config/commands.rb +3 -74
  6. data/config/rubocop/easy_disabled.yml +4 -0
  7. data/config/rubocop/easy_enabled.yml +0 -4
  8. data/config/rubocop/strict_disabled.yml +4 -0
  9. data/config/rubocop/strict_enabled.yml +0 -4
  10. data/config/version.rb +2 -3
  11. data/lib/origen.rb +27 -14
  12. data/lib/origen/application.rb +88 -2
  13. data/lib/origen/application/deployer.rb +3 -1
  14. data/lib/origen/application/release.rb +2 -2
  15. data/lib/origen/application/runner.rb +35 -20
  16. data/lib/origen/boot.rb +302 -0
  17. data/lib/origen/boot/api.rb +13 -0
  18. data/lib/origen/boot/app.rb +284 -0
  19. data/lib/origen/code_generators.rb +30 -10
  20. data/lib/origen/code_generators/actions.rb +244 -34
  21. data/lib/origen/code_generators/base.rb +9 -2
  22. data/lib/origen/code_generators/block.rb +203 -0
  23. data/lib/origen/code_generators/block_common.rb +100 -0
  24. data/lib/origen/code_generators/dut.rb +62 -0
  25. data/lib/origen/code_generators/feature.rb +50 -0
  26. data/lib/origen/code_generators/klass.rb +41 -0
  27. data/lib/origen/code_generators/model.rb +60 -0
  28. data/lib/origen/code_generators/module.rb +92 -0
  29. data/lib/origen/commands.rb +30 -13
  30. data/lib/origen/commands/archive.rb +175 -0
  31. data/lib/origen/commands/extract.rb +43 -0
  32. data/lib/origen/commands/generate.rb +1 -0
  33. data/lib/origen/commands/lint.rb +6 -1
  34. data/lib/origen/commands/new.rb +48 -24
  35. data/lib/origen/commands/new_resource.rb +41 -0
  36. data/lib/origen/commands/site.rb +52 -0
  37. data/lib/origen/commands/web.rb +11 -6
  38. data/lib/origen/commands_global.rb +9 -7
  39. data/lib/origen/core_ext/numeric.rb +20 -0
  40. data/lib/{option_parser → origen/core_ext/option_parser}/optparse.rb +0 -0
  41. data/lib/origen/dependencies.rb +0 -0
  42. data/lib/origen/file_handler.rb +18 -6
  43. data/lib/origen/generator.rb +19 -10
  44. data/lib/origen/generator/comparator.rb +2 -1
  45. data/lib/origen/generator/flow.rb +3 -1
  46. data/lib/origen/generator/job.rb +60 -16
  47. data/lib/origen/generator/pattern.rb +132 -72
  48. data/lib/origen/generator/pattern_finder.rb +3 -3
  49. data/lib/origen/generator/pattern_sequence.rb +201 -0
  50. data/lib/origen/generator/pattern_sequencer.rb +99 -0
  51. data/lib/origen/generator/pattern_thread.rb +175 -0
  52. data/lib/origen/loader.rb +381 -0
  53. data/lib/origen/log.rb +250 -108
  54. data/lib/origen/model.rb +22 -1
  55. data/lib/origen/model/exporter.rb +50 -10
  56. data/lib/origen/model_initializer.rb +5 -1
  57. data/lib/origen/operating_systems.rb +4 -0
  58. data/lib/origen/parameters.rb +96 -4
  59. data/lib/origen/parameters/set.rb +4 -3
  60. data/lib/origen/pins.rb +10 -8
  61. data/lib/origen/pins/pin.rb +61 -46
  62. data/lib/origen/ports/port.rb +5 -0
  63. data/lib/origen/registers.rb +5 -0
  64. data/lib/origen/registers/bit.rb +57 -53
  65. data/lib/origen/registers/bit_collection.rb +100 -43
  66. data/lib/origen/registers/msb0_delegator.rb +47 -0
  67. data/lib/origen/registers/reg.rb +114 -99
  68. data/lib/origen/revision_control.rb +1 -1
  69. data/lib/origen/revision_control/git.rb +23 -3
  70. data/lib/origen/site_config.rb +251 -60
  71. data/lib/origen/site_config/config.rb +217 -0
  72. data/lib/origen/sub_blocks.rb +106 -31
  73. data/lib/origen/top_level.rb +11 -0
  74. data/lib/origen/users/user.rb +3 -2
  75. data/lib/origen/utility/mailer.rb +42 -9
  76. data/lib/origen/value/bin_str_val.rb +1 -1
  77. data/lib/origen/value/hex_str_val.rb +1 -1
  78. data/lib/origen/version_string.rb +6 -1
  79. data/lib/tasks/gem.rake +6 -1
  80. data/origen_app_generators/Gemfile +19 -0
  81. data/origen_app_generators/Gemfile.lock +152 -0
  82. data/origen_app_generators/LICENSE +21 -0
  83. data/origen_app_generators/README.md +368 -0
  84. data/{templates/code_generators/rakefile.rb → origen_app_generators/Rakefile} +0 -0
  85. data/origen_app_generators/bin/boot.rb +39 -0
  86. data/origen_app_generators/config/application.rb +153 -0
  87. data/origen_app_generators/config/boot.rb +1 -0
  88. data/origen_app_generators/config/commands.rb +63 -0
  89. data/origen_app_generators/config/shared_commands.rb +177 -0
  90. data/origen_app_generators/config/version.rb +8 -0
  91. data/origen_app_generators/doc/history +223 -0
  92. data/origen_app_generators/lbin/bundle +105 -0
  93. data/origen_app_generators/lbin/byebug +29 -0
  94. data/origen_app_generators/lbin/coderay +29 -0
  95. data/origen_app_generators/lbin/htmldiff +29 -0
  96. data/origen_app_generators/lbin/httparty +29 -0
  97. data/origen_app_generators/lbin/httpclient +29 -0
  98. data/origen_app_generators/lbin/kramdown +29 -0
  99. data/origen_app_generators/lbin/ldiff +29 -0
  100. data/origen_app_generators/lbin/nanoc +29 -0
  101. data/origen_app_generators/lbin/nokogiri +29 -0
  102. data/origen_app_generators/lbin/origen +62 -0
  103. data/origen_app_generators/lbin/pry +29 -0
  104. data/origen_app_generators/lbin/rackup +29 -0
  105. data/origen_app_generators/lbin/rake +29 -0
  106. data/origen_app_generators/lbin/rspec +29 -0
  107. data/origen_app_generators/lbin/rubocop +29 -0
  108. data/origen_app_generators/lbin/ruby-parse +29 -0
  109. data/origen_app_generators/lbin/ruby-rewrite +29 -0
  110. data/origen_app_generators/lbin/thor +29 -0
  111. data/origen_app_generators/lbin/tilt +29 -0
  112. data/origen_app_generators/lbin/yard +29 -0
  113. data/origen_app_generators/lbin/yardoc +29 -0
  114. data/origen_app_generators/lbin/yri +29 -0
  115. data/origen_app_generators/lib/origen_app_generators.rb +125 -0
  116. data/origen_app_generators/lib/origen_app_generators/application.rb +62 -0
  117. data/origen_app_generators/lib/origen_app_generators/base.rb +257 -0
  118. data/origen_app_generators/lib/origen_app_generators/empty_application.rb +15 -0
  119. data/origen_app_generators/lib/origen_app_generators/empty_plugin.rb +15 -0
  120. data/origen_app_generators/lib/origen_app_generators/new.rb +170 -0
  121. data/origen_app_generators/lib/origen_app_generators/new_app_tests.rb +4 -0
  122. data/origen_app_generators/lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb +107 -0
  123. data/origen_app_generators/lib/origen_app_generators/plugin.rb +55 -0
  124. data/origen_app_generators/lib/origen_app_generators/test_engineering/common.rb +29 -0
  125. data/origen_app_generators/lib/origen_app_generators/test_engineering/stand_alone_application.rb +64 -0
  126. data/origen_app_generators/lib/origen_app_generators/test_engineering/test_block.rb +61 -0
  127. data/origen_app_generators/origen_app_generators.gemspec +33 -0
  128. data/{templates/code_generators → origen_app_generators/spec}/spec_helper.rb +0 -0
  129. data/origen_app_generators/target/debug.rb +8 -0
  130. data/origen_app_generators/target/default.rb +8 -0
  131. data/origen_app_generators/target/production.rb +0 -0
  132. data/origen_app_generators/templates/app_generators/application/.gitignore +37 -0
  133. data/origen_app_generators/templates/app_generators/application/.irbrc +9 -0
  134. data/origen_app_generators/templates/app_generators/application/.rspec +1 -0
  135. data/origen_app_generators/templates/app_generators/application/.travis.yml +11 -0
  136. data/origen_app_generators/templates/app_generators/application/Gemfile +34 -0
  137. data/origen_app_generators/templates/app_generators/application/Rakefile +7 -0
  138. data/origen_app_generators/templates/app_generators/application/app/blocks/top_level.rb +12 -0
  139. data/origen_app_generators/templates/app_generators/application/app/lib/module.rb +6 -0
  140. data/origen_app_generators/templates/app_generators/application/app/templates/web/index.md.erb +19 -0
  141. data/origen_app_generators/templates/app_generators/application/app/templates/web/layouts/_basic.html.erb +13 -0
  142. data/origen_app_generators/templates/app_generators/application/app/templates/web/partials/_navbar.html.erb +20 -0
  143. data/origen_app_generators/templates/app_generators/application/app/templates/web/release_notes.md.erb +5 -0
  144. data/origen_app_generators/templates/app_generators/application/config/application.rb +121 -0
  145. data/origen_app_generators/templates/app_generators/application/config/boot.rb +4 -0
  146. data/origen_app_generators/templates/app_generators/application/config/commands.rb +79 -0
  147. data/origen_app_generators/templates/app_generators/application/config/maillist_dev.txt +4 -0
  148. data/origen_app_generators/templates/app_generators/application/config/maillist_prod.txt +3 -0
  149. data/origen_app_generators/templates/app_generators/application/config/version.rb +8 -0
  150. data/origen_app_generators/templates/app_generators/application/doc/history +0 -0
  151. data/origen_app_generators/templates/app_generators/application/dot_keep +0 -0
  152. data/origen_app_generators/templates/app_generators/application/origen_core_session +2 -0
  153. data/origen_app_generators/templates/app_generators/application/spec/spec_helper.rb +44 -0
  154. data/origen_app_generators/templates/app_generators/application/target/debug.rb +8 -0
  155. data/origen_app_generators/templates/app_generators/application/target/default.rb +1 -0
  156. data/origen_app_generators/templates/app_generators/application/target/production.rb +4 -0
  157. data/origen_app_generators/templates/app_generators/new/generator.rb +102 -0
  158. data/origen_app_generators/templates/app_generators/new/info.md.erb +9 -0
  159. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/application.rb +54 -0
  160. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/base.rb +55 -0
  161. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/module.rb +28 -0
  162. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/plugin.rb +64 -0
  163. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/config/load_generators.rb +6 -0
  164. data/origen_app_generators/templates/app_generators/plugin/Gemfile +32 -0
  165. data/origen_app_generators/templates/app_generators/plugin/Rakefile +10 -0
  166. data/origen_app_generators/templates/app_generators/plugin/app/templates/web/index.md.erb +37 -0
  167. data/origen_app_generators/templates/app_generators/plugin/app/templates/web/partials/_navbar_external.html.erb +20 -0
  168. data/origen_app_generators/templates/app_generators/plugin/app/templates/web/partials/_navbar_internal.html.erb +20 -0
  169. data/origen_app_generators/templates/app_generators/plugin/config/boot.rb +24 -0
  170. data/origen_app_generators/templates/app_generators/plugin/gemspec.rb +43 -0
  171. data/origen_app_generators/templates/app_generators/test_engineering/environment/j750.rb +1 -0
  172. data/origen_app_generators/templates/app_generators/test_engineering/environment/uflex.rb +1 -0
  173. data/origen_app_generators/templates/app_generators/test_engineering/environment/v93k.rb +1 -0
  174. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/.keep +0 -0
  175. data/origen_app_generators/templates/app_generators/test_engineering/test_block/.keep +0 -0
  176. data/origen_site_config.yml +55 -5
  177. data/templates/code_generators/attributes.rb +20 -0
  178. data/templates/code_generators/class.rb +9 -0
  179. data/templates/code_generators/controller.rb +87 -0
  180. data/templates/code_generators/model.rb +21 -0
  181. data/templates/code_generators/module.rb +4 -0
  182. data/templates/code_generators/parameters.rb +19 -0
  183. data/templates/code_generators/pins.rb +28 -0
  184. data/templates/code_generators/registers.rb +20 -0
  185. data/templates/code_generators/sub_blocks.rb +24 -0
  186. data/templates/code_generators/timesets.rb +24 -0
  187. data/templates/code_generators/version.rb +0 -1
  188. data/templates/git/gitignore.erb +0 -1
  189. data/vendor/lib/models/origen/export1.rb +77 -0
  190. data/vendor/lib/models/origen/export1/block1.rb +13 -0
  191. data/vendor/lib/models/origen/export1/block1/x.rb +36 -0
  192. data/vendor/lib/models/origen/non_origen_meta_data.md +1 -0
  193. metadata +149 -68
  194. data/bin/fix_my_workspace +0 -100
  195. data/lib/c99/ate_interface.rb +0 -77
  196. data/lib/c99/nvm.rb +0 -110
  197. data/lib/c99/target/mock2.rb +0 -1
  198. data/lib/c99/target/subdir/mock3.rb +0 -1
  199. data/lib/origen/code_generators/bundler.rb +0 -17
  200. data/lib/origen/code_generators/gem_setup.rb +0 -49
  201. data/lib/origen/code_generators/rake.rb +0 -13
  202. data/lib/origen/code_generators/rspec.rb +0 -12
  203. data/lib/origen/commands/add.rb +0 -12
  204. data/lib/tasks/private/build.rake +0 -8
  205. data/templates/code_generators/gemfile_app.rb +0 -4
  206. data/templates/code_generators/gemfile_plugin.rb +0 -6
  207. data/templates/code_generators/gemspec.rb +0 -33
@@ -21,6 +21,7 @@ opt_parser = OptionParser.new do |opts|
21
21
  opts.on('--doc', 'Generate into doc format') { options[:doc] = true }
22
22
  opts.on('--html', 'Generate into html format') { options[:html] = true }
23
23
  opts.on('--nocom', 'No comments in the generated pattern') { options[:no_comments] = true }
24
+ opts.on('-seq', '--sequence NAME', String, 'Generate multiple patterns into a single concurrent pattern sequence') { |o| options[:sequence] = o }
24
25
  opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
25
26
  opts.on('-m', '--mode MODE', Origen::Mode::MODES, 'Force the Origen operating mode:', ' ' + Origen::Mode::MODES.join(', ')) { |_m| }
26
27
  # Apply any application option extensions to the OptionParser
@@ -32,7 +32,12 @@ if ARGV.empty?
32
32
  if Origen.config.lint_test[:files]
33
33
  files = Origen.config.lint_test[:files].map { |f| "#{Origen.root}/#{f}" }.join(' ')
34
34
  else
35
- files = "#{Origen.root}/lib"
35
+ files = []
36
+ ['lib', 'app/lib', 'app/blocks'].each do |sub_dir|
37
+ dir = "#{Origen.root}/#{sub_dir}"
38
+ files << dir if File.exist?(dir)
39
+ end
40
+ files = files.join(' ')
36
41
  end
37
42
  else
38
43
  files = ARGV.join(' ')
@@ -62,10 +62,15 @@ else
62
62
  end
63
63
  end
64
64
 
65
- generators = [['http://rubygems.org', 'origen_app_generators']] + Array(Origen.site_config.app_generators)
65
+ generators = [['https://rubygems.org', 'origen_app_generators']] + Array(Origen.site_config.app_generators)
66
+
67
+ def use_packaged_generators
68
+ puts "Using origen_app_generators that was packaged with Origen #{Origen.version}"
69
+ FileUtils.cp_r Origen.top.join('origen_app_generators').to_s, '.'
70
+ FileUtils.mv 'origen_app_generators', '0'
71
+ end
66
72
 
67
73
  if update_required
68
- puts 'Fetching the latest app generators...'
69
74
  FileUtils.rm_rf(generators_dir) if File.exist?(generators_dir)
70
75
  FileUtils.mkdir_p(generators_dir)
71
76
 
@@ -73,47 +78,66 @@ if update_required
73
78
  generators.each_with_index do |gen, i|
74
79
  # If a reference to a gem from a gem server
75
80
  if gen.is_a?(Array)
76
- response = HTTParty.get("#{gen[0]}/api/v1/dependencies.json?gems=#{gen[1]}")
81
+ begin
82
+ print "Determining the latest version of #{gen[1]}..."
83
+ response = HTTParty.get("#{gen[0]}/api/v1/dependencies.json?gems=#{gen[1]}", timeout: 2)
77
84
 
78
- if response.success?
79
- latest_version = JSON.parse(response.body).map { |v| v['number'] }.max
80
-
81
- response = HTTParty.get("#{gen[0]}/gems/#{gen[1]}-#{latest_version}.gem")
82
85
  if response.success?
83
- File.open("#{gen[1]}-#{latest_version}.gem", 'wb') do |f|
84
- f.write response.parsed_response
86
+ latest_version = JSON.parse(response.body).map { |v| v['number'] }.max
87
+ puts latest_version.to_s
88
+
89
+ url = "#{gen[0]}/gems/#{gen[1]}-#{latest_version}.gem"
90
+ print "Fetching #{url}..."
91
+ response = HTTParty.get(url, timeout: 5)
92
+ if response.success?
93
+ puts 'SUCCESS'
94
+ File.open("#{gen[1]}-#{latest_version}.gem", 'wb') do |f|
95
+ f.write response.parsed_response
96
+ end
97
+
98
+ `gem unpack #{gen[1]}-#{latest_version}.gem`
99
+ FileUtils.rm_rf("#{gen[1]}-#{latest_version}.gem")
100
+ FileUtils.mv("#{gen[1]}-#{latest_version}", i.to_s)
101
+ else
102
+ puts 'FAILED'
103
+ use_packaged_generators if i == 0
85
104
  end
86
105
  else
87
- puts "Sorry, could not find generator #{gen[1]} version #{latest_version}"
106
+ puts 'FAILED'
107
+ use_packaged_generators if i == 0
88
108
  end
89
-
90
- `gem unpack #{gen[1]}-#{latest_version}.gem`
91
- FileUtils.rm_rf("#{gen[1]}-#{latest_version}.gem")
92
- FileUtils.mv("#{gen[1]}-#{latest_version}", i.to_s)
93
-
94
- else
95
- puts "Failed to get generator #{gen[1]}, the response from the server was:"
96
- puts response.body
109
+ rescue
110
+ puts 'FAILED'
111
+ use_packaged_generators if i == 0
97
112
  end
98
113
 
99
114
  # If a reference to a git repo
100
115
  elsif gen.to_s =~ /\.git$/
101
- Origen::RevisionControl.new(remote: gen, local: i.to_s).checkout(version: 'master', force: true)
116
+ begin
117
+ print "Fetching #{gen}..."
118
+ Origen::RevisionControl.new(remote: gen, local: i.to_s).checkout(version: 'master', force: true)
119
+ puts 'SUCCESS'
120
+ rescue
121
+ puts 'FAILED'
122
+ end
102
123
 
103
124
  # Assume a reference to a folder
104
125
  else
105
- if File.exist?(gen)
106
- FileUtils.cp_r(gen, i.to_s)
107
- else
108
- puts "Failed to find generator at #{gen}"
126
+ begin
127
+ FileUtils.cp_r(gen, i.to_s) if File.exist?(gen)
128
+ puts 'SUCCESS'
129
+ rescue
130
+ puts 'FAILED'
109
131
  end
110
-
111
132
  end
112
133
  end
113
134
 
114
135
  Origen.session.app_generators[generators_dir] = Time.now
115
136
  end
137
+ else
138
+ puts 'Using cached app generators, run again with -f if you want to force a refresh'
116
139
  end
140
+ puts
117
141
 
118
142
  generators.each_with_index do |gen, i|
119
143
  lib = "#{generators_dir}/#{i}/lib"
@@ -0,0 +1,41 @@
1
+ # require 'optparse'
2
+ # require 'origen/commands/helpers'
3
+ #
4
+ # options = {}
5
+ #
6
+ ## App options are options that the application can supply to extend this command
7
+ # app_options = @application_options || []
8
+ # opt_parser = OptionParser.new do |opts|
9
+ # opts.banner = 'Usage: origen new RESOURCE_TYPE RESOURCE_NAME [options]'
10
+ # opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
11
+ # # Apply any application option extensions to the OptionParser
12
+ # Origen::CommandHelpers.extend_options(opts, app_options, options)
13
+ # opts.separator ''
14
+ # opts.on('-h', '--help', 'Show this message') { puts opts; exit }
15
+ # end
16
+ #
17
+ # opt_parser.parse! ARGV
18
+ #
19
+ # command = ARGV.shift
20
+ #
21
+ # case command
22
+ # when "model"
23
+ #
24
+ #
25
+ # else
26
+ # puts "Unknown resource type, must be one of: model"
27
+ # exit 1
28
+ # end
29
+
30
+ require 'origen/code_generators'
31
+
32
+ # if no argument/-h/--help is passed to origen add command, then
33
+ # it generates the help associated.
34
+ if [nil, '-h', '--help'].include?(ARGV.first)
35
+ Origen::CodeGenerators.help 'new'
36
+ exit
37
+ end
38
+
39
+ name = ARGV.shift
40
+
41
+ Origen::CodeGenerators.invoke name, ARGV # , behavior: :invoke, destination_root: Origen.root
@@ -0,0 +1,52 @@
1
+ require 'optparse'
2
+ require 'pathname'
3
+ require 'origen/commands/helpers'
4
+
5
+ module Origen
6
+ options = {}
7
+
8
+ # App options are options that the application can supply to extend this command
9
+ app_options = @application_options || []
10
+ opt_parser = OptionParser.new do |opts|
11
+ opts.banner = <<-END
12
+ env [filters...] Shows the current site environment configuration. Analogous to 'env' for shell environment.
13
+ In other words, lists all the site config variables and their values.
14
+ Aliased to 'environment'.
15
+
16
+ configs Shows the current config files used and their indexes.
17
+
18
+ inspect_config [config_indexes...] Inspects the configuration(s) at each index given.
19
+ Indexes can be found from 'origen site configs'
20
+ If no indexes are given, all configs are printed.
21
+
22
+ inspect_variable [variable_names...] Inspects and traces the variable(s) through the various sites configs.
23
+
24
+ refresh Forces a refresh of the centralized site config. This will reset the timer for the next automatc refresh.
25
+ END
26
+
27
+ # Apply any application option extensions to the OptionParser
28
+ Origen::CommandHelpers.extend_options(opts, app_options, options)
29
+ opts.separator ''
30
+ opts.on('-h', '--help', 'Show this message') { puts opts; exit }
31
+ end
32
+ opt_parser.parse! ARGV
33
+
34
+ if ARGV[0]
35
+ case ARGV.shift
36
+ when 'env', 'environment'
37
+ Origen.site_config.pretty_print_env(*ARGV)
38
+ when 'configs'
39
+ Origen.site_config.pretty_print_configs
40
+ when 'inspect_config', 'inspect_configs'
41
+ Origen.site_config.inspect_config(*ARGV)
42
+ when 'inspect_variable', 'inspect_variables'
43
+ Origen.site_config.inspect_variable(*ARGV)
44
+ when 'refresh'
45
+ Origen.site_config.refresh
46
+ else
47
+ puts "Unknown command, see 'origen site -h' for a list of commands"
48
+ end
49
+ else
50
+ puts "You must supply a command, see 'origen site -h' for a list of commands"
51
+ end
52
+ end
@@ -19,7 +19,7 @@ The following commands are available:
19
19
  serve Start a webserver from the current directory
20
20
 
21
21
  compile [FILE] Compile all web templates and start a server to view them, optionally supply a
22
- file argument to only update a single page e.g. 'origen web compile templates/web/index.md.erb'
22
+ file argument to only update a single page e.g. 'origen web compile app/templates/web/index.md.erb'
23
23
  Use the --remote option to copy the compiled files to a remote web server directory (the
24
24
  location of which should be specified via Origen.config.web_directory). In this case when no
25
25
  FILE argument is specified the entire site will be copied over to a fresh web server
@@ -104,7 +104,7 @@ The following options are available:
104
104
  puts "Web server directory created at: #{dir}"
105
105
  puts ''
106
106
  puts "Compile any files you want to test into the #{dir}/content directory, e.g.:"
107
- puts " origen c templates/file.md.erb -o #{dir}/content"
107
+ puts " origen c app/templates/file.md.erb -o #{dir}/content"
108
108
  puts ''
109
109
  puts 'To turn them into web pages:'
110
110
  puts " cd #{dir}"
@@ -149,9 +149,12 @@ The following options are available:
149
149
  Origen.app.listeners_for(:before_web_compile).each do |listener|
150
150
  listener.before_web_compile(options)
151
151
  end
152
- Origen.app.runner.launch action: :compile,
153
- files: 'templates/web',
154
- output: 'web/content'
152
+ templates_web_dir = 'app/templates/web'
153
+ templates_web_dir = 'templates/web' unless File.exist?("#{Origen.root}/#{templates_web_dir}")
154
+ templates_web_dir =
155
+ Origen.app.runner.launch action: :compile,
156
+ files: templates_web_dir,
157
+ output: 'web/content'
155
158
  Origen.app.listeners_for(:after_web_compile).each do |listener|
156
159
  listener.after_web_compile(options)
157
160
  end
@@ -168,7 +171,9 @@ The following options are available:
168
171
  ARGV.each do |file|
169
172
  path = Origen.file_handler.clean_path_to(file)
170
173
  if path.to_s =~ /origen_guides/
171
- output = Origen.file_handler.sub_dir_of(path, "#{Origen.root}/templates/origen_guides")
174
+ origen_guides_dir = 'app/templates/origen_guides'
175
+ origen_guides_dir = 'templates/origen_guides' unless File.exist?("#{Origen.root}/#{origen_guides_dir}")
176
+ output = Origen.file_handler.sub_dir_of(path, "#{Origen.root}/#{origen_guides_dir}")
172
177
  else
173
178
  output = Origen.file_handler.sub_dir_of(path, "#{Origen.root}/templates/web")
174
179
  end
@@ -70,11 +70,7 @@ if ARGV.delete('-d') || ARGV.delete('--debug')
70
70
  caller[0] =~ /.*\/(\w+\.rb):(\d+).*/
71
71
  puts 'The debugger gem is not installed, add the following to your Gemfile:'
72
72
  puts
73
- puts "if RUBY_VERSION >= '2.0.0'"
74
- puts " gem 'byebug', '~>3.5'"
75
- puts 'else'
76
- puts " gem 'debugger', '~>1.6'"
77
- puts 'end'
73
+ puts " gem 'byebug', '~>8'"
78
74
  puts
79
75
  end
80
76
  end
@@ -88,14 +84,18 @@ end
88
84
 
89
85
  case @command
90
86
 
91
- when 'new'
92
- require 'origen/commands/new'
87
+ when 'new', 'extract'
88
+ require "origen/commands/#{@command}"
93
89
  exit 0
94
90
 
95
91
  when '--version', '-v'
96
92
  require 'origen/commands/version'
97
93
  exit 0
98
94
 
95
+ when 'site'
96
+ require 'origen/commands/site'
97
+ exit 0
98
+
99
99
  # when 'fetch', 'f'
100
100
  # require 'origen/commands/fetch'
101
101
  # exit 0
@@ -115,6 +115,8 @@ The following commands are available:
115
115
  new origen application workspace in "./my_app"
116
116
  interactive Start an interactive Origen console (short-cut alias: "i"), this is just
117
117
  IRB with the 'origen' lib loaded automatically
118
+ extract Extract an Origen application archive (.origen file created with the archive command)
119
+ site Monitor and manage the Origen site configuration
118
120
  EOT
119
121
  cmds.split(/\n/).each do |line|
120
122
  puts Origen.clean_help_line(line)
@@ -187,4 +187,24 @@ class Numeric
187
187
  self / 1_000_000_000_000.0
188
188
  end
189
189
  end
190
+
191
+ # Shorthand for tester.wait(time_in_ns: 100), e.g. 100.ns!
192
+ def ns!
193
+ Origen.app.tester.wait time_in_ns: self
194
+ end
195
+
196
+ # Shorthand for tester.wait(time_in_us: 100), e.g. 100.us!
197
+ def us!
198
+ Origen.app.tester.wait time_in_us: self
199
+ end
200
+
201
+ # Shorthand for tester.wait(time_in_ms: 100), e.g. 100.ms!
202
+ def ms!
203
+ Origen.app.tester.wait time_in_ms: self
204
+ end
205
+
206
+ # Shorthand for tester.wait(time_in_s: 100), e.g. 100.s!
207
+ def s!
208
+ Origen.app.tester.wait time_in_s: self
209
+ end
190
210
  end
File without changes
@@ -15,7 +15,10 @@ module Origen
15
15
  # This will also take care of recursively expanding any embedded
16
16
  # list references.
17
17
  def expand_list(files, options = {})
18
- [files].flatten.map do |file|
18
+ options = {
19
+ preserve_duplicates: tester && tester.try(:sim?)
20
+ }.merge(options)
21
+ list_of_files = [files].flatten.map do |file|
19
22
  f = file.strip
20
23
  # Takes care of blank or comment lines in a list file
21
24
  if f.empty? || f =~ /^\s*#/
@@ -28,7 +31,12 @@ module Origen
28
31
  else
29
32
  f
30
33
  end
31
- end.flatten.compact.uniq
34
+ end.flatten.compact
35
+ if options[:preserve_duplicates]
36
+ list_of_files
37
+ else
38
+ list_of_files.uniq
39
+ end
32
40
  end
33
41
 
34
42
  # Returns the contents of the given list file in an array, if it
@@ -92,7 +100,7 @@ module Origen
92
100
  def clean_path_to(file, options = {})
93
101
  # Allow individual calls to this method to specify additional custom load paths to consider
94
102
  if options[:load_paths]
95
- [options[:load_paths]].each do |root|
103
+ Array(options[:load_paths]).each do |root|
96
104
  if File.exist?("#{root}/#{file}")
97
105
  return Pathname.new("#{root}/#{file}")
98
106
  end
@@ -214,7 +222,7 @@ module Origen
214
222
  begin
215
223
  # Allow relative references to templates/web when compiling a web template
216
224
  if Origen.lsf.current_command == 'web' || web_file
217
- clean_path_to(file, load_paths: "#{Origen.root}/templates/web")
225
+ clean_path_to(file, load_paths: ["#{Origen.root}/app/templates/web", "#{Origen.root}/templates/web"])
218
226
  else
219
227
  clean_path_to(file)
220
228
  end
@@ -222,7 +230,7 @@ module Origen
222
230
  # Try again without .erb
223
231
  file = file.gsub('.erb', '')
224
232
  if Origen.lsf.current_command == 'web' || web_file
225
- clean_path_to(file, load_paths: "#{Origen.root}/templates/web")
233
+ clean_path_to(file, load_paths: ["#{Origen.root}/app/templates/web", "#{Origen.root}/templates/web"])
226
234
  else
227
235
  clean_path_to(file)
228
236
  end
@@ -256,7 +264,11 @@ module Origen
256
264
  if import_name == :origen || import_name == :origen_core
257
265
  path.sub! 'origen', "#{Origen.top}/templates/shared"
258
266
  else
259
- path.sub! Regexp.last_match[1], "#{root}/templates/shared"
267
+ if File.exist?("#{root}/app/templates/shared")
268
+ path.sub! Regexp.last_match[1], "#{root}/app/templates/shared"
269
+ else
270
+ path.sub! Regexp.last_match[1], "#{root}/templates/shared"
271
+ end
260
272
  end
261
273
  else
262
274
  fail 'Unknown import path type!'
@@ -1,15 +1,20 @@
1
1
  module Origen
2
2
  class Generator
3
- autoload :Pattern, 'origen/generator/pattern'
4
- autoload :Flow, 'origen/generator/flow'
5
- autoload :Resources, 'origen/generator/resources'
6
- autoload :Job, 'origen/generator/job'
7
- autoload :PatternFinder, 'origen/generator/pattern_finder'
8
- autoload :PatternIterator, 'origen/generator/pattern_iterator'
9
- autoload :Stage, 'origen/generator/stage'
10
- autoload :Compiler, 'origen/generator/compiler'
11
- autoload :Comparator, 'origen/generator/comparator'
12
- autoload :Renderer, 'origen/generator/renderer'
3
+ autoload :Pattern, 'origen/generator/pattern'
4
+ autoload :Flow, 'origen/generator/flow'
5
+ autoload :Resources, 'origen/generator/resources'
6
+ autoload :Job, 'origen/generator/job'
7
+ autoload :PatternFinder, 'origen/generator/pattern_finder'
8
+ autoload :PatternIterator, 'origen/generator/pattern_iterator'
9
+ autoload :PatternSequencer, 'origen/generator/pattern_sequencer'
10
+ autoload :PatternSequence, 'origen/generator/pattern_sequence'
11
+ autoload :PatternThread, 'origen/generator/pattern_thread'
12
+ autoload :Stage, 'origen/generator/stage'
13
+ autoload :Compiler, 'origen/generator/compiler'
14
+ autoload :Comparator, 'origen/generator/comparator'
15
+ autoload :Renderer, 'origen/generator/renderer'
16
+
17
+ class AbortError < StandardError; end
13
18
 
14
19
  def pattern
15
20
  @pattern ||= Pattern.new
@@ -28,6 +33,10 @@ module Origen
28
33
  end
29
34
 
30
35
  def generate_pattern(file, options)
36
+ if options[:sequence]
37
+ options[:patterns] = file
38
+ file = options[:sequence]
39
+ end
31
40
  Job.new(file, options).run
32
41
  end
33
42