origen 0.38.0 → 0.40.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.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/bin/origen +1 -236
  3. data/config/application.rb +10 -1
  4. data/config/version.rb +1 -1
  5. data/lib/origen/{boot_api.rb → boot/api.rb} +2 -2
  6. data/lib/origen/boot/app.rb +324 -0
  7. data/lib/origen/boot.rb +287 -0
  8. data/lib/origen/commands/archive.rb +175 -0
  9. data/lib/origen/commands/extract.rb +43 -0
  10. data/lib/origen/commands/new.rb +33 -23
  11. data/lib/origen/commands.rb +4 -1
  12. data/lib/origen/commands_global.rb +3 -2
  13. data/lib/origen/operating_systems.rb +4 -0
  14. data/lib/origen/revision_control.rb +1 -1
  15. data/lib/origen/site_config.rb +4 -1
  16. data/lib/origen.rb +3 -2
  17. data/origen_app_generators/Gemfile +16 -0
  18. data/origen_app_generators/Gemfile.lock +147 -0
  19. data/origen_app_generators/LICENSE +21 -0
  20. data/origen_app_generators/README.md +368 -0
  21. data/origen_app_generators/Rakefile +10 -0
  22. data/origen_app_generators/bin/boot.rb +37 -0
  23. data/{bin → origen_app_generators/bin}/fix_my_workspace +0 -0
  24. data/origen_app_generators/config/application.rb +153 -0
  25. data/origen_app_generators/config/boot.rb +1 -0
  26. data/origen_app_generators/config/commands.rb +63 -0
  27. data/origen_app_generators/config/shared_commands.rb +172 -0
  28. data/origen_app_generators/config/version.rb +8 -0
  29. data/origen_app_generators/doc/history +213 -0
  30. data/origen_app_generators/lib/origen_app_generators/application.rb +62 -0
  31. data/origen_app_generators/lib/origen_app_generators/base.rb +231 -0
  32. data/origen_app_generators/lib/origen_app_generators/empty_application.rb +15 -0
  33. data/origen_app_generators/lib/origen_app_generators/empty_plugin.rb +15 -0
  34. data/origen_app_generators/lib/origen_app_generators/new.rb +162 -0
  35. data/origen_app_generators/lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb +109 -0
  36. data/origen_app_generators/lib/origen_app_generators/plugin.rb +58 -0
  37. data/origen_app_generators/lib/origen_app_generators/sub_block_parser.rb +81 -0
  38. data/origen_app_generators/lib/origen_app_generators/test_engineering/stand_alone_application.rb +236 -0
  39. data/origen_app_generators/lib/origen_app_generators/test_engineering/test_block.rb +162 -0
  40. data/origen_app_generators/lib/origen_app_generators.rb +123 -0
  41. data/origen_app_generators/lib/tasks/app_generators.rake +6 -0
  42. data/origen_app_generators/lib/tasks/new_app_tests.rake +8 -0
  43. data/origen_app_generators/origen_app_generators.gemspec +33 -0
  44. data/origen_app_generators/spec/spec_helper.rb +49 -0
  45. data/origen_app_generators/spec/sub_block_spec.rb +36 -0
  46. data/origen_app_generators/target/debug.rb +8 -0
  47. data/origen_app_generators/target/default.rb +8 -0
  48. data/origen_app_generators/target/production.rb +0 -0
  49. data/origen_app_generators/templates/app_generators/application/Gemfile +19 -0
  50. data/origen_app_generators/templates/app_generators/application/Rakefile +7 -0
  51. data/origen_app_generators/templates/app_generators/application/config/application.rb +125 -0
  52. data/origen_app_generators/templates/app_generators/application/config/boot.rb +4 -0
  53. data/origen_app_generators/templates/app_generators/application/config/commands.rb +79 -0
  54. data/origen_app_generators/templates/app_generators/application/config/maillist_dev.txt +4 -0
  55. data/origen_app_generators/templates/app_generators/application/config/maillist_prod.txt +3 -0
  56. data/origen_app_generators/templates/app_generators/application/config/version.rb +8 -0
  57. data/origen_app_generators/templates/app_generators/application/doc/history +0 -0
  58. data/origen_app_generators/templates/app_generators/application/dot_keep +0 -0
  59. data/origen_app_generators/templates/app_generators/application/lib/app.rake +6 -0
  60. data/origen_app_generators/templates/app_generators/application/lib/module.rb +22 -0
  61. data/origen_app_generators/templates/app_generators/application/lib/top_level.rb +12 -0
  62. data/origen_app_generators/templates/app_generators/application/origen_core_session +2 -0
  63. data/origen_app_generators/templates/app_generators/application/spec/spec_helper.rb +44 -0
  64. data/origen_app_generators/templates/app_generators/application/target/debug.rb +8 -0
  65. data/origen_app_generators/templates/app_generators/application/target/default.rb +1 -0
  66. data/origen_app_generators/templates/app_generators/application/target/production.rb +4 -0
  67. data/origen_app_generators/templates/app_generators/application/templates/web/index.md.erb +19 -0
  68. data/origen_app_generators/templates/app_generators/application/templates/web/layouts/_basic.html.erb +13 -0
  69. data/origen_app_generators/templates/app_generators/application/templates/web/partials/_navbar.html.erb +20 -0
  70. data/origen_app_generators/templates/app_generators/application/templates/web/release_notes.md.erb +5 -0
  71. data/origen_app_generators/templates/app_generators/new/generator.rb +102 -0
  72. data/origen_app_generators/templates/app_generators/new/info.md.erb +9 -0
  73. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/config/load_generators.rb +6 -0
  74. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/application.rb +54 -0
  75. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/base.rb +55 -0
  76. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/module.rb +28 -0
  77. data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/plugin.rb +64 -0
  78. data/origen_app_generators/templates/app_generators/plugin/Gemfile +26 -0
  79. data/origen_app_generators/templates/app_generators/plugin/Rakefile +10 -0
  80. data/origen_app_generators/templates/app_generators/plugin/config/boot.rb +24 -0
  81. data/origen_app_generators/templates/app_generators/plugin/gemspec.rb +42 -0
  82. data/origen_app_generators/templates/app_generators/plugin/lib/README +4 -0
  83. data/origen_app_generators/templates/app_generators/plugin/lib_dev/README +5 -0
  84. data/origen_app_generators/templates/app_generators/plugin/templates/web/index.md.erb +37 -0
  85. data/origen_app_generators/templates/app_generators/plugin/templates/web/partials/_navbar_external.html.erb +20 -0
  86. data/origen_app_generators/templates/app_generators/plugin/templates/web/partials/_navbar_internal.html.erb +20 -0
  87. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/Gemfile +23 -0
  88. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/environment/j750.rb +1 -0
  89. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/environment/jlink.rb +1 -0
  90. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/environment/uflex.rb +1 -0
  91. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/environment/v93k.rb +1 -0
  92. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/ip_block.rb +23 -0
  93. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/ip_block_controller.rb +5 -0
  94. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/top_level.rb +33 -0
  95. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/lib/top_level_controller.rb +21 -0
  96. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/pattern/example.rb +4 -0
  97. data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/target/top_level.rb +4 -0
  98. data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/j750.rb +2 -0
  99. data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/ultraflex.rb +2 -0
  100. data/origen_app_generators/templates/app_generators/test_engineering/test_block/environment/v93k.rb +2 -0
  101. data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/controller.rb +12 -0
  102. data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/interface.rb +21 -0
  103. data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib/model.rb +18 -0
  104. data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib_dev/dut.rb +27 -0
  105. data/origen_app_generators/templates/app_generators/test_engineering/test_block/lib_dev/dut_controller.rb +26 -0
  106. data/origen_app_generators/templates/app_generators/test_engineering/test_block/pattern/example.rb +5 -0
  107. data/origen_app_generators/templates/app_generators/test_engineering/test_block/program/prb1.rb +11 -0
  108. data/origen_app_generators/templates/app_generators/test_engineering/test_block/target/default.rb +2 -0
  109. data/origen_site_config.yml +13 -2
  110. data/templates/git/gitignore.erb +0 -1
  111. metadata +99 -4
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+ require 'origen_app_generators/sub_block_parser'
3
+
4
+ describe "Sub block parser" do
5
+
6
+ before :all do
7
+ @parser = OrigenAppGenerators::SubBlockParser.new
8
+ end
9
+
10
+ it "Can parse basic strings" do
11
+ s = "ram, atd"
12
+ @parser.parse(s).should == {"RAM" => {}, "ATD" => {}}
13
+ end
14
+
15
+ it "Can identify multiple instances" do
16
+ s = "ram, osc(2), atd(3)"
17
+ @parser.parse(s).should == {"RAM" => {}, "Osc" => {instances: 2}, "ATD" => {instances: 3}}
18
+ end
19
+
20
+ it "Can handle nesting" do
21
+ s = "ram, atd, nvm[ram(2), osc]"
22
+ @parser.parse(s).should == {"RAM" => {}, "ATD" => {}, "NVM" => {children: {
23
+ "RAM" => {instances: 2}, "Osc" => {}
24
+ }}}
25
+ end
26
+
27
+ it "Can handle a top-level namespace" do
28
+ s = "Falcon[ram, atd, nvm[ram(2), osc]], Eagle[ram(2), atd]"
29
+ @parser.parse(s).should ==
30
+ { "Falcon" => { children: {"RAM" => {}, "ATD" => {}, "NVM" => {children: {
31
+ "RAM" => {instances: 2}, "Osc" => {}
32
+ }}}},
33
+ "Eagle" => { children: {"RAM" => {instances: 2}, "ATD" => {}
34
+ }}}
35
+ end
36
+ end
@@ -0,0 +1,8 @@
1
+ # Production mode will require that there are no modified files in the workspace
2
+ # and any other conditions that you add to your application.
3
+ # Normally production targets define the target and then debug targets
4
+ # are setup to load the production target before switching Origen to debug
5
+ # mode as shown below.
6
+ load "#{Origen.root}/target/production.rb"
7
+
8
+ Origen.mode = :debug
@@ -0,0 +1,8 @@
1
+ # Production mode will require that there are no modified files in the workspace
2
+ # and any other conditions that you add to your application.
3
+ # Normally production targets define the target and then debug targets
4
+ # are setup to load the production target before switching Origen to debug
5
+ # mode as shown below.
6
+ load "#{Origen.root}/target/production.rb"
7
+
8
+ Origen.mode = :debug
File without changes
@@ -0,0 +1,19 @@
1
+ <% if (@audience != :external) && Origen.site_config.gem_server -%>
2
+ <% Array(Origen.site_config.gem_server).each do |server| -%>
3
+ source '<%= server %>'
4
+ <% end -%>
5
+ <% else %>
6
+ source 'https://rubygems.org'
7
+ <% end -%>
8
+
9
+ gem 'origen', '>= <%= @latest_origen_version %>'
10
+
11
+ gem 'origen_doc_helpers'
12
+
13
+ gem 'byebug'
14
+
15
+ gem 'origen_updater'
16
+
17
+ # Uncomment these if you want to use a visual debugger (e.g. Visual Studio Code) to debug your app
18
+ #gem 'ruby-debug-ide'
19
+ #gem 'debase'
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/<%= @name %>.rake, and they will automatically
3
+ # be available to Rake.
4
+ require "bundler/setup"
5
+ require "origen"
6
+
7
+ Origen.app.load_tasks
@@ -0,0 +1,125 @@
1
+ require 'origen'
2
+ class <%= @namespace %>Application < Origen::Application
3
+
4
+ # See http://origen-sdk.org/origen/api/Origen/Application/Configuration.html
5
+ # for a full list of the configuration options available
6
+
7
+ # These attributes should never be changed, the duplication here will be resolved in future
8
+ # by condensing these attributes that do similar things
9
+ self.name = "<%= @name %>"
10
+ self.namespace = "<%= @namespace %>"
11
+ config.name = "<%= @name %>"
12
+ config.initials = "<%= @namespace %>"
13
+ # Change this to point to the revision control repository for this <%= @type %>
14
+ <% if @audience == :external -%>
15
+ #config.rc_url = "ssh://git@github.com:myaccount/<%= @name %>.git"
16
+ <% else -%>
17
+ #config.rc_url = "ssh://git@sw-stash.mycompany.net/myproject/<%= @name %>.git"
18
+ <% end -%>
19
+ <% if @audience == :external -%>
20
+ config.release_externally = true
21
+ <% end -%>
22
+
23
+ # To enable deployment of your documentation to a web server (via the 'origen web'
24
+ # command) fill in these attributes.
25
+ <% if @audience == :external -%>
26
+ #config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/<%= @name %>"
27
+ #config.web_domain = "http://origen-sdk.org/<%= @name %>"
28
+ <% else -%>
29
+ #config.web_directory = "/path/to/server/<%= @name %>"
30
+ #config.web_domain = "http://origen.mycompany.net/<%= @name %>"
31
+ <% end -%>
32
+
33
+ # When false Origen will be less strict about checking for some common coding errors,
34
+ # it is recommended that you leave this to true for better feedback and easier debug.
35
+ # This will be the default setting in Origen v3.
36
+ config.strict_errors = true
37
+
38
+ # See: http://origen-sdk.org/origen/latest/guides/utilities/lint/
39
+ config.lint_test = {
40
+ # Require the lint tests to pass before allowing a release to proceed
41
+ run_on_tag: true,
42
+ # Auto correct violations where possible whenever 'origen lint' is run
43
+ auto_correct: true,
44
+ # Limit the testing for large legacy applications
45
+ #level: :easy,
46
+ # Run on these directories/files by default
47
+ #files: ["lib", "config/application.rb"],
48
+ }
49
+
50
+ config.semantically_version = true
51
+
52
+ # An example of how to set application specific LSF parameters
53
+ #config.lsf.project = "msg.te"
54
+
55
+ # An example of how to specify a prefix to add to all generated patterns
56
+ #config.pattern_prefix = "nvm"
57
+
58
+ # An example of how to add header comments to all generated patterns
59
+ #config.pattern_header do
60
+ # cc "This is a pattern created by the example origen application"
61
+ #end
62
+
63
+ # By default all generated output will end up in ./output.
64
+ # Here you can specify an alternative directory entirely, or make it dynamic such that
65
+ # the output ends up in a setup specific directory.
66
+ #config.output_directory do
67
+ # "#{Origen.root}/output/#{$dut.class}"
68
+ #end
69
+
70
+ # Similarly for the reference files, generally you want to setup the reference directory
71
+ # structure to mirror that of your output directory structure.
72
+ #config.reference_directory do
73
+ # "#{Origen.root}/.ref/#{$dut.class}"
74
+ #end
75
+
76
+ # This will automatically deploy your documentation after every tag
77
+ #def after_release_email(tag, note, type, selector, options)
78
+ # command = "origen web compile --remote --api"
79
+ # Dir.chdir Origen.root do
80
+ # system command
81
+ # end
82
+ #end
83
+ <% if @validate_release_tests %>
84
+ # Ensure that all tests pass before allowing a release to continue
85
+ def validate_release
86
+ if <%= Array(@validate_release_tests).map { |t| "!system('#{t}')" }.join(' || ') %>
87
+ puts "Sorry but you can't release with failing tests, please fix them and try again."
88
+ exit 1
89
+ else
90
+ puts "All tests passing, proceeding with release process!"
91
+ end
92
+ end
93
+ <% else %>
94
+ # Ensure that all tests pass before allowing a release to continue
95
+ #def validate_release
96
+ # if !system("origen specs") || !system("origen examples")
97
+ # puts "Sorry but you can't release with failing tests, please fix them and try again."
98
+ # exit 1
99
+ # else
100
+ # puts "All tests passing, proceeding with release process!"
101
+ # end
102
+ #end
103
+ <% end -%>
104
+
105
+ # To enabled source-less pattern generation create a class (for example PatternDispatcher)
106
+ # to generate the pattern. This should return false if the requested pattern has been
107
+ # dispatched, otherwise Origen will proceed with looking up a pattern source as normal.
108
+ #def before_pattern_lookup(requested_pattern)
109
+ # PatternDispatcher.new.dispatch_or_return(requested_pattern)
110
+ #end
111
+
112
+ # If you use pattern iterators you may come across the case where you request a pattern
113
+ # like this:
114
+ # origen g example_pat_b0.atp
115
+ #
116
+ # However it cannot be found by Origen since the pattern name is actually example_pat_bx.atp
117
+ # In the case where the pattern cannot be found Origen will pass the name to this translator
118
+ # if it exists, and here you can make any substitutions to help Origen find the file you
119
+ # want. In this example any instances of _b\d, where \d means a number, are replaced by
120
+ # _bx.
121
+ #config.pattern_name_translator do |name|
122
+ # name.gsub(/_b\d/, "_bx")
123
+ #end
124
+
125
+ end
@@ -0,0 +1,4 @@
1
+ # This file will be loaded by Origen to boot your application, just leave it as
2
+ # is and modify lib/<%= @name %>.rb to load the additional resources that your
3
+ # application requires
4
+ require "<%= @name %>"
@@ -0,0 +1,79 @@
1
+ # This file should be used to extend the origen with application specific commands
2
+
3
+ # Map any command aliases here, for example to allow 'origen ex' to refer to a
4
+ # command called execute you would add a reference as shown below:
5
+ aliases ={
6
+ # "ex" => "execute",
7
+ }
8
+
9
+ # The requested command is passed in here as @command, this checks it against
10
+ # the above alias table and should not be removed.
11
+ @command = aliases[@command] || @command
12
+
13
+ # Now branch to the specific task code
14
+ case @command
15
+
16
+ # (Working) example of how to create an application specific comment, here to generate
17
+ # a tags file for you application to enable method definition lookup and similar within
18
+ # editors/IDEs
19
+ when "tags"
20
+ # Here the logic is just written in-line, alternatively it could be written in a
21
+ # dedicated file and required here, e.g.
22
+ #require "<%= @name %>/commands/my_command" # Would load file lib/<%= @name %>/commands/my_command.rb
23
+ Dir.chdir Origen.root do
24
+ system("ripper-tags -R")
25
+ end
26
+ # You must always exit upon successfully capturing and executing a command to prevent
27
+ # control flowing back to Origen
28
+ exit 0
29
+
30
+ ## Example of how to make a command to run unit tests, this simply invokes RSpec on
31
+ ## the spec directory
32
+ #when "specs"
33
+ # require "rspec"
34
+ # exit RSpec::Core::Runner.run(['spec'])
35
+
36
+ ## Example of how to make a command to run diff-based tests
37
+ #when "examples", "test"
38
+ # Origen.load_application
39
+ # status = 0
40
+ #
41
+ # # Compiler tests
42
+ # ARGV = %w(templates/example.txt.erb -t debug -r approved)
43
+ # load "origen/commands/compile.rb"
44
+ # # Pattern generator tests
45
+ # #ARGV = %w(some_pattern -t debug -r approved)
46
+ # #load "#{Origen.top}/lib/origen/commands/generate.rb"
47
+ #
48
+ # if Origen.app.stats.changed_files == 0 &&
49
+ # Origen.app.stats.new_files == 0 &&
50
+ # Origen.app.stats.changed_patterns == 0 &&
51
+ # Origen.app.stats.new_patterns == 0
52
+ #
53
+ # Origen.app.stats.report_pass
54
+ # else
55
+ # Origen.app.stats.report_fail
56
+ # status = 1
57
+ # end
58
+ # puts
59
+ # if @command == "test"
60
+ # Origen.app.unload_target!
61
+ # require "rspec"
62
+ # result = RSpec::Core::Runner.run(['spec'])
63
+ # status = status == 1 ? 1 : result
64
+ # end
65
+ # exit status # Exit with a 1 on the event of a failure per std unix result codes
66
+
67
+ # Always leave an else clause to allow control to fall back through to the
68
+ # Origen command handler.
69
+ else
70
+ # You probably want to also add the your commands to the help shown via
71
+ # origen -h, you can do this by assigning the required text to @application_commands
72
+ # before handing control back to Origen.
73
+ @application_commands = <<-EOT
74
+ tags Build a tags file for this app
75
+ EOT
76
+ # specs Run the specs (tests), -c will enable coverage
77
+ # examples Run the examples (tests), -c will enable coverage
78
+ # test Run both specs and examples, -c will enable coverage
79
+ end
@@ -0,0 +1,4 @@
1
+ # Any email addresses listed here will be automatically sent an email whenever you
2
+ # run 'origen rc tag'
3
+ # See here for more info: http://origen-sdk.org/origen/guides/misc/users/#Maillists
4
+ <%= User.current.email %>
@@ -0,0 +1,3 @@
1
+ # Any email addresses listed here will be automatically sent an email whenever you
2
+ # run 'origen rc tag' and select a PRODUCTION release
3
+ # See here for more info: http://origen-sdk.org/origen/guides/misc/users/#Maillists
@@ -0,0 +1,8 @@
1
+ module <%= @namespace %>
2
+ MAJOR = 0
3
+ MINOR = 1
4
+ BUGFIX = 0
5
+ DEV = nil
6
+
7
+ VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
+ end
@@ -0,0 +1,6 @@
1
+ # You can define any Rake tasks to support your application here (or in any file
2
+ # ending in .rake in this directory).
3
+ #
4
+ # Rake (Ruby Make) is very useful for creating build scripts, see this short video
5
+ # for a quick introduction:
6
+ # http://railscasts.com/episodes/66-custom-rake-tasks
@@ -0,0 +1,22 @@
1
+ require 'origen'
2
+ <% if @type == :plugin -%>
3
+ require_relative '../config/application.rb'
4
+ <% end -%>
5
+ module <%= @namespace %>
6
+ <% if @type == :plugin -%>
7
+ # THIS FILE SHOULD ONLY BE USED TO LOAD RUNTIME DEPENDENCIES
8
+ # If this plugin has any development dependencies (e.g. dummy DUT or other models that are only used
9
+ # for testing), then these should be loaded from config/boot.rb
10
+
11
+ <% end -%>
12
+ # Example of how to explicitly require a file
13
+ # require "<%= @name %>/my_file"
14
+
15
+ # Load all files in the lib/<%= @name %> directory.
16
+ # Note that there is no problem from requiring a file twice (Ruby will ignore
17
+ # the second require), so if you have a file that must be required first, then
18
+ # explicitly require it up above and then let this take care of the rest.
19
+ Dir.glob("#{File.dirname(__FILE__)}/<%= @name %>/**/*.rb").sort.each do |file|
20
+ require file
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ module <%= @namespace %>
2
+ class TopLevel
3
+ # A simple method to get you going, to see this in action run a console session like this:
4
+ #
5
+ # origen i
6
+ #
7
+ # > $dut.hi
8
+ def hi
9
+ puts "Hello master!"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,2 @@
1
+ {: refresh_interval_in_minutesiA: modeI"
2
+ debug:EF
@@ -0,0 +1,44 @@
1
+ $VERBOSE=nil # Don't care about world writable dir warnings and the like
2
+
3
+ require 'pathname'
4
+ if File.exist? File.expand_path("../Gemfile", Pathname.new(__FILE__).realpath)
5
+ require 'rubygems'
6
+ require 'bundler/setup'
7
+ else
8
+ # If running on windows, can't use Origen helpers 'till we load it...
9
+ if RUBY_PLATFORM == 'i386-mingw32'
10
+ `where origen`.split("\n").find do |match|
11
+ match =~ /(.*)\\bin\\origen$/
12
+ end
13
+ origen_top = $1.gsub("\\", "/")
14
+ else
15
+ origen_top = `which origen`.strip.sub("/bin/origen", "")
16
+ end
17
+
18
+ $LOAD_PATH.unshift "#{origen_top}/lib"
19
+ end
20
+
21
+ require "origen"
22
+
23
+ require "rspec/legacy_formatters"
24
+ require "#{Origen.top}/spec/format/origen_formatter"
25
+ require "byebug"
26
+ require 'pry'
27
+
28
+ def load_target(target="default")
29
+ Origen.target.switch_to target
30
+ Origen.target.load!
31
+ end
32
+
33
+ RSpec.configure do |config|
34
+ config.formatter = OrigenFormatter
35
+ # rspec-expectations config goes here. You can use an alternate
36
+ # assertion/expectation library such as wrong or the stdlib/minitest
37
+ # assertions if you prefer.
38
+ config.expect_with :rspec do |expectations|
39
+ # Enable only the newer, non-monkey-patching expect syntax.
40
+ # For more details, see:
41
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
42
+ expectations.syntax = :should
43
+ end
44
+ end
@@ -0,0 +1,8 @@
1
+ # Production mode will require that there are no modified files in the workspace
2
+ # and any other conditions that you add to your application.
3
+ # Normally production targets define the target and then debug targets
4
+ # are setup to load the production target before switching Origen to debug
5
+ # mode as shown below.
6
+ load "#{Origen.root}/target/production.rb"
7
+
8
+ Origen.mode = :debug
@@ -0,0 +1 @@
1
+ # Use this file to instantiate the device model you are targeting
@@ -0,0 +1,4 @@
1
+ # The target file is run before *every* Origen operation and is used to instantiate
2
+ # the runtime environment - usually this means instantiating a top-level SoC or
3
+ # IP model.
4
+ <%= @namespace %>::TopLevel.new # Instantiate a DUT instance
@@ -0,0 +1,19 @@
1
+ % render "layouts/basic.html" do
2
+
3
+ %# HTML tags can be embedded in mark down files if you want to do specific custom
4
+ %# formatting like this, but in most cases that is not required.
5
+ <h1><%= Origen.app.namespace %> <span style="font-size: 14px">(<%= Origen.app.version %>)</span></h1>
6
+
7
+ ### Purpose
8
+
9
+ This application...
10
+
11
+ ### How To Use
12
+
13
+ Add quickstart documentation here...
14
+
15
+ ### How To Setup the Application Environment
16
+
17
+ Describe how a user would setup a new workspace for this application...
18
+
19
+ % end
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: <%= options[:title] || Origen.config.name %>
3
+ ---
4
+ <%= render "partials/navbar.html", tab: options[:tab] %>
5
+
6
+ <div class="row">
7
+ %# The markdown attribute is important if you are going to include content written
8
+ %# in markdown, without this is will be included verbatim
9
+ <div class="span12" markdown="1">
10
+ <%= yield %>
11
+
12
+ </div>
13
+ </div>
@@ -0,0 +1,20 @@
1
+ <nav class="navbar navbar-inverse navbar-fixed-top">
2
+ <div class="container">
3
+ <div class="navbar-header">
4
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
5
+ <span class="sr-only">Toggle navigation</span>
6
+ <span class="icon-bar"></span>
7
+ <span class="icon-bar"></span>
8
+ <span class="icon-bar"></span>
9
+ </button>
10
+ <a class="navbar-brand" href="<%= path "/" %>">Home</a>
11
+ </div>
12
+ <div id="navbar" class="collapse navbar-collapse">
13
+ <ul class="nav navbar-nav">
14
+ <li class="<%= options[:tab] == :api ? 'active' : '' %>"><a href="<%= path "/api/" %>">API</a></li>
15
+ <li class="<%= options[:tab] == :release ? 'active' : '' %>"><a href="<%= path "/release_notes" %>">Release Notes</a></li>
16
+ </ul>
17
+ <%= import "origen/web/logo.html" %>
18
+ </div><!--/.nav-collapse -->
19
+ </div>
20
+ </nav>
@@ -0,0 +1,5 @@
1
+ % render "layouts/basic.html", tab: :release do
2
+
3
+ <%= render "#{Origen.root}/doc/history" %>
4
+
5
+ % end
@@ -0,0 +1,102 @@
1
+ module <%= @namespace %>
2
+ module <%= @domain_namespace %>
3
+ # Generates a generic application shell
4
+ class <%= @classname %> < <%= @parentclass %>
5
+
6
+ desc "<%= @summary %>"
7
+
8
+ # Any methods that are not protected will get invoked in the order that they are
9
+ # defined when the generator is run, method naming is irrelevant unless you want
10
+ # to override a method that is defined by the parent class
11
+
12
+ def get_user_input
13
+ # The methods to get the common user input that applies to all applications will
14
+ # get called at the start automatically, you have a chance here to ask any additional
15
+ # questions that are specific to the type of application being generated.
16
+ # See the following links for some examples of how to ask questions:
17
+ # https://github.com/Origen-SDK/origen_app_generators/blob/master/lib/origen_app_generators/base.rb#L94
18
+ # https://github.com/Origen-SDK/origen_app_generators/blob/master/lib/origen_app_generators/plugin.rb#L44
19
+ end
20
+
21
+ def generate_files
22
+ # Calling this will build all files, directories and symlinks contained in the
23
+ # hash returned by the filelist method below
24
+ build_filelist
25
+ end
26
+
27
+ def modify_files
28
+ # Here you can add or remove things post-generation.
29
+ # Alternatively, you can copy any master file to the equivalent sub-directory of
30
+ # templates/app_generators/<%= @domain_namespace.underscore %>/<%= @classname.underscore %>
31
+ # and this will override the version in the master directory.
32
+ #
33
+ # However, post generation modification is recommended when possible since it means that your
34
+ # generated applications will automatically stay up to date with any improvements made to the
35
+ # master file.
36
+ # The downside is that creating a post-generation modification takes a bit more effort to create
37
+ # compared to simply copying and modifying the file manually.
38
+ # To help with creating modifications, you have access to all of the Thor Action methods described here:
39
+ # http://www.rubydoc.info/github/wycats/thor/Thor/Actions
40
+ # See the enable method for an example of using these here:
41
+ # https://github.com/Origen-SDK/origen_app_generators/blob/master/lib/origen_app_generators/new.rb#L25
42
+ end
43
+
44
+ def conclude
45
+ # Print out anything you think the user should know about their new application at the end
46
+ puts "New app created at: #{destination_root}"
47
+ end
48
+
49
+ protected
50
+
51
+ # Defines the filelist for the generator, the default list is inherited from the
52
+ # parent class (<%= @namespace %>::<%= @parentclass %>).
53
+ # <% if @parentclass == 'Plugin' -%>
54
+ # Since this is a plugin generator, the default list of files comprises the application list,
55
+ # which you can see here:
56
+ # https://github.com/Origen-SDK/origen_app_generators/blob/master/lib/origen_app_generators/application.rb
57
+ # And this is then modified by the base plugin generator which you can see here:
58
+ # https://github.com/Origen-SDK/origen_app_generators/blob/master/lib/origen_app_generators/plugin.rb
59
+ # Additionally, this application could have made further modifications to the default list
60
+ # within lib/<%= @namespace.underscore %>/plugin.rb
61
+ <% else %>
62
+ # See here for the default list of files included in an application:
63
+ # https://github.com/Origen-SDK/origen_app_generators/blob/master/lib/origen_app_generators/application.rb
64
+ # Additionally, this application could have made further modifications to the default list
65
+ # within lib/<%= @namespace.underscore %>/application.rb
66
+ <% end -%>
67
+ #
68
+ # The filelist can contain references to generate files, directories or symlinks in the
69
+ # new application.
70
+ #
71
+ # To make your generator more maintainable, try and re-use as much as possible
72
+ # from the parent generator, this means that your generators will automatically stay up
73
+ # to date with the latest conventions.
74
+ #
75
+ # Additional files can be added or removed from the filelist as shown below.
76
+ def filelist
77
+ @filelist ||= begin
78
+ list = super # Always pick up the parent list
79
+ # Example of how to remove a file from the parent list
80
+ # list.delete(:web_doc_layout)
81
+ # Example of how to add a file, in this case the file will be compiled and copied to
82
+ # the same location in the new app
83
+ # list[:config_shared_commands] = { source: 'config/shared_commands.rb' }
84
+ # Alternatively specifying a different destination, typically you would do this when
85
+ # the final location is dynamic
86
+ # list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
87
+ # Example of how to create a directory
88
+ # list[:pattern_dir] = { dest: "pattern", type: :directory }
89
+ # By default, directories created in this way will contain a .keep file, to inhibit this:
90
+ # list[:pattern_dir] = { dest: "pattern", type: :directory, nokeep: true }
91
+ # Example of how to create a symlink
92
+ # list[:target_default] = { source: 'debug.rb', # Relative to the file being linked to
93
+ # dest: 'target/default.rb', # Relative to destination_root
94
+ # type: :symlink }
95
+ # Remember to return the final list
96
+ list
97
+ end
98
+ end
99
+
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,9 @@
1
+ % render "templates/web/layouts/basic.html" do
2
+
3
+ ### OrigenAppGenerators
4
+
5
+ ## TITLE_GOES_HERE
6
+
7
+ INTRO_GOES_HERE
8
+
9
+ % end
@@ -0,0 +1,6 @@
1
+ # This file is used to hook the generators defined in this plugin into the
2
+ # 'origen new' command, it must not be removed or modified
3
+ require 'origen_app_generators'
4
+ require "<%= @name %>"
5
+ template_dir = File.expand_path('../../templates/app_generators', __FILE__)
6
+ OrigenAppGenerators.add_generators(<%= @namespace %>::AVAILABLE, template_dir: template_dir)