Origen-SDK / origen

The Origen Semiconductor Developer's Kit core platform
http://origen-sdk.org
MIT License
20 stars 24 forks source link

block inheritance feature can now propagate bugs and features #434

Closed CodyBriscoe closed 2 years ago

CodyBriscoe commented 2 years ago

When using the sub block inheritance feature, bugs and features can now propagate. This enables us along with the existing remote inheritance functionality to split bug/feature definitions into apps that are targeted towards modeling some IP, while apps that are targeted towards testing some aspect of an IP can focus on handling bugs/features in their flows when encountered.

class MyIPBlock
  include Origen::Model
  feature :my_feature
end

class MySocBlock < MyIPBlock
  include Origen::Model
end

class MyTop
  include Origen::TopLevel

  def initialize(options = {})
    sub_block :my_block, class_name: 'MySocBlock', inherit: 'MyIPBlock'
  end
end

dut.my_block.has_feature?(:my_feature)
=> true

The above works the same for bugs. You can disable bugs and/or feature inheritance by passing either/both disable_bug_inheritance or disable_feature_inheritance options to the sub_block method:

sub_block :my_block, class_name: 'MySocBlock', inherit: 'MyIPBlock', disable_feature_inheritance: true

dut.my_block.has_feature?(:my_feature)
=> false
priyavadan commented 2 years ago

Going to go ahead and merge this in.