Module: Origen::SubBlocks::Path

Included in:
Registers::BitCollection, Registers::Reg, Origen::SubBlocks
Defined in:
lib/origen/sub_blocks.rb

Instance Method Summary collapse

Instance Method Details

#abs_pathObject Also known as: full_path



148
149
150
# File 'lib/origen/sub_blocks.rb', line 148

def abs_path
  @abs_path
end

#abs_path=(val) ⇒ Object Also known as: full_path=



143
144
145
# File 'lib/origen/sub_blocks.rb', line 143

def abs_path=(val)
  @abs_path = val
end

#path(options = {}) ⇒ Object Also known as: hdl_path



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/origen/sub_blocks.rb', line 153

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
    root = ''
  end
  local = (path_var || name || self.class.to_s.split('::').last).to_s
  if local == 'hidden'
    root.chop
  else
    "#{root}#{local}"
  end
end

#path=(val) ⇒ Object



135
136
137
# File 'lib/origen/sub_blocks.rb', line 135

def path=(val)
  @path = val
end

#path_varObject



139
140
141
# File 'lib/origen/sub_blocks.rb', line 139

def path_var
  @path
end