Module: Origen::SubBlocks::Path
- Included in:
- Registers::BitCollection, Registers::Reg, Origen::SubBlocks
- Defined in:
- lib/origen/sub_blocks.rb
Instance Method Summary collapse
- #abs_path ⇒ Object (also: #full_path)
- #abs_path=(val) ⇒ Object (also: #full_path=)
- #path(options = {}) ⇒ Object (also: #hdl_path)
- #path=(val) ⇒ Object
- #path_var ⇒ Object
Instance Method Details
#abs_path ⇒ Object Also known as: full_path
155 156 157 |
# File 'lib/origen/sub_blocks.rb', line 155 def abs_path @abs_path end |
#abs_path=(val) ⇒ Object Also known as: full_path=
150 151 152 |
# File 'lib/origen/sub_blocks.rb', line 150 def abs_path=(val) @abs_path = val end |
#path(options = {}) ⇒ Object Also known as: hdl_path
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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/origen/sub_blocks.rb', line 160 def path( = {}) return abs_path if abs_path if is_a?(Origen::Registers::BitCollection) # Special case where path relative to the register has been requested if [: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 != [:relative_to] if p.path().empty? root = '' else root = "#{p.path()}." 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 |
#path=(val) ⇒ Object
142 143 144 |
# File 'lib/origen/sub_blocks.rb', line 142 def path=(val) @path = val end |
#path_var ⇒ Object
146 147 148 |
# File 'lib/origen/sub_blocks.rb', line 146 def path_var @path end |