origen_app_generators 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/config/version.rb +2 -2
  3. data/lib/origen_app_generators/plugin.rb +2 -2
  4. data/lib/origen_app_generators/test_engineering/test_block.rb +104 -10
  5. data/lib/origen_app_generators.rb +4 -2
  6. data/lib/tasks/app_generators.rake +0 -1
  7. data/lib/tasks/boot.rb +1 -5
  8. data/templates/app_generators/application/Gemfile +5 -1
  9. data/templates/app_generators/plugin/Gemfile +11 -5
  10. data/templates/app_generators/plugin/gemspec.rb +0 -3
  11. data/templates/app_generators/test_engineering/test_block/environment/j750.rb +2 -0
  12. data/templates/app_generators/test_engineering/test_block/environment/ultraflex.rb +2 -0
  13. data/templates/app_generators/test_engineering/test_block/environment/v93k.rb +2 -0
  14. data/templates/app_generators/test_engineering/test_block/lib/controller.rb +12 -0
  15. data/templates/app_generators/test_engineering/test_block/lib/interface.rb +1 -2
  16. data/templates/app_generators/test_engineering/test_block/lib/model.rb +18 -0
  17. data/templates/app_generators/test_engineering/test_block/lib/test/dut.rb +27 -0
  18. data/templates/app_generators/test_engineering/test_block/lib/test/dut_controller.rb +32 -0
  19. data/templates/app_generators/test_engineering/test_block/pattern/example.rb +5 -0
  20. data/templates/app_generators/test_engineering/test_block/program/prb1.rb +4 -2
  21. data/templates/app_generators/test_engineering/test_block/target/default.rb +2 -0
  22. metadata +12 -6
  23. data/templates/app_generators/test_engineering/test_block/target/j750.rb +0 -10
  24. data/templates/app_generators/test_engineering/test_block/target/ultraflex.rb +0 -10
  25. data/templates/app_generators/test_engineering/test_block/target/v93k.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd970f1c3187d496d80d9a9eec9778a176d03bcb
4
- data.tar.gz: 30052184f57fd16a98e56a8f813dd016a6c5f21e
3
+ metadata.gz: 5ff04d0825d25acb5a3de404f6803423bfa64b09
4
+ data.tar.gz: d2722bb1659bcc25b9e1f8142f4a5bd6808d84fa
5
5
  SHA512:
6
- metadata.gz: 409567a4b79e454d1489b4525785f6d3b32aed821cdea39ed42974bb614ebc86a4fbb694a2c6d58be5bf42dbedef30e912275a4f63ec94a3b901375f2e050283
7
- data.tar.gz: 170b9a1478b8899b7fe701041086f6b97ef0f95b8fb38d2bb20656e5fe6e55d27826e21d7319279a4c6e65da811f043fac29bba2b2d4479e02d13ce548bbb392
6
+ metadata.gz: 08a461b46d822b9d7e914b0a0b646ede13f964b130f2540d0cea7235f1be1627341cdab2f970881541842cf2a65fb85e129f78b918c6260a88e7639ff66a9bc3
7
+ data.tar.gz: f70719cb2766fe6bd0328b38bb8f6eceb990b395629425f5d2f202109cdce910195ba6d96ebad13aae786dd9b27281a7748c8210517e33d65daf7e6e7552bd2e
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module OrigenAppGenerators
2
2
  MAJOR = 0
3
- MINOR = 2
4
- BUGFIX = 3
3
+ MINOR = 3
4
+ BUGFIX = 0
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -4,7 +4,7 @@ module OrigenAppGenerators
4
4
  def get_common_user_input
5
5
  get_name_and_namespace
6
6
  get_summary
7
- get_audience
7
+ get_audience unless @audience
8
8
  end
9
9
 
10
10
  protected
@@ -43,7 +43,7 @@ module OrigenAppGenerators
43
43
  puts
44
44
  puts 'IS THIS PLUGIN GOING TO BE RELEASED TO AN EXTERNAL AUDIENCE?'
45
45
  puts
46
- puts 'By answering yes...'
46
+ puts 'By answering yes, this plugin will be pushed to rubygems.org when it is released and it will be available outside of your company.'
47
47
  puts
48
48
  confirm_external = get_text(confirm: :return_boolean, default: 'no')
49
49
  @audience = :external if confirm_external
@@ -2,25 +2,95 @@ module OrigenAppGenerators
2
2
  module TestEngineering
3
3
  # Generates a generic plugin shell
4
4
  class TestBlock < Plugin
