module Origen::SubBlocks::Path

Public Instance Methods

abs_path() click to toggle source
# File lib/origen/sub_blocks.rb, line 175
def abs_path
  @abs_path
end
Also aliased as: full_path
abs_path=(val) click to toggle source
# File lib/origen/sub_blocks.rb, line 170
def abs_path=(val)
  @abs_path = val
end
Also aliased as: full_path=
full_path()
Alias for: abs_path
full_path=(val)
Alias for: abs_path=
hdl_path(options = {})
Alias for: path
path(options = {}) click to toggle source
# File lib/origen/sub_blocks.rb, line 180
def path(options = {})
  return abs_path if abs_path

  if is_a?(Origen::Registers::BitCollection)
    # Special case where path relative to the register has been requested
    if options[:relative_to] == parent
      if size == 1
        return "[#{position}]"
      else
        return "[#{position + size - 1}:#{position}]"
      end
    else
      p = parent.parent
    end
  else
    p = parent
  end
  if p && p != options[:relative_to]
    if p.path(options).empty?
      root = ''
    else
      root = "#{p.path(options)}."
    end
  else
    # If a path variable has been set on a top-level object, then we will
    # include that in path, otherwise by default the top-level object is not
    # included in the path
    if p || path_var
      root = ''
    else
      return ''
    end
  end
  local = (path_var || name || self.class.to_s.split('::').last).to_s
  if local == 'hidden'
    root.chop
  elsif is_a?(Origen::Registers::BitCollection) && parent.path_var == :hidden
    "#{root.chop}#{local}"
  else
    "#{root}#{local}"
  end
end
Also aliased as: hdl_path
path=(val) click to toggle source
# File lib/origen/sub_blocks.rb, line 162
def path=(val)
  @path = val
end
path_var() click to toggle source
# File lib/origen/sub_blocks.rb, line 166
def path_var
  @path
end