lib/origen/registers.rb
# Returns true if the register is enabled by a feature of owner.
Returns true if the register is enabled by a feature of owner.
Returns true if the register is enabled by a feature of owner .
def enabled?
        if feature
          value = false
          current_owner = self
          if feature.class == Array
            feature.each do |f|
              current_owner = self
              loop do
                if current_owner.respond_to?(:owner)
                  current_owner = current_owner.owner
                  if current_owner.respond_to?(:has_feature?)
                    if current_owner.has_feature?(f)
                      value = true
                      break
                    end
                  end
                else 
                  value = false
                  break
                end
              end 
              unless value
                if Origen.top_level && \
                   Origen.top_level.respond_to?(:has_feature?) && \
                   Origen.top_level.has_feature?(f)
                  value = true
                  unless value
                    break
                  end
                end
              end
              unless value
                break 
              end
            end 
            return value
          else 
            loop do
              if current_owner.respond_to?(:owner)
                current_owner = current_owner.owner
                if current_owner.respond_to?(:has_feature?)
                  if current_owner.has_feature?(feature)
                    value = true
                    break
                  end
                end
              else 
                value = false
                break
              end
            end 
            unless value
              if Origen.top_level && \
                 Origen.top_level.respond_to?(:has_feature?) && \
                 Origen.top_level.has_feature?(feature)
                value = true
              end
            end
            return value
          end
        else
          return true
        end
      end
def enabled? if feature value = false current_owner = self if feature . class == Array feature . each do | f | current_owner = self loop do if current_owner . respond_to? ( :owner ) current_owner = current_owner . owner if current_owner . respond_to? ( :has_feature? ) if current_owner . has_feature? ( f ) value = true break end end else value = false break end end unless value if Origen . top_level && Origen . top_level . respond_to? ( :has_feature? ) && Origen . top_level . has_feature? ( f ) value = true unless value break end end end unless value break end end return value else loop do if current_owner . respond_to? ( :owner ) current_owner = current_owner . owner if current_owner . respond_to? ( :has_feature? ) if current_owner . has_feature? ( feature ) value = true break end end else value = false break end end unless value if Origen . top_level && Origen . top_level . respond_to? ( :has_feature? ) && Origen . top_level . has_feature? ( feature ) value = true end end return value end else return true end end
Returns true if the register is enabled by a feature of owner.
Returns true if the register is enabled by a feature of owner .
# if current owner does not have a owner # loop end # break if feature not found and return false # iterated through all features in array # if feature.class != Array # if current owner does not have a owner # loop end