5
- desc 'A test block intended to plugin into a top-level application'
5
+ desc 'An IP test module intended to plugin into a top-level (SoC) application'
6
+
7
+ def initialize(*args)
8
+ @audience = :internal
9
+ super
10
+ end
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
+ get_ip_names
17
+ get_sub_block_name
18
+ end
6
19
 
7
20
  def generate_files
8
21
  @runtime_dependencies = [
9
- ['origen_testers', '>= 0.3.0.pre35']
22
+ ['origen_testers', '>= 0.6.1']
10
23
  ]
11
24
  build_filelist
12
25
  end
13
26
 
14
- def add_requires
27
+ def final_modifications
15
28
  prepend_to_file "lib/#{@name}.rb", "require 'origen_testers'\n"
29
+ # Add require line
30
+ doc_helpers = /gem 'origen_doc_helpers'/
31
+ inject_into_file 'Gemfile', "\ngem 'origen_jtag'\ngem 'origen_arm_debug'\n",
32
+ after: doc_helpers
16
33
  end
17
34
 
18
35
  def conclude
19
- puts "New test block created at: #{destination_root}"
36
+ puts "New test module created at: #{destination_root}"
37
+ puts
38
+ puts 'Generate an example pattern by running "origen g example"'
20
39
  end
21
40
 
22
41
  protected
23
42
 
43
+ def get_ip_names
44
+ puts
45
+ puts 'NAME THE IP BLOCKS THAT THIS MODULE WILL SUPPORT'
46
+ puts
47
+ puts "You don't need to name them all up front, but you must declare at least one."
48
+ puts 'We recommend that you use the official name(s) for the IP(s) as used by your design team.'
49
+ puts 'Separate multiple names with a comma: FLASH_C40_512K, FLASH_C40_2M'
50
+ puts
51
+
52
+ valid = false
53
+ until valid
54
+ @ip_names = get_text(single: true).strip.split(',').map do |name|
55
+ n = name.strip.symbolize.to_s.upcase
56
+ unless n.empty?
57
+ n
58
+ end
59
+ end.compact
60
+ unless @ip_names.empty?
61
+ # Should we check anything here?
62
+ valid = true
63
+ end
64
+ end
65
+ @ip_names
66
+ end
67
+
68
+ def get_sub_block_name
69
+ puts
70
+ puts "WHAT SHOULD BE THE PATH TO #{@ip_names.first} WHEN IT IS INSTANTIATED IN AN SOC?"
71
+ puts
72
+ puts 'Your IPs will be instantiated by a top-level (SoC) model, at which point it should be given a generic nickname'
73
+ puts 'that will provide an easy way to access it.'
74
+ puts 'For example, if you had an IP model for an NVM block, the IP name might be "FLASH_C40_512K_128K", but when it is'
75
+ puts 'instantiated it would be given the name "flash", allowing it be easily accessed as "dut.flash".'
76
+ puts
77
+
78
+ valid = false
79
+ until valid
80
+ @sub_block_name = get_text(single: true).strip.split(',').map do |name|
81
+ n = name.strip.symbolize.to_s.downcase
82
+ unless n.empty?
83
+ n
84
+ end
85
+ end.compact
86
+ unless @sub_block_name.empty?
87
+ # Should we check anything here?
88
+ valid = true
89
+ end
90
+ end
91
+ @sub_block_name = @sub_block_name.first
92
+ end
93
+
24
94
  # Defines the filelist for the generator, the default list is inherited from the
25
95
  # parent class (Plugin).
26
96
  # The filelist can contain references to generate files, directories or symlinks in the
@@ -45,9 +115,10 @@ module OrigenAppGenerators
45
115
  list.delete(:target_production)
46
116
  # Example of how to add a file, in this case the file will be compiled and copied to
47
117
  # the same location in the new app
48
- list[:target_v93k] = { source: 'target/v93k.rb' }
49
- list[:target_j750] = { source: 'target/j750.rb' }
50
- list[:target_ultraflex] = { source: 'target/ultraflex.rb' }
118
+ list[:target_default] = { source: 'target/default.rb' }
119
+ list[:environment_v93k] = { source: 'environment/v93k.rb' }
120
+ list[:environment_j750] = { source: 'environment/j750.rb' }
121
+ list[:environment_ultraflex] = { source: 'environment/ultraflex.rb' }
51
122
  list[:program_prb1] = { source: 'program/prb1.rb' }
52
123
  list[:lib_interface] = { source: 'lib/interface.rb', dest: "lib/#{@name}/interface.rb" }
53
124
  # Alternatively specifying a different destination, typically you would do this when
@@ -56,9 +127,32 @@ module OrigenAppGenerators
56
127
  # Example of how to create a directory
