lib/origen/registers/reg.rb
# Query the owner heirarchy to see if this register is enabled
Query the owner heirarchy to see if this register is enabled
Query the owner heirarchy to see if this register is enabled
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
Query the owner heirarchy to see if this register is enabled
Query the owner heirarchy to see if this register is enabled
# 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