Module: Origen::SubBlocks::Domains

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

Instance Method Summary collapse

Instance Method Details

#domain(name, options = {}) ⇒ Object


54
55
56
# File 'lib/origen/sub_blocks.rb', line 54

def domain(name, options = {})
  domains[name] = Origen::Registers::Domain.new(name, options)
end

#domain_specified?Boolean

Returns:

  • (Boolean)

58
59
60
# File 'lib/origen/sub_blocks.rb', line 58

def domain_specified?
  @domain_specified
end

#domainsObject Also known as: register_domains


62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/origen/sub_blocks.rb', line 62

def domains
  @domains ||= {}.with_indifferent_access
  if @domain_names
    @domain_names.each do |domain|
      if domain.is_a?(Origen::Registers::Domain)
        @domains[domain.id] = domain
      elsif parent.domains[domain]
        @domains[domain] = parent.domains[domain]
      else
        fail "Uknown domain: #{domain}"
      end
    end
    @domain_names = nil
  end
  if parent && @domains.empty?
    parent.domains
  else
    @domains
  end
end