57
128
  list[:pattern_dir] = { dest: 'pattern', type: :directory }
58
129
  # Example of how to create a symlink
59
- list[:target_default] = { source: 'j750.rb', # Relative to the file being linked to
60
- dest: 'target/default.rb', # Relative to destination_root
61
- type: :symlink }
130
+ list[:environment_default] = { source: 'ultraflex.rb', # Relative to the file being linked to
131
+ dest: 'environment/default.rb', # Relative to destination_root
132
+ type: :symlink }
133
+ list[:test_dut] = { source: 'lib/test/dut.rb',
134
+ dest: "lib/#{@name}/test/dut.rb",
135
+ options: { class_name: @ip_names.first, sub_block_name: @sub_block_name }
136
+ }
137
+ list[:test_dutc] = { source: 'lib/test/dut_controller.rb',
138
+ dest: "lib/#{@name}/test/dut_controller.rb"
139
+ }
140
+
141
+ @ip_names.each_with_index do |name, i|
142
+ list["ip_#{i}"] = { source: 'lib/model.rb',
143
+ dest: "lib/#{@name}/#{name.underscore}.rb",
144
+ options: { name: name }
145
+ }
146
+
147
+ list["ip_controller_#{i}"] = { source: 'lib/controller.rb',
148
+ dest: "lib/#{@name}/#{name.underscore}_controller.rb",
149
+ options: { name: name }
150
+ }
151
+ end
152
+
153
+ list[:pattern_example] = { source: 'pattern/example.rb',
154
+ options: { sub_block_name: @sub_block_name }
155
+ }
62
156
  # Remember to return the final list
63
157
  list
64
158
  end
@@ -18,14 +18,16 @@ module OrigenAppGenerators
18
18
  # Empty plugin
19
19
  ['0', '1', :default, :default, 'A test block', 'yes', []],
20
20
  # Stand alone test engineering app
21
- ['1', '0', :default, :default, 'Falcon, Eagle', 'Falcon[ram, atd(2), comm[ram(2), osc](3)], Eagle[ram(2), atd(4)]', ['origen g example']]
21
+ ['1', '0', :default, :default, 'Falcon, Eagle', 'Falcon[ram, atd(2), comm[ram(2), osc](3)], Eagle[ram(2), atd(4)]', ['origen g example']],
22
+ # Test module
23
+ ['1', '1', :default, :default, 'Test module for all flash IPs', 'FLASH_512K, FLASH_1024K', 'flash', ['origen g example']]
22
24
  ]
23
25
 
24
26
  # If adding any new generators manually always add them at the top, but
25
27
  # generally speaking don't, use 'rake new' to create a new generator instead
26
28
  AVAILABLE = {
27
29
  'Test Engineering' => [
28
- # OrigenAppGenerators::TestEngineering::TestBlock,
30
+ OrigenAppGenerators::TestEngineering::TestBlock,
29
31
  OrigenAppGenerators::TestEngineering::StandAloneApplication
30
32
  ]
31
33
  }
@@ -70,7 +70,6 @@ def _execute_generator(klass)
70
70
  # With the generator identified this now launches it in a standalone shell
71
71
  # This is to emulate how it will run in real life and cause it to fail if there are
72
72
  # any dependencies on running within an Origen app environment
73
-
74
73
  boot = "#{File.expand_path(File.dirname(__FILE__))}/boot.rb"
75
74
  origen_lib = "#{Origen.top}/lib"
76
75
  origen_lib = '/proj/mem_c40tfs_testeng/r49409/origen/lib'
data/lib/tasks/boot.rb CHANGED
@@ -25,11 +25,7 @@ begin
25
25
  Dir.chdir tmp_dir do
26
26
  # For some reason this is not being defined by required origen anymore
27
27
  User = Origen::Users::User unless defined? User
28
- if RUBY_VERSION >= '2.0.0'
29
- gem 'byebug', '~>3.5'
30
- else
31
- gem 'debugger', '~>1.6'
32
- end
28
+ gem 'byebug'
33
29
  require 'origen_app_generators'
34
30
  if ARGV[1] == 'invoke'
35
31
  OrigenAppGenerators.invoke('tmp')
@@ -7,4 +7,8 @@ gem 'origen', '>= <%= @latest_origen_version %>'
7
7
 
8
8
  gem 'origen_doc_helpers'
9
9
 
10
- gem 'byebug', '~>3.5'
10
+ gem 'byebug'
11
+
12
+ # Uncomment these if you want to use a visual debugger (e.g. Visual Studio Code) to debug your app
13
+ #gem 'ruby-debug-ide'
14
+ #gem 'debase'
@@ -3,13 +3,19 @@ source 'https://rubygems.org'
3
3
  source '<%= Origen.site_config.gem_server %>'
