module Origen::Location::Map::ClassMethods
Public Instance Methods
constructed()
click to toggle source
A hash of constructed location objects, i.e. an entry will be cached here the first time a location is referenced outside of its initial definition, after that it will be served directly from here.
# File lib/origen/location/map.rb, line 46 def constructed @constructed ||= {} end
constructor(&block)
click to toggle source
# File lib/origen/location/map.rb, line 16 def constructor(&block) if defining? constructors[@x] = block else constructors[:default] = block end end
constructors()
click to toggle source
# File lib/origen/location/map.rb, line 32 def constructors @constructors ||= {} end
default_attributes()
click to toggle source
# File lib/origen/location/map.rb, line 36 def default_attributes @default_attributes ||= {} end
default_constructor(attributes, defaults)
click to toggle source
# File lib/origen/location/map.rb, line 24 def default_constructor(attributes, defaults) Origen::Location::Base.new(defaults.merge(attributes)) end
define_locations(defaults = {}) { || ... }
click to toggle source
# File lib/origen/location/map.rb, line 8 def define_locations(defaults = {}) @x = @x ? (@x + 1) : 0 # Provides a unique ID for each define_locations block default_attributes[@x] = defaults @defining = true yield @defining = false end
defining?()
click to toggle source
# File lib/origen/location/map.rb, line 40 def defining? @defining end
definitions()
click to toggle source
# File lib/origen/location/map.rb, line 28 def definitions @definitions ||= {} end
method_missing(method, *args, &block)
click to toggle source
Provides accessors for all named locations, for example:
$dut.nvm.fmu.ifr_map.probe1_pass
Calls superclass method
# File lib/origen/location/map.rb, line 53 def method_missing(method, *args, &block) if defining? if definitions[method] warning "Redefinition of map location: #{method}" end definitions[method] = { attributes: args.first, x: @x } else super end end