I create many test interface parameters during the $dut initialization. The app inits the model in either 'load' or 'import' mode, as we get many sources of info from 3rd parties. For parameters, the source is native Ruby so regardless of the init method (load or import) the code is required like this:
send modeling_method, model_path # load_params or import_params
Here is that method(s):
def load_params(path)
Origen.log.info("PPEKit: Modeling parameters from #{path}")
require path.to_s.chomp('.rb')
Origen.log.info("PPEKit: Modeling of parameters complete")
end
alias_method 'import_params', 'load_params'
Here is the content of the file required above:
Origen.top_level.define_params :default do |params|
params.bist.override = 1
params.bist.lev_equ_set = 1
params.bist.lev_spec_set = 1
params.bist.levset = 1
params.bist.seqlbl = 'mbist_cpu_hr_vnom_burst'
params.bist.override_tim_spec_set = 'bist_25Mhz'
params.bist.override_timset = '1,1,1,1,1,1,1,1'
params.bist.site_control = 'parallel:'
params.bist.site_match = 2
end
I can see them at the end of my $dut initialization during execution of the command 'origen p myflowfile.rb':
[5] pry(#<PPEKit::Product>)> $dut.params
=> {:bist=>
{:override=>1,
:lev_equ_set=>1,
:lev_spec_set=>1,
:levset=>1,
:seqlbl=>"mbist_cpu_hr_vnom_burst",
:override_tim_spec_set=>"bist_25Mhz",
:override_timset=>"1,1,1,1,1,1,1,1",
:site_control=>"parallel:",
:site_match=>2}}
However, when Origen transitions to the test interface code, the params are not accessible:
[1] pry(#<STP::Interface>)> $dut.params
=> #<Origen::Parameters::Missing:0x002aaab22dc378
@owner=<Model/Controller: PPEKit::Product:23456337817000/PPEKit::ProductController:23456355062960>>
I can, however, see other parts of the $dut model such as pins and sub_blocks:
[2] pry(#<STP::Interface>)> $dut.sub_blocks
=> {"block0"=><Model: PPEKit::Product::Block0:23456336916760>,
"block1"=><Model: PPEKit::Product::Block1:23456336907380>,
"block2"=><Model: PPEKit::Product::Block2:23456336841100>,
It just seems like they are getting erased sometime between the model init and the test flow generation. So I put a breakpoint in the 'on_load_target' callback, and saw different results each time the breakpoint was hit. On the first break, the params were there and on subsequent breaks they were not.
75: def on_load_target
=> 76: binding.pry
77: to_origen(path: vendor_path.to_s, instantiate_level: :sub_block) if @import
78: end
[1] pry(#<PPEKit::Product>)> $dut.params
=> {:bist=>
{:override=>1,
:lev_equ_set=>1,
:lev_spec_set=>1,
:levset=>1,
:seqlbl=>"mbist_ccx_hr_vnom_burst",
:override_tim_spec_set=>"bist_25Mhz",
:override_timset=>"1,1,1,1,1,1,1,1",
:site_control=>"parallel:",
:site_match=>2}}
[2] pry(#<PPEKit::Product>)>
Frame number: 0/25
From: /users/user/origen/ppekit/lib/ppekit/product.rb @ line 76 PPEKit::Product#on_load_target:
75: def on_load_target
=> 76: binding.pry
77: to_origen(path: vendor_path.to_s, instantiate_level: :sub_block) if @import
78: end
[1] pry(#<PPEKit::Product>)> $dut.params
=> #<Origen::Parameters::Missing:0x002aaab9f3ad48
@owner=<Model/Controller: PPEKit::Product:23456377300040/PPEKit::ProductController:23456379739240>>
I believe there could be 2 issues here:
1) The repeated initialization of the $dut during test flow generation, documented here
2) The emptying of the parameter set hash, which is due to issue #1 (and some Parameter set initialization code
I believe it has something to do with the parameter @owner being defined as the $dut instance during the parameter definition and @owner being re-defined as the $dut ProductController instance on subsequent queries of the parameters.
thx
The problem here is that the parameters are ultimately getting loaded by calling
require 'some_file.rb'
.Whenever the target is internally re-loaded, Ruby hits the line again but does not do anything since it knows that it has already required that file and effectively skips over that line.
Changing it to
load 'some_file.rb'
will force it to execute the file every time.