Module: RgGen::Core::Base::ComponentLayerExtension::RegisterBlock

Includes:
Common
Defined in:
lib/rggen/core/base/component_layer_extension.rb

Instance Method Summary collapse

Methods included from Common

#bit_field?, #register?, #register_block?, #register_file?, #root?

Instance Method Details

#bit_fieldsObject



78
79
80
# File 'lib/rggen/core/base/component_layer_extension.rb', line 78

def bit_fields
  registers.flat_map(&:bit_fields)
end

#files_and_registersObject



58
59
60
# File 'lib/rggen/core/base/component_layer_extension.rb', line 58

def files_and_registers
  children
end

#register_files(include_lower_layer = true) ⇒ Object



62
63
64
65
66
# File 'lib/rggen/core/base/component_layer_extension.rb', line 62

def register_files(include_lower_layer = true)
  files_and_registers
    .select(&:register_file?)
    .flat_map { |rf| [rf, *(include_lower_layer ? rf : nil)&.register_files] }
end

#registers(include_lower_layer = true) ⇒ Object



68
69
70
71
72
73
74
75
76
# File 'lib/rggen/core/base/component_layer_extension.rb', line 68

def registers(include_lower_layer = true)
  files_and_registers.flat_map do |file_or_register|
    if file_or_register.register?
      file_or_register
    else
      [*(include_lower_layer ? file_or_register : nil)&.registers]
    end
  end
end

#rootObject



54
55
56
# File 'lib/rggen/core/base/component_layer_extension.rb', line 54

def root
  parent
end