rchitect-of-info
rchitect-of-info

Reputation: 1596

Origen sub-flows and the options passed

In the test program docs, I see this code bit that shows there will be some default options passed to a sub-flow.

  # These are the option defaults that will be used unless specified by the caller
  options = {
    include_loaded_output_tests: true,
    index: 0,
  }.merge(options)

But when i set a breakpoint in the sub-flow all I see is an empty hash. If I pass in some options to the sub-flow they show up:

# In top-level flow
import 'scan_coverage_flow', test_modes: test_modes

# In the sub-flow
From: /users/user/origen/prod/scan/origen/_scan_coverage_flow.rb @ line 3 :

    1: Flow.create do |options|
    2:   binding.pry

[1] pry(#<AmdTest::Interface>)> options
=> {:test_modes=>
  {"mode1"=><Model: Origen::SubBlock:23972990241220>,

Is the documentation up-to-date or am I misreading it?

thx

Upvotes: 1

Views: 29

Answers (1)

Ginty
Ginty

Reputation: 3501

You are misreading the docs, it is intending to show how to set sub-flow specific default options.

Say we have an empty sub-flow that just prints out the options:

# _my_sub_flow.rb
Flow.create do |options|
  puts options
end

Calling it like this should print out an empty hash:

import "my_sub_flow"

# => {}

If you add some default options to it:

Flow.create do |options|
  options = { a: 10,
              b: 20
  }.merge(options)

  puts options
end

Then it will do what you would expect:

import "my_sub_flow"

# => {a: 10, b: 20}

And if course the reason for having options is so that you can override them at call time:

import "my_sub_flow", b: 50

# => {a: 10, b: 50}

Upvotes: 1

Related Questions