4
4
  <% end -%>
5
5
 
6
- # Specify your gem's dependencies in <%= @name %>.gemspec
7
- gemspec
8
-
9
- # Only these gems should be added here
6
+ # Only development dependencies (things your only plugin needs when running in its own workspace) should
7
+ # be listed here in the Gemfile
10
8
  <% if @audience == :external -%>
11
9
  # This gem provides integration with https://coveralls.io/ to monitor
12
10
  # your application's test coverage
13
11
  gem 'coveralls', require: false
14
12
  <% end -%>
15
- gem 'byebug', '~>3.5'
13
+ gem 'byebug'
14
+ gem 'origen_doc_helpers'
15
+ # Uncomment these if you want to use a visual debugger (e.g. Visual Studio Code) to debug your app
16
+ #gem 'ruby-debug-ide'
17
+ #gem 'debase'
18
+
19
+ # Specify your gem's runtime dependencies in <%= @name %>.gemspec
20
+ # THIS LINE SHOULD BE LEFT AT THE END
21
+ gemspec
@@ -34,7 +34,4 @@ Gem::Specification.new do |spec|
34
34
  spec.add_runtime_dependency <%= dep.map{ |d| "\"#{d}\"" }.join(', ') %>
35
35
  <% end -%>
36
36
  <% end -%>
37
-
38
- # Add any gems that your plugin needs for its development environment only
39
- spec.add_development_dependency "origen_doc_helpers"
40
37
  end
@@ -0,0 +1,2 @@
1
+ # Instantiate a tester driver, this will be globally available as 'tester'
2
+ OrigenTesters::J750.new
@@ -0,0 +1,2 @@
1
+ # Instantiate a tester driver, this will be globally available as 'tester'
2
+ OrigenTesters::UltraFLEX.new
@@ -0,0 +1,2 @@
1
+ # Instantiate a tester driver, this will be globally available as 'tester'
2
+ OrigenTesters::V93K.new
@@ -0,0 +1,12 @@
1
+ module <%= @namespace %>
2
+ class <%= @options[:name] %>Controller
3
+ include Origen::Controller
4
+
5
+ def do_something
6
+ # The config register is defined in the corresponding model
7
+ config.mode.write!(0x14)
8
+ tester.wait(time_in_us: 100)
9
+ config.secure.read!(0)
10
+ end
11
+ end
12
+ end
@@ -1,6 +1,5 @@
1
1
  module <%= @namespace %>
2
2
  class Interface
3
- include Testers::ProgramGenerators
4
- include Testers::BasicTestSetups
3
+ include OrigenTesters::ProgramGenerators
5
4
  end
6
5
  end
@@ -0,0 +1,18 @@
1
+ module <%= @namespace %>
2
+ class <%= @options[:name] %>
3
+ include Origen::Model
4
+
5
+ def initialize(options = {})
6
+ instantiate_registers(options)
7
+ end
8
+
9
+ def instantiate_registers(options)
10
+ # Define your IP's registers here
11
+ reg :config, 0x0, size: 32 do |reg|
12
+ reg.bits 15..8, :mode
13
+ reg.bit 1, :ext_clk, reset: 1
14
+ reg.bit 0, :secure, access: :ro
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,27 @@
1
+ module <%= @namespace %>
2
+ module Test
3
+ # This is a dummy DUT class that should be used to test that your test module can
4
+ # integrate into a top-level app
5
+ class DUT
6
+ include Origen::TopLevel
7
+
8
+ def initialize(options = {})
9
+ instantiate_pins(options)
10
+ instantiate_sub_blocks(options)
11
+ end
12
+
13
+ def instantiate_pins(options)
14
+ add_pin :tclk
15
+ add_pin :tdi
16
+ add_pin :tdo
17
+ add_pin :tms
18
+ add_pin :resetb
19
+ end
20
+
21
+ def instantiate_sub_blocks(options)
22
+ sub_block :arm_debug, class_name: 'OrigenARMDebug::Driver', aps: { mem_ap: 0x0, mdmap: 0x0100_0000 }
23
+ sub_block :<%= options[:sub_block_name] %>, class_name: '<%= @namespace %>::<%= options[:class_name] %>', base_address: 0x1000_0000
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ module <%= @namespace %>
2
+ module Test
3
+ # This is a dummy DUT controller that should be used to test that your test module can
4
+ # integrate into a top-level app
5
+ class DUTController
6
+ include Origen::TopLevel
7
+ include OrigenJTAG
8
+ include OrigenARMDebug
9
+
10
+ def startup(options = {})
11
+ tester.set_timeset('func_25', 40)
12
+ ss 'Startup the SoC'
13
+ pin(:resetb).drive!(0)
14
+ 100.cycles
15
+ pin(:resetb).dont_care
16
+ end
17
+
18
+ def shutdown(options = {})
19
+ ss 'Shutdown the SoC'
20
+ pin(:resetb).drive!(0)
21
+ end
22
+
23
+ def write_register(reg, options = {})
24
+ arm_debug.write_register(reg, options)
25
+ end
26
+
27
+ def read_register(reg, options = {})
28
+ arm_debug.read_register(reg, options)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ Pattern.create do
2
+ # Registers should never be written directly from here, always call API methods
3
+ # that are defined by your controllers
4
+ dut.<%= options[:sub_block_name] %>.do_something
5
+ end
@@ -1,9 +1,11 @@
1
1
  Flow.create interface: '<%= @namespace %>::Interface' do
