origen 0.34.3 → 0.52.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/origen +1 -231
- data/config/application.rb +12 -3
- data/config/boot.rb +2 -7
- data/config/commands.rb +3 -74
- data/config/rubocop/easy_disabled.yml +4 -0
- data/config/rubocop/easy_enabled.yml +0 -4
- data/config/rubocop/strict_disabled.yml +4 -0
- data/config/rubocop/strict_enabled.yml +0 -4
- data/config/version.rb +2 -3
- data/lib/origen.rb +27 -14
- data/lib/origen/application.rb +88 -2
- data/lib/origen/application/deployer.rb +3 -1
- data/lib/origen/application/release.rb +2 -2
- data/lib/origen/application/runner.rb +35 -20
- data/lib/origen/boot.rb +302 -0
- data/lib/origen/boot/api.rb +13 -0
- data/lib/origen/boot/app.rb +284 -0
- data/lib/origen/code_generators.rb +30 -10
- data/lib/origen/code_generators/actions.rb +244 -34
- data/lib/origen/code_generators/base.rb +9 -2
- data/lib/origen/code_generators/block.rb +203 -0
- data/lib/origen/code_generators/block_common.rb +100 -0
- data/lib/origen/code_generators/dut.rb +62 -0
- data/lib/origen/code_generators/feature.rb +50 -0
- data/lib/origen/code_generators/klass.rb +41 -0
- data/lib/origen/code_generators/model.rb +60 -0
- data/lib/origen/code_generators/module.rb +92 -0
- data/lib/origen/commands.rb +30 -13
- data/lib/origen/commands/archive.rb +175 -0
- data/lib/origen/commands/extract.rb +43 -0
- data/lib/origen/commands/generate.rb +1 -0
- data/lib/origen/commands/lint.rb +6 -1
- data/lib/origen/commands/new.rb +48 -24
- data/lib/origen/commands/new_resource.rb +41 -0
- data/lib/origen/commands/site.rb +52 -0
- data/lib/origen/commands/web.rb +11 -6
- data/lib/origen/commands_global.rb +9 -7
- data/lib/origen/core_ext/numeric.rb +20 -0
- data/lib/{option_parser → origen/core_ext/option_parser}/optparse.rb +0 -0
- data/lib/origen/dependencies.rb +0 -0
- data/lib/origen/file_handler.rb +18 -6
- data/lib/origen/generator.rb +19 -10
- data/lib/origen/generator/comparator.rb +2 -1
- data/lib/origen/generator/flow.rb +3 -1
- data/lib/origen/generator/job.rb +60 -16
- data/lib/origen/generator/pattern.rb +132 -72
- data/lib/origen/generator/pattern_finder.rb +3 -3
- data/lib/origen/generator/pattern_sequence.rb +201 -0
- data/lib/origen/generator/pattern_sequencer.rb +99 -0
- data/lib/origen/generator/pattern_thread.rb +175 -0
- data/lib/origen/loader.rb +381 -0
- data/lib/origen/log.rb +250 -108
- data/lib/origen/model.rb +22 -1
- data/lib/origen/model/exporter.rb +50 -10
- data/lib/origen/model_initializer.rb +5 -1
- data/lib/origen/operating_systems.rb +4 -0
- data/lib/origen/parameters.rb +96 -4
- data/lib/origen/parameters/set.rb +4 -3
- data/lib/origen/pins.rb +10 -8
- data/lib/origen/pins/pin.rb +61 -46
- data/lib/origen/ports/port.rb +5 -0
- data/lib/origen/registers.rb +5 -0
- data/lib/origen/registers/bit.rb +57 -53
- data/lib/origen/registers/bit_collection.rb +100 -43
- data/lib/origen/registers/msb0_delegator.rb +47 -0
- data/lib/origen/registers/reg.rb +114 -99
- data/lib/origen/revision_control.rb +1 -1
- data/lib/origen/revision_control/git.rb +23 -3
- data/lib/origen/site_config.rb +251 -60
- data/lib/origen/site_config/config.rb +217 -0
- data/lib/origen/sub_blocks.rb +106 -31
- data/lib/origen/top_level.rb +11 -0
- data/lib/origen/users/user.rb +3 -2
- data/lib/origen/utility/mailer.rb +42 -9
- data/lib/origen/value/bin_str_val.rb +1 -1
- data/lib/origen/value/hex_str_val.rb +1 -1
- data/lib/origen/version_string.rb +6 -1
- data/lib/tasks/gem.rake +6 -1
- data/origen_app_generators/Gemfile +19 -0
- data/origen_app_generators/Gemfile.lock +152 -0
- data/origen_app_generators/LICENSE +21 -0
- data/origen_app_generators/README.md +368 -0
- data/{templates/code_generators/rakefile.rb → origen_app_generators/Rakefile} +0 -0
- data/origen_app_generators/bin/boot.rb +39 -0
- data/origen_app_generators/config/application.rb +153 -0
- data/origen_app_generators/config/boot.rb +1 -0
- data/origen_app_generators/config/commands.rb +63 -0
- data/origen_app_generators/config/shared_commands.rb +177 -0
- data/origen_app_generators/config/version.rb +8 -0
- data/origen_app_generators/doc/history +223 -0
- data/origen_app_generators/lbin/bundle +105 -0
- data/origen_app_generators/lbin/byebug +29 -0
- data/origen_app_generators/lbin/coderay +29 -0
- data/origen_app_generators/lbin/htmldiff +29 -0
- data/origen_app_generators/lbin/httparty +29 -0
- data/origen_app_generators/lbin/httpclient +29 -0
- data/origen_app_generators/lbin/kramdown +29 -0
- data/origen_app_generators/lbin/ldiff +29 -0
- data/origen_app_generators/lbin/nanoc +29 -0
- data/origen_app_generators/lbin/nokogiri +29 -0
- data/origen_app_generators/lbin/origen +62 -0
- data/origen_app_generators/lbin/pry +29 -0
- data/origen_app_generators/lbin/rackup +29 -0
- data/origen_app_generators/lbin/rake +29 -0
- data/origen_app_generators/lbin/rspec +29 -0
- data/origen_app_generators/lbin/rubocop +29 -0
- data/origen_app_generators/lbin/ruby-parse +29 -0
- data/origen_app_generators/lbin/ruby-rewrite +29 -0
- data/origen_app_generators/lbin/thor +29 -0
- data/origen_app_generators/lbin/tilt +29 -0
- data/origen_app_generators/lbin/yard +29 -0
- data/origen_app_generators/lbin/yardoc +29 -0
- data/origen_app_generators/lbin/yri +29 -0
- data/origen_app_generators/lib/origen_app_generators.rb +125 -0
- data/origen_app_generators/lib/origen_app_generators/application.rb +62 -0
- data/origen_app_generators/lib/origen_app_generators/base.rb +257 -0
- data/origen_app_generators/lib/origen_app_generators/empty_application.rb +15 -0
- data/origen_app_generators/lib/origen_app_generators/empty_plugin.rb +15 -0
- data/origen_app_generators/lib/origen_app_generators/new.rb +170 -0
- data/origen_app_generators/lib/origen_app_generators/new_app_tests.rb +4 -0
- data/origen_app_generators/lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb +107 -0
- data/origen_app_generators/lib/origen_app_generators/plugin.rb +55 -0
- data/origen_app_generators/lib/origen_app_generators/test_engineering/common.rb +29 -0
- data/origen_app_generators/lib/origen_app_generators/test_engineering/stand_alone_application.rb +64 -0
- data/origen_app_generators/lib/origen_app_generators/test_engineering/test_block.rb +61 -0
- data/origen_app_generators/origen_app_generators.gemspec +33 -0
- data/{templates/code_generators → origen_app_generators/spec}/spec_helper.rb +0 -0
- data/origen_app_generators/target/debug.rb +8 -0
- data/origen_app_generators/target/default.rb +8 -0
- data/origen_app_generators/target/production.rb +0 -0
- data/origen_app_generators/templates/app_generators/application/.gitignore +37 -0
- data/origen_app_generators/templates/app_generators/application/.irbrc +9 -0
- data/origen_app_generators/templates/app_generators/application/.rspec +1 -0
- data/origen_app_generators/templates/app_generators/application/.travis.yml +11 -0
- data/origen_app_generators/templates/app_generators/application/Gemfile +34 -0
- data/origen_app_generators/templates/app_generators/application/Rakefile +7 -0
- data/origen_app_generators/templates/app_generators/application/app/blocks/top_level.rb +12 -0
- data/origen_app_generators/templates/app_generators/application/app/lib/module.rb +6 -0
- data/origen_app_generators/templates/app_generators/application/app/templates/web/index.md.erb +19 -0
- data/origen_app_generators/templates/app_generators/application/app/templates/web/layouts/_basic.html.erb +13 -0
- data/origen_app_generators/templates/app_generators/application/app/templates/web/partials/_navbar.html.erb +20 -0
- data/origen_app_generators/templates/app_generators/application/app/templates/web/release_notes.md.erb +5 -0
- data/origen_app_generators/templates/app_generators/application/config/application.rb +121 -0
- data/origen_app_generators/templates/app_generators/application/config/boot.rb +4 -0
- data/origen_app_generators/templates/app_generators/application/config/commands.rb +79 -0
- data/origen_app_generators/templates/app_generators/application/config/maillist_dev.txt +4 -0
- data/origen_app_generators/templates/app_generators/application/config/maillist_prod.txt +3 -0
- data/origen_app_generators/templates/app_generators/application/config/version.rb +8 -0
- data/origen_app_generators/templates/app_generators/application/doc/history +0 -0
- data/origen_app_generators/templates/app_generators/application/dot_keep +0 -0
- data/origen_app_generators/templates/app_generators/application/origen_core_session +2 -0
- data/origen_app_generators/templates/app_generators/application/spec/spec_helper.rb +44 -0
- data/origen_app_generators/templates/app_generators/application/target/debug.rb +8 -0
- data/origen_app_generators/templates/app_generators/application/target/default.rb +1 -0
- data/origen_app_generators/templates/app_generators/application/target/production.rb +4 -0
- data/origen_app_generators/templates/app_generators/new/generator.rb +102 -0
- data/origen_app_generators/templates/app_generators/new/info.md.erb +9 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/application.rb +54 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/base.rb +55 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/module.rb +28 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/app/lib/plugin.rb +64 -0
- data/origen_app_generators/templates/app_generators/origen_infrastructure/app_generator_plugin/config/load_generators.rb +6 -0
- data/origen_app_generators/templates/app_generators/plugin/Gemfile +32 -0
- data/origen_app_generators/templates/app_generators/plugin/Rakefile +10 -0
- data/origen_app_generators/templates/app_generators/plugin/app/templates/web/index.md.erb +37 -0
- data/origen_app_generators/templates/app_generators/plugin/app/templates/web/partials/_navbar_external.html.erb +20 -0
- data/origen_app_generators/templates/app_generators/plugin/app/templates/web/partials/_navbar_internal.html.erb +20 -0
- data/origen_app_generators/templates/app_generators/plugin/config/boot.rb +24 -0
- data/origen_app_generators/templates/app_generators/plugin/gemspec.rb +43 -0
- data/origen_app_generators/templates/app_generators/test_engineering/environment/j750.rb +1 -0
- data/origen_app_generators/templates/app_generators/test_engineering/environment/uflex.rb +1 -0
- data/origen_app_generators/templates/app_generators/test_engineering/environment/v93k.rb +1 -0
- data/origen_app_generators/templates/app_generators/test_engineering/stand_alone_application/.keep +0 -0
- data/origen_app_generators/templates/app_generators/test_engineering/test_block/.keep +0 -0
- data/origen_site_config.yml +55 -5
- data/templates/code_generators/attributes.rb +20 -0
- data/templates/code_generators/class.rb +9 -0
- data/templates/code_generators/controller.rb +87 -0
- data/templates/code_generators/model.rb +21 -0
- data/templates/code_generators/module.rb +4 -0
- data/templates/code_generators/parameters.rb +19 -0
- data/templates/code_generators/pins.rb +28 -0
- data/templates/code_generators/registers.rb +20 -0
- data/templates/code_generators/sub_blocks.rb +24 -0
- data/templates/code_generators/timesets.rb +24 -0
- data/templates/code_generators/version.rb +0 -1
- data/templates/git/gitignore.erb +0 -1
- data/vendor/lib/models/origen/export1.rb +77 -0
- data/vendor/lib/models/origen/export1/block1.rb +13 -0
- data/vendor/lib/models/origen/export1/block1/x.rb +36 -0
- data/vendor/lib/models/origen/non_origen_meta_data.md +1 -0
- metadata +149 -68
- data/bin/fix_my_workspace +0 -100
- data/lib/c99/ate_interface.rb +0 -77
- data/lib/c99/nvm.rb +0 -110
- data/lib/c99/target/mock2.rb +0 -1
- data/lib/c99/target/subdir/mock3.rb +0 -1
- data/lib/origen/code_generators/bundler.rb +0 -17
- data/lib/origen/code_generators/gem_setup.rb +0 -49
- data/lib/origen/code_generators/rake.rb +0 -13
- data/lib/origen/code_generators/rspec.rb +0 -12
- data/lib/origen/commands/add.rb +0 -12
- data/lib/tasks/private/build.rake +0 -8
- data/templates/code_generators/gemfile_app.rb +0 -4
- data/templates/code_generators/gemfile_plugin.rb +0 -6
- data/templates/code_generators/gemspec.rb +0 -33
@@ -1,6 +1,16 @@
|
|
1
1
|
module Origen
|
2
2
|
module Model
|
3
3
|
module Exporter
|
4
|
+
# Export the model
|
5
|
+
#
|
6
|
+
# Options defaults:
|
7
|
+
# include_pins: true
|
8
|
+
# include_registers: true
|
9
|
+
# include_sub_blocks: true
|
10
|
+
# include_timestamp: true
|
11
|
+
# rm_rb_only: nil # delete only .rb files, default is rm -rf * Origen.root/vendor/lib/models/name
|
12
|
+
#
|
13
|
+
# Use the rm_rb_only option if the export dir is under revision control and the dir contains revision control metadata
|
4
14
|
def export(name, options = {})
|
5
15
|
options = {
|
6
16
|
include_pins: true,
|
@@ -14,7 +24,13 @@ module Origen
|
|
14
24
|
file = options[:file_path] || export_path(name, options)
|
15
25
|
dir = options[:dir_path] || export_dir(options)
|
16
26
|
path_to_file = Pathname.new(File.join(dir, file))
|
17
|
-
|
27
|
+
if File.exist?(path_to_file.sub_ext('').to_s)
|
28
|
+
if options[:rm_rb_only]
|
29
|
+
Dir.glob(path_to_file.sub_ext('').to_s + '/**/*.rb').each { |f| FileUtils.rm_f(f) }
|
30
|
+
else
|
31
|
+
FileUtils.rm_rf(path_to_file.sub_ext('').to_s)
|
32
|
+
end
|
33
|
+
end
|
18
34
|
FileUtils.rm_rf(path_to_file.to_s) if File.exist?(path_to_file.to_s)
|
19
35
|
FileUtils.mkdir_p(path_to_file.dirname)
|
20
36
|
File.open(path_to_file, 'w') do |f|
|
@@ -114,7 +130,7 @@ module Origen
|
|
114
130
|
attr_end_str = (attr == pin_pkg_meta.keys.last) ? ' }' : ', '
|
115
131
|
case attr_val
|
116
132
|
when String
|
117
|
-
str << "
|
133
|
+
str << "\"#{attr_val.gsub('"', '\"')}\"#{attr_end_str}"
|
118
134
|
else
|
119
135
|
str << "#{attr_val}#{attr_end_str}"
|
120
136
|
end
|
@@ -177,6 +193,9 @@ module Origen
|
|
177
193
|
if (d = pin.direction) != :io
|
178
194
|
line << ", direction: :#{d}"
|
179
195
|
end
|
196
|
+
if (t = pin.type)
|
197
|
+
line << ", type: :#{t}"
|
198
|
+
end
|
180
199
|
pkg_meta = write_pin_packages(pin)
|
181
200
|
line << ", #{pkg_meta}" unless pkg_meta == ''
|
182
201
|
Array(options[:attributes]).each do |attr|
|
@@ -224,7 +243,7 @@ module Origen
|
|
224
243
|
indent = ' ' * (options[:indent] || 0)
|
225
244
|
file_path = File.join(Pathname.new(options[:file_path]).sub_ext(''), "#{id}.rb")
|
226
245
|
dir_path = options[:dir_path]
|
227
|
-
line = indent + "model.sub_block :#{id}, file: '#{file_path}', dir: '#{
|
246
|
+
line = indent + "model.sub_block :#{id}, file: '#{file_path}', dir: \"#{dir_path.gsub(Origen.root.to_s, '#{Origen.root!}')}\", lazy: true"
|
228
247
|
unless block.base_address == 0
|
229
248
|
line << ", base_address: #{block.base_address.to_hex}"
|
230
249
|
end
|
@@ -232,9 +251,9 @@ module Origen
|
|
232
251
|
if value.is_a?(Symbol)
|
233
252
|
line << ", #{key}: :#{value}"
|
234
253
|
elsif value.is_a?(String)
|
235
|
-
line << ", #{key}:
|
254
|
+
line << ", #{key}: \"#{value.gsub('"', '\"')}\""
|
236
255
|
else
|
237
|
-
line << ", #{key}: #{value}"
|
256
|
+
line << ", #{key}: #{value}" unless value.nil?
|
238
257
|
end
|
239
258
|
end
|
240
259
|
block.export(id, options.merge(file_path: file_path, dir_path: dir_path))
|
@@ -247,22 +266,29 @@ module Origen
|
|
247
266
|
unless reg.description.empty?
|
248
267
|
reg.description.each { |l| lines << indent + "# #{l}" }
|
249
268
|
end
|
250
|
-
lines << indent + "model.add_reg :#{id}, #{reg.offset.to_hex}, size: #{reg.size} do |reg|"
|
269
|
+
lines << indent + "model.add_reg :#{id}, #{reg.offset.to_hex}, size: #{reg.size} #{reg.bit_order == :msb0 ? ', bit_order: :msb0' : ''}#{build_reg_meta(reg)} do |reg|"
|
251
270
|
indent = ' ' * ((options[:indent] || 0) + 2)
|
252
271
|
reg.named_bits.each do |name, bits|
|
253
272
|
unless bits.description.empty?
|
254
273
|
bits.description.each { |l| lines << indent + "# #{l}" }
|
255
274
|
end
|
275
|
+
position = reg.bit_order == :msb0 ? (reg.size - bits.position - 1) : bits.position
|
256
276
|
if bits.size == 1
|
257
|
-
line = indent + "reg.bit #{
|
277
|
+
line = indent + "reg.bit #{position}, :#{name}"
|
258
278
|
else
|
259
|
-
|
279
|
+
if reg.bit_order == :msb0
|
280
|
+
line = indent + "reg.bit #{position - bits.size + 1}..#{position}, :#{name}"
|
281
|
+
else
|
282
|
+
line = indent + "reg.bit #{position + bits.size - 1}..#{position}, :#{name}"
|
283
|
+
end
|
260
284
|
end
|
261
285
|
unless bits.access == :rw
|
262
286
|
line << ", access: :#{bits.access}"
|
263
287
|
end
|
264
|
-
|
265
|
-
line << ", reset:
|
288
|
+
if bits.reset_val.is_a?(Symbol)
|
289
|
+
line << ", reset: :#{bits.reset_val}"
|
290
|
+
else
|
291
|
+
line << ", reset: #{bits.reset_val.to_hex}" unless bits.reset_val == 0
|
266
292
|
end
|
267
293
|
lines << line
|
268
294
|
end
|
@@ -270,6 +296,20 @@ module Origen
|
|
270
296
|
lines << indent + 'end'
|
271
297
|
lines.join("\n")
|
272
298
|
end
|
299
|
+
|
300
|
+
def build_reg_meta(reg)
|
301
|
+
ret_str = ''
|
302
|
+
reg.meta.each do |key, value|
|
303
|
+
if value.is_a?(Symbol)
|
304
|
+
ret_str += ", #{key}: :#{value}"
|
305
|
+
elsif value.is_a?(String)
|
306
|
+
ret_str += ", #{key}: \"#{value.gsub('"', '\"')}\""
|
307
|
+
else
|
308
|
+
ret_str += ", #{key}: #{value}" unless value.nil?
|
309
|
+
end
|
310
|
+
end
|
311
|
+
ret_str
|
312
|
+
end
|
273
313
|
end
|
274
314
|
end
|
275
315
|
end
|
@@ -46,7 +46,10 @@ module Origen
|
|
46
46
|
else
|
47
47
|
x.send(:initialize, *args, &block)
|
48
48
|
end
|
49
|
-
|
49
|
+
if x.respond_to?(:is_an_origen_model?)
|
50
|
+
x.send(:_initialized)
|
51
|
+
Origen::Loader.load_block(x)
|
52
|
+
end
|
50
53
|
if x.respond_to?(:register_callback_listener)
|
51
54
|
Origen.after_app_loaded do |app|
|
52
55
|
x.register_callback_listener
|
@@ -55,6 +58,7 @@ module Origen
|
|
55
58
|
# Do this before wrapping, otherwise the respond to method in the controller will
|
56
59
|
# be looking for the model to be instantiated when it is not fully done yet
|
57
60
|
is_top_level = x.respond_to?(:includes_origen_top_level?)
|
61
|
+
|
58
62
|
if x.respond_to?(:wrap_in_controller)
|
59
63
|
x = x.wrap_in_controller
|
60
64
|
end
|
data/lib/origen/parameters.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'active_support/concern'
|
2
|
+
require 'set'
|
2
3
|
module Origen
|
3
4
|
module Parameters
|
4
5
|
extend ActiveSupport::Concern
|
@@ -8,6 +9,75 @@ module Origen
|
|
8
9
|
|
9
10
|
attr_accessor :current
|
10
11
|
|
12
|
+
# @api private
|
13
|
+
#
|
14
|
+
# Any define_params blocks contained within the given block will be allowed to be re-opened later
|
15
|
+
# in the block to override existing parameter settings or to add new ones.
|
16
|
+
#
|
17
|
+
# This is not allowed normally since already-defined child parameter sets could have referenced the
|
18
|
+
# original parameter and they would not reflect the final value after re-opening the parent parameter
|
19
|
+
# set.
|
20
|
+
#
|
21
|
+
# By defining the parameters within this block, Origen will keep track of relationships between parameter
|
22
|
+
# sets and any time a parent is changed the definitions of existing children will be re-executed to ensure
|
23
|
+
# that they reflect the new values.
|
24
|
+
#
|
25
|
+
# This is initially intended to support the concept of a app/parameters/application.rb being
|
26
|
+
# used to define baseline parameter sets, and then target-specific files can then override them.
|
27
|
+
def self.transaction
|
28
|
+
start_transaction
|
29
|
+
yield
|
30
|
+
stop_transaction
|
31
|
+
end
|
32
|
+
|
33
|
+
# @api private
|
34
|
+
def self.start_transaction
|
35
|
+
@transaction_data = {}
|
36
|
+
@transaction_open = true
|
37
|
+
@transaction_counter ||= 0
|
38
|
+
@transaction_counter += 1
|
39
|
+
end
|
40
|
+
|
41
|
+
# @api private
|
42
|
+
def self.stop_transaction
|
43
|
+
@transaction_counter -= 1
|
44
|
+
if @transaction_counter == 0
|
45
|
+
# Now finalize (freeze) all parameter sets we have just defined, this was deferred at define time due
|
46
|
+
# to running within a transaction
|
47
|
+
@transaction_data.each do |model, parameter_sets|
|
48
|
+
parameter_sets.keys.each do |name|
|
49
|
+
model._parameter_sets[name].finalize
|
50
|
+
end
|
51
|
+
end
|
52
|
+
@transaction_data = nil
|
53
|
+
@transaction_open = false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# @api private
|
58
|
+
def self.transaction_data
|
59
|
+
@transaction_data
|
60
|
+
end
|
61
|
+
|
62
|
+
# @api private
|
63
|
+
def self.transaction_open
|
64
|
+
@transaction_open
|
65
|
+
end
|
66
|
+
|
67
|
+
# @api private
|
68
|
+
def self.transaction_redefine
|
69
|
+
@transaction_redefine
|
70
|
+
end
|
71
|
+
|
72
|
+
# @api private
|
73
|
+
def self.redefine(model, name)
|
74
|
+
@transaction_redefine = true
|
75
|
+
model._parameter_sets.delete(name)
|
76
|
+
@transaction_data[model][name][:definitions].each { |options, block| model.define_params(name, options, &block) }
|
77
|
+
@transaction_data[model][name][:children].each { |model, name| redefine(model, name) }
|
78
|
+
@transaction_redefine = false
|
79
|
+
end
|
80
|
+
|
11
81
|
module ClassMethods
|
12
82
|
def parameters_context(obj = nil)
|
13
83
|
if obj
|
@@ -25,19 +95,41 @@ module Origen
|
|
25
95
|
end
|
26
96
|
end
|
27
97
|
|
98
|
+
# @api private
|
99
|
+
def define_params_transaction
|
100
|
+
Origen::Parameters.transaction_data
|
101
|
+
end
|
102
|
+
|
28
103
|
def define_params(name, options = {}, &block)
|
29
|
-
|
30
|
-
|
104
|
+
name = name.to_sym
|
105
|
+
if _parameter_sets[name] && !Origen::Parameters.transaction_open
|
106
|
+
fail "Parameter set '#{name}' cannot be re-opened once originally defined!"
|
31
107
|
else
|
32
|
-
|
108
|
+
if Origen::Parameters.transaction_open && !Origen::Parameters.transaction_redefine
|
109
|
+
define_params_transaction[self] ||= {}
|
110
|
+
define_params_transaction[self][name] ||= { children: ::Set[], definitions: [] }
|
111
|
+
define_params_transaction[self][name][:definitions] << [options.dup, block]
|
112
|
+
redefine_children = define_params_transaction[self][name][:children] if _parameter_sets[name]
|
113
|
+
end
|
114
|
+
if _parameter_sets[name]
|
115
|
+
defaults_already_set = true
|
116
|
+
else
|
117
|
+
_parameter_sets[name] = Origen::Parameters::Set.new(top_level: true, owner: self)
|
118
|
+
end
|
33
119
|
if options[:inherit]
|
34
120
|
kontext = _validate_parameter_set_name(options[:inherit])
|
35
121
|
parent = kontext[:obj]._parameter_sets[kontext[:context]]
|
36
|
-
|
122
|
+
if Origen::Parameters.transaction_open && !Origen::Parameters.transaction_redefine
|
123
|
+
define_params_transaction[kontext[:obj]][kontext[:context]][:children] << [self, name]
|
124
|
+
end
|
125
|
+
_parameter_sets[name].copy_defaults_from(parent) unless defaults_already_set
|
37
126
|
_parameter_sets[name].define(parent, &block)
|
38
127
|
else
|
39
128
|
_parameter_sets[name].define(&block)
|
40
129
|
end
|
130
|
+
if redefine_children
|
131
|
+
redefine_children.each { |model, set_name| Origen::Parameters.redefine(model, set_name) }
|
132
|
+
end
|
41
133
|
end
|
42
134
|
end
|
43
135
|
alias_method :define_parameters, :define_params
|
@@ -21,7 +21,7 @@ module Origen
|
|
21
21
|
@defining = true
|
22
22
|
yield self, parent
|
23
23
|
@defining = false
|
24
|
-
finalize
|
24
|
+
finalize unless Origen::Parameters.transaction_open
|
25
25
|
end
|
26
26
|
|
27
27
|
# Returns the current parameter context
|
@@ -60,10 +60,10 @@ module Origen
|
|
60
60
|
if args.length != 0
|
61
61
|
super
|
62
62
|
else
|
63
|
-
|
64
|
-
if !val
|
63
|
+
if !key?(method)
|
65
64
|
super
|
66
65
|
else
|
66
|
+
val = self[method]
|
67
67
|
if val.is_a?(Set)
|
68
68
|
val
|
69
69
|
else
|
@@ -114,6 +114,7 @@ module Origen
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def defining?
|
117
|
+
return true if Origen::Parameters.transaction_open
|
117
118
|
if top_level?
|
118
119
|
@defining
|
119
120
|
else
|
data/lib/origen/pins.rb
CHANGED
@@ -229,21 +229,23 @@ module Origen
|
|
229
229
|
|
230
230
|
rtl_name = options[:rtl_name]
|
231
231
|
force = options[:force]
|
232
|
+
offset = options.delete(:offset) || 0
|
232
233
|
options.delete(:size).times do |i|
|
233
|
-
|
234
|
-
options[:
|
235
|
-
options[:
|
234
|
+
pin_index = offset + i
|
235
|
+
options[:name] = "#{id}#{pin_index}".to_sym
|
236
|
+
options[:rtl_name] = "#{rtl_name}#{pin_index}".to_sym if rtl_name
|
237
|
+
options[:force] = force[pin_index] if force
|
236
238
|
|
237
239
|
if power_pin
|
238
|
-
group[i] = PowerPin.new(
|
240
|
+
group[i] = PowerPin.new(pin_index, self, options)
|
239
241
|
elsif ground_pin
|
240
|
-
group[i] = GroundPin.new(
|
242
|
+
group[i] = GroundPin.new(pin_index, self, options)
|
241
243
|
elsif virtual_pin
|
242
|
-
group[i] = VirtualPin.new(
|
244
|
+
group[i] = VirtualPin.new(pin_index, self, options)
|
243
245
|
elsif other_pin
|
244
|
-
group[i] = OtherPin.new(
|
246
|
+
group[i] = OtherPin.new(pin_index, self, options)
|
245
247
|
else
|
246
|
-
group[i] = Pin.new(
|
248
|
+
group[i] = Pin.new(pin_index, self, options)
|
247
249
|
end
|
248
250
|
group[i].invalidate_group_cache
|
249
251
|
end
|
data/lib/origen/pins/pin.rb
CHANGED
@@ -56,6 +56,14 @@ module Origen
|
|
56
56
|
attr_accessor :description
|
57
57
|
attr_accessor :notes
|
58
58
|
|
59
|
+
# Returns a hash containing any meta data associated with the current pin state
|
60
|
+
#
|
61
|
+
# my_pin.read!(1, meta: { position: 10 })
|
62
|
+
# my_pin.state_meta # => { position: 10 }
|
63
|
+
# my_pin.dont_care
|
64
|
+
# my_pin.state_meta # => {}
|
65
|
+
attr_reader :state_meta
|
66
|
+
|
59
67
|
# Should be instantiated through the HasPins macros
|
60
68
|
def initialize(id, owner, options = {}) # :nodoc:
|
61
69
|
options = {
|
@@ -89,6 +97,7 @@ module Origen
|
|
89
97
|
@clock = nil
|
90
98
|
@meta = options[:meta] || {}
|
91
99
|
@dib_meta = options[:dib_meta] || {}
|
100
|
+
@state_meta = {}
|
92
101
|
@_saved_state = []
|
93
102
|
@_saved_value = []
|
94
103
|
@_saved_suspend = []
|
@@ -638,6 +647,11 @@ module Origen
|
|
638
647
|
@repeat_previous
|
639
648
|
end
|
640
649
|
|
650
|
+
def set_state_with_options(state, options = {})
|
651
|
+
@state_meta = options[:meta] || {}
|
652
|
+
set_state(state)
|
653
|
+
end
|
654
|
+
|
641
655
|
def set_state(state)
|
642
656
|
invalidate_vector_cache
|
643
657
|
@repeat_previous = false
|
@@ -690,76 +704,77 @@ module Origen
|
|
690
704
|
|
691
705
|
def state=(value)
|
692
706
|
invalidate_vector_cache
|
707
|
+
@state_meta = {}
|
693
708
|
@state = value
|
694
709
|
end
|
695
710
|
|
696
711
|
# Set the pin to drive a 1 on future cycles
|
697
|
-
def drive_hi
|
698
|
-
|
712
|
+
def drive_hi(options = {})
|
713
|
+
set_state_with_options(:drive, options)
|
699
714
|
set_value(1)
|
700
715
|
end
|
701
716
|
alias_method :write_hi, :drive_hi
|
702
717
|
|
703
|
-
def drive_hi!
|
704
|
-
drive_hi
|
718
|
+
def drive_hi!(options = {})
|
719
|
+
drive_hi(options)
|
705
720
|
cycle
|
706
721
|
end
|
707
722
|
alias_method :write_hi!, :drive_hi!
|
708
723
|
|
709
724
|
# Set the pin to drive a high voltage on future cycles (if the tester supports it).
|
710
725
|
# For example on a J750 high-voltage channel the pin state would be set to "2"
|
711
|
-
def drive_very_hi
|
712
|
-
|
726
|
+
def drive_very_hi(options = {})
|
727
|
+
set_state_with_options(:drive_very_hi, options)
|
713
728
|
set_value(1)
|
714
729
|
end
|
715
730
|
|
716
|
-
def drive_very_hi!
|
717
|
-
drive_very_hi
|
731
|
+
def drive_very_hi!(options = {})
|
732
|
+
drive_very_hi(options)
|
718
733
|
cycle
|
719
734
|
end
|
720
735
|
|
721
736
|
# Set the pin to drive a 0 on future cycles
|
722
|
-
def drive_lo
|
723
|
-
|
737
|
+
def drive_lo(options = {})
|
738
|
+
set_state_with_options(:drive, options)
|
724
739
|
set_value(0)
|
725
740
|
end
|
726
741
|
alias_method :write_lo, :drive_lo
|
727
742
|
|
728
|
-
def drive_lo!
|
729
|
-
drive_lo
|
743
|
+
def drive_lo!(options = {})
|
744
|
+
drive_lo(options)
|
730
745
|
cycle
|
731
746
|
end
|
732
747
|
alias_method :write_lo!, :drive_lo!
|
733
748
|
|
734
|
-
def drive_mem
|
735
|
-
|
749
|
+
def drive_mem(options = {})
|
750
|
+
set_state_with_options(:drive_mem, options)
|
736
751
|
end
|
737
752
|
|
738
|
-
def drive_mem!
|
739
|
-
drive_mem
|
753
|
+
def drive_mem!(options = {})
|
754
|
+
drive_mem(options)
|
740
755
|
cycle
|
741
756
|
end
|
742
757
|
|
743
|
-
def expect_mem
|
744
|
-
|
758
|
+
def expect_mem(options = {})
|
759
|
+
set_state_with_options(:expect_mem, options)
|
745
760
|
end
|
746
761
|
|
747
|
-
def expect_mem!
|
748
|
-
expect_mem
|
762
|
+
def expect_mem!(options = {})
|
763
|
+
expect_mem(options)
|
749
764
|
cycle
|
750
765
|
end
|
751
766
|
|
752
767
|
# Set the pin to expect a 1 on future cycles
|
753
|
-
def assert_hi(
|
754
|
-
|
768
|
+
def assert_hi(options = {})
|
769
|
+
set_state_with_options(:compare, options)
|
755
770
|
set_value(1)
|
756
771
|
end
|
757
772
|
alias_method :expect_hi, :assert_hi
|
758
773
|
alias_method :compare_hi, :assert_hi
|
759
774
|
alias_method :read_hi, :assert_hi
|
760
775
|
|
761
|
-
def assert_hi!
|
762
|
-
assert_hi
|
776
|
+
def assert_hi!(options = {})
|
777
|
+
assert_hi(options)
|
763
778
|
cycle
|
764
779
|
end
|
765
780
|
alias_method :expect_hi!, :assert_hi!
|
@@ -767,8 +782,8 @@ module Origen
|
|
767
782
|
alias_method :read_hi!, :assert_hi!
|
768
783
|
|
769
784
|
# Set the pin to expect a 0 on future cycles
|
770
|
-
def assert_lo(
|
771
|
-
|
785
|
+
def assert_lo(options = {})
|
786
|
+
set_state_with_options(:compare, options)
|
772
787
|
set_value(0)
|
773
788
|
# Planning to add the active load logic to the tester instead...
|
774
789
|
# options = { :active => false #if active true means to take tester active load capability into account
|
@@ -783,8 +798,8 @@ module Origen
|
|
783
798
|
alias_method :compare_lo, :assert_lo
|
784
799
|
alias_method :read_lo, :assert_lo
|
785
800
|
|
786
|
-
def assert_lo!
|
787
|
-
assert_lo
|
801
|
+
def assert_lo!(options = {})
|
802
|
+
assert_lo(options)
|
788
803
|
cycle
|
789
804
|
end
|
790
805
|
alias_method :expect_lo!, :assert_lo!
|
@@ -792,12 +807,12 @@ module Origen
|
|
792
807
|
alias_method :read_lo!, :assert_lo!
|
793
808
|
|
794
809
|
# Set the pin to X on future cycles
|
795
|
-
def dont_care
|
796
|
-
|
810
|
+
def dont_care(options = {})
|
811
|
+
set_state_with_options(:dont_care, options)
|
797
812
|
end
|
798
813
|
|
799
|
-
def dont_care!
|
800
|
-
dont_care
|
814
|
+
def dont_care!(options = {})
|
815
|
+
dont_care(options)
|
801
816
|
cycle
|
802
817
|
end
|
803
818
|
|
@@ -807,14 +822,14 @@ module Origen
|
|
807
822
|
# [0,1,1,0].each do |level|
|
808
823
|
# $pin(:d_in).drive(level)
|
809
824
|
# end
|
810
|
-
def drive(value)
|
811
|
-
|
825
|
+
def drive(value, options = {})
|
826
|
+
set_state_with_options(:drive, options)
|
812
827
|
set_value(value)
|
813
828
|
end
|
814
829
|
alias_method :write, :drive
|
815
830
|
|
816
|
-
def drive!(value)
|
817
|
-
drive(value)
|
831
|
+
def drive!(value, options = {})
|
832
|
+
drive(value, options)
|
818
833
|
cycle
|
819
834
|
end
|
820
835
|
alias_method :write!, :drive!
|
@@ -825,8 +840,8 @@ module Origen
|
|
825
840
|
# [0,1,1,0].each do |level|
|
826
841
|
# $pin(:d_in).assert(level)
|
827
842
|
# end
|
828
|
-
def assert(value,
|
829
|
-
|
843
|
+
def assert(value, options = {})
|
844
|
+
set_state_with_options(:compare, options)
|
830
845
|
set_value(value)
|
831
846
|
end
|
832
847
|
alias_method :compare, :assert
|
@@ -841,15 +856,15 @@ module Origen
|
|
841
856
|
alias_method :expect!, :assert!
|
842
857
|
alias_method :read!, :assert!
|
843
858
|
|
844
|
-
def assert_midband
|
845
|
-
|
859
|
+
def assert_midband(options = {})
|
860
|
+
set_state_with_options(:compare_midband, options)
|
846
861
|
end
|
847
862
|
alias_method :compare_midband, :assert_midband
|
848
863
|
alias_method :expect_midband, :assert_midband
|
849
864
|
alias_method :read_midband, :assert_midband
|
850
865
|
|
851
|
-
def assert_midband!
|
852
|
-
assert_midband
|
866
|
+
def assert_midband!(options = {})
|
867
|
+
assert_midband(options)
|
853
868
|
cycle
|
854
869
|
end
|
855
870
|
alias_method :compare_midband!, :assert_midband!
|
@@ -909,14 +924,14 @@ module Origen
|
|
909
924
|
end
|
910
925
|
|
911
926
|
# Mark the (data) from the pin to be captured
|
912
|
-
def capture
|
913
|
-
|
927
|
+
def capture(options = {})
|
928
|
+
set_state_with_options(:capture, options)
|
914
929
|
end
|
915
930
|
alias_method :store, :capture
|
916
931
|
|
917
932
|
# Mark the (data) from the pin to be captured and trigger a cycle
|
918
|
-
def capture!
|
919
|
-
capture
|
933
|
+
def capture!(options = {})
|
934
|
+
capture(options)
|
920
935
|
cycle
|
921
936
|
end
|
922
937
|
alias_method :store!, :capture!
|