2
2
 
3
3
  if_job :p1 do
4
- functional :test1, bin: 10, id: :t1
4
+ test :test1, bin: 10, id: :t1
5
5
 
6
- functional :test2, bin: 15, if_failed: :t1
6
+ test :test2, bin: 15, if_failed: :t1
7
7
  end
8
8
 
9
+ pass 1, softbin: 55
10
+
9
11
  end
@@ -0,0 +1,2 @@
1
+ # Instantiate a DUT instance, this will be globally available as 'dut'
2
+ <%= @namespace %>::Test::DUT.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_app_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -93,11 +93,17 @@ files:
93
93
  - templates/app_generators/test_engineering/stand_alone_application/lib/top_level_controller.rb
94
94
  - templates/app_generators/test_engineering/stand_alone_application/pattern/example.rb
95
95
  - templates/app_generators/test_engineering/stand_alone_application/target/top_level.rb
96
+ - templates/app_generators/test_engineering/test_block/environment/j750.rb
97
+ - templates/app_generators/test_engineering/test_block/environment/ultraflex.rb
98
+ - templates/app_generators/test_engineering/test_block/environment/v93k.rb
99
+ - templates/app_generators/test_engineering/test_block/lib/controller.rb
96
100
  - templates/app_generators/test_engineering/test_block/lib/interface.rb
101
+ - templates/app_generators/test_engineering/test_block/lib/model.rb
102
+ - templates/app_generators/test_engineering/test_block/lib/test/dut.rb
103
+ - templates/app_generators/test_engineering/test_block/lib/test/dut_controller.rb
104
+ - templates/app_generators/test_engineering/test_block/pattern/example.rb
97
105
  - templates/app_generators/test_engineering/test_block/program/prb1.rb
98
- - templates/app_generators/test_engineering/test_block/target/j750.rb
99
- - templates/app_generators/test_engineering/test_block/target/ultraflex.rb
100
- - templates/app_generators/test_engineering/test_block/target/v93k.rb
106
+ - templates/app_generators/test_engineering/test_block/target/default.rb
101
107
  homepage: http://origen-sdk.org/origen_app_generators
102
108
  licenses:
103
109
  - LGPL-3
@@ -118,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
124
  version: 1.8.11
119
125
  requirements: []
120
126
  rubyforge_project:
121
- rubygems_version: 2.2.2
127
+ rubygems_version: 2.4.5
122
128
  signing_key:
123
129
  specification_version: 4
124
130
  summary: Origen application generators
@@ -1,10 +0,0 @@
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
- #
5
- # Naming is arbitrary but instances names should be prefixed with $ which indicates a
6
- # global variable in Ruby, and this is required in order for the objects instantiated
7
- # here to be visible throughout your application code.
8
-
9
- $dut = <%= @namespace %>::TopLevel.new # Instantiate a DUT instance
10
- $tester = Testers::J750.new
@@ -1,10 +0,0 @@
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
- #
5
- # Naming is arbitrary but instances names should be prefixed with $ which indicates a
6
- # global variable in Ruby, and this is required in order for the objects instantiated
7
- # here to be visible throughout your application code.
8
-
9
- $dut = <%= @namespace %>::TopLevel.new # Instantiate a DUT instance
10
- $tester = Testers::UltraFLEX.new
@@ -1,10 +0,0 @@
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
- #
5
- # Naming is arbitrary but instances names should be prefixed with $ which indicates a
6
- # global variable in Ruby, and this is required in order for the objects instantiated
7
- # here to be visible throughout your application code.
8
-
9
- $dut = <%= @namespace %>::TopLevel.new # Instantiate a DUT instance
10
- $tester = Testers::V93K.new